Link to: header | record viewer
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
COwnerEquityViewer
This class manages owner equity accounts for the Goldenseal accounting software,
small business management software, construction
project management software and
construction estimating software.
a viewer for owner equity accounts
SUPERCLASS = CAccountViewer
Source Code
/*********************************************************************************
FinishUpdatingFields split TCS 4/17/00
Finish prep work after updating fields from an object, but before displaying them
*********************************************************************************/
void COwnerEquityViewer::FinishUpdatingFields(const UInt8 creationMethod,
DB_PersistentObject *viewerObject)
{
// the superclass handles basic field updating
THE_SUPERCLASS::FinishUpdatingFields(creationMethod, viewerObject);
// fetch the owner share member table and update it
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_ownersharetable), CMemberTable);
if (table)
table->Refresh();
}
/*********************************************************************************
IsReadyToUpdateObject
before updating, let's make sure the table adds up
*********************************************************************************/
UInt8 COwnerEquityViewer::IsReadyToUpdateObject(const UInt8 saveSource)
{
// first let the superclass have a try TCS 1/29/01
UInt8 saveSuccess = THE_SUPERCLASS::IsReadyToUpdateObject(saveSource);
if (saveSuccess != save_success)
return saveSuccess;
// if in find, we're always OK TCS 1/4/01
if (InFindMode())
return save_notneeded;
// find the owner table
CMemberTable *table =
TCS_SAFE_CAST(FindPaneByID(tag_ownersharetable), CMemberTable);
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadObject));
// get total column
SInt32 accountCol = 1;
SInt32 totalCol = 2;
// make sure it adds up to 100% and has owners
if (table->AdjustRequiredValues(accountCol, id_Owner, totalCol))
{
if (table->AdjustPercentTotal(totalCol)) // reversed order TCS 3/6/00
return save_success;
else
return save_notready;
}
else
return save_notready;
}
|