project QadFinancials > class BBankEntry > method GetBankStateID


Parameters


iiCompanyIDinputinteger
icGLCodeinputcharacter
iiBankStateYearinputinteger
icBankStateNumberinputcharacter
oiBankStateIDoutputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.AddBankEntryHeader
method BBankEntry.ApiCreateBankEntryFromImport
method BBankEntry.ApiStdMaintainTT
method BBankEntry.PreSave
method BBankEntry.ValidateComponentPre


program code (program1/bbankentry.p)

/* =========================================================================================== */
/* This procedure can be used to retrieve the BankState_ID based on the logic key of BankState */
/* =========================================================================================== */
/* Input    iiCompanyID                                                                        */
/*          icGLCode                                                                           */
/*          iiBankStateYear                                                                    */
/*          icBankStateNumber                                                                  */
/* =========================================================================================== */
/* Output   oiBankStateID (0=none, ?=many)                                                     */
/*          oiReturnStatus                                                                     */
/* =========================================================================================== */
<I-97 {READDIRECTDBACCESS
     &READTABLENAMES = "GL CompanySharedSet BankState"}>

assign oiBankStateID = 0.

for each GL where 
         GL.GLCode = icGLCode no-lock,
    each CompanySharedSet where
         CompanySharedSet.SharedSet_ID = GL.SharedSet_ID and
         CompanySharedSet.Company_ID   = iiCompanyID no-lock,
    each BankState where
         BankState.Company_ID      = CompanySharedSet.Company_ID and
         BankState.GL_ID           = GL.GL_ID                    and
         BankState.BankStateYear   = iiBankStateYear     and
         BankState.BankStateNumber = icBankStateNumber no-lock :

    if oiBankStateID = 0
    then assign oiBankStateID = BankState.BankState_ID.
    else assign oiBankStateID = ?.
end.