Link to: header | record viewer
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
CJobSalesTaxViewer
This class manages job sales tax for the Goldenseal accounting software,
small business management software, construction
project management software and
construction estimating software.
a viewer for job sales tax rates. This handles sales tax collected from customers
on sales and project billing.
SUPERCLASS = DB_RecordViewer
Constructor
/*********************************************************************************
constructor
*********************************************************************************/
CJobSalesTaxViewer::CJobSalesTaxViewer(const SPaneInfo &inPaneInfo,
const SViewInfo &inViewInfo)
: DB_RecordViewer(inPaneInfo, inViewInfo)
{
}
Source Code
/******************************************************************************
ListenToMessage
Responds to a message v1.28, 01-30-96, 12-30-96
*******************************************************************************/
void CJobSalesTaxViewer::ListenToMessage(MessageT inMessage, void *ioParam)
{
switch (inMessage)
{
case msg_TableEditCellChanged:
case msg_TableCVCellChanged:
// find the tax rate table
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_SalesTaxTable), CMemberTable);
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadObject));
// was a percentage changed?
if (table->SelectedColumn() == CJobSalesTax::col_percent)
{ // if so, get the sum of tax rates in the table
CMoney totalRate =
table->GetColumnMoneyTotal(CJobSalesTax::col_percent);
// put the sum into the rate field
SetFieldCString(tag_rate, totalRate.GetPercentString());
}
break;
}
// Always call inherited method
THE_SUPERCLASS::ListenToMessage(inMessage, ioParam);
}/*********************************************************************************
GetReadyToUpdateObjects
do some prep before updating object from fields
*********************************************************************************/
void CJobSalesTaxViewer::GetReadyToUpdateObject(DB_PersistentObject *viewerObject)
{
TCS_FailNILMsg(viewerObject, TCS_GetErrString(errID_BadObject));
// update the pay to clairvoyant TCS 10/13/02
DBClass accountClass = 0;
viewerObject->GetMemberValue(tag_paidtoclass, type_objclass, &accountClass);
SetCVClassID(tag_paidto, accountClass);
// get the total of tax rates
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_SalesTaxTable), CMemberTable);
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadObject));
CMoney totalRate =
table->GetColumnMoneyTotal(CJobSalesTax::col_percent);
// update the total field
SetFieldCString(tag_rate, totalRate.GetPercentString());
}
/*********************************************************************************
HandlePopupChanged TCS 10/4/02 moved TCS 10/13/02
a popup menu has been clicked, act accordingly
*********************************************************************************/
void CJobSalesTaxViewer::HandlePopupChanged(CTCS_StdPopupMenu *popupMenu)
{
TCS_FailNILMsg(popupMenu, TCS_GetErrString(errID_BadPopup));
SInt32 value = popupMenu->GetValue();
switch (popupMenu->GetPaneID())
{
case tag_paidtoclass:
SetCVClassID(tag_paidto, value, cEraseValue);
break;
default:
break;
}
// we always let the superclass have a crack
THE_SUPERCLASS::HandlePopupChanged(popupMenu);
}
|