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

Breakdown Array Owners (Header)

Link to: source code | transactions directory

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

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

class CBreakdownArrayOwner
{
public:

CBreakdownArrayOwner();
virtual ~CBreakdownArrayOwner() {}

SInt32 GetNumBreakdowns() const { return mBreakdownArray.GetCount(); }
/*CBreakdownEntry *GetNthBreakdown(SInt32 index, DBid classID,
Boolean subclassesAlso = true);*/

virtual NeoSize GetFileLength(const CNeoFormat */*aFormat*/) const // changed TCS 8/13/98, 12/21/98
{ return ARRAY_FILE_SIZE(mBreakdownArray) + cFileLength; }

virtual Boolean GetMemberValue(const TagType aTag, const TagType aType,
void *aValue) const;
virtual Boolean SetMemberValue(const TagType aTag, const TagType aType,
const void *aValue);

virtual void ReadObject(CNeoStream *aStream, const TagType aTag);
virtual void WriteObject(CNeoStream *aStream, const TagType aTag);

virtual SInt32 GetBreakdownCount(const DBid /*breakdownClass*/ = 0) const
{ return mBreakdownArray.GetCount(); }


virtual void CopyBreakdowns(CBreakdownArrayOwner *source, const DBid newOwnerID);

virtual void UpdateBreakdownsFromTable(CBreakdownTable *table,
const SInt32 breakdownType,
const DBid breakdownClassID,
DB_PersistentObject *owner = nil);
virtual Boolean FillTableFromBreakdowns(CBreakdownTable *table,
const DBid breakdownClassID);
virtual Boolean FillTableFromBreakdownArray(CBreakdownTable *table, TObjectIDArray &breakdownArray,
const DBid breakdownClassID);

virtual Boolean WriteToReportTable(CReportTable *table, const DBid breakdownClass,
TObjectIDArray &breakdownArray, DB_PersistentObject *source);

virtual DBid GetBreakdownClassID() const { return mBreakdownClassID; }
virtual void SetBreakdownClassID(const DBid classID)
{ mBreakdownClassID = classID; }

virtual Boolean CanCopyBreakdown(DB_PersistentObject */*breakdown*/) { return true; }
virtual void FinishBreakdownUpdate(CBreakdownEntry */*breakdown*/, CBreakdownTable */*table*/) {}

virtual Boolean HasBreakdown(const DBid breakdownID);

virtual Boolean BreakdownMatchesSelectors(CTCS_Array &selectorArray,
const Boolean matchAny, const SInt32 selectorCount) const;

// subclasses should override these (and check if they are in the dbase first) TCS moved 5/9/01
virtual void AddBreakdown(const DBid /*breakdownID*/) {}
virtual void RemoveAllBreakdownEntries(const Boolean /*removeFromDatabase*/ = true) {}

virtual void ClearBreakdownArray(TObjectIDArray *breakdownArray, const DBid breakdownClassID,
const Boolean removeFromDatabase = true);
virtual void RemoveExcessBreakdowns(TObjectIDArray &breakdownArray,
const DBClass breakdownClassID, SInt32 breakdownsCompleted);

virtual Boolean HasNewBreakdowns() { return mHasNewBreakdowns; } // TCS 4/17/00
virtual void SetHasNewBreakdowns(const Boolean inValue) { mHasNewBreakdowns = inValue; }

virtual TObjectIDArray GetBreakdownArray() { return mBreakdownArray; }


protected:
// array members
TObjectIDArray mBreakdownArray; // array of breakdown ids

// copied members
UInt8 mBreakdownType, // breakdown type
mBreakdownClassID; // class id for breakdowns

// temporary members- do NOT add to cFileLength
Boolean mHasNewBreakdowns; // TCS 4/17/00

enum
{
cCopyFileLength = 2*sizeof(UInt8),

cFileLength = cCopyFileLength + 0
};

virtual void FillBreakdownEntriesFromTable(CBreakdownTable *table,
TObjectIDArray &breakdownArray,
const DBid breakdownClassID,
DB_PersistentObject *owner = nil,
const Boolean allowZeroAmount = false,
const Boolean allowBlankName = false,
const Boolean allowBlankCheckmark = false);
typedef void (*EntryFunc)(DB_PersistentObject *entry,...);
void DoForEachEntry(EntryFunc func, void *param1 = nil,
void *param2 = nil, void *param3 = nil,
void *param4 = nil);
};