Return Type | Function name | Arguments |
---|---|---|
hzEcode | hdbADP::InitFinancials | (const hzString&,) |
Declared in file: hzDatabase.h
Defined in file : hdbClass.cpp
Function Logic:
Function body:
hzEcode hdbADP::InitFinancials (const hzString& dataDir) { _hzfunc("hdbADP::InitFinancials") ; hdbEnum* pEnum ; hdbClass* pClass ; hdbObjRepos* pRepos ; hzString cname ; hzString mname ; hzEcode rc ; cname = "Currency" ; if (m_mapRepositories.Exists(cname)) return hzerr(E_SEQUENCE, "This function has already been called") ; if (!dataDir) return hzerr(E_ARGUMENT, "No application data directory") ; 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 ** */ 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) ; 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_mapRepositories.Insert(pRepos->strName(), pRepos) ; pRepos->Open() ; /* ** ** Categories ** */ 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) ; 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_mapRepositories.Insert(pRepos->strName(), pRepos) ; pRepos->Open() ; /* ** ** Accounts ** */ 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) ; 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_mapRepositories.Insert(pRepos->strName(), pRepos) ; pRepos->Open() ; /* ** ** Transactions ** */ 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) ; 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_mapRepositories.Insert(pRepos->strName(), pRepos) ; pRepos->Open() ; return rc ; }