Return TypeFunction nameArguments
hzEcodehdbADP::InitFinancials(hzString&,)

Declared in file: hzDatabase.h
Defined in file : hdbADP.cpp

Function Logic:

0:START 1:cname 2:unknown 3:Return hzerr(E_SEQUENCE,This function has already been called) 4:unknown 5:Return hzerr(E_ARGUMENT,No application data directory) 6:mname pEnum items items items items items items items items items items items items pClass rc 7:unknown 8:mname rc 9:unknown 10:mname rc 11:rc 12:unknown 13:rc 14:pRepos 15:unknown 16:items 17:rc 18:unknown 19:items 20:mname rc 21:unknown 22:items 23:rc 24:unknown 25:items 26:rc items cname pClass rc 27:unknown 28:mname rc 29:unknown 30:mname rc 31:rc 32:unknown 33:rc 34:pRepos 35:unknown 36:items 37:rc 38:unknown 39:items 40:mname rc 41:unknown 42:items 43:rc 44:unknown 45:items 46:rc items cname pClass rc 47:unknown 48:mname rc 49:unknown 50:mname rc 51:unknown 52:mname rc 53:unknown 54:mname rc 55:unknown 56:mname rc 57:unknown 58:mname rc 59:unknown 60:mname rc 61:rc 62:unknown 63:items 64:pRepos 65:unknown 66:items 67:rc 68:unknown 69:items 70:mname rc 71:unknown 72:items 73:rc 74:unknown 75:items 76:rc items cname pClass rc 77:unknown 78:mname rc 79:unknown 80:mname rc 81:unknown 82:mname rc 83:unknown 84:mname rc 85:unknown 86:mname rc 87:unknown 88:mname rc 89:unknown 90:mname rc 91:unknown 92:mname rc 93:unknown 94:mname rc 95:unknown 96:mname rc 97:rc 98:unknown 99:items 100:pRepos 101:unknown 102:items 103:rc 104:unknown 105:items 106:mname rc 107:unknown 108:items 109:mname rc 110:unknown 111:items 112:rc 113:unknown 114:items 115:rc items 116:Return rc

Function body:

hzEcode hdbADP::InitFinancials (hzString& dataDir)
{
   _hzfunc("hdbADP::InitFinancials") ;
   hdbEnum*        pEnum ;     //  Enum pointer
   hdbClass*       pClass ;    //  Data class pointer
   hdbObjRepos*    pRepos ;    //  Repository pointer
   hzString        cname ;     //  Current data class name
   hzString        mname ;     //  Current member name
   hzEcode         rc ;        //  Return code
   cname = "Currency" ;
   if (m_mapObjRepos.Exists(cname))
       return hzerr(E_SEQUENCE, "This function has already been called") ;
   if (!dataDir)
       return hzerr(E_ARGUMENT, "No application data directory") ;
   //  Setup the 'Account Type' enum
   mname = "enumAccType" ;
   pEnum = new hdbEnum() ;
   pEnum->SetTypename(mname) ;
   pEnum->AddItem("ACC_NULL",      0x0000);
   pEnum->AddItem("ACC_ASSET",     0x0001);
   pEnum->AddItem("ACC_BANK",      0x0002);
   pEnum->AddItem("ACC_CASH",      0x0004);
   pEnum->AddItem("ACC_DIRECTOR",  0x0008);
   pEnum->AddItem("ACC_FOREX",     0x0010);
   pEnum->AddItem("ACC_GOV",       0x0020);
   pEnum->AddItem("ACC_SHARE",     0x0040);
   pEnum->AddItem("ACC_STOCK",     0x0080);
   pEnum->AddItem("ACC_TRADE",     0x0100);
   RegisterDataEnum(pEnum) ;
   /*
   **  ** Currencies
   **      */
   //  Set up Currency data class
   pClass = new hdbClass(*this, HDB_CLASS_DESIG_SYS) ;
   rc = pClass->InitStart(cname) ;
   if (rc == E_OK) { mname = "Name" ;      rc = pClass->InitMember(mname, "string", HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Symbol" ;    rc = pClass->InitMember(mname, "string", HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   rc = pClass->InitDone() ;
   if (rc == E_OK)
       rc = RegisterDataClass(pClass) ;
   //  Create and initialize Currency repository
   pRepos = new hdbObjRepos(*this) ;
   if (!pRepos)
       hzexit(E_MEMORY, "No Currency cache allocated") ;
   rc = pRepos->InitStart(pClass, pClass->strType(), dataDir, HDB_REPOS_CACHE) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos") ;
   mname = "Name" ;
   rc = pRepos->InitMbrIndex(mname, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   rc = pRepos->InitDone() ;
   if (rc != E_OK)
       hzexit(rc, "Could not complete subsriber repos initialization") ;
   rc = m_mapObjRepos.Insert(pRepos->strName(), pRepos) ;
   pRepos->Open() ;
   /*
   **  ** Categories
   **      */
   //  Set up Currency data class
   cname = "Category" ;
   pClass = new hdbClass(*this, HDB_CLASS_DESIG_SYS) ;
   rc = pClass->InitStart(cname) ;
   if (rc == E_OK) { mname = "Code" ;  rc = pClass->InitMember(mname, "string", HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Desc" ;  rc = pClass->InitMember(mname, "string", HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   rc = pClass->InitDone() ;
   if (rc == E_OK)
       rc = RegisterDataClass(pClass) ;
   //  Create and initialize Currency repository
   pRepos = new hdbObjRepos(*this) ;
   if (!pRepos)
       hzexit(E_MEMORY, "No Currency cache allocated") ;
   rc = pRepos->InitStart(pClass, pClass->strType(), dataDir, HDB_REPOS_CACHE) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos") ;
   mname = "Code" ;
   rc = pRepos->InitMbrIndex(mname, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   rc = pRepos->InitDone() ;
   if (rc != E_OK)
       hzexit(rc, "Could not complete subsriber repos initialization") ;
   rc = m_mapObjRepos.Insert(pRepos->strName(), pRepos) ;
   pRepos->Open() ;
   /*
   **  ** Accounts
   **      */
   //  Set up Account data class
   cname = "Account" ;
   pClass = new hdbClass(*this, HDB_CLASS_DESIG_SYS) ;
   rc = pClass->InitStart(cname) ;
   if (rc == E_OK) { mname = "Opened" ;    rc = pClass->InitMember(mname, "sdate",         HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Closed" ;    rc = pClass->InitMember(mname, "sdate",         HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Currency" ;  rc = pClass->InitMember(mname, "string",        HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Code" ;      rc = pClass->InitMember(mname, "string",        HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Desc" ;      rc = pClass->InitMember(mname, "string",        HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "InitBal" ;   rc = pClass->InitMember(mname, "int32",         HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Type" ;      rc = pClass->InitMember(mname, "enumAccType",   HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   rc = pClass->InitDone() ;
   if (rc == E_OK)
       RegisterDataClass(pClass) ;
   //  Create and initialize Account repository
   pRepos = new hdbObjRepos(*this) ;
   if (!pRepos)
       hzexit(E_MEMORY, "No Currency cache allocated") ;
   rc = pRepos->InitStart(pClass, pClass->strType(), dataDir, HDB_REPOS_CACHE) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos") ;
   mname = "Code" ;
   rc = pRepos->InitMbrIndex(mname, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   rc = pRepos->InitDone() ;
   if (rc != E_OK)
       hzexit(rc, "Could not complete subsriber repos initialization") ;
   rc = m_mapObjRepos.Insert(pRepos->strName(), pRepos) ;
   pRepos->Open() ;
   /*
   **  ** Transactions
   **      */
   //  Set up Transaction data class
   cname = "Transaction" ;
   pClass = new hdbClass(*this, HDB_CLASS_DESIG_SYS) ;
   rc = pClass->InitStart(cname) ;
   if (rc == E_OK) { mname = "Date" ;      rc = pClass->InitMember(mname, "sdate",     HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Currency" ;  rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Category" ;  rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "From" ;      rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "To" ;        rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Desc" ;      rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Note" ;      rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Qty" ;       rc = pClass->InitMember(mname, "string",    HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Value" ;     rc = pClass->InitMember(mname, "int32",     HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   if (rc == E_OK) { mname = "Type" ;      rc = pClass->InitMember(mname, "int32",     HDB_MBR_POP_SINGLE_COMPULSORY) ; }
   rc = pClass->InitDone() ;
   if (rc == E_OK)
       RegisterDataClass(pClass) ;
   //  Create and initialize Transaction repository
   pRepos = new hdbObjRepos(*this) ;
   if (!pRepos)
       hzexit(E_MEMORY, "No Currency cache allocated") ;
   rc = pRepos->InitStart(pClass, pClass->strType(), dataDir, HDB_REPOS_CACHE) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos") ;
   mname = "Date" ;
   rc = pRepos->InitMbrIndex(mname, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   mname = "From" ;
   rc = pRepos->InitMbrIndex(mname, true) ;
   if (rc != E_OK)
       hzexit(rc, "Could not init subsriber repos index") ;
   rc = pRepos->InitDone() ;
   if (rc != E_OK)
       hzexit(rc, "Could not complete subsriber repos initialization") ;
   rc = m_mapObjRepos.Insert(pRepos->strName(), pRepos) ;
   pRepos->Open() ;
   return rc ;
}