We will be handling credit checking on sales orders based on the master order instead of individual orders as we do currently in Avante. To accomplish this, we will first check the billto customer's available credit against the Cart Total (which includes all bundle totals, upcharges, and web discount). If the total master order value puts the customer over their credit limit, all sub-orders for the master order will go on hold. This logic will be done for both Stock and MOD orders.
RPC$SHOPPINGCART_CREATEORDER:
This main program will be modified to check the cart total against the billto customer's available credit to see if this master order will put them over their credit limit.
Before calling RPC$CONVERT_QUOTE (for MOD orders) and RPC$CREATE_STOCKORDER (for stock orders):
- If this master order is being paid using a credit card or cash on delivery or cash in advance, no credit checking logic is required. Just let it run SOPS4000.4 as it does now. SOPS4000.4 calls the credit checking program SOPS4000.7, which bypasses credit check for these credit terms. To determine if this is a credit card/cod/cia payment method, location RECORD<51> in SYSCON TERMS.LAD<1>.
- Get the cart total (RPC$SHOPPINGCART_GETORDERVALUE)
- If billto customer's credit used (from CUSTMST<15>) + Cart Total > Credit Limit (from CUSTMST<14>) or this is a delinquent customer (CUSTMST<76>=1), pass a master order onhold flag to the credit checking program SOPS4000.7, which is called from SOPS4000.4.
BP SOPS4000.7 - Credit Checking:
- In the credit checking program SOPS4000.7 (which is called from convert quote and stock order programs), check the master order onhold flag passed from CREATEORDER. If the onhold flag is set, set RECORD<76>=1 and get out of the credit check program. This will result in each of the sub-orders for the master order (both stock and MOD) being put on credit hold. No inventory allocation will be done for these orders because RECORD<76>=1. If the master onhold flag isn't set, continue with the normal credit checking/credit used updating.
- Inventory Allocation is done in SYSS0123.1 only if RECORD<76>=0. As long as on hold orders have RECORD<76>=1, this logic shouldn't require any change.
Testing:
- If all orders were authorized (SOHDR<76>=0), the billto customer's credit used (CUSTMST<15>) should have been updated with the value of the cart
- If SOHDR<76> = 0 (authorized) and Stock Order:
- inventory should have been allocated or backordered in INVWHS (fields 2 or 4) for all stock items