FastCart, a shipping company, aids businesses in shipping online orders. FastCart has a shipping policy that if multiple shipping orders are placed on the same day, delivery will occur in the evening.
FastCart utilizes Salesforce to store customer sales information. Customer details are maintained in account objects, and customer orders are managed by creating orders in Salesforce.
Customers frequently place multiple orders on the same day. To efficiently manage these orders, FastCart's shipping department needs to identify items placed on the same day by a customer to ship them together.
To identify same-day orders, FastCart uses a shipping counter. The shipping counter is an incremental number that must be printed on the orders for effective shipment management.
The shipping counter starts with 1.0, and if there are three or more orders on the same day, the counter will be printed as 1.0, 1.1, 1.2, and so on.
If the same customer places another three orders on the next day, the counter will be printed as 2.0, 2.1, 2.2.
Complete the provided Apex code, which accepts a list of account IDs (customer IDs) as input and return a list of updated orders with the OrderReferenceNumber as the shipping counter.
Note :
1. Use the Effective Date (EffectiveDate) field on orders to determine the order date.
2. Print the shipping count in ascending order based on the order number.
Input
List<Id>
Output
List<Order>, fields to include Id, OrderReferenceNumber