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

Report Layouts (Source Code)

Link to: header | other data directory

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

Comments

DB_ReportLayout

This class manages report layouts for the Goldenseal job cost accounting software,
project management software, construction estimating software
and construction project estimating software.

It's a report layout persistent object. Used to set up a custom report for
viewing or printing.

Financial reports like the balance sheet and income statement usually use
calculators. Most other reports use a report table.

SUPERCLASS = DB_Layout

******************

Related Objects:

CReportPopup- the popup that shows a list of custom reports
CReportLayoutEditor- the window for displaying & changing custom reports
DB_ReportViewer- viewer to handle the display of report layouts

Constructor

/*********************************************************************************
constructor TCS 6/4/01
*********************************************************************************/
DB_ReportLayout::DB_ReportLayout()
: DB_Layout()
{
mMenuID = 0;
mDBReportFiller = 0;
mSpareByte = 0;

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

Source Code

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

GetMemberValue

return the value of the member with the given tag

*********************************************************************************/
Boolean DB_ReportLayout::GetMemberValue(const TagType aTag, const TagType aType,
void *aValue) const
{
switch (aTag)
{
case tag_menuid:
return ConvertMember(&mMenuID, 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 DB_ReportLayout::SetMemberValue(const TagType aTag, const TagType aType,
const void *aValue)
{
switch (aTag)
{
case tag_menuid:
return ConvertMember(aValue, aType, &mMenuID, type_long);
break;

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

ReadObject

read the persistent object's data in from a stream
*********************************************************************************/
void DB_ReportLayout::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(&mSpareByte, cFileLength); // TCS 7/9/01

mSpareByte = aStream->ReadChar(); // mfs_sa rev 20feb2k3
*((UInt8*)&mSpareByte + sizeof(mSpareByte)) = aStream->ReadBits(1); // --Bitfield

mMenuID = aStream->ReadShort();

mEndSafetyTag = aStream->ReadEndSafetyTag(this);

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

WriteObject

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

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

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

aStream->WriteChar(mSpareByte); // mfs_sa rev 20feb2k3
aStream->WriteChar(*((UInt8*)&mSpareByte + sizeof(mSpareByte))); // --Bitfield

aStream->WriteShort(mMenuID);

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

IsCustomReport (static)

return whether or not the given report id refers to a custom report

*********************************************************************************/
Boolean DB_ReportLayout::IsCustomReport(const DBid reportID)
{
// it's a custom report if the dreport id is greater than
// the base custom report id
return reportID >= cCustomReportBaseID;
}
/*********************************************************************************

IsOneItemReport (static) TCS 6/4/01 rev 7/9/01

return whether or not the given report id refers to a one-item report

*********************************************************************************/
Boolean DB_ReportLayout::IsOneItemReport(const DBid reportID)
{
// if it's a custom report or a stock report that has
// been changed by the user, we check the stored object's bit
DB_ReportLayout *layout =
TCS_SAFE_CAST(gDBFile->GetOneObject(id_ReportLayout, reportID),
DB_ReportLayout);
if (layout)
{
DB_ObjectWatcher watcher(layout);
return layout->IsOneItemReport();
}
else
{
if (IsCustomReport(reportID))
{
ReportMissingObject(id_ReportLayout, reportID);
return false;
}
else switch (reportID) // for resources, we just hard-code
{
case cmd_ReportProjectLog:

case cmd_ReportProjectByClass:
case cmd_ReportProjectByCat:
case cmd_ReportProjectBySubcat:
case cmd_ReportProjectByLoc: // TCS 11/26/01

case cmd_ReportOverheadByCat:
case cmd_ReportOverheadBySubcat:

case cmd_ReportToolList:
case cmd_ReportToolsByItem: // TCS 4/11/02
case cmd_ReportReminderList:
case cmd_ReportTakeoff:
case cmd_ReportTakeoffByItem:
case cmd_ReportProjectSchedule:
case cmd_ReportProjectCostItems: // TCS 8/14/02
case cmd_ReportEstItemSubcat: // TCS 2/19/03
case cmd_ReportEstItemCat:
case cmd_ReportEstItemLoc:
case cmd_ReportEstSubcat:
case cmd_ReportEstCat:
case cmd_ReportEstLocation:
case cmd_ReportLaborTakeoff: // TCS 2/12/04

case cmd_ReportSalesTax: // TCS 11/16/02
case cmd_ReportPayrollTax:
case cmd_ReportTaxPayments: // TCS 3/10/03
return true;
break;

default:
return false;
break;
}
}
}
#if CAN_USE_MARK
#pragma mark -
#endif
/*********************************************************************************

FillDataReport TCS 9/23/02

fill in a diagnostic table that shows data field values.

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

FillFieldStockRow(table, stream, stockID_Expansion, cCharSize, SInt32(mSpareByte));
FillFieldBitRow(table, stream, "mOneItemReport", mOneItemReport, true);
FillFieldStockRow(table, stream, stockID_Padding, -7, mDBReportFiller);
FillFieldTableRow(table, stream, "mMenuID", cShortSize, SInt32(mMenuID));

FillEndSafetyTag(table, stream, mLayoutSafetyTag);
}