Formatting table
[order_line_extra.git] / haxe / ItemScheduler.hx
index 8922be470aa5b2a99368f83276f91722a5974b19..0446983596a2f12764dfdbf93fc2745addcc8557 100644 (file)
@@ -54,9 +54,10 @@ class ItemScheduler {
        }
 
        function tableHeader() {
-               return ["Order", "Customer", "Quantity", "Left", "On Hand", "Loc", "Required Date"];
+               return ["Order", "Customer", "Quantity", "Before", "After", "Loc", "Required Date"];
        }
 
+/*
        function generateTablex(): Void {
                for(location in locations()) {
                        formatLocation(location, null);
@@ -65,6 +66,7 @@ class ItemScheduler {
                        this.formatRow(order);
                }
        }
+*/
 
        function generateTable(): Void {
                        var startDate = Date.fromTime(0);
@@ -84,7 +86,7 @@ class ItemScheduler {
                var location  = locationIter.next();
                var qoh : Int = location.quantityOnHand(stock_id, null);
                var left = qoh;
-               formatLocation(location, left);
+               formatLocation(location, "Initial", left);
 
                // We display the order ordered by priority 
                // But insert the location when needed (meaning
@@ -98,8 +100,7 @@ class ItemScheduler {
                                var quantityForLocation : Int = location.quantityOnHand(stock_id, null);
                                if(quantityForLocation == null || quantityForLocation == 0) continue;
                                left += quantityForLocation;
-                               trace(quantityForLocation);
-                               formatLocation(location, left);
+                               formatLocation(location, "Delivery", left);
                        }
                        left -= quantity;
 
@@ -163,12 +164,14 @@ class ItemScheduler {
                
        }
 
-       function formatLocation(location : Location, left : Int) {
+       function formatLocation(location : Location, type: String,  left : Int) {
                var cells = [
-                       location.code
+                       type
                        ,location.name
                        ,location.quantityOnHand(stock_id, null)
+                       ,left-location.quantityOnHand(stock_id, null)
                        ,left
+                       ,location.code
                        ,location.delivery
                ];
                var status = 'header';