Picked = Green + fix null quantity => 0.
[order_line_extra.git] / item_schedule.php
index acbf4be748878dd9e1a707ed3342eb73e7cd6f98..9eac399baa1838faa43ca7e42e27c7bd1f31b26e 100644 (file)
@@ -20,8 +20,10 @@ include_once($path_to_root . "/reporting/includes/reporting.inc");
 //include_once("includes/item_scheduler.inc");
 include_once("hincludes/lib/php/Boot.class.php");
 include_once("includes/db_order_lines.inc");
+include_once("includes/picking.inc");
+include_once("config.php");
 
-$page_security = 'SA_ORDERLINEX_EDIT';
+$page_security = 'SA_ORDERLINEX_SCHEDULE';
 add_access_extensions();
 
 $_SESSION['page_title'] = _($help_context = "Item schedule");
@@ -39,12 +41,6 @@ start_form();
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 
-echo date('h:i:s <br>',time());
-?>GET<?php
-print_r($_GET);
-?>POST<?php
-print_r($_POST);
-
 if (!isset($_POST['stock_id'])) {
 if (isset($_GET['stock_id']))
 {
@@ -55,7 +51,9 @@ else {
        }
 }
 
-if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule');
+if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule') ;
+//else update_queue_quantities() && update_qoh_for_item();
+
 
 //if (!@$_GET['popup'])
 //     start_form();
@@ -72,7 +70,6 @@ if(isset($stock_id)) echo '<input type="hidden" name="last_stock_id" value="'.$s
 
 if(isset($_POST['Update'])) {
        $Ajax->activate('item_schedule');
-               echo 'youpiii';
        // Restore the parameters
        $params = new ScheduleParameters($_SESSION['schedule_parameters']);
        $params->setMode('update');
@@ -82,7 +79,7 @@ else {
        // save parameters form update
        $_SESSION['schedule_parameters'] = $_POST;
 }
-$scheduler = new ItemScheduler($stock_id, 'DEF', $params);
+$scheduler = new ItemScheduler($stock_id, OrderXtraConfig::$default_location, $params);
 $scheduler->action();
 
 start_table(TABLESTYLE);
@@ -115,7 +112,12 @@ tr.partial  td:nth-child(5) {
        background: pink;
 }
 
+
 tr.location {
+       font-weight: normal;
+               background: #bbb;
+}
+tr.picked {
        font-weight: normal;
                background: #8f8;
 }
@@ -125,11 +127,20 @@ tr.on_time {
 tr.late {
                background: #fc8;
 }
+tr.early {
+               background: #def;
+               color: blue;
+}
 
 tr.soldout {
                background: pink;
 }
 
+tr.expired td:nth-child(7) {
+       background: #444;
+       color: white;
+}
+
 tr.tDnD_whileDrag {
        background: #ccc;
        border: 2px solid black;
@@ -138,11 +149,22 @@ tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
        color: transparent;
        background: transparent;
 }
+
+span.picked {
+       color: black;
+       font-weight: bold;
+}
+
+tr.partial span.pickable {
+       background: #cfc;
+}
+span.partial  {
+       background: transparent;
+}
 </style>
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script src="js/jquery.tablednd.0.8.min.js"></script>
 <script text="text/javascript">
-       console.log('hello')
        /**  add table DnD as behavior **/
        function onDragStart (table, row) {
        console.log(table)
@@ -170,6 +192,15 @@ tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
                
        }
 
+       function onPick(element) {
+               /* horible hack but it works */
+               /* in the way it call an Ajax request */
+               var row = $(element).closest('tr')[0];
+               var table = $(element).closest('table')[0];
+               onDrop(table, row);
+               
+       }
+
        var inserts = {
                '#item_schedule table': function (e) { 
                        $(e).tableDnD({onDragStart: onDragStart, onDrop: onDrop})