project QadFinancials > class BBankImportLine > method ProcessBankImpLineCDocStatusChg
Description
This method changes supplier 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 : ProcessBankImpLineCDocStatusChg */
/* Desc : This method changes supplier 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.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not available tBankImpLine
then do:
assign vcMessage = trim(#T-10'Missing definition of imported bank line.':255(67965)T-10#).
<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-7628':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_CDOCUMENT_STATUS:
do:
/* =================================================================================================== */
/* Get the Creditor base on the Bank Import Line information */
/* =================================================================================================== */
<M-89 run CreateBankImpLineProcessInfo
(input 'GetCreditorByBankImpLine':U (icProcessName),
input #T-95'Get supplier info':255(959221706)T-95# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineCDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-15 run GetCreditorByBankImpLine (output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-26 run UpdateBankImpLineProcessResult
(input 'GetCreditorByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_CDOCUMENT_STATUS.
/* =================================================================================================== */
/* Get the own banknumber and PayformatType base on the Bank Import Line information */
/* =================================================================================================== */
<M-7 run CreateBankImpLineProcessInfo
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input #T-65'Get own bank number and payment format type':255(932355768)T-65# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineCDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-16 run GetOwnBankNumberByBankImpLine
(output viDummy (oiBankNumberId),
output vcOwnBankNumber (ocBankNumberNumber),
output viDummy (oiGLId),
output vcDummy (ocGLCode),
output viDummy (oiBankPaymentFormatId),
output vcPayFormatTypeCode (ocPaymentFormatCode),
output viCurrencyId (oiCurrencyId),
output vcDummy (ocCurrencyCode),
output viDummy (oiTransactionCompanyId),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-21 run UpdateBankImpLineProcessResult
(input 'GetOwnBankNumberByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_CDOCUMENT_STATUS.
if viBCDocumentBankImpLineID = 0 or viBCDocumentBankImpLineID = ?
then do:
<I-2 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BCDocument"}>
end. /* if viBCDocumentBankImpLineID = 0 */
else if not valid-handle(vhBCDocumentBankImpLineInst)
then do:
<I-3 {bFcOpenInstance
&CLASS = "BCDocument"}>
end. /* if not valid-handle(vhBCDocumentBankImpLineInst) */
<M-38 run SetExternalUniqueIDForSetMessage
(input true (ilUseExternalUID),
output viFcReturnSuper (oiReturnStatus)) in BCDocument>
/* =================================================================================================== */
/* Clear the instance of CDocument before loading data */
/* =================================================================================================== */
/* <M-11 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BCDocument>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave CHANGE_CDOCUMENT_STATUS.
*/
/* =================================================================================================== */
/* Get the creditor document base on the Bank Import Line information */
/* =================================================================================================== */
<M-91 run CreateBankImpLineProcessInfo
(input 'GetCDocumentByBankImpLine':U (icProcessName),
input #T-74'Get supplier payment info':255(327330528)T-74# (icProcessDesc),
input ? (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineCDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
<M-12 run GetCDocumentByBankImpLine
(output viCDocumentId (oiCDocumentId),
output viCDocumentYear (oiCDocumentYear),
output vcCDocumentType (ocCDocumentType),
output viCDocumentNumber (oiCDocumentNumber),
input viCurrencyId (iiCurrencyID),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
<M-8 run UpdateBankImpLineProcessResult
(input 'GetCDocumentByBankImpLine':U (icProcessName),
input viLocalReturn (iiProcessStatus),
input ? (icProcessResult),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_CDOCUMENT_STATUS.
/* =================================================================================================== */
/* Change status */
/* =================================================================================================== */
if tBankImpLine.BankImpLineBatchNbr <> 0 and
tBankImpLine.BankImpLineBatchNbr <> ?
then do:
assign vcBankImpLineRef = string(tBankImpLine.BankImpLineBatchNbr).
end.
else do:
<Q-76 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-13 run ChangeStatus
(input viCDocumentId (iiCDocumentId),
input icToStatus (icToStatus),
input vcBankImpLineRef (icBankImpLineRef),
input tBankImpLine.BankImpLineValueDate (itValueDate),
input tBankImpLine.tc_Rowid (icBankImpLineRowID),
output viFcReturnSuper (oiReturnStatus)) in BCDocument>
if viFcReturnSuper <> 0 then assign viLocalReturn = viFcReturnSuper.
assign vcParam = "ToStatus = " + icToStatus.
<M-87 run CreateBankImpLineProcessInfo
(input 'ChangeStatus':U (icProcessName),
input #T-40'Change supplier payment status':255(778623790)T-40# (icProcessDesc),
input vcParam (icProcessResult),
input ? (icProcessParam),
input 'ProcessBankImpLineCDocStatusChg':U (icParentRowName),
input 0 (iiProcessStatus),
output viFcReturnSuper (oiReturnStatus)) in BBankImportLine>
if viLocalReturn < 0 then leave CHANGE_CDOCUMENT_STATUS.
assign tBankImpLine.CDocument_ID = viCDocumentId.
/* Record the processed CDocument */
create tProcessedDocumentId.
assign tProcessedDocumentId.tiProcessedDocID = viCDocumentId.
end. /* do CHANGE_CDOCUMENT_STATUS */
/*
if valid-handle(vhBCDocumentBankImpLineInst)
then do:
<I-9 {bFcCloseInstance
&CLASS = "BCDocument"}>
end.
*/
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
if viLocalReturn <> 0 then assign oiReturnStatus = viLocalReturn.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.