Accounting Software
Small Business Software Estimating Software
Inventory SoftwareInventory Tracking SoftwareInventory Control SoftwareInventory Management SoftwareConstruction Management SoftwareProject Management SoftwareBusiness Management Software

Billing Statements (Source Code)

Link to: header | transactions directory

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

Comments

CBillingStatement

This class manages billing statements for the Goldenseal accounting software,
small business management software, construction project management software and
construction accounting software.

a billing statement summarizes a bunch of sales and/or billing records.

This class is incomplete.

SUPERCLASS = CBreakdownTransaction

Constructor

/*********************************************************************************
constructor TCS 12/8/03
*********************************************************************************/
CBillingStatement::CBillingStatement()
{
mMainAccountClass = id_CustomerAccount;

// we always have the same breakdown
mBreakdownType = breakdown_payment;
mBreakdownClassID = id_PaymentBreakdownEntry;

mMessage = mPaymentTerms = 0;

mStatus = status_Entered;
mSpareByte = 0;

mEndDate.SetToToday();

mStartDate.SetToToday();
mStartDate.AddSafeMonths(-1);
mStartDate.SetToFirstOfMonth();

mExpansionMoney = 0;
mExpansionLong = 0;

mEndSafetyTag = tag_endsafetytag; // TCS 9/8/02
}

Source Code

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

GetFileLength TCS 12/8/03

return the file length to reserve for this object

*********************************************************************************/
NeoSize CBillingStatement::GetFileLength(const CNeoFormat *aFormat) const
{
return THE_SUPERCLASS::GetFileLength(aFormat) +
cFileLength;
}
/*********************************************************************************

CopyFrom TCS 12/8/03

copy the data members from the passed object. This is used to implement
duplicate. source should be an object of the same class as this object

*********************************************************************************/
void CBillingStatement::CopyFrom(DB_PersistentObject *source, const UInt8 copyFlags)
{
THE_SUPERCLASS::CopyFrom(source, copyFlags);

CBillingStatement *src = TCS_SAFE_CAST(source, CBillingStatement);
TCS_FailNILMsg(src, TCS_GetErrString(errID_BadRecord));

TCS_BlockMove(&src->mMessage, &mMessage, cCopyFileLength);

if (HasLockedStatus())
mStatus = GetStarterStatus();
}/*********************************************************************************

GetMemberValue TCS 12/8/03

return the value of the member with the given tag

*********************************************************************************/
Boolean CBillingStatement::GetMemberValue(const TagType aTag, const TagType aType,
void *aValue) const
{
switch (aTag)
{
case tag_message:
return ConvertObjectIDMember(mMessage, id_Message, aValue, aType);
break;

case tag_paymentterm:
return ConvertObjectIDMember(mPaymentTerms, id_CustomerPaymentTerm, aValue, aType);
break;

case tag_status:
return ConvertEnumMember(mStatus, MENU_BillingRecordStatus, aValue, aType);
break;

case tag_startdate:
return ConvertMember(&mStartDate, type_date, aValue, aType);
break;

case tag_enddate:
return ConvertMember(&mEndDate, type_date, aValue, aType);
break;

default:
return THE_SUPERCLASS::GetMemberValue(aTag, aType, aValue);
break;
}
}/*********************************************************************************

SetMemberValue

set the value of the member with the given tag

*********************************************************************************/
Boolean CBillingStatement::SetMemberValue(const TagType aTag, const TagType aType,
const void *aValue)
{
switch (aTag)
{
case tag_message:
return ConvertDataToObjectID(aValue, aType, &mMessage, id_Message);
break;

case tag_paymentterm:
return ConvertDataToObjectID(aValue, aType, &mPaymentTerms, id_CustomerPaymentTerm);
break;

case tag_status:
return ConvertMember(aValue, aType, &mStatus, type_enum);
break;

case tag_startdate:
return ConvertMember(aValue, aType, &mStartDate, type_date);
break;

case tag_enddate:
return ConvertMember(aValue, aType, &mEndDate, type_date);
break;

default:
return THE_SUPERCLASS::SetMemberValue(aTag, aType, aValue);
break;
}
}/*********************************************************************************

ReadObject TCS 12/8/03

read the persistent object's data in from a stream
*********************************************************************************/
void CBillingStatement::ReadObject(CNeoStream *aStream, const TagType aTag)
{
TCS_FailNILMsg(aStream, TCS_GetErrString(errID_BadStream));

CNeoDebugImport checker(aStream, this, cCheckTooSmall);

THE_SUPERCLASS::ReadObject(aStream, aTag);

if (!IsIOValid())
return;

mMessage = aStream->ReadID();
mPaymentTerms = aStream->ReadID();

mStatus = aStream->ReadChar();
mSpareByte = aStream->ReadChar();

mStartDate.ReadFromStream(aStream);
mEndDate.ReadFromStream(aStream);

mExpansionMoney.ReadFromStream(aStream);
mExpansionLong = aStream->ReadLong();

mEndSafetyTag = aStream->ReadEndSafetyTag(this);

if (!IsValidEndTag(mEndSafetyTag))
ReportDamagedObject(GetDBClassID(), GetDBID());
}/*********************************************************************************

WriteObject TCS 12/8/03

write the persistent object's data to a stream
*********************************************************************************/
void CBillingStatement::WriteObject(CNeoStream *aStream, const TagType aTag)
{
TCS_FailNILMsg(aStream, TCS_GetErrString(errID_BadStream));

// make sure we have valid data to write
if (!IsValidEndTag(mEndSafetyTag))
{
ReportDamagedObject(GetDBClassID(), GetDBID());
mEndSafetyTag = tag_endsafetytag;
}

CNeoDebugExport checker(aStream, this, cCheckTooSmall);
THE_SUPERCLASS::WriteObject(aStream, aTag);

aStream->WriteID(mMessage);
aStream->WriteID(mPaymentTerms);

aStream->WriteChar(mStatus);
aStream->WriteChar(mSpareByte);

mStartDate.WriteToStream(aStream);
mEndDate.WriteToStream(aStream);

mExpansionMoney.WriteToStream(aStream);
aStream->WriteLong(mExpansionLong);

aStream->WriteEndSafetyTag(mEndSafetyTag, this);
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

FillDataReport TCS 12/8/03

fill in a diagnostic table that shows data field values.

*********************************************************************************/
void CBillingStatement::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_message, mMessage, id_Message);
FillFieldObjectIDRow(table, stream, tag_paymentterm, mPaymentTerms, id_CustomerPaymentTerm);

FillFieldEnumRow(table, stream, tag_status, mStatus, MENU_BillingRecordStatus);
FillFieldStockRow(table, stream, stockID_Padding, cCharSize, SInt32(mSpareByte));

FillFieldTagRow(table, stream, tag_startdate, cDateSize, mStartDate.GetCString());
FillFieldTagRow(table, stream, tag_enddate, cDateSize, mEndDate.GetCString());

FillFieldStockRow(table, stream, stockID_Padding, cMoneySize, mExpansionMoney.GetNumberString());
FillFieldStockRow(table, stream, stockID_Padding, cLongSize, mExpansionLong);

FillEndSafetyTag(table, stream, mEndSafetyTag);
}