00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _TOBILL_H_
00031 #define _TOBILL_H_
00032
00033
00034
00035
00036 #include <set>
00037
00038
00039 #include "chrono.h"
00040 #include "osbid.h"
00041
00042
00043
00044 namespace OSB_LIB {
00045 class Associate;
00046 class Contract;
00047 class Billcycle;
00048 class BsPage;
00049 }
00050
00051 namespace OSB_DB {
00052 class Session;
00053 }
00054
00055
00056
00057 namespace OSB_LIB {
00058
00059
00060
00061
00086 class ToBill {
00087 public:
00092 typedef std::set< Id<Contract> > Batch;
00093
00094 public:
00096 ToBill() : endDate_(Date::max()), batchSize_(0) {}
00098 ToBill(
00099 const Date& endDate
00100 ) : endDate_(endDate), batchSize_(0) {}
00101
00106 ToBill(
00107 const Id<Billcycle>& bcId,
00108 const Date& endDate,
00109 long batchSize
00110 ) : endDate_(endDate),
00111 bcId_(bcId), batchSize_(batchSize) {}
00112
00113 public:
00142 long loadContracts(
00143 const OSB_DB::Session& session
00144 );
00145
00149 long loadContracts(
00150 const OSB_DB::Session& session,
00151 const Id<Associate>& ownerId
00152 );
00153
00162 bool loadContract(
00163 const OSB_DB::Session& session,
00164 const Id<Contract>& coId
00165 );
00166
00167 public:
00168 Batch batch_;
00169
00176 Date endDate_;
00177 Id<Billcycle> bcId_;
00178 long batchSize_;
00179 Id<Contract> lastCoId_;
00180
00181 public:
00220 static bool pageToBill(
00221 BsPage& page,
00222 const Id<Billcycle>& bcId,
00223 const Date& endDate
00224 );
00225 };
00226 }
00227 #endif // #ifndef _TOBILL_H_