This class supports the billing application to select the contracts to invoice.
All loading function just wrap to the supporting gateway class OSB_DB::ToBillGw.
Definition at line 86 of file tobill.h.
typedef std::set< Id<Contract> > OSB_LIB::ToBill::Batch |
OSB_LIB::ToBill::ToBill | ( | const Date & | endDate | ) | [inline] |
bool OSB_LIB::ToBill::loadContract | ( | const OSB_DB::Session & | session, | |
const Id< Contract > & | coId | |||
) |
Load a single contract for invoicing.
session | Database session to use. | |
coId | Id of the contract to load. |
long OSB_LIB::ToBill::loadContracts | ( | const OSB_DB::Session & | session, | |
const Id< Associate > & | ownerId | |||
) |
Load all contracts owned by an associate.
long OSB_LIB::ToBill::loadContracts | ( | const OSB_DB::Session & | session | ) |
Load the next batch of contracts to invoice.
session | Database session to use. |
Each of the selected contracts has at least one open BsPage with:
static bool OSB_LIB::ToBill::pageToBill | ( | BsPage & | page, | |
const Id< Billcycle > & | bcId, | |||
const Date & | endDate | |||
) | [static] |
Determine whether a balance page needs billing.
This static member is a service offered to the billing application, which is free to implement its own different rule.
page | Balance page to check. | |
bcId | Id of the running billcycle. | |
endDate | End date of the billed period. |
Instead of complicated explanations the source code is given below:
// trivial case: page is closed if (!page.isOpen()) return false; // billcycle specific: skip if the billcyle does not match if (bcId.isSet() && page.billcycleId() != bcId) return false; // start date after or equal last date billed: skip // (if we'd allow for start date = endDate // the invoice period would be 0 days.) if (page.startDate() >= endDate) return false; // end date set and after end of billed period: skip if ( Date::notSet() != page.endDate() && endDate < page.endDate()) return false; // if the page is to be billed: set its end date if (Date::notSet() == page.endDate()) page.setEndDate(endDate); return true;