project QadFinancials > class BDInvoice > method AdditionalUpdatesAllOpInfo


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoice.AdditionalUpdatesAll


program code (program8/bdinvoice.p)

/* Error handling */
assign oiReturnStatus = -98
       viMaxLength = 255.
/******************************************************/
/* Synchornise the dinvoicegoldentaxinvoicelist with  */
/* dinvoiceopinfo table.                              */
/******************************************************/
for each tDInvoice where tDInvoice.tc_Status <> "D":U:
    assign vcGoldenTaxInvoiceList = "":U.
    for each t_sDInvoiceOpInfo where t_sDInvoiceOpInfo.tc_ParentRowid = tDInvoice.tc_Rowid
                                     and t_sDInvoiceOpInfo.tc_Status <> "D":U
                                     and t_sDInvoiceOpInfo.DInvoiceOpInfoType = {&DINVOICEOPINFOTYPE-GOLDENTAX}:
            if vcGoldenTaxInvoiceList = "":U 
            then do: 
                if length(t_sDInvoiceOpInfo.DInvoiceOpInfoCode,"CHARACTER":U) <= viMaxLength
                then assign vcGoldenTaxInvoiceList = t_sDInvoiceOpInfo.DInvoiceOpInfoCode.
                else leave.
            end.
            else do:
                if length(vcGoldenTaxInvoiceList + ",":U + t_sDInvoiceOpInfo.DInvoiceOpInfoCode,"CHARACTER":U) <= viMaxLength
                then assign vcGoldenTaxInvoiceList = vcGoldenTaxInvoiceList + ",":U + t_sDInvoiceOpInfo.DInvoiceOpInfoCode.
                else leave.
            end.

    end. /* end for each t_sDInvoiceOpInfo */
    assign tDInvoice.DInvoiceGoldenTaxInvoiceList = vcGoldenTaxInvoiceList.
end. /* end for each tDInvoice <> "D" */

empty temp-table tDInvoiceOpInfoForGT.
for each t_sDInvoiceOpInfo where 
        t_sDInvoiceOpInfo.tc_Status <> "D":U                    and 
        t_sDInvoiceOpInfo.DInvoiceOpInfoGTUpdateType = {&GOLDENTAX-UPDATE-TYPE-MAN} and 
        t_sDInvoiceOpInfo.DInvoiceOpInfoGTDocNbr <> "":U                        and 
        t_sDInvoiceOpInfo.DInvoiceOpInfoGTDocNbr <> ?                           and 
        t_sDInvoiceOpInfo.DInvoiceOpInfoGTDocNbr  <> "0":U:
    create tDInvoiceOpInfoForGT.
    assign tDInvoiceOpInfoForGT.tcDocNbr             = t_sDInvoiceOpInfo.DInvoiceOpInfoGTDocNbr
           tDInvoiceOpInfoForGT.tcDInvoiceOpInfoCode = t_sDInvoiceOpInfo.DInvoiceOpInfoCode.
end. /* for each t_sDInvoiceOpInfo where */

if can-find (first tDInvoiceOpInfoForGT) 
then do :  
    <I-74 {bFcStartAndOpenInstance
         &ADD-TO-TRANSACTION   = "false"
         &CLASS                = "PMfgProGTApi"}>

    MAIN_BLOCK:
    dO:
        assign vhIn = dataset tDInvoiceOpInfoForGT:handle.
        <M-27 run UpdateGTTable
           (input  vhIn (izDInvoiceOpInfo), 
            output viFcReturnSuper (oiReturnStatus)) in PMfgProGTApi>
        if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
        then assign oiReturnStatus = viFcReturnSuper.                 

    END. /* END MAIN_BLOCK: */ 
    <I-32 {bFcCloseAndStopInstance
      &CLASS           = "PMfgProGTApi"}> 

end. /* if can-find (first tDInvoiceOpInfoForGT) */

if oiReturnStatus = -98
then  assign oiReturnStatus = 0.