Accounting Software
Small Business Software Estimating Software
Time Tracking SoftwareTime Management SoftwareTime Billing SoftwareContact Management SoftwareCustomer Management SoftwareProject Management SoftwareBusiness Management Software

Purchase Tables (Source Code)

Link to: header | tables directory

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

Comments

CPaymentBreakdownTable

This class manages purchase breakdown tables for the Goldenseal accounting software,
small business management software, construction project management software and
construction accounting software.

It's a table listing payments made for expenses. It's usually included in bank checks
that cover accounts payables payments via the Pay Bills command. This is a key
part of the Goldenseal Accounts Payable software.

SUPERCLASS = CTransactionBreakdownTable

Source Code

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

RecalcBreakdownRow TCS 2/9/99 rev 3/9/99, major rev 1/26/00

recalculate the given row.

*********************************************************************************/
CMoney CPurchaseBreakdownTable::RecalcBreakdownRow(const TableIndexT row, const TagType /*changedCol*/)
{
// if the pay column has changed, we do nothing
if (SelectedColumn() == GetMemberCol(tag_amount) &&
GetClickedColumn() != GetMemberCol(tag_pay)) // rev TCS 1/26/00
return GetMemberColMoney(row, tag_amount);

// for other columns, we recalculate the total due amount
CMoney payAmount = GetMemberColMoney(row, tag_current);
payAmount += GetMemberColMoney(row, tag_adjustment);
payAmount += GetMemberColMoney(row, tag_pastdue);

// always update the total due col TCS 1/26/00
SetMemberColMoney(row, tag_amountdue, payAmount);

// update the amount paid col
payAmount += GetMemberColMoney(row, tag_pending);

TableIndexT col = GetMemberCol(tag_pay);
if (col && !IsChecked(row, col))
{
SetMemberColString(row, tag_amount, CMoney::GetZeroCurrencyString());
return 0;
}
else
{
SetMemberColMoney(row, tag_amount, payAmount);
return payAmount;
}
}
/*********************************************************************************

GetColType rev TCS 3/13/02

return the column type for the given column

*********************************************************************************/
SInt32 CPurchaseBreakdownTable::GetColType(const TableIndexT row, const TableIndexT col) const
{
SMemberInfo memberInfo;
TCS_ASSERTMsg(GetColMemberInfo(col, &memberInfo), TCS_GetErrString(errID_BadColumn));

switch (memberInfo.tag)
{
case tag_amount: // TCS 3/13/02
{
UInt8 transType = GetMemberColValue(row, tag_transactiontype);
if (transType == id_Chargeback)
return coltype_caption;
else
return coltype_edit;
}
break;

default:
return THE_SUPERCLASS::GetColType(memberInfo);
break;
}
}
/*********************************************************************************

GetDetailTransactionClass TCS 12/13/99

get the transaction object class id for a row. We override since we get this
from the owner's main account class

*********************************************************************************/
UInt8 CPurchaseBreakdownTable::GetDetailTransactionClass(const TableIndexT row) const
{
DBid itemID = GetMemberColValue(row, tag_transactid);
DBClass itemClass = GetMemberColValue(row, tag_transactiontype);

if (itemID == cPayOnAccountFlag)
return 0;
else if (itemClass) // TCS 3/13/02
return itemClass;
else
return DB_ClassDescriptor::GetCostTransaction(GetTableMainAccountClass());
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

RecalcBreakdownRow

recalculate the given row

*********************************************************************************/
CMoney CTandMBreakdownTable::RecalcBreakdownRow(const TableIndexT row, const TagType /*changedCol*/)
{
CMoney payAmount(0,0);

// calculate the total due amount
TableIndexT col = GetMemberCol(tag_bill);
if (col)
{
if (IsChecked(row, col))
{
payAmount = GetMemberColMoney(row, tag_costamount);
payAmount += GetMemberColMoney(row, tag_markup);
}

SetMemberColMoney(row, tag_amount, payAmount);
}

return payAmount;
}