CalculateContractCancelledLine

Calculate Contract Cancelled Line

Minor Business Rule

Object Name: N1702880

Parent DLL: CCRIN

Location: Client/Server

Language: NER

Functional Description
This Business Function will Calculate the Domestic and Foreign Total for a contract when a line is cancelled.


Purpose

The purpose of this Business Function is to simplify the code in the P1721 as this calculation adds to complexity.  It will calculate Domestic, 

Foreign, for positive and negative contracts.


Setup Notes and Prerequisites

Before calling this Business function, verify that the line cancelled amount is not zero.  With zero amounts, the Business function will not do perform 

any calculations.


Special Logic



Technical Specification

VA evt_mnCreditCancelTotal_MATH01 = [BF mnDomesticCreditAmount]+[BF mnDomesticCancelAmount]

//

// ---------------------------------------------------------------------------

//           POSITIVE  CONTRACTS

// ---------------------------------------------------------------------------

If VA evt_mnCreditCancelTotal_MATH01 is greater than 

   //

   //    -Verify Dates/Amounts are within range

   //

   If BF jdCancelDate is equal to BF jdContractLineStartDate Or BF mnDomesticCancelAmount is greater than BF mnDomesticCreditAmount And 

VA evt_mnCreditCancelTotal_MATH01 is less than BF mnDomesticLineTotal

      BF mnDomesticContractTotal = ([BF mnDomesticContractTotal]-[BF mnDomesticCancelAmount])+[BF mnForeignCreditAmount]

      If SL CurrencyProcessing is not equal to "N"

         If BF szCurrencyCodeFrom is not equal to BF szCurrencyCodeOrigin

            BF mnForeignContractTotal = ([BF mnForeignContractTotal]-[BF mnForeignCancelAmount])+[BF mnForeignCreditAmount]

         End If

      End If

   Else

      //

      //    -Full Line total amount needs to be cancelled

      //

      If VA evt_mnCreditCancelTotal_MATH01 is greater than BF mnDomesticLineTotal

         BF mnDomesticContractTotal = ([BF mnDomesticContractTotal]-[BF mnDomesticLineTotal])+[BF mnDomesticCreditAmount]

         If SL CurrencyProcessing is not equal to "N"

            If BF szCurrencyCodeFrom is not equal to BF szCurrencyCodeOrigin

               BF mnForeignContractTotal = ([BF mnForeignContractTotal]-[BF mnForeignLineTotal])+[BF mnForeignCreditAmount]

            End If

         End If

      End If

   End If

End If

// ---------------------------------------------------------------------------

//

// ---------------------------------------------------------------------------

//           NEGATIVE  CONTRACTS

// ---------------------------------------------------------------------------

If VA evt_mnCreditCancelTotal_MATH01 is less than 

   //

   //    -Verify Dates/Amounts are within range

   //

   If BF jdCancelDate is equal to BF jdContractLineStartDate Or BF mnDomesticCancelAmount is less than BF mnDomesticCreditAmount And VA 

evt_mnCreditCancelTotal_MATH01 is greater than BF mnDomesticLineTotal

      BF mnDomesticContractTotal = ([BF mnDomesticContractTotal]-[BF mnDomesticCancelAmount])+[BF mnForeignCreditAmount]

      If SL CurrencyProcessing is not equal to "N"

         If BF szCurrencyCodeFrom is not equal to BF szCurrencyCodeOrigin

            BF mnForeignContractTotal = ([BF mnForeignContractTotal]-[BF mnForeignCancelAmount])+[BF mnForeignCreditAmount]

         End If

      End If

   Else

      //

      //    -Full Line total amount needs to be cancelled

      //

      If VA evt_mnCreditCancelTotal_MATH01 is less than BF mnDomesticLineTotal

         BF mnDomesticContractTotal = ([BF mnDomesticContractTotal]-[BF mnDomesticLineTotal])+[BF mnDomesticCreditAmount]

         If SL CurrencyProcessing is not equal to "N"

            If BF szCurrencyCodeFrom is not equal to BF szCurrencyCodeOrigin

               BF mnForeignContractTotal = ([BF mnForeignContractTotal]-[BF mnForeignLineTotal])+[BF mnForeignCreditAmount]

            End If

         End If

      End If

   End If

End If

// ---------------------------------------------------------------------------




Data Structure

D1702880 - Calculate Contract Cancelled Line

CSDTContract Line Start DateIYGC Contract Start
CNDJCancel DateIYGC Contract Cancel

AMTCDDomestic Credit AmountIYGC Credit

AMTCFForeign Credit AmountYGC Credit  F

CANDMDomestic Cancel AmountIYGC Cancel Amount

CANFNForeign Cancel AmountYGC Cancel Amount  F

TOTDDomestic Line TotalIYGC Line Total

FOAGForeign Line TotalIYGC Line Total  F

TOTDDomestic Contract TotalI/OYFC Total

FOAGForeign Contract TotalI/OYFC Total  F

CRCDCurrency Code FromIYFC Base Currency

CRCFCurrency Code BaseIYFC Customer Currency

MODEModeNReserved for Future Use

EV01Suppress ErrorsNReserved for Future Use

ERRCError CodeNReserved for Future Use

DTAIData Item (Error)NReserved for Future Use

Parameter NameData ItemData TypeReq/OptI/O/Both
jdContractLineStartDateCSDTJDEDATEOPTNONE

The date you actually start work on the contract.

jdCancelDateCNDJJDEDATEOPTNONE

The date that the order should be canceled if the goods have not been sent to the customer or the goods have not been received from the 
supplier. This is a memo-only field and does not cause the system to perform any type of automatic processing. If a line on a sales order in 
canceled in Sales Order Entry, this field will  be updated with the date the line has been canceled.                         

mnDomesticCreditAmountAMTCDMATH_NUMERICOPTNONE

The monetary amount the customer has been credited for this order. The monetary amount is expressed in the currency that is set up for the 
company initiating the transaction.

mnForeignCreditAmountAMTCFMATH_NUMERICOPTNONE

The monetary amount that the customer has been credited for this order. The monetary amount is expressed in the currency that is set up 
for the customer.

mnDomesticCancelAmountCANDMMATH_NUMERICOPTNONE

The monetary amount that has been cancelled. The monetary amount is expressed in the currency that is set up for the company initiating 
the transaction.

mnForeignCancelAmountCANFNMATH_NUMERICOPTNONE

The monetary amount that has been cancelled. The monetary amount is expressed in the currency that is set up for the customer.

mnDomesticLineTotalTOTDMATH_NUMERICOPTNONE

Total dollars is a factor used to calculate average days to pay. The amount is equal to the sum of cash received against valid accounts 
receivable invoices. The Total Dollars amount is updated at the same time that the Weighted Days total is updated.

mnForeignLineTotalFOAGMATH_NUMERICOPTNONE

When an adjustment is made to an invoice, the gross amount of the pay item before the adjustment.  The foreign original gross amount is 
stored in the F03B112.

mnDomesticContractTotalTOTDMATH_NUMERICOPTNONE

Total dollars is a factor used to calculate average days to pay. The amount is equal to the sum of cash received against valid accounts 
receivable invoices. The Total Dollars amount is updated at the same time that the Weighted Days total is updated.

mnForeignContractTotalFOAGMATH_NUMERICOPTNONE

When an adjustment is made to an invoice, the gross amount of the pay item before the adjustment.  The foreign original gross amount is 
stored in the F03B112.

szCurrencyCodeOriginCRCFcharOPTNONE

The currency code of the insured amount.

szCurrencyCodeFromCRCDcharOPTNONE

A code that identifies the currency of a transaction. 

cModeMODEcharOPTNONE

Reserved for Future Use

cSuppressErrorsEV01charOPTNONE

Reserved for Future Use

cErrorCodeERRCcharOPTNONE

Reserved for Future Use

szDataItemDTAIcharOPTNONE

Reserved for Future Use

Related Functions

None

Related Tables

None