Developers - Removal of Sales Order Remains
The Removal of Sales Order Remains extension allows you to automatically or semi-automatically remove quantities of sales orders that have been partially served and that, according to the criteria defined in the application, are no longer being served.
The extension modifies the Sales and Receivables Configuration (311), Customer (18), and Sales Header (36) tables to include the configuration fields that will be used when calculating whether or not to remove the remains of an order. The deletion code takes the values from the header, if they exist, if it does not he/she looks for them in the customer, and if not, it takes them from the sales setup.
In addition, in the Sales Header (36) it adds a field (Remains Removed On), and in the Sales Lines another field (Removed Quantity) that are filled in when a document is processed, in order to have a trace changes made to an order.
These latter fields, along with the main header setup fields, are also duplicated in the Sales Header History (5107) and Sales Line History (5108) tables, to keep this trace when documents are archived.
For internal use of the extension, the header and the customer also have a IDP51 Updated field, which is used internally by the extension to know if the record has already been initialized with the default values of the extension or not. This way, when you install the extension the update/installation code scrolls through all records that are not marked "Updated", and sets the default values.
Pages 21 Customer Card, 42 Sales Order, 46 Sales Order Subform, 459 Sales & Receivables Setup, 5159 Sales Order Archive, 5160 Sales Order Archive Subform and 9305 Sales Order List have been modified to include the setup and trace fields mentioned above, which can be edited/displayed by users. In addition, for the 42 Sales Order, and 9305 Sales Order List pages, actions have been included to manually trigger remains removal.
Of the CodeUnits included with the extension, the 7142500-7142505 are relatively simple and handle only fields validation events, or trigger the deletion process when the corresponding action is pressed or a document is registered. The bulk of the code, and the main logic of the application, is found in CodeUnit 7142506 IDP51 Removal of Sales Order Remains Mgt., which executes to remove the remains of all documents that meet the selection conditions (codeunit method Run), or takes care of removing the remains of a specific document (methods DeleteSalesFromPost or ConfirmDeleteSales, depending on whether it is called automatically from the document record, or manually from an action).
Due to the type of functionality it implements, the option of customizing the included objects is not considered in principle. In case the need arise, please contact the product department, and we would suggest the feasibility of implementing the necessary events in the extension to try to avoid the modification of the base code.