Link to: header | record viewer
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
CUtilityAccountViewer
This class manages utility accounts for the Goldenseal accounting software,
small business management software, construction
project management software and
construction estimating software.
It's a viewer for utility accounts. They are "accounting" accounts that manage things
like
accounts payable, accounts receivable, expense accounts and income accounts.
SUPERCLASS = CAccountViewer
Constructor
/*********************************************************************************
constructor
*********************************************************************************/
CUtilityAccountViewer::CUtilityAccountViewer(const SPaneInfo &inPaneInfo,
const SViewInfo &inViewInfo)
: CAccountViewer(inPaneInfo, inViewInfo)
{
}
Source Code
/*********************************************************************************
HasLockedStatus
return whether a record is locked, so it can't be edited or deleted.
We override, since we have some required accounts
*********************************************************************************/
Boolean CUtilityAccountViewer::HasLockedStatus() const
{
TCS_FailNILMsg(mCurrViewerObject, TCS_GetErrString(errID_BadObject));
return (mCurrViewerObject->GetDBID() < account_LastItem);
}
/*********************************************************************************
GetDetailTransactionClass
return the class id used for detail transactions.
*********************************************************************************/
UInt8 CUtilityAccountViewer::GetDetailTransactionClass() const
{
TCS_FailNILMsg(mCurrViewerObject, TCS_GetErrString(errID_BadObject));
DBid accountID = mCurrViewerObject->GetDBID();
// only some accounts have a fixed class
switch (accountID)
{
case account_UnbilledSales:
case account_BilledSales:
case account_UndepositedCashSales:
case account_UnallocatedSales:
return id_Sale;
break;
case account_UnbilledRentals:
case account_BilledRentals:
case account_UndepositedCashRentals:
return id_RentalTransaction;
break;
case account_BilledProjects:
case account_BilledOther:
return id_BillingRecord;
break;
case account_UndepositedReceipts:
return id_PaymentReceipt;
break;
case account_UnpaidLaborHrs:
return id_LaborHours;
break;
case account_UnpaidPayroll: // TCS 4/25/01
return id_PayrollRecord;
break;
case account_MaterialsPayable:
return id_MaterialPurchase;
break;
case account_SubsPayable:
return id_SubcontractorLog; // bugfix TCS 7/24/01
break;
case account_OtherPayable:
return id_OtherCost;
break;
case account_BilledCustomers:
return id_CustomerAccount;
break;
case account_Writeoffs: // TCS 12/8/02
return id_PaymentReceipt;
break;
default:
return 0;
}
}
/*********************************************************************************
CanShowMultipleDetails TCS 12/12/00
can we show multiple detail transactions? Only some types can
*********************************************************************************/
Boolean CUtilityAccountViewer::CanShowMultipleDetails() const
{
TCS_FailNILMsg(mCurrViewerObject, TCS_GetErrString(errID_BadObject));
DBid accountID = mCurrViewerObject->GetDBID();
// only some accounts have a fixed class
switch (accountID)
{
case account_UnbilledSales: // receivables
case account_UnbilledRentals:
case account_BilledSales:
case account_BilledProjects:
case account_BilledRentals:
case account_BilledOther:
case account_UndepositedCashSales: // undeposited funds
case account_UndepositedCashRentals:
case account_UndepositedReceipts:
case account_UnpaidLaborHrs: // payables
case account_UnpaidPayroll:
case account_MaterialsPayable:
case account_SubsPayable:
case account_OtherPayable:
case account_BilledCustomers: // misc
case account_UnallocatedSales:
case account_Writeoffs: // TCS 12/8/02
return true;
default:
return false;
}
}
/*********************************************************************************
HasMultipleDetails TCS 12/12/00
does this account have multiple details?
*********************************************************************************/
Boolean CUtilityAccountViewer::HasMultipleDetails()
{
CUtilityAccount *account = TCS_SAFE_CAST(mCurrViewerObject, CUtilityAccount);
TCS_FailNILMsg(account, TCS_GetErrString(errID_BadAccount));
return (account->GetActiveArrayCount());
}
/*********************************************************************************
ShowMultipleDetails TCS 12/12/00
show a window with all detail transactions from the active array
*********************************************************************************/
void CUtilityAccountViewer::ShowMultipleDetails()
{
// fetch the account
CUtilityAccount *account = TCS_SAFE_CAST(mCurrViewerObject, CUtilityAccount);
TCS_FailNILMsg(account, TCS_GetErrString(errID_BadAccount));
// it can fill in an array of object ID's
DBClass displayClass = GetDetailTransactionClass();
if (DB_ClassDescriptor::IsTransaction(displayClass) ||
DB_ClassDescriptor::IsAccount(displayClass))
{
TObjectIDArray selectArray = account->GetActiveIDArray(displayClass);
// have the editor show the window with array selected
DB_Editor::RemoteShowEditor(displayClass, selectArray);
}
else
TCS_SysBeep();
}
|