project QadFinancials > class BCInvoiceJournalEntry > method CreateApiPostingVatDelayCIJE

Description

Initialize a new record in class table tApiPostingVatDelayCIJE.


Parameters


ic_ParentRowidinputcharacter= tApiPostingVatDelayCIJE.tc_ParentRowid
BCInvoiceJournalEntryoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bcinvoicejournalentry.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sApiCInvoiceBankCIJE.
    empty temp-table t_sApiCInvoiceBankPayCodeCIJE.
    empty temp-table t_sApiCInvoiceCIJE.
    empty temp-table t_sApiCInvoiceMovementCIJE.
    empty temp-table t_sApiCInvoicePOCIJE.
    empty temp-table t_sApiCInvoicePostingCIJE.
    empty temp-table t_sApiCInvoiceStageCIJE.
    empty temp-table t_sApiCInvoiceVatCIJE.
    empty temp-table t_sApiCInvoiceWHTCIJE.
    empty temp-table t_sApiPostingCIJE.
    empty temp-table t_sApiPostingLineCIJE.
    empty temp-table t_sApiPostingSafCIJE.
    empty temp-table t_sApiPostingVatCIJE.
    empty temp-table t_sApiPostingVatDelayCIJE.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    find first tFcRowidConvert where
               tFcRowidConvert.tcFcOldRowid = ic_ParentRowid and
               tFcRowidConvert.tlFcOk       no-error.
    if available tFcRowidConvert
    then assign ic_ParentRowid = tFcRowidConvert.tcFcNewRowid.

    find tApiPostingLineCIJE where
         tApiPostingLineCIJE.tc_Rowid = ic_ParentRowid no-error.
    if not available tApiPostingLineCIJE
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tApiPostingLineCIJE.tc_Rowid':U,
                         input ic_ParentRowid,
                         input 'S':U,
                         input 3,
                         input ic_ParentRowid,
                         input '',
                         input '',
                         input '',
                         input '',
                         output oiReturnStatus" }
        assign oiReturnStatus = -3.
        return.
    end.

    create tApiPostingVatDelayCIJE.
    assign tApiPostingVatDelayCIJE.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tApiPostingVatDelayCIJE.tc_Status = "N":U.
    assign tApiPostingVatDelayCIJE.tc_ParentRowid = tApiPostingLineCIJE.tc_Rowid
           tApiPostingVatDelayCIJE.PostingLine_ID = tApiPostingLineCIJE.PostingLine_ID.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'ApiPostingVatDelayCIJE':U,
                     output oiReturnStatus" }

    create t_sApiPostingVatDelayCIJE.
    raw-transfer tApiPostingVatDelayCIJE to t_sApiPostingVatDelayCIJE.
    assign t_sApiPostingVatDelayCIJE.tc_ParentRowid = ic_ParentRowid.