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 _BALANCESHEETGW_H_
00031 #define _BALANCESHEETGW_H_
00032
00033
00034
00035
00036 #include <deque>
00037
00038
00039 #include "balancesheet.h"
00040
00041
00042
00043 namespace OSB_DB {
00044 class Session;
00045 }
00046
00047
00048
00049 namespace OSB_DB {
00050
00051
00052
00053
00054
00055
00059 class BalanceSheetGw {
00061
00062 friend class OSB_LIB::BsPage;
00063 friend class OSB_LIB::BalanceSheet;
00065
00067
00068 public:
00078 bool readRerate(
00079 const Session& session,
00080 std::deque<OSB_LIB::Contract::Oid>& dest
00081 );
00082
00083 private:
00097 bool read(
00098 const Session& session,
00099 OSB_LIB::BalanceSheet& bs
00100 );
00101
00109 void readBsPages(
00110 const Session& session,
00111 OSB_LIB::BalanceSheet& bs,
00112 bool incClosed
00113 );
00114
00132 OSB_LIB::ObjectStatus lock(
00133 const Session& session,
00134 OSB_LIB::BalanceSheet& bs,
00135 bool noWait
00136 );
00137
00146 bool insert(
00147 const Session& session,
00148 OSB_LIB::BalanceSheet& bs
00149 );
00150
00159 OSB_LIB::ObjectStatus checkObjVs(
00160 const Session& session,
00161 const OSB_LIB::BalanceSheet& bs
00162 );
00164
00166
00167
00180 bool readInfo(
00181 const Session& session,
00182 OSB_LIB::BsPage& page
00183 );
00184
00196 long fetchOnetimeCharges(
00197 const Session& session,
00198 OSB_LIB::BsPage& page
00199 );
00200
00212 long fetchAdvanceCharges(
00213 const Session& session,
00214 OSB_LIB::BsPage& page
00215 );
00217
00219
00220
00221 bool setStatus(
00222 const Session& session,
00223 OSB_LIB::BsPage& bs,
00224 OSB_LIB::BsPage::Status status
00225 );
00227
00229
00230
00243 bool insert(
00244 const Session& session,
00245 OSB_LIB::BsPage& page
00246 );
00247
00264 bool remove(
00265 const Session& session,
00266 OSB_LIB::BsPage& page
00267 );
00269
00271
00272
00285 bool updLastCharged(
00286 const Session& session,
00287 OSB_LIB::BsPage& page
00288 );
00289
00298 bool updRecoveryId(
00299 const Session& session,
00300 const OSB_LIB::BsPage::Oid& pageId,
00301 long recoveryId
00302 );
00303
00309 bool incrUsgTotal(
00310 const Session& session,
00311 const OSB_LIB::BsPage::Oid& pageId,
00312 const OSB_LIB::BsTotal::SubTotal& st
00313 );
00314
00320 bool incrOtcTotal(
00321 const Session& session,
00322 const OSB_LIB::BsPage::Oid& pageId,
00323 const OSB_LIB::BsTotal::SubTotal& st
00324 );
00325
00331 bool incrAdvTotal(
00332 const Session& session,
00333 const OSB_LIB::BsPage::Oid& pageId,
00334 const OSB_LIB::BsTotal::SubTotal& st
00335 );
00336
00349 bool close(
00350 const Session& session,
00351 const OSB_LIB::BsPage& page
00352 );
00353
00363 bool insert(
00364 const Session& session,
00365 OSB_LIB::OnetimeCharge& otc
00366 );
00367
00380 bool remove(
00381 const Session& session,
00382 OSB_LIB::OnetimeCharge& otc
00383 );
00385
00386 private:
00388
00389
00390 void readTotals(
00391 const Session& session,
00392 OSB_LIB::BsPage& page
00393 );
00395 bool insert(
00396 const Session& session,
00397 const OSB_LIB::BsPage::Oid& pageId,
00398 const OSB_LIB::Currency::Oid& cc
00399 );
00401 OSB_LIB::DateTime sysDate(
00402 const Session& session
00403 );
00405 long nextVal(
00406 const Session& session,
00407 const std::string& seqName
00408 );
00427 bool incrSubTotal(
00428 const Session& session,
00429 const std::string& column,
00430 const OSB_LIB::BsPage::Oid& pageId,
00431 const OSB_LIB::Currency::Oid& cc,
00432 const OSB_LIB::Decimal& delta
00433 );
00435 };
00436 }
00437 #endif // #ifndef _BALANCESHEETGW_H_