project QadFinancials > class BDInvoice > method ValidateComponentAllDInvoiceOpInfo


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDInvoice.ValidateComponentAll


program code (program5/bdinvoice.p)

MAIN_BLOCK:
do on error undo, throw:
    /* If user is deleting the last record for golden tax reference, give warning */
    find first t_sDInvoiceOpInfo where t_sDInvoiceOpInfo.DInvoiceOpInfoType = {&DINVOICEOPINFOTYPE-GOLDENTAX} no-error.
    if available t_sDInvoiceOpInfo 
    then do:
        find first t_sDInvoiceOpInfo where 
                    t_sDInvoiceOpInfo.DInvoiceOpInfoType = {&DINVOICEOPINFOTYPE-GOLDENTAX} and
                    t_sDInvoiceOpInfo.tc_Status          <> "D":U no-error.
        if not available t_sDInvoiceOpInfo  
        then do:
            <M-92 run SetMessage
               (input  trim(#T-97'You are deleting the last golden tax reference record. This invoice can no longer be used for golden tax reference.':200(927293456)T-97#) (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'W':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-469500':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
            assign oiReturnStatus = 1.
        end. /* if not available t_sDInvoiceOpInfo */
    end. /* if available t_sDInvoiceOpInfo */
    else do:
        leave MAIN_BLOCK.
    end.
    
    
    /* When user is deleting a DInvoiceOpInfo record that was generated by system from Golden Tax procedure such as IPP or Golden Tax Load */
    find first t_sDInvoiceOpInfo where 
                t_sDInvoiceOpInfo.DInvoiceOpInfoType         = {&DINVOICEOPINFOTYPE-GOLDENTAX} and
                t_sDInvoiceOpInfo.tc_Status                  = "D":U                           and
                t_sDInvoiceOpInfo.DInvoiceOpInfoGTUpdateType <> {&GOLDENTAX-UPDATE-TYPE-MAN} no-error.
    if available t_sDInvoiceOpInfo 
    then do:  
      <M-93 run SetMessage
               (input  trim(#T-55'You are deleting an operational information record for golden tax that was generated by system.':255(340024550)T-55#) (icMessage), 
                input  '':U (icArguments), 
                input  'DInvoiceOpInfo.DInvoiceOpInfoCode':U (icFieldName), 
                input  t_sDInvoiceOpInfo.DInvoiceOpInfoCode (icFieldValue), 
                input  'W':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'qadfin-493047':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
        assign oiReturnStatus = 1.
    end. /* find first t_sDInvoiceOpInfo where */
    
    
    /* For GOLDENTAX type records, length of Shipper ID cannot be more than 8 characters */
    find first t_sDInvoiceOpInfo where 
                t_sDInvoiceOpInfo.DInvoiceOpInfoType                                   = {&DINVOICEOPINFOTYPE-GOLDENTAX} and
                index(t_sDInvoiceOpInfo.DInvoiceOpInfoCode,{&DINVOICEOPINFOCODE-TEMP}) = 0                               and
                length(t_sDInvoiceOpInfo.DInvoiceOpInfoCode,"CHARACTER")               > 8                               and
                t_sDInvoiceOpInfo.tc_Status                                            <> "D":U no-error.
    if available t_sDInvoiceOpInfo 
    then do:
           <M-33 run SetMessage
              (input  trim(#T-82'Length of Shipper ID cannot exceed 8 characters for records of golden tax type.':255(272942228)T-82#) (icMessage), 
               input  '':U (icArguments), 
               input  'DInvoiceOpInfo.DInvoiceOpInfoCode':U (icFieldName), 
               input  t_sDInvoiceOpInfo.DInvoiceOpInfoCode (icFieldValue), 
               input  'E':U (icType), 
               input  3 (iiSeverity), 
               input  '':U (icRowid), 
               input  'qadfin-809270':U (icFcMsgNumber), 
               input  '':U (icFcExplanation), 
               input  '':U (icFcIdentification), 
               input  '':U (icFcContext), 
               output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
        assign oiReturnStatus = -1.
        return.
    end. /* find first t_sDInvoiceOpInfo where */
end. /* do on error undo,throw: */