2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $path_to_root = "../..";
14 include_once($path_to_root . "/includes/session.inc");
15 include_once($path_to_root . "/includes/ui/ui_lists.inc");
16 include_once($path_to_root . "/includes/ui/ui_globals.inc");
17 include_once($path_to_root . "/includes/ui/ui_input.inc");
18 include_once($path_to_root . "/reporting/includes/reporting.inc");
20 //include_once("includes/item_scheduler.inc");
21 include_once("hincludes/lib/php/Boot.class.php");
23 $page_security = 'SA_ORDERLINEX_EDIT';
24 add_access_extensions();
26 $_SESSION['page_title'] = _($help_context = "Item schedule");
30 page($_SESSION['page_title'], false, false, "", $js);
32 //---------------------------------------------------------------------------------------------
34 div_start('item_schedule');
37 start_table(TABLESTYLE_NOBORDER);
40 echo date('h:i:s <br>',time());
46 if (!isset($_POST['stock_id'])) {
47 if (isset($_GET['stock_id']))
49 $_POST['stock_id'] = $_GET['stock_id'];
52 $_POST['stock_id'] = get_global_stock_item();
56 if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule');
58 //if (!@$_GET['popup'])
62 $stock_id = $_POST['stock_id'];
63 stock_costable_items_list_cells(_("Item:"), 'stock_id', $stock_id);
69 $params = in_ajax() ? new ScheduleParameters($_POST) : null;
70 $scheduler = new ItemScheduler($stock_id, 'DEF', $params);
72 start_table(TABLESTYLE);
73 $th = $scheduler->tableHeader();
77 $scheduler->generateTable();
82 submit_center_first('Update', _("Update"), '', 'default', false);
83 submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
91 <style type='text/css'>
96 tr.partial td:nth-child(5) {
117 border: 2px solid black;
119 tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
121 background: transparent;
124 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
125 <script src="js/jquery.tablednd.0.8.min.js"></script>
126 <script text="text/javascript">
128 /** add table DnD as behavior **/
129 function onDragStart (table, row) {
133 function findRowPosition(table, row) {
135 function addInput(form, name, value) {
136 $(form).append('<input type="hidden" name="'+name+'" value="'+value+'">')
138 function addInputs(form, name, values) {
139 for(index = 0; index < values.length; index++) {
140 addInput(form, name+'['+index+']', values[index])
143 function onDrop(table, row) {
144 var row_ids = $.map(table.tBodies[0].rows, function(r) { return r.id} )
146 var form = $(table).closest('form')[0]
148 addInput(form, 'row_id', row.id)
149 addInputs(form, 'row_order', row_ids )
151 JsHttpRequest.request(this, form);
156 '#item_schedule table': function (e) {
157 $(e).tableDnD({onDragStart: onDragStart, onDrop: onDrop})
160 Behaviour.register(inserts);