Accounting Software
Small Business Software Estimating Software
Construction Estimating SoftwareBookkeeping SoftwareInventory SoftwareInventory Control SoftwareInventory Tracking SoftwareInventory Management SoftwareBusiness Management Software

Payroll Tax Field Viewer (Source Code)

Link to: header | record viewer directory

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

Comments

CTaxFieldViewer

This class manages payroll tax fields for the Goldenseal accounting software,
payroll software and small business management software.

It's a viewer for income tax fields and payroll tax fields. These are
calculators which compute state and local payroll tax totals and other
payroll amounts.

SUPERCLASS = DB_RecordViewer

Source Code

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

FinishUpdatingFields split TCS 4/13/00

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

*********************************************************************************/
void CTaxFieldViewer::FinishUpdatingFields(const UInt8 creationMethod,
DB_PersistentObject *viewerObject)
{
THE_SUPERCLASS::FinishUpdatingFields(creationMethod, viewerObject);

// set enablement of date fields
SetDateFieldDisplay(GetPopupValue(tag_timeperiod));

// set display of table
SetTableDisplay(GetPopupValue(tag_calcmethod));
}
/*********************************************************************************

ListenToMessage TCS 1/14/02

listen to a message

*********************************************************************************/
void CTaxFieldViewer::ListenToMessage(MessageT inMessage, void *ioParam)
{
switch (inMessage)
{
case msg_TableCVCellChanged:
{
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_calctaxtable), CMemberTable);
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadTable));

if (table->SelectedColumn() == CCalcPayrollTax::col_class)
{ // we've changed the row class, so erase stuff
TableIndexT row = table->SelectedRow();
table->SetCVCellValue(row, CCalcPayrollTax:: col_id, 0);
table->RefreshRow(row);
}
}
break;

default:
break;
}

THE_SUPERCLASS::ListenToMessage(inMessage, ioParam);
}
/*********************************************************************************

HandlePopupChanged

handle a popup change

*********************************************************************************/
void CTaxFieldViewer::HandlePopupChanged(CTCS_StdPopupMenu *popupMenu)
{
TCS_FailNILMsg(popupMenu, TCS_GetErrString(errID_BadPopup));
UInt8 value = popupMenu->GetValue();

switch (popupMenu->GetPaneID())
{
case tag_timeperiod:
SetDateFieldDisplay(value, true);
break;

case tag_calcmethod:
SetTableDisplay(value, true);
break;

default:
break;
}

// always pass it along bugfix TCS 1/15/02
THE_SUPERCLASS::HandlePopupChanged(popupMenu);
}
/*********************************************************************************

SetDateFieldDisplay TCS 11/22/01

set enablement of the start and end date fields

*********************************************************************************/
void CTaxFieldViewer::SetDateFieldDisplay(const UInt8 period, const Boolean resetDates)
{
Boolean isCustomDate = (period == time_custom);
SetFieldEnabled(tag_startdate, isCustomDate);
SetFieldEnabled(tag_enddate, isCustomDate);

if (resetDates)
{
CDate startDate = CDate::Today(),
endDate = CDate::Today();

switch (period)
{
case time_week:
startDate.SetToFirstOfWeek();
endDate.SetToLastOfWeek();
break;

case time_lastweek:
startDate.SetToFirstOfWeek();
startDate.AddDays(-7);
endDate = startDate;
endDate.AddDays(6);
break;

case time_month:
startDate.SetToFirstOfMonth();
endDate.SetToLastOfMonth();
break;

case time_lastmonth:
startDate.SetToFirstOfMonth();
startDate.AddMonths(-1);
endDate = startDate;
endDate.SetToLastOfMonth();
break;

case time_quarter:
startDate.SetToFirstOfQuarter();
endDate.SetToLastOfQuarter();
break;

case time_lastquarter:
startDate.SetToFirstOfQuarter();
startDate.AddMonths(-3);
endDate = startDate;
endDate.SetToLastOfQuarter();
break;

case time_year:
startDate.SetToFirstOfYear();
endDate.SetToLastOfYear();
break;

case time_lastyear:
startDate.SetToFirstOfYear();
startDate.AddYears(-1);
endDate = startDate;
endDate.SetToLastOfYear();
break;

case time_custom: // do nothing
return;
break;

default:
TCS_DebugAlert("Oops, bad case in CTaxFieldViewer::SetDateFieldDisplay!");
return;
break;
}

SetFieldCString(tag_startdate, startDate.GetCString());
SetFieldCString(tag_enddate, endDate.GetCString());
}
}
/*********************************************************************************

SetTableDisplay TCS 1/15/02 rev 3/20/02

set display of the itemized table

*********************************************************************************/
void CTaxFieldViewer::SetTableDisplay(const UInt8 method, const Boolean /*resetTable*/)
{
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_calctaxtable), CMemberTable);
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadTable));

switch (method)
{
case calc_base:
case calc_deduction:
case calc_cutoff:
case calc_taxnamelist:
case calc_taxamountlist:
table->Show();
break;

default:
table->Hide();
break;
}
}