project QadFinancials > class BCInvoice > method CreateCInvoice

Description

Initialize a new record in class table tCInvoice.


Parameters


ic_ParentRowidinputcharacter= tCInvoice.tc_ParentRowid
BCInvoiceoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bcinvoice.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sCInvoice.
    empty temp-table t_sCInvoiceBank.
    empty temp-table t_sCInvoiceBankPayCode.
    empty temp-table t_sCInvoiceMovement.
    empty temp-table t_sCInvoicePO.
    empty temp-table t_sCInvoicePosting.
    empty temp-table t_sCInvoiceStage.
    empty temp-table t_sCInvoiceVat.
    empty temp-table t_sCInvoiceWHT.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    create tCInvoice.
    assign tCInvoice.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tCInvoice.tc_Status = "N":U.
    { includes/bfcrun.i
      &procedure  = "StartPersistence"
      &parameters = "output vh_persistence,
                     output viFcReturnSuper" }
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.
    assign tCInvoice.CInvoice_ID = dynamic-function ("GetNextValue":U in vh_persistence,"ObjectNumber":U).
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'CInvoice':U,
                     output oiReturnStatus" }

    create t_sCInvoice.
    raw-transfer tCInvoice to t_sCInvoice.