project QadFinancials > class BCInvoice > method RestoreUIProcessDataForCInvoice

Description

This method gets all needed data to fully restore process object of supplier invoice.


Parameters


icCInvoiceRowIdinputcharacter
ocCreditorTaxClassoutputcharacter
ocCreditorTaxUsageoutputcharacter
oiCreditorCNControlGLProfileIdoutputinteger
oiCreditorInvControlGLProfileIdoutputinteger
oiCreditorDivisionProfileIdoutputinteger
olCreditorIsIndividialPaymentoutputlogical
ocShipFromTaxZoneoutputcharacter
oiShipFromAddressIdoutputinteger
olShipFromCountryIsEUCountryoutputlogical
olBusinessRelationIsIntercooutputlogical
ocBusinessRelationICCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program6/bcinvoice.p)

/* =================================================================================================== */
/* Method      : RestoreUIProcessDataForCInvoice                                                       */
/* Desc        : This method obtains additional data for process object, to be able fully restore      */
/*               user interface for existing supplier invoice                                          */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  CInvoiceRowId        Row id of supplier invoice                                       */
/*          (O)  CreditorTaxClass     Creditor's tax class                                             */
/*          (O)  CreditorTaxUsage     Creditor's tax usage                                             */
/*          (O)  CreditorCNControlGLProfileId                                                          */
/*          (O)  CreditorInvControlGLProfileId                                                         */
/*          (O)  CreditorDivisionProfileId                                                             */
/*          (O)  CreditorIsIndividualPayment                                                           */
/*          (O)  ShipFromTaxZone      Ship from tax zone                                               */
/*          (O)  ShipFromAddressId                                                                     */
/*          (O)  ShipFromCountryIsEUCountry                                                            */
/*          (O)  BusinessRelationIsInterco                                                             */
/*          (O)  BusinessRelationICCode                                                                */
/* =================================================================================================== */

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Default output values                                                                               */
/* =================================================================================================== */
assign ocCreditorTaxClass              = ?
       ocCreditorTaxUsage              = ?
       oiCreditorCNControlGLProfileId  = ?
       oiCreditorInvControlGLProfileId = ?
       oiCreditorDivisionProfileId     = ?
       olCreditorIsIndividialPayment   = ?
       ocShipFromTaxZone               = ?
       oiShipFromAddressId             = ?
       olShipFromCountryIsEUCountry    = ?
       olBusinessRelationIsInterco     = ?
       ocBusinessRelationICCode        = ?.

/* =================================================================================================== */
/* Normalize input parameters                                                                          */
/* =================================================================================================== */
if icCInvoiceRowId = '':U then assign icCInvoiceRowId = ?.

/* =================================================================================================== */
/* Validate input parameters                                                                           */
/* =================================================================================================== */
if icCInvoiceRowId = ?
then do:
    assign vcMessage = #T-1'You have not entered all the mandatory values.':255(63250)t-1#.
    <M-2 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-7914':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    assign oiReturnStatus = -1.
    return.
end.

/* =================================================================================================== */
/* Get Supplier invoice                                                                                */
/* =================================================================================================== */
find tCInvoice where
     tCInvoice.tc_Rowid = icCInvoiceRowId no-error.
if not available tCInvoice
then do:
    assign vcMessage = #T-5'The system cannot find instance data of supplier invoice.':255(69146)t-5#.
    <M-4 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-7915':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    assign oiReturnStatus = -1.
    return.
end.

/* =================================================================================================== */
/* Get Values of supplier                                                                              */
/* =================================================================================================== */
<Q-3 run CreditorForCInvoiceDefault (all) (Read) (NoCache)
   (input viCompanyId, (CompanyId)
    input tCInvoice.tcCreditorCode, (CreditorCode)
    input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
    output dataset tqCreditorForCInvoiceDefault) in BCreditor >

find first tqCreditorForCInvoiceDefault where
           tqCreditorForCInvoiceDefault.tcCreditorCode    = tCInvoice.tcCreditorCode and
           tqCreditorForCInvoiceDefault.tcAddressTypeCode = {&ADDRESSTYPECODESYSTEM-HEADOFFICE} 
           no-error.
if not available tqCreditorForCInvoiceDefault
then do:
    assign vcMessage = #T-7'The supplier code (&1) is invalid. The system cannot read details of this supplier.':255(69148)t-7#
           vcMessage = substitute(vcMessage, tCInvoice.tcCreditorCode).
    <M-6 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'S':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-7916':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
    assign oiReturnStatus = -1.
    return.
end.

assign olBusinessRelationIsInterco     = tqCreditorForCInvoiceDefault.tlBusinessRelationIsInterco
       ocBusinessRelationICCode        = if olBusinessRelationIsInterco
                                         then tqCreditorForCInvoiceDefault.tcBusinessRelationICCode
                                         else "":U
       ocCreditorTaxUsage              = tqCreditorForCInvoiceDefault.tcTxuTaxUsage
       ocShipFromTaxZone               = tqCreditorForCInvoiceDefault.tcTxzTaxZone
       ocCreditorTaxClass              = tqCreditorForCInvoiceDefault.tcTxclTaxCls
       oiCreditorCnControlGLProfileId  = tqCreditorForCInvoiceDefault.tiCnControlGLProfile_ID
       oiCreditorInvControlGLProfileId = tqCreditorForCInvoiceDefault.tiInvControlGLProfile_ID
       oiCreditorDivisionProfileId     = tqCreditorForCInvoiceDefault.tiDivisionProfile_ID
       olCreditorIsIndividialPayment   = tqCreditorForCInvoiceDefault.tlCreditorIsIndividualPaymnt.
       
/* =================================================================================================== */
/* Address related information                                                                         */
/* =================================================================================================== */
<Q-8 run AddressForInvoiceDefault (all) (Read) (NoCache)
   (input tqCreditorForCInvoiceDefault.tiBusinessRelation_ID, (BusinessRelationId)
    input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
    output dataset tqAddressForInvoiceDefault) in BBusinessRelation >    

find first tqAddressForInvoiceDefault where
           tqAddressForInvoiceDefault.tiBusinessRelation_ID = tqCreditorForCInvoiceDefault.tiBusinessRelation_ID and
           tqAddressForInvoiceDefault.tcAddressTypeCode     = {&ADDRESSTYPECODESYSTEM-HEADOFFICE}
           no-error.

if available tqAddressForInvoiceDefault
then assign oiShipFromAddressId          = tqAddressForInvoiceDefault.tiAddress_ID
            olShipFromCountryIsEUCountry = tqAddressForInvoiceDefault.tlCountryIsEUCountry.
    
/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.