ictDDocumentTcRowid | input | character | The value of field tDDocument.tc_rowid indicating which customer-payment this is about |
tMultiDDocumentInvoiceXref | input | temp-table | tMultiDDocumentInvoiceXref: Temp-table that is used by method CreateDDocumentInvoiceXrefsAndStages and that only holds: - tiDInvoiceID: Indicates for which DInvoice this Xref is about |
tMultiDDocInvoiceXrefStage | input | temp-table | tMultiDDocInvoiceXrefStage: Temp-table that is used by method CreateDDocumentInvoiceXrefsAndStages and that only holds: - tiDInvoiceID: Indicates for which DInvoice this Xref is about - tiDInvoiceStageID: Indicates for which DInvoiceStage this is about |
tApiDDocumentInvoiceXref | output | temp-table | Dataset with temp-table tApiDDocumentInvoiceXref holding the newly create tDDocumentInvoiceXref records |
tApiDDocInvoiceXrefStage | output | temp-table | Dataset with temp-table tApiDDocInvoiceXrefStage holding the newly create tDDocInvoiceXrefStage records |
oiReturnStatus | output | integer | Return status of the method. |
/* ==================================================================================================================== */ /* Method CreateDDocumentInvoiceXrefsAndStages: */ /* This method will create a new tDDocumentInvoiceXref record for every entry in the corresponding input temp-table and */ /* will create a new tDDocInvoiceXrefStage record for every entry in the corresponding input temp-table. */ /* The newly created records will also be returned in the the output temp-tables and in these output temp-tables fields */ /* the fields that are in the input tables will be filled as well so the caller can map these output records to the */ /* associated input records */ /* ==================================================================================================================== */ /* ===================================== */ /* Validate the correctness of the input */ /* ===================================== */ if ictDDocumentTcRowid = "":U or ictDDocumentTcRowid = ? then do : assign vcMessage = trim(substitute(#T-32'Internal error in method &1: mandatory input for &2 is missing.':255(576494072)T-32#, "CreateDDocumentInvoiceXrefsAndStages":U , "ictDDocumentTcRowid":U )). <M-62 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'S':U (icType), input 3 (iiSeverity), input t_sDDocument.tc_Rowid (icRowid), input 'qadfin-245084':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BDDocument> Return. end. /* if ictDDocumentTcRowid = "":U or */ Find tDDocument where tDDocument.tc_Rowid = ictDDocumentTcRowid no-lock no-error. if not available tDDocument then do : assign vcMessage = trim(substitute(#T-56'Internal error in method &1: unable to find &2 based upon its rowid &2.':255(178612730)T-56#, "CreateDDocumentInvoiceXrefsAndStages":U , "tDDocument":U, ictDDocumentTcRowid )). <M-57 run SetMessage (input vcMessage (icMessage), input '':U (icArguments), input '':U (icFieldName), input '':U (icFieldValue), input 'S':U (icType), input 3 (iiSeverity), input t_sDDocument.tc_Rowid (icRowid), input 'qadfin-712672':U (icFcMsgNumber), input '':U (icFcExplanation), input '':U (icFcIdentification), input '':U (icFcContext), output viFcReturnSuper (oiReturnStatus)) in BDDocument> Return. end. /* if not available tDDocument */ /* ================================== */ /* Empty the output temp-tables */ /* ================================== */ empty temp-table tApiDDocumentInvoiceXref. empty temp-table tApiDDocInvoiceXrefStage. /* ================================== */ /* Cycle through the main input table */ /* ================================== */ for each tMultiDDocumentInvoiceXref no-lock on error undo, throw : /* =================================== */ /* Create a new record in the instance */ /* =================================== */ <M-45 run AddDetailLine (input 'DDocumentInvoiceXref' (icTable), input ictDDocumentTcRowid (icParentRowid), output viFcReturnSuper (oiReturnStatus)) in BDDocument> /* =============================================================================== */ /* Copy the DInvoice-ID from the input to the newly created record in the instance */ /* =============================================================================== */ assign tDDocumentInvoiceXref.DInvoice_ID = tMultiDDocumentInvoiceXref.tiDInvoiceId tDDocumentInvoiceXref.tcDInvoiceReference = tMultiDDocumentInvoiceXref.tcDInvoiceReference tDDocumentInvoiceXref.tcDInvoiceType = tMultiDDocumentInvoiceXref.tcDInvoiceType tDDocumentInvoiceXref.tcDInvoiceDeductionParentRowID = tMultiDDocumentInvoiceXref.tcDInvoiceDeductionParentRowID. /* ======================================================================================== */ /* Copy the newly created record of the instance into a new record in the output temp-table */ /* ======================================================================================== */ create tApiDDocumentInvoiceXref. buffer-copy tDDocumentInvoiceXref to tApiDDocumentInvoiceXref. /* ====================================================== */ /* Cycle through the underlying stages in the input table */ /* ====================================================== */ for each tMultiDDocInvoiceXrefStage where tMultiDDocInvoiceXrefStage.tiDInvoiceId = tMultiDDocumentInvoiceXref.tiDInvoiceId no-lock on error undo, throw : /* =================================== */ /* Create a new record in the instance */ /* =================================== */ <M-82 run AddDetailLine (input 'DDocInvoiceXrefStage':U (icTable), input tDDocumentInvoiceXref.tc_Rowid (icParentRowid), output viFcReturnSuper (oiReturnStatus)) in BDDocument> /* =================================================================================================== */ /* Copy the DInvoiceStage_ID from the input to the newly created record in the instance */ /* =================================================================================================== */ assign tDDocInvoiceXrefStage.DInvoiceStage_ID = tMultiDDocInvoiceXrefStage.tiDInvoiceStageId. /* ======================================================================================== */ /* Copy the newly created record of the instance into a new record in the output temp-table */ /* ======================================================================================== */ create tApiDDocInvoiceXrefStage. buffer-copy tDDocInvoiceXrefStage to tApiDDocInvoiceXrefStage. end. /* for each tMultiDDocInvoiceXrefStage */ end. /* for each tMultiDDocumentInvoiceXref */