Documentation >
MAC-PAC Technical Library >
Distribution >
Purchasing >
Programs >
Purchase Order Receipt - Purpose >
Purchase Order Receipt - Calculations
Purchase Order Receipt - Calculations
PO210E
A. Housekeeping
1. See Common Processing Routines - Housekeeping of this manual for a general discussion of the Housekeeping subroutine. Processing specific to this program is described below.
2. A parameter list is set up for the fast path and help screen parameters.
3. Key lists are defined for each file retrieved by the program.
4. Workfields are defined and program constants are initialized.
5. The following records are retrieved from the Reference file (REFERP):
a. The date format record (category 049) is retrieved. If this record is not found, the date format defaults to MMDDYY.
b. The default company/warehouse is retrieved from the workstation assignment record (category 428).
c. All company/warehouses to which the user is authorized are retrieved from the user company/warehouse authorization record (category 409) and loaded into an array. If no records are found for the user, a flag is set authorizing the user to all company/warehouses.
d. The decimal field precision record (category 446) is retrieved.
e. The purchase order document release codes (category 484) are retrieved and loaded into an array.
f. The Purchasing application system defaults 1 record (category 491) is retrieved and the Receipt Number Assignment Method is saved.
g. The system option assignment record (category 133) is retrieved. The single/multiple currency record is checked to determine if the base currency should be displayed on the screen(s).
The address format is also checked to determine if addresses should be displayed in free-form or U.S. format.
h. The Applications Installed record (category 012) is retrieved to determine whether the Job Control module is installed. If so, the job/group number will be displayed (if the part is job controlled). This record is also used to determine whether the Expert Configurator module is installed. If so, and the part is configuration coded, the part's configuration code is displayed.
i. The order types (category 401) are retrieved.
6. All valid company/warehouse combinations are retrieved from the Warehouse Description file (IC170M) and stored in an array. The default company/warehouse retrieved in step 5.b. above is validated against this array. The plant ID, plant flag, sales order planning flag, and calendar code values for IC170M are also retrieved and stored in arrays.
B. Mainline
1. The Purchase Order Receipt Function Select screen (PO210S01) is initialized and displayed.
2. If F18 - Order Retrieval is pressed, a call is made to the Purchase Order Retrieval program (PO920E), and the returned value is displayed in the Order Number field. See Common Processing Routines, Purchase Order Retrieval, for a discussion of this processing.
3. The user's input is validated.
a. For an add transaction (Request Code = 1), the Order Number and Receipt Number are validated, and a header record is created.
(1) The Purchase Order Header file (PO180M1) is accessed to validate the entered Order Number. There must be purchase order lines for the order. The Purchase Order Line file (PO180M2) is accessed to ensure that open lines exist and that the difference between the Ordered Quantity and the Received Quantity is greater than zero.
(2) If automatic receipt number assignment is in effect, the Receipt Number field must be blank. The Next Available Receipt Number is retrieved from the Reference File (category 496).
If manual receipt number assignment is in effect, the Receipt Number field must be entered. The Purchase Order Receipt Header file (PO210M1) is accessed to ensure the entered Receipt Number does not already exist.
If both receipt number assignment methods are in effect, the system will automatically assign the Next Available Receipt Number from the Reference File (category 496) if no Receipt Number is manually entered.
(3) A header record is created for the added receipt. The record is initialized with information from the Purchase Order Header file (PO180M1). The header record is updated on the Purchase Order Receipt Header file (PO210M1U). An audit trail record is formatted and written to the Purchase Order Receipt Header Audit Trail file (PO210BP1).
b. For a change (Request Code = 2) or close (Request Code = 3) transaction, the Receipt Number is validated on the Purchase Order Receipt Header file (PO210M1). The Purchase Order Receipt Line file (PO210M2) is checked for existing lines. For a close transaction, each line is checked: it must not be closed and the Quantity Control Status cannot equal complete.
4. The Purchase Order Receipt Header screen (PO210S02) is initialized and displayed.
a. For an add transaction, data is retrieved from the Purchase Order Header file (PO180M1). The Receipt Date defaults to the System Date; the default Receipt Notice Code is retrieved from the Purchasing System Defaults record (category 492) on the Reference file. The Comments Flag is set to N (do not display comments).
b. For a change or close transaction, the data is loaded from the existing record on the Purchase Order Receipt Header file (PO210M1). Decodes are retrieved from the Reference file. The Purchase Order Receipt Comment file (PO210M4) is checked; if comments exist for the receipt, the Comments Flag is set to Y (display comments).
5. The user's input is validated.
a. For an add or change transaction, each added or changed field is validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Control, for validation rules. If no errors occurred, the new or changed record is updated on the Purchase Order Receipt Header file (PO210M1U) and an audit trail record is formatted and written to the Purchase Order Receipt Header Audit Trail file (PO210BP1). The Multi-Line screen is displayed.
b. For a close transaction, the Receipt Status (RHRCST) is changed to closed. The record is updated on the Purchase Order Receipt Header file (PO210M1U) and an audit trail record is formatted and written to the Purchase Order Receipt Header Audit Trail file (PO210BP1). The close transaction is then complete; the Function Select screen is redisplayed so the user may begin a new transaction.
6. The Purchase Order Receipt Multi-Line screen (PO210S03) is initialized and displayed.
a. For an add transaction, the subfile is loaded with purchase order lines from the Purchase Order Line file (PO180M2).
b. For a change transaction, the subfile is loaded with the existing lines from the Purchase Order Receipt Line file (PO210M2).
c. In a multi-currency environment, the currency code is validated and the description is retrieved.
d. The Warehouse Balance file (IC140M) is accessed to retrieve the inventory balances. The total available balance is compared to the quantity needed; if a shortage is found, a flag is set to display a warning message to the user. Shortage conditions are determined as follows:
(1) The Warehouse Balance File balance type quantities are summed as follows to give the On-Hand Quantity:
(a) For a manufacturing warehouse, if the Order Planning flag on the balance type is Y, the quantity is added to the total.
(b) For a manufacturing warehouse, if any balance types are available for both planning and distribution (both Order Planning Flag and Distribution Flag = Y on the balance type), and sales orders are not considered for planning (the Sales Order Planning Flag on the Warehouse Description file is N), then the inventory quantity reserved for customer orders is subtracted from the total.
(c) For a distribution warehouse, if the Distribution flag on the balance type is Y, the quantity is added to the total.
(2) For non-direct ship purchase orders:
(a) If the company/warehouse is the manufacturing company/warehouse + Allocated Quantity - JIT (WBFRAQ) + Allocated Quantity - Synchro (WBSIAQ), the Sales Order Planning Flag is No, and the On-Hand Quantity (WKHAND) is less than the Allocated Quantity - Manufacturing (WBAQMF), the Shortage Flag is set to Y.
If the company/warehouse is the manufacturing company/warehouse, the Sales Order Planning Flag is Yes, and the On-Hand Quantity (WKHAND) is less than the Allocated Quantity - Manufacturing + Allocated Quantity - JIT (WBFRAQ) + Allocated Quantity - Synchro (WBSIAQ) plus the Reserved Quantity (WBRSOQ) plus the Backordered Quantity (WBBOSQ), the Shortage Flag is set to Y.
(b) If the company/warehouse is a distribution company/warehouse and the On-Hand Quantity (WKHAND) is less than the sum of the Reserved Sales Order Quantity (WBRSOQ) and Backordered Sales Order Quantity (WBBOSQ), the Shortage Flag is set to Y.
(3) For direct ship purchase orders, if the On-Order Quantity - Direct Ship Purchase Order (WBQDSP) is less than the On-Order Quantity - Direct Ship Sales Order (WBQDSS), the Shortage Flag is set to Y.
7. On the Header screen as well as a the Multi-Line screen F18 can be used to call the Multiple PO Receipt Window (PORCTWIN). This window allows selection of multiple purchase orders for the receipt or display of all purchase orders on this receipt.
8. Any changed or added lines are validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Control, for validation rules.
9. The Select Field allows the user to display the Purchase Order Receipt Comment screen (PO210S04) for the selected line. If X is entered for a line and command key F12 - Display Comments is pressed, the Comment screen will be displayed.
10. After the Comment screen has been processed, or if no comments were processed, the Purchase Order Receipt Header file (PO210M1U), Purchase Order Receipt Line file (PO210M2U), Purchase Order Header file (PO180MU), and Purchase Order Line file (PO180M2U) are updated. An audit trail record is formatted and written to the Purchase Order Receipt Line Audit Trail file (PO210BP2).
11. If it has been requested, the Purchase Order Receipt Comment screen (PO210S04) is initialized and displayed.
a. For a new receipt, the subfile is formatted with blanks.
b. For an existing receipt, the existing comments are retrieved from the Purchase Order Receipt Comment file (PO210M2) and loaded into the subfile for display.
12. Changed or added comments are validated. See the Purchasing User Manual, File Maintenance Screens-Purchasing Control, for validation rules.
13. The Purchase Order Receipt Comment file (PO210M4U) is updated with the added or changed records. An audit trail file is formatted and written to the Purchase Order Receipt Comment Audit Trail file (PO210BP4).