In Sage X3, one of the client’s requirement was to have a dynamic departure time field update based on Arrival time field data under Management tab of Sales invoice module. The field takes value in the form of HH:MM. Below is the
Customization done for achieving the same.
New Stuff: Validation of Supplier Invoice No and Date in GRN
First to navigate to the screens that’ll be used for the below steps:
Sales Invoice: All > Sales > Invoices > Invoices (GESSIH)
Window Management: All > Development > Script dictionary > Windows
Scripts: All > Development > Script dictionary > Scripts
Refer the screenshots for reference:
Step 1: Head over to Sales invoice > Management tab and locate the fields. The initial default values in these fields are set to current system time.
Step 2: For the customization we require a couple of Action events to be assigned to Invoice Preparation time (Arrival time) and Invoice Preparation date (Arrival date) fields. The purpose of these events is to trigger our customization on Departure time and Departure date fields upon changes made.
Step 3: The customization logic performs 3 parts which are as follows:
1) If a new Invoice is being created through New button press then the Arrival time field and Arrival date field will default to Current system time and date and the Departure time field will default to +20mins (as per requirement) from Arrival time field and Departure date field will default to Arrival date.
2) After defaulting if the user changes the Arrival time/date fields then the respective changes will reflect on Departure time/date fields.
3) If the Invoice creation takes time, then upon creation the Arrival time field will reflect the Creation time and Departure time field will reflect change as per Arrival time.
Step 4: The key part is the conversion from Date-time data to CLBFile format (HH:MM format) and vice-versa to get the required changes made to the Departure time field. For this GDATETIME$, DATE$, VAL(expression) and FORMAT$ Sage X3’s keywords for achieving this.