Page History: Jetfire Code: Timesheet
Compare Page Revisions
Page Revision: 2009/07/29 02:48
Jetfire Code: Timesheet
The Jetfire Code Class for Timesheet is shown below in the box. This class is used for the Timesheet application.
// T I M E S H E E T S ==============================================================
// Timesheets.txt
//===================================================================================
// Copyright (C) 2007 TrackerRealm Corporation
//===================================================================================
// T I M E S H E E T S
// Use this Timesheet Workflow submit Timeslips, vacations, sick days, etc
// Each Timesheet workflow tracks multiple timeslips for ONE project (workflow) and ONE worker
// Multiple Timesheet workflows are used to track mutiple Projects/Worker each week.
// Multiple Timesheet workflows are used to track mutiple Projects/Multiple Workers each week.
//
namespace JetfireApps
{
private workflow Timeslip
{
public Timeslip()
{
Subject = "Timeslip ";
RegularOT = false;
PremiumOT = false;
}
// Commands
public void Set_Regular_OT()
{
RegularOvertime = true;
}
public void Set_Premium_OT()
{
PremiumOvertime = true;
}
// Properties
public Workflow Project
{
get;
set;
}
public TimeSpan Mon
{
get;
set;
}
public TimeSpan Tue
{
get;
set;
}
public TimeSpan Wed
{
get;
set;
}
public TimeSpan Thu
{
get;
set;
}
public TimeSpan Fri
{
get;
set;
}
public TimeSpan Sat
{
get;
set;
}
public TimeSpan Sun
{
get;
set;
}
public bool RegularOvertime
{
get;
set;
}
public bool PremiumOvertime
{
get;
set;
}
}
public workflow Timesheet
{
// Add workflow constructor
public Timesheet()
{
Subject = "Timesheet ";
Timeslips = new List();
OvertimeTimeslips = new List();
ToilTimeslips = new List();
WeekNumber = 0;
enterstate Submitted();
}
// The Timesheet goes thru a number of states.
// 1. The employee fills in and then Submits the timesheet.
// 2. The manager Approves the timesheet.
// 3. Accounting reviews and and then Locks the timesheet.
// From State To State Command
// new Submitted Save
// Submitted Approved Approve
// Approved Submitted Un-Approve
// Approved Locked Lock
// Locked Approved Un-Lock
// Add states to the workflow
public Submitted() { }
public Approved() { }
public Locked() { }
// Add Properties
public Person Worker
{
get;
set;
}
public OrganizationUnit Department
{
get;
set;
}
public uint WeekNumber
{
get;
set;
}
public Date WeekEnding
{
get;
set;
}
public List Timeslips
{
get;
private set;
}
public List OvertimeTimeslips
{
get;
private set;
}
public List ToilTimeslips
{
get;
private set;
}
// Add Command Methods
public void Save() : states(Submitted)
{
enterstate Submitted();
}
public void Approve() : states(Submitted)
{
enterstate Approved();
}
public void UnApprove() : states(Approved)
{
enterstate Submitted();
}
public void Lock() : states(Approved)
{
enterstate Locked();
}
public void UnLock() : states(Locked)
{
enterstate Approved();
}
public Timeslip Add_Timeslip() : states(Submitted)
{
Timeslip schedule = new Timeslip();
schedule.Project = this;
Timeslips.Add(schedule);
return schedule;
}
public Timeslip Add_Timeslip(Timeslip schedule) : states(Submitted)
{
schedule.Project = this;
Timeslips.Add(schedule);
return schedule;
}
public Timeslip Add_Overtime_Timeslip() : states(Submitted)
{
Timeslip schedule = new Timeslip();
schedule.Project = this;
OvertimeTimeslips.Add(schedule);
return schedule;
}
public Timeslip Add_Overtime_Timeslip(Timeslip schedule) : states(Submitted)
{
schedule.Project = this;
OvertimeTimeslips.Add(schedule);
return schedule;
}
public Timeslip Add_TOIL_Timeslip() : states(Submitted)
{
Timeslip schedule = new Timeslip();
schedule.Project = this;
ToilTimeslips.Add(schedule);
return schedule;
}
public Timeslip Add_TOIL_Timeslip(Timeslip schedule) : states(Submitted)
{
schedule.Project = this;
ToilTimeslips.Add(schedule);
return schedule;
}
}
}