Link to: header |
source 1 | transactions
directory
Copyright Turtle Creek Software 1996-2006. All Rights Reserved.
Source Code
This class manages receipt transactions in the Goldenseal accounting software,
estimating software, project
management software
and construction
accounting software.
/*********************************************************************************
GetPaymentDetailsClass
return the class to use for the details member // renamed by TCS 1/13/98
*********************************************************************************/
SInt32 CReceiptTransaction::GetPaymentDetailsClass(const DBid paymentID)
{
// we get the payment method type from the pmt method object
UInt8 paymentType = GetPaymentType(paymentID);
if (paymentType)
{
switch (paymentType)
{
case method_cash:
return id_CashAccount;
break;
case method_check:
case method_checkingdebit:
return id_CheckingAccount;
break;
case method_barter:
return id_BarterTransfer;
break;
case method_creditcard:
return id_CreditCardAccount;
break;
case method_loandebit:
case method_loancheck: // TCS 3/27/02
return id_LoanAccount;
break;
case method_emplpurchase:
return id_EmployeeAccount;
break;
case method_billed:
return id_VendorPaymentTerm;
break;
case method_savingsdebit:
return id_SavingsAccount;
break;
case method_escrowcheck:
case method_escrowdebit:
return id_EscrowAccount;
break;
case method_multiple:
case method_redeemable:
case method_creditmemo:
case method_foreign:
case method_freebie:
case method_writeoff:
case method_jobcostonly: // TCS 12/27/00
case method_priceonly: // TCS 12/28/00
case method_none:
return 0;
break;
default:
TCS_DebugAlert("Oops, bad case in CReceiptTransaction:: GetPaymentDetailsClass!");
return 0;
break;
}
}
else // if no method, we can just return zero
{
return 0;
}
}
/*********************************************************************************
AddPaymentAmounts TCS 1/5/98
add this sale to the given amounts for different types of deposit income
*********************************************************************************/
/*void CReceiptTransaction::AddPaymentAmounts(CMoney &cashAmount, CMoney &checkAmount,
CMoney &creditCardAmount, CMoney &otherAmount,
CMoney &freebieAmount, CMoney &depositAmount)
{
UInt8 method = GetPaymentType();
switch (method)
{
case method_billed:
// do nothing
break;
case method_cash:
cashAmount += mAmount;
depositAmount += mAmount;
break;
case method_check:
checkAmount += mAmount;
depositAmount += mAmount;
break;
case method_creditcard:
creditCardAmount += mAmount;
depositAmount += mAmount;
break;
case method_foreign:
otherAmount += mAmount;
depositAmount += mAmount;
break;
case method_multiple:
// for multiple methods, we'll have to look at the array
depositAmount += mAmount;
break;
default:
freebieAmount += mAmount;
// other payments don't make a deposit
break;
}
}*/
/*********************************************************************************
GetDatePaid TCS 9/1/99
return the date when this item was paid
*********************************************************************************/
CDate CReceiptTransaction::GetDatePaid() const
{
CDate paidDate;
if (IsBilled())
{
if (HasBeenPaid() && GetPaymentTransactionClass())
{ // fetch payment date from the payment transaction
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
DB_PersistentObject *pmt =
gDBFile->GetOneObject(GetPaymentTransactionClass(), GetPaymentTransactionID());
if (pmt)
{
DB_ObjectWatcher watcher(pmt);
paidDate = pmt->GetDate();
}
else
paidDate.SetToFarFuture();
}
else
paidDate.SetToNever();
}
else
paidDate = GetDate();
return paidDate;
}
/*********************************************************************************
GetDueDate TCS 9/14/00
return the due date for this transaction
*********************************************************************************/
CDate CReceiptTransaction::GetDueDate() const
{
// sanity check
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
// first let's get the payment terms
CDate dueDate = mDate; // rev TCS 3/7/02
// credits and cash items are due right away TCS 12/7/00
if (IsCredit() || !IsBilled())
return dueDate;
CPaymentTerm *term = nil;
DBid termID = GetPaymentTerm();
DBClass termClass = GetPaymentTermClass();
// if we have a payment term, let's fetch it from the database
if (termID && termClass)
term = TCS_SAFE_CAST(gDBFile->GetOneObject(termClass, termID), CPaymentTerm);
// if we found a payment term, watch it and fetch the due date for our billing date
if (term)
{
DB_ObjectWatcher watch(term);
dueDate = term->GetDueDateAfter(GetBillingDate());
}
return dueDate;
}
/*********************************************************************************
GetAllDueDates TCS 10/19/00
return the billing, discount and due dates for this transaction
*********************************************************************************/
Boolean CReceiptTransaction::GetAllDueDates(CDate *billingDate, CDate *discountDate,
CDate *dueDate)
{
// sanity check
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
TCS_FailNILMsg(billingDate, TCS_GetErrString(errID_BadDate)); // TCS 9/19/02
TCS_FailNILMsg(discountDate, TCS_GetErrString(errID_BadDate));
TCS_FailNILMsg(dueDate, TCS_GetErrString(errID_BadDate));
// first let's get the payment terms and fill in the billing date
DBClass termClass = GetPaymentTermClass();
*billingDate = GetBillingDate();
// if we have a payment term, let's fetch it from the database
CPaymentTerm *term = TCS_SAFE_CAST(gDBFile->GetOneObject(termClass,
GetPaymentTerm()), CPaymentTerm);
// if we found a payment term, watch it and fetch the due date for our billing date
if (term)
{
DB_ObjectWatcher watcher(term);
*dueDate = term->GetDueDateAfter(*billingDate);
*discountDate = term->GetDiscountDateAfter(*billingDate);
}
else // if no term, all are the same day
{
*dueDate = *billingDate;
*discountDate = *billingDate;
}
return true;
}
/*********************************************************************************
GetDepositTransactionClass TCS 5/4/01
return the object class used for deposit transactions. We just fetch the
first deposit listed in the payment array.
*********************************************************************************/
DBClass CReceiptTransaction::GetDepositTransactionClass() const
{
if (mPaymentArray.GetCount() > 0)
{
TObjectInfoArrayIterator iterator(mPaymentArray);
SObjectInfo info;
while (iterator.Next(info))
{
if (info.transactionType == id_BankDeposit)
return info.classID;
}
return 0;
}
else
return 0;
}
/*********************************************************************************
GetDepositTransactionID TCS 4/11/00 moved TCS 5/4/01
return the object id used for deposit transactions. We just fetch the
first deposit listed in the payment array.
*********************************************************************************/
DBid CReceiptTransaction::GetDepositTransactionID() const
{
if (mPaymentArray.GetCount() > 0)
{
TObjectInfoArrayIterator iterator(mPaymentArray);
SObjectInfo info;
while (iterator.Next(info))
{
if (info.transactionType == id_BankDeposit)
return info.itemID;
}
return 0;
}
else
return 0;
}
/*********************************************************************************
GetAccountNumber TCS 1/23/03
return the account number for the main account
*********************************************************************************/
CTextString CReceiptTransaction::GetAccountNumber() const
{
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
if (IS_TURTLE_CLASS_ID(mMainAccountClass))
{
DB_PersistentObject *account = gDBFile->GetOneObject(mMainAccountClass, mMainAccount);
if (account)
{
DB_ObjectWatcher watcher(account);
return account->GetRefNumString();
}
}
return cEmptyString;
}
/*********************************************************************************
GetCustomerName TCS 10/30/01
return the name of the customer. We generally use the main account name, but
for projects we fetch the project's customer account
*********************************************************************************/
CTextString CReceiptTransaction::GetCustomerName() const
{
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
if (IS_TURTLE_CLASS_ID(mMainAccountClass))
{
DB_PersistentObject *account = gDBFile->GetOneObject(mMainAccountClass, mMainAccount);
if (account)
{
DB_ObjectWatcher watcher(account);
return account->GetCustomerName();
}
}
return cEmptyString;
}
/*********************************************************************************
GetBillingAddress TCS 1/14/03
get the billing address from the main account
*********************************************************************************/
CTextString CReceiptTransaction::GetBillingAddress() const
{
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
if (IS_TURTLE_CLASS_ID(mMainAccountClass))
{
DB_PersistentObject *account = gDBFile->GetOneObject(mMainAccountClass, mMainAccount);
if (account)
{
DB_ObjectWatcher watcher(account);
return account->GetBillingAddress();
}
}
return cEmptyString;
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
GetDaysOverdue TCS moved 8/12/99
return the number of days this invoice is overdue on the given date
*********************************************************************************/
SInt32 CReceiptTransaction::GetDaysOverdue(CDate compareDate) const
{
CDate dueDate = GetDueDate();
SInt32 daysOverdue = compareDate.Subtract(dueDate);
if (daysOverdue < 0)
return 0;
else
return daysOverdue;
}
/*********************************************************************************
GetAmountOverdue TCS 5/16/00
return the amount overdue on this transaction
*********************************************************************************/
CMoney CReceiptTransaction::GetAmountOverdue(const CDate compareDate) const
{
if (GetDaysOverdue(compareDate))
return GetAmountDue();
else
return 0;
}
/*********************************************************************************
GetAmountVeryOverdue TCS 5/16/00
return the amount very overdue on this transaction
*********************************************************************************/
CMoney CReceiptTransaction::GetAmountVeryOverdue(const CDate compareDate) const
{
if (GetDaysOverdue(compareDate) > 30)
return GetAmountDue();
else
return 0;
}
/*********************************************************************************
GetAccountingAmount TCS 12/11/00
for unpaid taxes use the sales tax amount
*********************************************************************************/
CMoney CReceiptTransaction::GetAccountingAmount(const Boolean removeIt, const UInt8 type) const
{
if (type == virtual_unpaidtax)
{
if (removeIt)
return -GetSalesTaxAmount();
else
return GetSalesTaxAmount();
}
else
{
if (removeIt)
return -GetAmount();
else
return GetAmount();
}
}
/*********************************************************************************
GetCreditAmount TCS 1/1/01
return the net amount
*********************************************************************************/
CMoney CReceiptTransaction::GetCreditAmount() const
{
if (HasVoidStatus())
return 0;
else
return GetAmount();
}
/*********************************************************************************
GetIncomeAmount TCS 4/26/01
return the amount to use for net income. We don't consider this as income
if it's been deposited, since the billing record, pmt receipt or deposit will
then cover the income.
Subclasses should override if a different method is used to track payment/deposit.
*********************************************************************************/
CMoney CReceiptTransaction::GetIncomeAmount() const
{
if (HasVoidStatus())
return 0;
else
return GetAmount() - GetAmountPaid();
}
/*********************************************************************************
GetReceivablesAmount TCS 1/1/01
get the amount of receivables due as of the given date
*********************************************************************************/
CMoney CReceiptTransaction::GetReceivablesAmount(const TagType tag, const CDate reportDate) const
{
if (tag == tag_receivablestotal || tag == tag_receivablesnet) // TCS 2/19/01
return GetReceivablesAmount();
else if (tag == tag_receivablesbilled)
{
if (HasBeenReceivableBilled())
return GetAmount(); // entire amount
else
return 0;
}
CDate dueDate = GetDueDate();
SInt32 daysFromDue = reportDate.Subtract(dueDate);
SInt32 overdueCutoff = GetPrefsObjectID(id_InterfacePrefs, tag_overduecutoff);
SInt32 overdueCutoff2 = GetPrefsObjectID(id_InterfacePrefs, tag_overduecutoff2);
SInt32 overdueCutoff3 = GetPrefsObjectID(id_InterfacePrefs, tag_overduecutoff3);
switch (tag)
{
case tag_receivablespending:
if (daysFromDue < 0)
return GetReceivablesAmount();
break;
case tag_receivablesdue:
if (daysFromDue >= 0 && daysFromDue <= overdueCutoff)
return GetReceivablesAmount();
break;
case tag_receivablesoverdue1:
if (daysFromDue > overdueCutoff && daysFromDue <= overdueCutoff2)
return GetReceivablesAmount();
break;
case tag_receivablesoverdue2:
if (daysFromDue > overdueCutoff2 && daysFromDue <= overdueCutoff3)
return GetReceivablesAmount();
break;
case tag_receivablesoverdue3:
if (daysFromDue > overdueCutoff3)
return GetReceivablesAmount();
break;
default:
break;
}
// if we got this far, just return zero
return 0;
}
/*********************************************************************************
GetBillPaymentMethod TCS 10/13/99
get the payment method used to pay for a billed item. This applies only
if a payment receipt was used
*********************************************************************************/
DBid CReceiptTransaction::GetBillPaymentMethod() const
{
if (GetPaymentTransactionClass() != id_PaymentReceipt)
return 0;
CPaymentReceipt *pmtReceipt =
TCS_SAFE_CAST(gDBFile->GetOneObject(id_PaymentReceipt, GetPaymentTransactionID()),
CPaymentReceipt);
if (pmtReceipt)
{
DB_ObjectWatcher watcher(pmtReceipt);
return pmtReceipt->GetPaymentMethod();
}
else
return 0;
}
/*********************************************************************************
GetUnpaidBalance TCS 2/27/03
return the unpaid balance. We fetch it from the account
*********************************************************************************/
CMoney CReceiptTransaction::GetUnpaidBalance() const
{
if (!IS_TURTLE_CLASS_ID(mMainAccountClass))
return 0;
DB_Account *account =
TCS_SAFE_CAST(gDBFile->GetOneObject(mMainAccountClass, mMainAccount),
DB_Account);
if (account)
{
DB_ObjectWatcher watcher (account);
return account->GetUnpaidBalance();
}
else
return 0;
}
/*********************************************************************************
GetPastDueBalance TCS 2/27/03
return the past due balance. We fetch it from the account
*********************************************************************************/
CMoney CReceiptTransaction::GetPastDueBalance(const CDate cutoffDate) const
{
if (!IS_TURTLE_CLASS_ID(mMainAccountClass))
return 0;
DB_Account *account =
TCS_SAFE_CAST(gDBFile->GetOneObject(mMainAccountClass, mMainAccount),
DB_Account);
if (account)
{
DB_ObjectWatcher watcher (account);
return account->GetPastDueBalance(cutoffDate);
}
else
return 0;
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
FetchJobCostItemInfo TCS 5/3/01 rev TCS 8/10/02
add job cost data to a category/location item. We override to fill in
different info
*********************************************************************************/
Boolean CReceiptTransaction::FetchJobCostItemInfo(TJobCostItemArray &itemArray,
CTextString &/*catName*/,
const UInt8 costType)
{
if (costType != costtype_income) // TCS 8/10/02
return true;
SJobCostItemInfo itemInfo;
itemInfo.id = GetDBID();
CTextString nameString = GetMenuName();
TCS_BufferFromText(itemInfo.item, nameString);
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
nameString = DB_ClassDescriptor::GetClassName(GetDBClassID());
TCS_BufferFromText(itemInfo.supplier, nameString);
nameString = gDBFile->GetObjectName(id_PaymentMethod, GetPaymentMethod());
TCS_BufferFromText(itemInfo.category, nameString);
itemInfo.type = costtype_income;
itemInfo.date = GetDate();
// fill in amounts
itemInfo.costAmount = GetAmount();
itemInfo.paidAmount = GetAmountPaid();
if (HasBeenReceivableBilled())
itemInfo.billedAmount = GetAmount();
else if (itemInfo.paidAmount.IsPositive()) // TCS 6/20/01 rev 7/5/01
itemInfo.billedAmount = GetAmount();
else
itemInfo.billedAmount = 0;
return (itemArray.Append(itemInfo) != LArray::index_Bad);
}
/*********************************************************************************
FetchDiscountOrPenalty TCS 10/19/00
return the discount or finance charge amount on the given date
*********************************************************************************/
CMoney CReceiptTransaction::FetchDiscountOrPenalty(const CDate theDate) const
{
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
// no discount or penalty for credits or zero balances TCS 12/6/00
CMoney amountDue = GetAmountDue();
if (!amountDue.IsPositive())
return 0;
// first let's get the payment terms
DBClass termClass = GetPaymentTermClass();
CDate billingDate = GetBillingDate();
// if we have a payment term, let's fetch it from the database
CPaymentTerm *term = TCS_SAFE_CAST(gDBFile->GetOneObject(termClass,
GetPaymentTerm()), CPaymentTerm);
// if we found a payment term, watch it and fetch the discount date for our billing date
if (term)
{
DB_ObjectWatcher watch(term);
CDate discountDate = term->GetDiscountDateAfter(billingDate);
CDate penaltyDate = term->GetDueDateAfter(billingDate);
SInt32 daysOverdue = theDate.Subtract(penaltyDate); // rev TCS 1/25/00
SInt32 daysEarly = discountDate.Subtract(theDate);
if (theDate > penaltyDate)
return term->CalculateFinanceCharge(amountDue, daysOverdue);
else if (theDate <= discountDate)
return - (term->CalculateDiscount(amountDue, daysEarly));
else
return 0;
}
else // no payment term, so it can't have a discount or penalty
return 0;
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
IsPrepaid rev TCS 9/1/99, rev TCS 4/10/00
return whether this sale is at least partly prepaid
*********************************************************************************/
Boolean CReceiptTransaction::IsPrepaid() const
{
UInt8 method = GetPaymentType();
if (method == method_billed)
return false;
else
return true;
}
/*********************************************************************************
IsBilled TCS 9/13/01
return whether this transaction has a billed payment method. This replaces
a less inclusive form.
*********************************************************************************/
Boolean CReceiptTransaction::IsBilled() const
{
if (!HasVoidStatus())
{
UInt8 method = GetPaymentType();
if (method == method_billed)
return true;
else
return false;
}
else
return false;
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
SetPaidInFull TCS 10/16/00
mark a payment. We only include unpaid items in the menu arrays
*********************************************************************************/
void CReceiptTransaction::SetPaidInFull(const Boolean isPaid)
{
THE_SUPERCLASS::SetPaidInFull(isPaid);
// update the menu list
DB_ListManager::ChangeInMenus(this); // TCS bugfix 11/10/00. We shouldn't delete from menu
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
HasPaymentReceipt TCS 12/4/00
return whether this transaction has been paid via payment receipt
*********************************************************************************/
Boolean CReceiptTransaction::HasPaymentReceipt() const
{
TObjectInfoArrayIterator iterator(mPaymentArray);
SObjectInfo info;
while (iterator.Next(info))
{
if (info.classID == id_PaymentReceipt)
return true;
}
// if we got this far, there's no receipt
return false;
}
/*********************************************************************************
HasBeenDeposited TCS rev 9/17/01
return whether this transaction has been deposited
*********************************************************************************/
Boolean CReceiptTransaction::HasBeenDeposited() const
{
if (mAmount.IsZero())
return true;
else if (mAmount.IsPositive())
return mAmountDeposited >= mAmount;
else
return mAmountDeposited <= mAmount;
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
HandlePaymentMade TCS 4/10/00
payment has been made for a refunded sale. We handle it very differently from the
superclass
*********************************************************************************/
void CReceiptTransaction::HandlePaymentMade(const CMoney &inAmount, const UInt8 sourceClass,
const DBid sourceID, const UInt8 transactionType, const Boolean removeItem)
{
// we used to skip customer & tenant billing records, but we
// need to do those too. TCS 12/11/03
// we should never receive payment if void TCS 12/7/99
if (HasVoidStatus())
{
TCS_DebugAlert("Oops, invalid void payment in CSale:: HandlePaymentMade!");
return;
}
// update payment amount
CMoney prevPaidAmount = GetAmountPaid();
CMoney amountPaid = prevPaidAmount - inAmount;
SetAmountPaid(amountPaid);
CMoney adjustedAmount = GetAdjustedAmount();
Boolean fullyPaid;
// are we changing an 'on account' balance? TCS 5/28/00
if (WasOverpaid() && PaysOnAccount())
{
CMoney prevExcess = adjustedAmount - prevPaidAmount;
CMoney changeAmount = TCS_MAX(inAmount, prevExcess);
changeAmount.ReverseSign();
PayOnAccount(changeAmount);
}
// if we are currently in a viewer, prepare to update it TCS 8/22/00
UInt8 saveSuccess = PrepareViewerDisplay();
if (amountPaid < adjustedAmount) // OVERREFUND, so reduce 'on account' amount
{
// set payment details
fullyPaid = true;
// update the status
SetPaidStatus(status_Overpaid);
// if not already overpaid, post the excess on account rev TCS 5/29/00
if (!WasOverpaid())
{
CMoney excess = adjustedAmount - amountPaid;
excess.ReverseSign();
PayOnAccount(excess);
}
// now we are definitely overpaid
SetBeenOverpaid(true);
}
else if (amountPaid == adjustedAmount) // EXACT PAYMENT
{
fullyPaid = true;
SetBeenOverpaid(false);
SetPaidStatus(status_Paid);
}
else if (amountPaid.IsPositive()) // PARTIAL PAYMENT
{
fullyPaid = false;
SetBeenOverpaid(false);
SetPaidStatus(status_PartPaid);
}
else // NOT PAID AT ALL
{
fullyPaid = false;
SetBeenOverpaid(false);
// update the status
SetPaidStatus(status_Unpaid);
}
// mark the flag bit
SetPaidInFull(fullyPaid);
// now pass it along to all the breakdown entries TCS 3/22/00 rev 6/6/00
MarkBreakdownsPaid(mBreakdownArray, mBreakdownClassID, fullyPaid, inAmount, sourceClass,
sourceID, transactionType, removeItem, cPaymentMade);
// we've changed
MakeDirty();
// update the payment transaction array TCS 6/6/00
AddToObjectInfoArray(mPaymentArray, sourceClass, sourceID, 0, removeItem, true);
// if we are currently in a viewer, need to update it TCS 3/21/00
UpdateViewerDisplay(saveSuccess);
// no need to pass it along from here
}
/*********************************************************************************
HandleTaxesPaid TCS 2/12/01
handle payment of sales tax for this item.
*********************************************************************************/
void CReceiptTransaction::HandleTaxesPaid(const DBClass /*sourceClass*/, const DBid /*sourceID*/,
const Boolean removeItem)
{
// We can just use the basic tax posting code, but reversed.
PostSalesTaxDue(!removeItem);
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************
FillJobCostCatInfo TCS 5/8/01
fill in a job cost category item. We only use these transactions for the
income values
*********************************************************************************/
Boolean CReceiptTransaction::FillJobCostCatInfo(SJobCostCategoryInfo &costInfo,
const CMoney &amount, const DBClass transactionClass,
const UInt8 costType)
{
if (costType == costtype_income) // rev TCS 8/10/02
return THE_SUPERCLASS::FillJobCostCatInfo(costInfo, amount, transactionClass,
costType);
else
return true;
}
/*********************************************************************************
FillCostItemInfo TCS 4/19/01
fill in an item for detailed job costing. We override since this is income,
not a cost.
*********************************************************************************/
void CReceiptTransaction::FillCostItemInfo(TJobCostItemArray &itemArray, const UInt8 costType,
const DBid /*accountID*/) const
{
if (costType != costtype_income && costType != costtype_all) // rev TCS 8/10/02
return;
SJobCostItemInfo itemInfo;
// fetch some basic info from the transaction
itemInfo.id = GetDBID();
CTextString nameString = GetMenuName();
TCS_BufferFromText(itemInfo.item, nameString);
TCS_FailNILMsg(gDBFile, TCS_GetErrString(errID_BadFile));
nameString = DB_ClassDescriptor::GetClassName(GetDBClassID());
TCS_BufferFromText(itemInfo.supplier, nameString);
nameString = gDBFile->GetObjectName(id_PaymentMethod, GetPaymentMethod());
TCS_BufferFromText(itemInfo.category, nameString);
itemInfo.date = mDate;
itemInfo.type = costtype_income;
// fill in amounts
itemInfo.costAmount = GetAmount();
itemInfo.paidAmount = GetAmountPaid();
if (HasBeenReceivableBilled())
itemInfo.billedAmount = GetAmount();
else if (itemInfo.paidAmount.IsPositive()) // TCS 6/20/01 rev 7/5/01
itemInfo.billedAmount = GetAmount();
else
itemInfo.billedAmount = 0;
itemArray.Append(itemInfo);
}
/*********************************************************************************
FillDataReport TCS 9/6/02
fill in a diagnostic table that shows data field values.
*********************************************************************************/
void CReceiptTransaction::FillDataReport(CTCS_Table *table, CNeoStream *stream) const
{
TCS_FailNILMsg(table, TCS_GetErrString(errID_BadTable));
TCS_FailNILMsg(stream, TCS_GetErrString(errID_BadStream));
THE_SUPERCLASS::FillDataReport(table, stream);
FillFieldObjectIDRow(table, stream, tag_paymentmethod, mPaymentMethod, id_PaymentMethod);
FillFieldObjectIDRow(table, stream, tag_revenueaccount, mRevenueAccount, id_UtilityAccount);
FillFieldTagRow(table, stream, tag_amountpaid, cMoneySize, mAmountPaid.GetCurrencyString());
FillFieldTagRow(table, stream, tag_amountdeposited, cMoneySize, mAmountDeposited.GetCurrencyString());
FillFieldTagRow(table, stream, tag_adjustment, cMoneySize, mAdjustmentAmount.GetCurrencyString());
FillFieldBitRow(table, stream, "mCommishPaid", mCommishPaid, true);
FillFieldBitRow(table, stream, "mJobCosted", mJobCosted);
FillFieldBitRow(table, stream, "mSalePricing", mSalePricing);
FillFieldStockRow(table, stream, stockID_Padding, -5, SInt32(filler));
FillFieldStockRow(table, stream, stockID_Padding, cCharSize, SInt32(mReceiptPadding));
}
|