Link to: header | record viewer
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
CWageScheduleViewer
This class manages wage schedules for the Goldenseal accounting software,
payroll software and small business
management software.
a viewer for wage schedules. Part of the setup for the Goldenseal
payroll software.
SUPERCLASS = CCommissionViewer
Source Code
/*********************************************************************************
FinishUpdatingFields split TCS 6/5/02
Finish prep work after updating fields from an object, but before displaying them
*********************************************************************************/
void CWageScheduleViewer::FinishUpdatingFields(const UInt8 creationMethod,
DB_PersistentObject *viewerObject)
{
// the superclass handles basic field updating
THE_SUPERCLASS::FinishUpdatingFields(creationMethod, viewerObject);
FormatOvertimeField(tag_dailyOTrate, GetPopupValue(tag_dailyOTtype));
FormatOvertimeField(tag_weeklyOTrate, GetPopupValue(tag_weeklyOTtype));
FormatOvertimeField(tag_satOTrate, GetPopupValue(tag_satOTtype));
FormatOvertimeField(tag_sunOTrate, GetPopupValue(tag_sunOTtype));
CWageSchedule *wageSchedule = TCS_SAFE_CAST(mCurrViewerObject, CWageSchedule);
TCS_FailNILMsg(wageSchedule, TCS_GetErrString(errID_BadObject));
UInt8 wageUnit = wageSchedule->GetWageUnit();
FormatWageType(GetPopupValue(tag_wagetype), wageUnit);
// format wage rate field rev TCS 8/16/00
Boolean boxOn = GetCheckboxValue(tag_usevariablewage);
EnableRateField(!boxOn);
}
/*********************************************************************************
HandlePopupChanged
a popup menu has been clicked, act accordingly
*********************************************************************************/
void CWageScheduleViewer::HandlePopupChanged(CTCS_StdPopupMenu *popupMenu)
{
TCS_FailNILMsg(popupMenu, TCS_GetErrString(errID_BadPopup));
TCS_FailNILMsg(mCurrViewerObject, TCS_GetErrString(errID_BadObject));
UInt8 value = popupMenu->GetValue();
switch (popupMenu->GetPaneID())
{
case tag_dailyOTtype:
FormatOvertimeField(tag_dailyOTrate, value);
break;
case tag_weeklyOTtype:
FormatOvertimeField(tag_weeklyOTrate, value);
break;
case tag_satOTtype:
FormatOvertimeField(tag_satOTrate, value);
break;
case tag_sunOTtype:
FormatOvertimeField(tag_sunOTrate, value);
break;
default:
break;
}
// be sure to pass it along
THE_SUPERCLASS::HandlePopupChanged(popupMenu);
}
/*********************************************************************************
FormatOvertimeField
format overtime field as dollar or straight based on the setting
*********************************************************************************/
void CWageScheduleViewer::FormatOvertimeField(const SInt32 tag, const SInt32 overtimeType)
{
CTCS_EditField *field =
TCS_SAFE_CAST(FindMemberField(tag), CTCS_EditField);
if (field)
{ // the field exists, update its format
SetFieldVisible(tag, overtimeType == over_othermultiple ||
overtimeType == over_additional);
field->SetFieldType(overtimeType == over_additional ?
fieldtype_money :
fieldtype_number);
if (overtimeType == over_straight)
field->SetRealValue(1);
else if (overtimeType == over_timehalf)
field->SetRealValue(1.5);
else if (overtimeType == over_doubletime)
field->SetRealValue(2);
}
}
|