accounting software, Construction Accounting Software"> Goldenseal Accounting Software-- Billing Rates Viewer
Accounting Software
Small Business Software Estimating Software
Construction Estimating SoftwareBookkeeping SoftwareInventory SoftwareInventory Control SoftwareInventory Tracking SoftwareInventory Management SoftwareBusiness Management Software

Billing Rates Viewer (Source Code)

Link to: header | record viewer directory

Copyright Turtle Creek Software 1996-2006. All Rights Reserved.

Comments

CEquipRateViewer

This class manages billing rates for the Goldenseal accounting software,
small business management software, construction project management software and
construction estimating software

A viewer for equipment billing rates

***************

CPersonRateViewer

A viewer for labor billing rates and subcontractor billing rates

Source Code

/*********************************************************************************

FinishUpdatingFields split TCS 4/17/00

Finish prep work after updating fields from an object, but before displaying them

*********************************************************************************/
void CEquipRateViewer::FinishUpdatingFields(const UInt8 creationMethod,
DB_PersistentObject *viewerObject)
{
// the superclass handles basic field updating
THE_SUPERCLASS::FinishUpdatingFields(creationMethod, viewerObject);

// we must now toggle the various rate and type fields on & off
Boolean rateOn = false;

for (SInt32 i = 0; i < CEquipRentalRate::cNumRateTypes; i++)
{ // first check the checkbox, and set enablement from that
rateOn =
CTCS_View::GetSubpaneValue(this, tag_SingleUseRateOn + i) ? true : false;

ShowRateAndType(i, rateOn);
}
}
/*********************************************************************************

HandleCheckboxClicked

a checkbox has been clicked, handle it accordingly

*********************************************************************************/
void CEquipRateViewer::HandleCheckboxClicked(CTCS_StdCheckbox *checkbox)

{
// sanity check
TCS_FailNILMsg(checkbox, TCS_GetErrString(errID_BadCheckbox));

// get the index of the clicked checkbox
const SInt32 cboxIndex = checkbox->GetPaneID() - tag_SingleUseRateOn;
ShowRateAndType(cboxIndex, checkbox->GetValue() ? true : false);

// be sure to pass it along
THE_SUPERCLASS::HandleCheckboxClicked(checkbox);
}/*********************************************************************************

HandlePopupChanged

a popup menu has been clicked, act accordingly

*********************************************************************************/
void CEquipRateViewer::HandlePopupChanged(CTCS_StdPopupMenu *popupMenu)
{
TCS_FailNILMsg(popupMenu, TCS_GetErrString(errID_BadPopup));

FormatRateField(popupMenu->GetValue(), popupMenu->GetPaneID() - tag_SingleUseRateType);

THE_SUPERCLASS::HandlePopupChanged(popupMenu);
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CheckForVariable

look to see if there's already a popup set to the 'variable' option

*********************************************************************************/
Boolean CEquipRateViewer::CheckForVariable()
{
Boolean alreadyHasVariable = false;
for (SInt32 i = 0; i < CEquipRentalRate::cNumRateTypes; i++)
{
if (CTCS_View::GetSubpaneValue(this, tag_SingleUseRateType + i) == rate_Variable)
{
alreadyHasVariable = true;
break;
}
}
return alreadyHasVariable;
}/*********************************************************************************

CheckForDependency

look to see if the given rate is dependent on another rate

*********************************************************************************/
Boolean CEquipRateViewer::CheckForDependency(const TagType tag)
{
UInt8 calcType = GetPopupValue(tag);

switch (calcType)
{
case rate_TimesHourly:
case rate_TimesDaily:
case rate_TimesWeekly:
case rate_TimesMonthly:
return true;
break;

case rate_Dollar:
case rate_Variable:
return false;
break;

default:
TCS_DebugAlert("Oops, unexpected value in CheckForDependency!");
return false;
break;
}
}/*********************************************************************************

ShowRateAndType

show or hide the rate and type for the given rate index. Used for resetting
the display when a checkbox is clicked

*********************************************************************************/
void CEquipRateViewer::ShowRateAndType(SInt32 rateIndex, Boolean show)
{
SInt32 rateType;

SetFieldEnabled(tag_SingleUseRate + rateIndex, show);
SetFieldEnabled(tag_SingleUseRateType + rateIndex, show);

if (show)
{ // if it's enabled, also check the popup
rateType =
CTCS_View::GetSubpaneValue(this, tag_SingleUseRateType + rateIndex);

FormatRateField(rateType, rateIndex);
}
}/*********************************************************************************

FormatRateField rev TCS 2/13/02

format the rate field as dollar, percent or disabled
according to the popup setting

*********************************************************************************/
void CEquipRateViewer::FormatRateField(const SInt32 calcMethod, const SInt32 rateIndex)
{
if (calcMethod == rate_Dollar) // dollar amounts
{
SetFieldType(tag_SingleUseRate + rateIndex, fieldtype_money);
SetFieldEnabled(tag_SingleUseRate + rateIndex, true);
}

else if (calcMethod == rate_Variable) // variable rate
{
SetFieldType(tag_SingleUseRate + rateIndex, fieldtype_number);
SetFieldValue(tag_SingleUseRate + rateIndex, 0);
SetFieldEnabled(tag_SingleUseRate + rateIndex, false);
}
else // multipliers
{
SetFieldType(tag_SingleUseRate + rateIndex, fieldtype_number);
SetFieldEnabled(tag_SingleUseRate + rateIndex, true);
}
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

FinishUpdatingFields split TCS 4/17/00

Finish prep work after updating fields from an object, but before displaying them

*********************************************************************************/
void CPersonRateViewer::FinishUpdatingFields(const UInt8 creationMethod,
DB_PersistentObject *viewerObject)
{
// the superclass handles basic field updating
THE_SUPERCLASS::FinishUpdatingFields(creationMethod, viewerObject);

// format the rate field
UInt8 calcMethod = GetPopupValue(tag_calcmethod);
FormatRateField(calcMethod);

calcMethod = GetPopupValue(tag_earlycalcmethod); // in labor billing rates only
if (calcMethod)
FormatRateField(calcMethod, tag_earlyrate, tag_earlytimeunit);
}
/*********************************************************************************

HandlePopupChanged

a popup menu has been clicked, act accordingly

*********************************************************************************/
void CPersonRateViewer::HandlePopupChanged(CTCS_StdPopupMenu *popupMenu)
{
TCS_FailNILMsg(popupMenu, TCS_GetErrString(errID_BadPopup));
switch (popupMenu->GetPaneID())
{
case tag_calcmethod:
FormatRateField(popupMenu->GetValue());
break;

case tag_earlycalcmethod:
FormatRateField(popupMenu->GetValue(), tag_earlyrate, tag_earlytimeunit);
break;

default:
break;
}
// be sure to pass it along
THE_SUPERCLASS::HandlePopupChanged(popupMenu);
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

CheckForVariable

look to see if the popup is set to the 'variable' option

*********************************************************************************/
Boolean CPersonRateViewer::CheckForVariable()
{
Boolean alreadyHasVariable = false;
if (CTCS_View::GetSubpaneValue(this, tag_billingrate) == rate_Variable)
alreadyHasVariable = true;

return alreadyHasVariable;
}
/*********************************************************************************

FormatRateField rev TCS 8/31/00

format the rate field as dollar, percent or disabled
according to the popup setting

*********************************************************************************/
void CPersonRateViewer::FormatRateField(const SInt32 calcMethod, const TagType rateTag,
const TagType timeTag)
{
CTCS_EditField *rateField =
TCS_SAFE_CAST(FindMemberField(rateTag), CTCS_EditField);

if (!rateField)
return;

switch (calcMethod) // the field exists, update its format
{
case rate_DontUse: // TCS 9/5/00
rateField->SetFieldType(fieldtype_number);
SetFieldValue(rateTag, 0);
SetFieldEnabled(rateTag, false);
SetFieldEnabled(timeTag, false);
break;

case rate_Dollar:
rateField->SetFieldType(fieldtype_money);
SetFieldEnabled(rateTag, true);
SetFieldEnabled(timeTag, true);
break;
// percentages
case rate_PayPlusPercent:
case rate_NetPlusPercent:
case rate_GrossPlusPercent:
rateField->SetFieldType(fieldtype_percent);
SetFieldEnabled(rateTag, true);
SetFieldEnabled(timeTag, false);
break;

case rate_Pay: // dollars
case rate_Net:
case rate_Gross:
rateField->SetFieldType(fieldtype_money);
SetFieldValue(rateTag, 0);
SetFieldEnabled(rateTag, false);
SetFieldEnabled(timeTag, false);
break;

case rate_Variable:
rateField->SetFieldType(fieldtype_money);
SetFieldValue(rateTag, 0);
SetFieldEnabled(rateTag, false);
SetFieldEnabled(timeTag, true);
break;

default:
TCS_DebugAlert("Oops, bad case in CPersonRateViewer::FormatRateField!");
break;
}
}