project QadFinancials > class BBankImportLine > method ProcessBankImpLineDDocStatusChg
Description
This method changes customer document status
Parameters
icToStatus | input | character | Change Status To |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bbankimportline.p)
/* =================================================================================================== */
/* Method : ProcessBankImpLineDDocStatusChg */
/* Desc : This method changes customer document status */
/* !!! This method has to be in the same segment as parent methods (expects correct */
/* record in table tBankImpLine) - segment 6 */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) ToStatus Status to be changed to */
/* =================================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0
vcParam = '':U
vcCriteria = '':U.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not available tBankImpLine
then do:
assign vcMessage = trim(#T-16'Missing definition of imported bank line.':255(67965)T-16#).
<M-1 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7622':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
return.
end. /* if not available tBankImpLine */
CHANGE_DDOCUMENT_STATUS:
do:
/* =================================================================================================== */
/* Get the own banknumber and PayformatType base on the Bank Import Line information */
/* =================================================================================================== */
/* Create Processing Info */
<M-96 run CreateBankImpLineProcessInfo
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input #T-31'Get own bank number and payment format type':255(932355768)T-31# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-21 run GetOwnBankNumberByBankImpLine
(output tBankImpLine.tiOwnBankNumber_ID (oiBankNumberId),
output vcOwnBankNumber (ocBankNumberNumber),
output viDummy (oiGLId),
output vcBankGLCode (ocGLCode),
output viDummy (oiBankPaymentFormatId),
output vcPayFormatTypeCode (ocPaymentFormatCode),
output viCurrencyID (oiCurrencyId),
output vcDummy (ocCurrencyCode),
output viTransactionCompanyId (oiTransactionCompanyId),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-56 run UpdateBankImpLineProcessResult
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_DDOCUMENT_STATUS.
/* =================================================================================================== */
/* Get the PIBF Configuration properties */
/* =================================================================================================== */
if tBankImpLine.tiOwnBankNumber_ID <> 0 and
tBankImpLine.tiOwnBankNumber_ID <> ?
then do:
<Q-40 run PAYConfByBankNumberID (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tBankImpLine.tiOwnBankNumber_ID, (BankNumberId)
output dataset tqPayConfByBankNumberID) in BPayConf>
find first tqPayConfByBankNumberID no-error.
if available tqPayConfByBankNumberID
then assign vlIsNewBEForPayCheck = if icToStatus = {&DOCUMENTSTATUS-BOUNCED}
then no
else if tqPayConfByBankNumberID.tcPayConfPIBFNoCustOrDDocAction = {&PAYCONFNOCUSTOMERACT-NEW-BE}
then yes
else no.
end.
/* =================================================================================================== */
/* Get the Debtor base on the Bank Import Line information */
/* =================================================================================================== */
/* Create Processing Info */
<M-90 run CreateBankImpLineProcessInfo
(input 'GetDebtorByBankImpLine':U (icProcessName),
input #T-67'Get customer info':255(989613730)T-67# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-18 run GetDebtorByBankImpLine
(input vlIsNewBEForPayCheck (ilIsClearErrMsg),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-17 run UpdateBankImpLineProcessResult
(input 'GetDebtorByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then
do:
if vlIsNewBEForPayCheck and
icToStatus = {&DOCUMENTSTATUS-PAID} then
do:
/*=========================================================================================== */
/* Create unallocated banking entry if customer doesn't exist */
/* ========================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0.
<M-72 run CreateBankImpLineProcessInfo
(input 'CreateUnallocatedBankEntry':U (icProcessName),
input #T-30'Create Unallocated Bank Entry':50(505749338)T-30# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-19 run CreateUnallocatedBankEntry
(input tBankImpLine.BankImpLineBankNumber (icOwnBankNumber),
input-output tBankImpLine.tiOwnBankNumber_ID (biOwnBankNumber_ID),
input-output vcBankGLCode (bcBankGLCode),
input-output tBankImpLine.BankImpLineOrigTransDate (btBankImpLineOrigTransDate),
input tBankImpLine.BankImpLineValueDate (itBankImpLineValueDate),
input tBankImpLine.BankImpLineBatchNbr (iiBankImpLineBatchNbr),
input tBankImpLine.BankImpLine_ID (iiBankImpLine_ID),
input tBankImpLine.BankImpLineStatNumber (icBankImpLineStatNumber),
input tBankImpLine.BankImpLineInfo (icBankImpLineInfo),
output tBankImpLine.BankState_ID (oiBankState_ID),
input tBankImpLine.BankImpLineInOut (icBankImpLineInOut),
input tBankImpLine.BankImpLineDescription (icBankImpLineDescription),
input tBankImpLine.BankImpLinePaymentRef (icBankImpLinePaymentRef),
input tBankImpLine.BankImpLineInvRefList (icBankImpLineInvRefList),
input tBankImpLine.BankImpLineDebtorCode (icBankImpLineDebtorCode),
input tBankImpLine.BankImpLineCreditorCode (icBankImpLineCreditorCode),
input tBankImpLine.BankImpLineAmountTC (idBankImpLineAmountSumTC),
input tBankImpLine.BankImpLineDebtorName (icBankImpLineDebtorName),
input tBankImpLine.BankImpLineAddressLine (icBankImpLineAddressLine),
input tBankImpLine.BankImpLineAddressCity (icBankImpLineAddressCity),
input tBankImpLine.BankImpLineAddressZip (icBankImpLineAddressZip),
input tBankImpLine.BankImpLineAddressCountry (icBankImpLineAddressCountry),
input tBankImpLine.BankImpLineBankNumber (icBankImpLineBankNumber),
input tBankImpLine.BankImpLineOrigAmountTC (idBankImpLineOrigAmountTC),
input tBankImpLine.BankImpLineOrigCurrCode (icBankImpLineOrigCurrCode),
input tBankImpLine.BankImpLineExchangeRate (idBankImpLineExchangeRate),
input tBankImpLine.BankImpLineRateScale (idBankImpLineRateScale),
input tBankImpLine.BankImpLineCost (icBankImpLineCost),
input tBankImpLine.tc_Rowid (icBankImpLineRowID),
output vcMessageReference (ocBankingEntryReference),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign viLocalReturn = viFcReturnSuper.
<M-45 run UpdateBankImpLineProcessResult
(input 'CreateUnallocatedBankEntry':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
else do:
assign tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-OK}
tBankImpLine.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEUNBE}
tBankImpLine.tlIsDifferentAction = true
vcMessage = trim(substitute(#T-42'Please allocate bank entry later. (Year/Number/BankImportReference : &1)':255(297808028)T-42#,
vcMessageReference)).
<M-86 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'I':U (icType),
input 4 (iiSeverity),
input tBankImpLine.tc_Rowid (icRowid),
input 'qadfin-747884':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
end.
end.
leave CHANGE_DDOCUMENT_STATUS.
end.
/* =================================================================================================== */
/* Get the Debtor BankNumber_ID base on the Bank Import Line information */
/* =================================================================================================== */
<Q-22 run BankNumberByBankFileFormat (all) (Read) (NoCache)
(input tBankImpLine.Debtor_ID, (ParentObjectId)
input tBankImpLine.BankImpLineFileFormatCode, (BankFileFormat)
input vcOwnBankNumber, (ownBankNumber)
input {&PAYFORMATMODULE-AR}, (PayFormatTypeModule)
input viCompanyId, (CompanyId)
output dataset tqBankNumberByBankFileFormat) in BBankNumber>
find first tqBankNumberByBankFileFormat no-error.
if available tqBankNumberByBankFileFormat
then do:
assign tBankImpLine.BankImpLineBankNumber = tqBankNumberByBankFileFormat.tcParentBankNumber.
assign vcParam = "BankImpLineBankNumber = ":U + tqBankNumberByBankFileFormat.tcParentBankNumber
vcCriteria = "DebtorCode = " + tBankImpLine.BankImpLineDebtorCode +
";BankFileFormat = " + tBankImpLine.BankImpLineFileFormatCode +
";OwnBankNumber = " + vcOwnBankNumber +
";PayFormatTypeModule = " + {&PAYFORMATMODULE-AR}.
end.
else do:
assign vcMessage = trim(substitute(#T-24'The own bank &1 for payment format &2 is not defined for this customer.':255(68532)t-24#,
tBankImpLine.BankImpLineOwnBankNumber,vcPayFormatTypeCode)).
<M-23 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7682':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign oiReturnStatus = -1.
end.
/* Create Processing Info */
<M-34 run CreateBankImpLineProcessInfo
(input 'BankNumberByBankFileFormat':U (icProcessName),
input #T-20'Get customer bank info':255(678620148)T-20# (icProcessDesc),
input if oiReturnStatus = -1 then '':U else vcParam (icProcessResult),
input if oiReturnStatus = -1 then '':U else vcCriteria (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input oiReturnStatus (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if oiReturnStatus = -1 then leave CHANGE_DDOCUMENT_STATUS.
if viBDDocumentBankImpLineID = 0 or viBDDocumentBankImpLineID = ?
then do:
<I-5 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BDDocument"}>
end. /* if viBDDocumentBankImpLineID = 0 */
else if not valid-handle(vhBDDocumentBankImpLineInst)
then do:
<I-6 {bFcOpenInstance
&CLASS = "BDDocument"}>
end. /* else if not valid-handle(vhBDDocumentBankImpLineInst) */
<M-326 run SetExternalUniqueIDForSetMessage
(input 'true' (ilUseExternalUID),
output viFcReturnSuper (oiReturnStatus)) in BDDocument>
/* =================================================================================================== */
/* Clear the instance of DDocument before loading data */
/* =================================================================================================== */
/*<M-7 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BDDocument>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave CHANGE_DDOCUMENT_STATUS.
*/
/* =================================================================================================== */
/* Get the debtor document base on the Bank Import Line information */
/* =================================================================================================== */
/* Create Processing Info */
<M-68 run CreateBankImpLineProcessInfo
(input 'GetDDocumentByBankImpLine':U (icProcessName),
input #T-98'Get customer payment info':255(35347084)T-98# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-91 run GetDDocumentByBankImpLine
(output viDDocumentId (oiDDocumentId),
output viDDocumentYear (oiDDocumentYear),
output vcDDocumentType (ocDDocumentType),
output viDDocumentNumber (oiDDocumentNumber),
input viCurrencyID (iiCurrencyID),
input vlIsNewBEForPayCheck (ilIsClearErrMsg),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-87 run UpdateBankImpLineProcessResult
(input 'GetDDocumentByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then
do:
if vlIsNewBEForPayCheck and
icToStatus = {&DOCUMENTSTATUS-PAID} then
do:
/*=========================================================================================== */
/* Create unallocated banking entry if customer doesn't exist */
/* ========================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0.
<M-69 run CreateBankImpLineProcessInfo
(input 'CreateUnallocatedBankEntry':U (icProcessName),
input #T-47'Create Unallocated Bank Entry':50(505749338)T-47# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-95 run CreateUnallocatedBankEntry
(input tBankImpLine.BankImpLineBankNumber (icOwnBankNumber),
input-output tBankImpLine.tiOwnBankNumber_ID (biOwnBankNumber_ID),
input-output vcBankGLCode (bcBankGLCode),
input-output tBankImpLine.BankImpLineOrigTransDate (btBankImpLineOrigTransDate),
input tBankImpLine.BankImpLineValueDate (itBankImpLineValueDate),
input tBankImpLine.BankImpLineBatchNbr (iiBankImpLineBatchNbr),
input tBankImpLine.BankImpLine_ID (iiBankImpLine_ID),
input tBankImpLine.BankImpLineStatNumber (icBankImpLineStatNumber),
input tBankImpLine.BankImpLineInfo (icBankImpLineInfo),
output tBankImpLine.BankState_ID (oiBankState_ID),
input tBankImpLine.BankImpLineInOut (icBankImpLineInOut),
input tBankImpLine.BankImpLineDescription (icBankImpLineDescription),
input tBankImpLine.BankImpLinePaymentRef (icBankImpLinePaymentRef),
input tBankImpLine.BankImpLineInvRefList (icBankImpLineInvRefList),
input tBankImpLine.BankImpLineDebtorCode (icBankImpLineDebtorCode),
input tBankImpLine.BankImpLineCreditorCode (icBankImpLineCreditorCode),
input tBankImpLine.BankImpLineAmountTC (idBankImpLineAmountSumTC),
input tBankImpLine.BankImpLineDebtorName (icBankImpLineDebtorName),
input tBankImpLine.BankImpLineAddressLine (icBankImpLineAddressLine),
input tBankImpLine.BankImpLineAddressCity (icBankImpLineAddressCity),
input tBankImpLine.BankImpLineAddressZip (icBankImpLineAddressZip),
input tBankImpLine.BankImpLineAddressCountry (icBankImpLineAddressCountry),
input tBankImpLine.BankImpLineBankNumber (icBankImpLineBankNumber),
input tBankImpLine.BankImpLineOrigAmountTC (idBankImpLineOrigAmountTC),
input tBankImpLine.BankImpLineOrigCurrCode (icBankImpLineOrigCurrCode),
input tBankImpLine.BankImpLineExchangeRate (idBankImpLineExchangeRate),
input tBankImpLine.BankImpLineRateScale (idBankImpLineRateScale),
input tBankImpLine.BankImpLineCost (icBankImpLineCost),
input tBankImpLine.tc_Rowid (icBankImpLineRowID),
output vcMessageReference (ocBankingEntryReference),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
assign viLocalReturn = viFcReturnSuper.
<M-46 run UpdateBankImpLineProcessResult
(input 'CreateUnallocatedBankEntry':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
else do:
assign tBankImpLine.BankImpLineProcessedStatus = {&BANKIMPPROCSTATUS-PROCESSED-OK}
tBankImpLine.BankImpLineResultAction = {&BANKIMPORTRESULTACTION-CREATEUNBE}
tBankImpLine.tlIsDifferentAction = true
vcMessage = trim(substitute(#T-4'Please allocate bank entry later. (Year/Number/BankImportReference : &1)':255(297808028)T-4#,
vcMessageReference)).
<M-62 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'I':U (icType),
input 4 (iiSeverity),
input tBankImpLine.tc_Rowid (icRowid),
input 'qadfin-234998':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
end.
end.
leave CHANGE_DDOCUMENT_STATUS.
end.
/* =================================================================================================== */
/* Change status */
/* =================================================================================================== */
if tBankImpLine.BankImpLineBatchNbr <> 0 and
tBankImpLine.BankImpLineBatchNbr <> ?
then do:
assign vcBankImpLineRef = string(tBankImpLine.BankImpLineBatchNbr).
end.
else do:
<Q-71 run GetBankImpByLineID (all) (Read) (NoCache)
(input tBankImpLine.BankImpLine_ID, (BankImpLineID)
output dataset tqGetBankImpByLineID) in BBankImportLine >
find first tqGetBankImpByLineID where
tqGetBankImpByLineID.tiBankImpLine_ID = tBankImpLine.BankImpLine_ID
no-error.
if available tqGetBankImpByLineID
then assign vcBankImpLineRef = tqGetBankImpByLineID.tcBankImpFileName.
end.
<M-11 run ChangeStatus
(input viDDocumentId (iiDDocumentId),
input icToStatus (icToStatus),
input vcBankImpLineRef (icBankImpLineRef),
input tBankImpLine.tc_Rowid (icBankImpLineRowID),
output viFcReturnSuper (oiReturnStatus)) in BDDocument>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
/* Create Processing Info */
assign vcParam = "ToStatus = " + icToStatus.
<M-9 run CreateBankImpLineProcessInfo
(input 'ChangeStatus':U (icProcessName),
input #T-51'Change customer payment status':255(213914093)T-51# (icProcessDesc),
input vcParam (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineDDocStatusChg':U (icParentRowName),
input oiReturnStatus (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_DDOCUMENT_STATUS.
assign tBankImpLine.DDocument_ID = viDDocumentId.
/* =================================================================================================== */
/* Validate the update the BDDocument */
/* =================================================================================================== */
/* <M-13 run ValidateBCAndAdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BDDocument>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave CHANGE_DDOCUMENT_STATUS.
*/
end. /* do CHANGE_DDOCUMENT_STATUS */
/*
if valid-handle(vhBDDocumentBankImpLineInst)
then do:
<I-15 {bFcCloseInstance
&CLASS = "BDDocument"}>
end.
*/
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.