+ function generateTable(): Void {
+ var schedules = [];
+ var startDate = Date.fromTime(0);
+ for(order in orders()) {
+ var obj = php.Lib.objectOfAssociativeArray(order);
+ schedules.push({date: Date.fromString(obj.delivery_date), order:order, location:null});
+ }
+ for(location in locations()) {
+ schedules.push({date: if(location.code == startLocation) startDate else location.delivery, order:null, location:location});
+ }
+
+ schedules.sort(function(a,b ) { return cast(a.date.getTime() - b.date.getTime(), Int) ; });
+ for(schedule in schedules) {
+ if(schedule.order != null) formatRow(schedule.order);
+ if(schedule.location != null) formatLocation(schedule.location);
+ }
+ }
+