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

Checking Transactions (Source Code)

Link to: header | transactions directory

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

Comments

CCheckingTransaction

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

It's a basic checking account transaction. This handles the basic data that is
used for checks, deposits, and misc checkbook transactions. These are the
transactions that are printed with the Goldenseal check writing software.

SUPERCLASS = CBankTransaction

Constructor

/*********************************************************************************
constructor
*********************************************************************************/
CCheckingTransaction::CCheckingTransaction()
{
mCheckbookID = 0;
mFiller = 0;

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

Source Code

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

CopyFrom

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 CCheckingTransaction::CopyFrom(DB_PersistentObject *source, const UInt8 copyFlags)
{
THE_SUPERCLASS::CopyFrom(source, copyFlags);

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

TCS_BlockMove(&src->mCheckbookID, &mCheckbookID, cCopyFileLength);
}/*********************************************************************************

GetMemberValue

return the value of the member with the given tag

*********************************************************************************/
Boolean CCheckingTransaction::GetMemberValue(const TagType aTag, const TagType aType,
void *aValue) const
{
switch (aTag)
{
case tag_bankaccount:
return ConvertObjectIDMember(mBankAccount, id_CheckingAccount, aValue, aType);
break;

case tag_checkbook:
return ConvertMember(&mCheckbookID, type_enum, aValue, aType);
break;

case tag_bankaccountclass: // this isn't a member but we still may need it
{
DBClass id = id_CheckingAccount;
return ConvertMember(&id, type_objclass, aValue, aType);
}
break;

case tag_nextcheck: // we get the next check number from the bank account
{
SInt32 refNum = 0;

CCheckingAccount *checkAccount =
TCS_SAFE_CAST(gDBFile->GetOneObject(id_CheckingAccount, mBankAccount),
CCheckingAccount);
if (checkAccount)
{
DB_ObjectWatcher watcher(checkAccount);
refNum = checkAccount->PeekNextCheckNumber(mConditions);
}

return ConvertMember(&refNum, type_long, aValue, aType);
}
break;

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

SetMemberValue

set the value of the member with the given tag

*********************************************************************************/
Boolean CCheckingTransaction::SetMemberValue(const TagType aTag, const TagType aType,
const void *aValue)
{
switch (aTag)
{
case tag_bankaccount:
return ConvertDataToObjectID(aValue, aType, &mBankAccount, id_CheckingAccount);
break;

case tag_checkbook:
return ConvertMember(aValue, aType, &mCheckbookID, type_enum);
break;

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

ReadObject

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

CNeoDebugImport checker(aStream, this, cCheckTooSmall); // TCS 2/24/00

THE_SUPERCLASS::ReadObject(aStream, aTag);

if (!IsIOValid()) // TCS 2/5/02
return;
/// aStream->ReadChunk(&mCheckbookID, cFileLength);

mCheckbookID = aStream->ReadChar(); // mfs_sa rev 20feb2k3
mFiller = aStream->ReadChar();

mEndSafetyTag = aStream->ReadEndSafetyTag(this);

if (!IsValidEndTag(mEndSafetyTag)) // TCS 9/8/02
ReportDamagedObject(GetDBClassID(), GetDBID());
}
/*********************************************************************************

WriteObject

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

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

CNeoDebugExport checker(aStream, this, cCheckTooSmall);
THE_SUPERCLASS::WriteObject(aStream, aTag);
/// aStream->WriteChunk(&mCheckbookID, cFileLength);

aStream->WriteChar(mCheckbookID); // mfs_sa rev 20feb2k3
aStream->WriteChar(mFiller);

aStream->WriteEndSafetyTag(mEndSafetyTag, this);

}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

FillDataReport TCS 9/6/02

fill in a diagnostic table that shows data field values.

*********************************************************************************/
void CCheckingTransaction::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);

FillFieldTagRow(table, stream, tag_checkbook, cCharSize, SInt32(mCheckbookID));
FillFieldStockRow(table, stream, stockID_Padding, cCharSize, SInt32(mFiller));

FillEndSafetyTag(table, stream, mEndSafetyTag);
}