Link to: header | tables
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Comments
CTransactionBreakdownTable
This class manages accounting transaction tables
for the Goldenseal estimating software,
small business management software, construction
project management software and
construction estimating software.
It's a generic table for displaying transactions. Transaction tables are a passive
display of existing data- the user cannot add new rows. Generally transaction
tables include a checkmark column to determine which items are to be paid.
We use transaction tables in many parts of the Goldenseal accounting software--
they handle accounts payable, accounts receivable, payroll, and other tracking
of business transactions.
SUPERCLASS = CBreakdownTable
Source Code
/*********************************************************************************
GetColType
return the column type for the given column
*********************************************************************************/
SInt32 CTransactionBreakdownTable::GetColType(const SMemberInfo &memberInfo) const
{
switch (memberInfo.tag)
{
case tag_amount: // TCS 7/12/99
return coltype_caption;
break;
case tag_mainaccount: // TCS 3/27/00 (generally used in passive tables)
return coltype_lookup;
break;
case tag_mainaccountclass: // TCS 3/27/00
return coltype_menulookup;
break;
case tag_conditions: // TCS 5/22/00
return coltype_menulookup;
break;
case tag_transactid:
case tag_duedate: // TCS 11/21/01
case tag_refnum:
return coltype_caption;
break;
default:
return THE_SUPERCLASS::GetColType(memberInfo);
break;
}
}
/*********************************************************************************
GetFieldType TCS 9/11/99
return the field type for the given col
*********************************************************************************/
UInt8 CTransactionBreakdownTable::GetFieldType(const TableIndexT col) const
{
switch (GetColTag(col))
{
case tag_transactid:
return fieldtype_integer;
break;
case tag_mainaccount: // TCS 3/27/00
case tag_mainaccountclass:
case tag_conditions:
return fieldtype_cv;
break;
default:
return THE_SUPERCLASS::GetFieldType(col);
break;
}
}/*********************************************************************************
RecalcBreakdownRow
recalculate the given row
*********************************************************************************/
CMoney CTransactionBreakdownTable::RecalcBreakdownRow(const TableIndexT row, const TagType /*changedCol*/)
{
CMoney payAmount(0,0);
// calculate the total due amount
TableIndexT col = GetMemberCol(tag_pay);
if (col)
{
if (IsChecked(row, col))
payAmount = GetMemberColMoney(row, tag_amountdue);
SetMemberColMoney(row, tag_amount, payAmount);
}
return payAmount;
}
/*********************************************************************************
HandleReturnKey
handle the return or enter key being pressed. We override to prevent
new rows from being added.
*********************************************************************************/
Boolean CTransactionBreakdownTable::HandleReturnKey()
{
if (SelectedRow() == LastRow())
{
TCS_SysBeep();
return true;
}
else
return THE_SUPERCLASS::HandleReturnKey();
}
/*********************************************************************************
MakeSingleRowTable TCS 1/1/99 rev 12/13/01
we override since we don't show any rows
*********************************************************************************/
void CTransactionBreakdownTable::MakeSingleRowTable(const Boolean redraw, const Boolean findMode)
{
if (findMode)
THE_SUPERCLASS::MakeSingleRowTable(redraw, findMode);
else
MakeEmptyTable(redraw);
}
/*********************************************************************************
GetCellCVClassID TCS 3/27/00
return the class ID for cv field, based on the given member info. We override
since the account column needs to fetch the main account class
*********************************************************************************/
DBid CTransactionBreakdownTable::GetCellCVClassID(const TableCellT &inCell) const
{
SMemberInfo memberInfo;
TCS_ASSERTMsg(GetColMemberInfo(COL(inCell), &memberInfo),
TCS_GetErrString(errID_BadColumn));
TableIndexT col;
DBid accountClass;
if (memberInfo.tag == tag_mainaccount)
{
col = GetMemberCol(tag_mainaccountclass);
if (col)
{
accountClass = GetCellValue(ROW(inCell), col);
return accountClass;
}
else if (DB_ClassDescriptor::IsAccount(mMainAccountClass)) // TCS 3/20/02
return mMainAccountClass;
else if (mMainAccountClass == filter_cashsalesbybranch ||
mMainAccountClass == filter_cashsalesbydate ||
mMainAccountClass == filter_billedsales)
return id_CustomerAccount; // TCS 3/20/02
else if (mMainAccountClass == filter_rentals ||
mMainAccountClass == id_Lease) // TCS 1/16/03
return id_Lease;
else
return id_ProjectAccount;
}
else if (memberInfo.tag == tag_secondaccount) // TCS 10/22/01
{
col = GetMemberCol(tag_secondaccountclass);
if (col)
{
accountClass = GetCellValue(ROW(inCell), col);
return accountClass;
}
}
// if we get this far, just return the stored member value
return THE_SUPERCLASS::GetMemberCVClassID(memberInfo);
}
/*********************************************************************************
GetMenuCVClassID TCS 3/27/00
return the class ID for cv field, based on the given member info. We override
since the account column needs to fetch the main account class
*********************************************************************************/
DBid CTransactionBreakdownTable::GetMemberMenuCVClassID(const SMemberInfo &memberInfo) const
{
if (memberInfo.tag == tag_mainaccountclass)
{
return MENU_AccountClasses;
}
else
return THE_SUPERCLASS::GetMemberMenuCVClassID(memberInfo);
}
|