Configuring rules

Each rule record is connected to one transaction and one entity. It is processed to create one journal or one instance of SourceSystemJournalEntry, which is essentially identified by its unique header components such as LedgerID/ LedgerType, or AccountingJournalReference. Consider creating a rule for every type of accounting event that requires a unique LedgerID or AccountingJournalReference. In some implementation projects, rules may be numerous, but may be identical to one another as to the journal entry requirements; the slight difference may lie only in the definition of conditions.

Rules also define whether journals are generated in detailed or summarized journal lines. By default, IGFC generates journals in detailed form. Should you require that journals are consolidated based on a specific journal field, for example, vendor account, rule output settings can be configured to define a summarized posting method with a range of vendor account numbers as its summarization parameter. Other journal entry attributes can also be added as a parameter to summarize the journals.

While it is easy to define the rule setup record, writing of the rule scripts could be a challenging task. In which case, you may copy an existing rule script from the rule script editor page and paste it onto a new rule script editor.

For example, PO receipt transaction is classified into two types, receipt with PO and receipt without PO. Each type is identified by a different AccountingJournalReference ID, thus requires separate journals. Different rules must then be created for each transaction type.

If the transaction to be processed requires data from another source transaction to make a journal entry, then the referenced source transaction document and its attributes must be indicated in the rule setup through the reference document fields.

Rule scripts include the definitions for the generation of journal entry for an accounting event. It combines attributes, expressions, and conditions. Conditions restrict the usage of a rule to a particular type of transaction. For example, you can specify a condition that will enable a set of journal entry lines to be created only for a combination of a particular item type and tracking method.

When a dimension code value is retrieved through an expression, then this expression must be assigned to a dimension code variable in the rule scripts.

Similarly, when a journal user field is retrieved through an expression, then this expression must also be assigned to a journal user field variable in the rule scripts.

Rule sets combined with dimension code assignments, journal user fields, and journal entry templates is processed by the journal generation module to provide a complete journal entry.

This is the rule script for Purchase Order creation transaction where item type "stocked" and tracking method "stocked":

set ledgerTypVal = ""
set ledgerIdVal= ""
set journalType = ""
set unitPriceAmt = ""
set totalPoCost = ""

if (PoHdr.statCd == "Open"){
  ledgerIdVal = "C"
  ledgerTypVal = "Commitment"
} else {
  ledgerIdVal = "A"
  ledgerTypVal = "Actual"
}
for every PoHdrBuy {
   for every PoHdrSup{
      for every PoLine {
         for every PoItem{
           if(PoLine.userArType == "PS" and PoTrackMethod == "true"){

           if (PoCostCurrency != PoLine.extCur) {
                     unitPriceAmt = PoLine.unitPriceAmt*PoLine.userArexchRate
       totalPoCost = unitPriceAmt*PoLine.qty
          }
          else{
              totalPoCost =PoLine.extAmt
          }
create entry (drCr: "DEBIT", lnAmt:PoLine.extAmt, lnAmtCur:PoLine.extCur, lnFuncAmtCur:PoCostCurrency,
  lnFuncAmt:totalPoCost, jlDimCd:PoDimCodeListDr, acctNum:PoLedgerAcctDr, jlActgChartId:PoCharRefId,
  acctgChName:PoCharRefName, lnDocRefIdTyp: "PurchaseOrder", lnDocRefId: PoHdr.poNum)

create entry (drCr: "CREDIT", lnAmt:PoLine.extAmt, lnAmtCur:PoLine.extCur,
lnFuncAmtCur:PoCostCurrency, lnFuncAmt:totalPoCost, jlDimCd: PoDimCodeListCr, acctNum: PoLedgerAcctCr,
  jlActgChartId:PoCharRefId, acctgChName:PoCharRefName, lnDocRefIdTyp: "PurchaseOrder", lnDocRefId:
  PoHdr.poNum)
        journalType = PoJournalType
           } }}}}
create header (ledgerTyp: ledgerTypVal, ledgerId: ledgerIdVal, actgJrnlRefId: journalType)

This is the rule script for receiving of items where item type "stocked" and tracking method "stocked":

Rule Script for Set1 to reverse commitment entries:
set journalType = ""
set linecurr = ""
set receivedQty = ""
set unitPriceAmt = ""
set totalPoCost = ""
set amt= ""

for every RdWhsLoc {
   for every RdShipFr {
      for every RdItem {
        for every PoHdrBuy {
          for every PoLine {

           if(RdItem.rdPoLine == PoLine.poLineNum){

           for every PoItem {
             if(PoLine.userArType == "PS" and RdTrackMethod == "true"){


                     linecurr = RdCostCurrency

                     receivedQty = RdItem.receivedQty
                   if (RdCostCurrency != PoLine.unitPriceCur){
            unitPriceAmt = PoLine.unitPriceAmt*PoLine.userArexchRate
                  totalPoCost = unitPriceAmt*receivedQty
                }else{
               unitPriceAmt = PoLine.unitPriceAmt
              totalPoCost = unitPriceAmt*receivedQty
                 }

                                    amt = RdItem.receivedQty*PoLine.unitPriceAmt

create entry (drCr: "DEBIT", lnAmt:amt, lnAmtCur:PoLine.extCur,
lnFuncAmt:totalPoCost,lnFuncAmtCur:linecurr, acctNum: RdLedgerAcctDrSet1, jlActgChartId:RdCharRefId,
 acctgChName:RdCharRefName, jlDimCd: RdDimCodeListDrSet1)

create entry (drCr: "CREDIT", lnAmt:amt, lnAmtCur:PoLine.extCur,
lnFuncAmt:totalPoCost,lnFuncAmtCur:linecurr, acctNum: RdLedgerAcctCrSet1, jlActgChartId:RdCharRefId,
  acctgChName:RdCharRefName, jlDimCd: RdDimCodeListCrSet1, lnDocRefIdTyp: "ReceiveDelivery",lnDocRefId:
  RdHdr.docNum)

              journalType = RdJournalTypeSet1
                }}}}
          }
        }
      }
    }
create header (actgJrnlRefId: journalType, ledgerTyp: "Actual", ledgerId: "A")
Rule Script for Set2 to recognize inventory:
set journalType = ""
set linecurr = ""
set receivedQty = ""
set unitPriceAmt = ""
set totalPoCost = ""
set amt= ""

for every RdWhsLoc {
for every RdShipFr {
for every RdItem {
for every PoHdrBuy {
for every PoLine {
 if(RdItem.rdPoLine == PoLine.poLineNum){
  for every PoItem {
   if(PoLine.userArType == "PS" and RdTrackMethod == "true"){

   linecurr = RdCostCurrency
   receivedQty = RdItem.receivedQty

   if (RdCostCurrency != PoLine.unitPriceCur){
    unitPriceAmt = PoLine.unitPriceAmt*PoLine.userArexchRate
    totalPoCost = unitPriceAmt*receivedQty
   }else{
     unitPriceAmt = PoLine.unitPriceAmt
     totalPoCost = unitPriceAmt*receivedQty
   }
   amt = RdItem.receivedQty*PoLine.unitPriceAmt

   create entry (drCr: "DEBIT", lnAmt:amt, lnAmtCur:PoLine.extCur,
   lnFuncAmt:totalPoCost,lnFuncAmtCur:linecurr, acctNum: RdLedgerAcctDrSet2,
jlActgChartId:RdCharRefId,
   acctgChName:RdCharRefName, jlDimCd: RdDimCodeListDrSet2, lnUserArea: LineUserFields)

   create entry (drCr: "CREDIT", lnAmt:amt, lnAmtCur:PoLine.extCur,
   lnFuncAmt:totalPoCost,lnFuncAmtCur:linecurr, acctNum: RdLedgerAcctCrSet2,
jlActgChartId:RdCharRefId,
   acctgChName:RdCharRefName, jlDimCd: RdDimCodeListCrSet2, lnDocRefIdTyp:
"ReceiveDelivery",lnDocRefId:
   RdHdr.docNum, lnUserArea: LineUserFields)
   journalType = RdJournalTypeSet2
   }}}}
}
}
}
}