project QadFinancials > class BPaymentSelection > method ValidateComponentPost1


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.ValidateComponentPost


program code (program4/bpaymentselection.p)

/* Called from BPaymentSelection.ValidateComponent */
/* Validating the paySel Header related to the activity which is bein run */

/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus                 = -98
       viLocalReturnStatus            = 0.
       
/* ================================================================== */
/* The execution date cannot be earlier than today (payment selection */
/* ================================================================== */
if vcActivityCode      <> {&PAYMENTSELECTIONACTIVITY-DELETE} and
   t_sPaySel.PaySelDate < today
then do:
    assign vcType     = if vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTE} or
                           vcActivityCode = {&PAYMENTSELECTIONACTIVITY-EXECUTEAGAIN}
                        then "W":U
                        else "E":U
           viSeverity = if vcType = "W":U
                        then 4
                        else 3.
    assign vcDatetemp = <M-43 DisplayDate  (input  t_sPaySel.PaySelDate (itDate)) in BPaymentSelection>.
    <M-2 run SetMessage
       (input  trim(#T-17'The execution date cannot be earlier than today (payment selection: $1).':250(635935354)T-17#) (icMessage), 
        input  t_sPaySel.PaySelCode (icArguments), 
        input  'tPaySel.PaySelDate':U (icFieldName), 
        input  vcDatetemp (icFieldValue), 
        input  vcType (icType), 
        input  viSeverity (iiSeverity), 
        input  t_sPaySel.tc_Rowid (icRowid), 
        input  'qadfin-464642':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
       
    if vcType = "E":U 
    then assign viLocalReturnStatus = -1.
    else 
    if viLocalReturnStatus = 0
    then assign viLocalReturnStatus = 1.
end.

/* ==================================================================================== */
/* Posting year, GL period, and date are mandatory when registering a payment selection */
/* ==================================================================================== */
if (vcActivityCode            = {&PAYMENTSELECTIONACTIVITY-REGISTER} or
    vcActivityCode            = {&PAYMENTSELECTIONACTIVITY-UNCONFIRM})and
  (t_sPaySel.tiPostingYear   = ?                                    or
   t_sPaySel.tiPostingYear   = 0                                    or
   t_sPaySel.tiPostingPeriod = ?                                    or
   t_sPaySel.tiPostingPeriod = 0                                    or
   t_sPaySel.ttPostingDate   = ?)
then do:
    <M-15 run SetMessage
       (input  trim(#T-45'Posting year, GL period, and date are mandatory when registering a payment selection.':250(855019422)T-45#) (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  t_sPaySel.tc_Rowid (icRowid), 
        input  'qadfin-819544':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
       
    assign viLocalReturnStatus = -1.
end.

/* ==================================================================================== */
/* Only Payment Selection with Status Confirmed or Transferred can be unconfirmed       */
/*      In Confirm/Unconfirm processing, PaySelStatus will be updated to 'Processing'   */
/*      in ChangeStatusPaymentSelInProcessing at the beginning.                         */
/*      VcOriginalPayStatus will record status before updating and used in validation.  */
/* ==================================================================================== */
if vcActivityCode            = {&PAYMENTSELECTIONACTIVITY-UNCONFIRM} and
   t_sPaySel.PaySelStatus      <> {&PAYMENTSELECTIONSTATUS-REGISTERED} and
   t_sPaySel.PaySelStatus      <> {&PAYMENTSELECTIONSTATUS-TRANSFERRED} and
   t_sPaySel.PaySelStatus      <> {&PAYMENTSELECTIONSTATUS-PARTIALLY} and
   vcOriginalPayStatus         <> {&PAYMENTSELECTIONSTATUS-REGISTERED} and
   vcOriginalPayStatus         <> {&PAYMENTSELECTIONSTATUS-TRANSFERRED} and
   vcOriginalPayStatus         <> {&PAYMENTSELECTIONSTATUS-PARTIALLY}
then do:
    assign vcStatusTr = if t_sPaySel.PaySelStatus = {&PAYMENTSELECTIONSTATUS-INITIAL}
                        then {&PAYMENTSELECTIONSTATUS-INITIAL-TR}
                        else if t_sPaySel.PaySelStatus = {&PAYMENTSELECTIONSTATUS-PROCESSING}
                        then {&PAYMENTSELECTIONSTATUS-PROCESSING-TR}
                        else if t_sPaySel.PaySelStatus = {&PAYMENTSELECTIONSTATUS-CLOSED}
                        then {&PAYMENTSELECTIONSTATUS-CLOSED-TR}
                        else t_sPaySel.PaySelStatus.
    <M-73 run SetMessage
       (input  trim(#T-31'You can only unconfirm a payment selection if it has the status Confirmed, Transferred or Partially Confirmed.':255(950402508)T-31#) (icMessage), 
        input  '':U (icArguments), 
        input  'tPaySel.PaySelStatus':U (icFieldName), 
        input  vcStatusTr (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-175303':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
        
    assign viLocalReturnStatus = -1.
end.

/* ================================================================================================== */
/* Invoices Having Same Transaction Currency Should Only Allow For French Driver FR-VIREMFOR-AP       */
/* ================================================================================================== */
if (vcActivityCode                = {&PAYMENTSELECTIONACTIVITY-CREATE}  or
    vcActivityCode                = {&PAYMENTSELECTIONACTIVITY-MODIFY}) and
    t_sPaySel.tcPayFormatTypeCode = "FR-VIREMFOR-AP"
then do:
    for each tProposedLine where tProposedLine.tlProposedLineIsSelected:
        if can-find(first btProposedLine
                        where btProposedLine.tlProposedLineIsSelected and
                              btProposedLine.tcInvoiceCurrencyCode <> tProposedLine.tcInvoiceCurrencyCode)
        then do:

             <M-94 run SetMessage
                (input  trim(#T-29'Invoices With Single Currency Will be Accepted For Payment Format Type Code: $1':255(510951600)T-29#) (icMessage), 
                 input  t_sPaySel.tcPayFormatTypeCode (icArguments), 
                 input  '':U (icFieldName), 
                 input  '':U (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  '':U (icRowid), 
                 input  'qadfin-714338':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>

             assign viLocalReturnStatus = -1.

        end.
    end.
end.


/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.