N5542B3

From Invoicing
Jump to: navigation, search

N5542B3 - SF Validate Order Activity Rules[edit]

  1. Data Structure (D5542B3A)
    1. Order Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. Load Branch (VMCU)
    5. Load Number (LDNM)
    6. Line Type (LNTY)
    7. Current Status (TRTY)
    8. New Status (NXTR)
    9. Error Code (Y55INEC)
  2. Logic
    1. Read from F40203 (where DCTO = ordertype, LNTY = linetype, TRTY=Current Status) fetch F40203/nxtr, a1tr, a2tr….a5tr
      1. If BF_NextStatus is in one of the above 6 fetched fields, then its passed => Error Code = Blank
      2. Else
        1. Call SF Write Invoice Error (ACTIVITY)
  3. End if

N5542B3 - SF Validate Delivery Method[edit]

  1. DSTR = D5542B3B
    1. Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. Load Branch (VMCU)
    5. Load Number (LDNM)
    6. Sold To (AN8)
    7. Document Type (Y55DCTO), input
    8. Default Delivery Method (Y55DELVMTH), input
    9. Delivery Method (Y55DELVMTH) (output)
    10. Error Code (Y55INEC)
  2. Logic
    1. Read Delivery Method from F5503080 matching on order company and sold to and documentType
      1. If not found, read F5503080 using CO = 00000 instead of OrderCompany
      2. If still not found,
        1. Set BF_DeliveryMethod = BF_DefaultDeliveryMethod
        2. End the function with appropriate error code
        3. Call SF Write Invoice Error (EMAIL)
    2. If found record from above
      1. If its EMAIL, then verify the email address is set up in F01151 (idln, etp, an8), read email address,
        1. If email address is found, set BF_DeliveryMethod = EMAIL
        2. if no email address found,
          1. Set BF_DeliveryMethod = BF_DefaultDeliveryMethod
          2. Return with appropriate error code
          3. Call SF Write Invoice Error (EMAIL)
    3. Else
      1. Set BF_DeliveryMethod = BF_DefaultDeliveryMethod

N5542B3 - SF Validate Shipping Date[edit]

  1. DSTR = D5542B3C
    1. Load Branch (VMCU)
    2. Load Number (LDNM)
    3. Order Company (KCOO)
    4. Order Type (DCTO)
    5. Order Number (DOCO)
    6. PickStatus (NXTR)
    7. Max Days Between (INT01)
    8. Status Acctg Validation (NXTR)
    9. New Status (NXTR), output
    10. Error Code (Y55INEC)
  2. Logic
    1. Read from Sales Order Header (F4201) ⇒ SoldTo (AN8)
    2. Read from Load Header (F4960) ⇒ ShipDate (ADDJ)
    3. Check 1:
      1. Calculate Days between (TodaysDate - F4960/ShipDate)
        1. If its > BF_MaxDaysBetween then
          1. Set BF_NewStatus = BF_StatusAcctgVal
          2. return appropriate error
          3. Call SF Write Invoice Error (DAYS)
    4. Check 2:
      1. Read F0010 using OrderCompany ⇒ Read CurrPeriod/PNC
        1. Calculate period of todays date (using Months_between today and F0010/ARFJ) ⇒ VA_TodaysPeriod
        2. If VA_TodaysPeriod <> F0010/CurrPeriod or F0010/ARFJ <> TodaysYear then
          1. Set BF_NewStatus = BF_StatusAcctgVal
          2. return appropriate error
          3. Call SF Write Invoice Error (PERIOD)

N5542B3 - SF Validate Same Shipping Date[edit]

  1. DSTR = D5542B3D
    1. Order Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. Load Branch (VMCU)
    5. Load Number (LDNM)
    6. PickStatus (NXTR)
    7. StatusAcctgVal (NXTR)
    8. NewStatus, (NXTR)output
    9. Error Code (Y55INEC)
  2. Logic
    1. Read from join of F4211+F4941 (V5542B3)
      1. Read F4211/ADDJ from all lines. If they are all same, its passed.
      2. If any of those dates are different or zero or null
        1. Set NewStatus = StatusAcctgVal
        2. Call SF Write Invoice Error (SDATE)

N5542B3- SF Calculate Order Totals[edit]

  1. DSTR = D5542B3E
    1. Order Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. SCLineNumber(LNID)
    5. Load Branch (VMCU)
    6. Load Number (LDNM)
    7. PickStatusFrom (NXTR)
    8. PickStatusThru (NXTR)
    9. Total Quantity W (UORG)
    10. Total Quantity SC (UORG)
    11. Total Dom. Price W (AEXP)
    12. Total Dom. Price SC (AEXP)
    13. Total For. Price W (FEA)
    14. Total For. Price SC (FEA)
  2. Logic
    1. Read from F4201 ⇒ VA_CurrMode (CRRM)
    2. Read from join of F4211+F4941 (V5542B3), where line type = W
      1. Add up F4211/UORG into BF_TotalQuantityW
      2. If VA_CurrMode = D
        1. Add up F4211/AEXP into BF_TotalDomPriceW
      3. Add F4211/FEA into BF_TotalForPriceW
    3. Read from F4211 where line type = SC and Status = PickStatus
      1. Add up F4211/UORG into BF_TotalQuantitySC
      2. If VA_CurrMode = D
        1. Add up F4211/AEXP into BF_TotalDomPriceSC
        2. Add F4211/FEA into BF_TotalForPriceSC
      3. End

N5542B3- SF Validate Surcharges[edit]

  1. DSTR = D5542B3F
    1. Order Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. Load Branch (VMCU)
    5. Load Number (LDNM)
    6. Pick Status From (NXTR)
    7. Pick Status Thru (NXTR)
    8. Status_OrdVal (NXTR)
    9. Status_AcctgVal (NXTR)
    10. Status_NoVal (NXTR)
    11. Bypass Surcharge Code 1 (AC15) (BF_BypassSur1)
    12. Bypass Surcharge Code 2 (AC15) (BF_BypassSur2)
    13. Bypass Surcharge Code 3 (AC15) (BF_BypassSur3)
    14. Bypass Surcharge Code 4 (AC15) (BF_BypassSur4)
    15. Bypass Surcharge Code 5 (AC15) (BF_BypassSur5)
    16. New_SC_Qty_Curr_Line (UORG)
    17. New_SC_Qty_New_Line (UORG)
    18. NewStatus (NXTR)
  2. Logic
    1. Other Line Types
      1. Read from F4211 to look for any lines with LineType other than SC and W. if found, set NewStatus = BF_Status_AcctgVal
      2. Read from F4201 ⇒ SoldTo (AN8)
    2. SC Line Type
      1. Read from F03012 matching on OrderCompany and SoldTo, ⇒ return AC15 (VA_SurchargeCode)
      2. If VA_SurchargeCode is Blank (Customer is not a surcharge customer)
        1. Read F4211 for any LineType=SC, if found, NewStatus=BF_Status_OrdVal, write error record (SURCHARGE)
      3. If VA_SurchargeCode is Not Blank (Customer is a surcharge customer)
        1. Read F4211 for any linetype=SC, if not found, error, NewStatus=BF_Status_OrdVal, write error record (SURPRICE)
        2. If Found and no errors
          1. Call BSFN SFCalculateOrderTotals
          2. If W_Qty = SC_Qty
            1. We are good
            2. Return 0 for both New SC Qty (Curr & New)
          3. Else
            1. Set New_SC_Qty_Curr = W_Qty
            2. Set New_SC_Qty_New = SC_Qty - W_Qty

N5542B3- SF Write Invoice Error[edit]

  1. DSTR = D5542B3G
    1. Load Branch (VMCU)
    2. Load Number (LDNM)
    3. Order Company (KCOO)
    4. Order Type (DCTO)
    5. Order Number (DOCO)
    6. Invoice Error Code (Y55INEC)
  2. Logic
    1. Insert the Values in F5542B3E
    2. Get Audit Field Info

N5542B3- SF Clear Invoice Errors[edit]

  1. DSTR = D5542B3H
    1. Load Branch (VMCU)
    2. Load Number (LDNM)
    3. Order Company (KCOO)
    4. Order Type (DCTO)
    5. Order Number (DOCO)
  2. Logic
    1. Delete the Records in F5542B3E

N5542B3- SF Split Surcharge Lines[edit]

  1. DSTR = D5542B3H
    1. Order Company (KCOO)
    2. Order Type (DCTO)
    3. Order Number (DOCO)
    4. SC New Line (LNID)
    5. W Qty (UORG)
    6. SC Qty (UORG)
  2. Logic
    1. Read from F4211 => (NXTR, LTTR, UPRC, FUP)
      1. DomExtPrice = [VA evt_UPRC_F4211]*[BF mnWQty]
      2. VA evt_ForExtPrice = [VA evt_FUP_F4211]*[BF mnWQty]
      3. BF mnInvoiceLine = [BF mnInvoiceLine]+1
    2. F4211.Update
    3. F554211.Update
    4. Update F4211 Detail and F42199 Ledger
    5. If BF mnSCQty is greater than BF mnWQty
      1. VA evt_SCNewLine = [BF mnSCCurrentLine]+.001
        1. SF Copy Sales Line
          1. BF szOrderCompany -> BF szFromOrderCompany
          2. BF szOrderType -> BF szFromOrderType
          3. BF mnOrderNumber -> BF mnFromOrderNumber
          4. BF mnSCCurrentLine -> BF mnFromOrderLine
          5. VA evt_SCNewLine -> BF mnToOrderLine
        2. Update New Line
          1. VA evt_SCQty_New = [BF mnSCQty]-[BF mnWQty]
          2. VA evt_DomExtPrice_New = [VA evt_UPRC_F4211]*[VA evt_SCQty_New]
          3. VA evt_ForExtPrice_New = [VA evt_FUP_F4211]*[VA evt_SCQty_New]
        3. F4211.Update
        4. F554211.Update
        5. Update F4211 Detail and F42199 Ledger
    6. End If


invoicing