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/db_pager.inc");
15 include_once($path_to_root . "/includes/session.inc");
16 include_once($path_to_root . "/sales/includes/sales_ui.inc");
17 include_once($path_to_root . "/reporting/includes/reporting.inc");
19 include_once("config.php");
20 include_once("includes/order_lines.inc");
21 include_once("includes/splitter.inc");
22 include_once("includes/bulk_updater.inc");
23 include_once("includes/picking.inc");
25 $page_security = 'SA_ORDERLINEX_EDIT';
26 add_access_extensions();
28 $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters");
32 update_extra_order_details();
33 split_order_details();
34 bulk_update_order_details();
36 process_picking_flag();
40 if ($use_popup_windows)
41 $js .= get_js_open_window(900, 600);
43 $js .= get_js_date_picker();
44 page($_SESSION['page_title'], false, false, "", $js);
46 //---------------------------------------------------------------------------------------------
48 div_start('order_line_view');
51 start_table(TABLESTYLE_NOBORDER);
55 if(!isset($_POST['customer_id'])) {
56 if(isset($_GET['customer_id'])) {
57 $customer_id = $_GET['customer_id'];
58 $_POST['customer_id'] = $customer_id;
60 else $customer_id = null;
64 $customer_id = $_POST['customer_id'];
66 customer_list_cells(_("Select a customer: "), 'customer_id', $customer_id, true, true);
68 if($customer_id != null) {
69 if(!isset($_POST['item_like'])) {
70 if(isset($_GET['item_like'])) {
71 $item_like = $_GET['item_like'];
72 $_POST['item_like'] = $item_like;
74 else $item_like = null;
76 else $item_like = $_POST['item_like'];
77 text_cells_ex('Filter Item', 'item_like', 50, null, $item_like,
78 null, null, null, true );
85 //submit_cells('SearchOrders', _("Search"),'',_('Select documents'), 'default');
91 //---------------------------------------------------------------------------------------------
92 // Orders inquiry table
95 // Display all item for one customer
96 $sql = get_order_details_extra($customer_id, 'DEF', $item_like);
99 , _("Order #") => array('fun'=>'view_link', 'ord' => '')
100 ,_("Item Code") => array('ord' => '', 'fun' => 'item_link')
101 ,_("Quantity") => array('type' => 'qty', 'dec' => 0)
102 ,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '')
103 ,_("Before") => 'skip'
104 ,_("To Pick") => array('type' => 'qty', 'ord' => '', 'dec' => 0)
105 ,_("Priority") => array('type' => 'time', 'ord' => '')
106 ,_("Hold Until") => array('fun' => 'input_hold_until_date_details', 'ord' => '')
107 ,_("Require By") => array('fun' => 'input_required_date_details', 'ord' => '')
108 ,_("Expiry Date") => array('fun' => 'input_expiry_date_details', 'ord' => '')
109 ,_("Comment") => array('fun' => 'input_comment_details', 'ord' => '')
110 ,'<input id="checkAll" type="checkbox">' => array('fun' => 'input_check_details')
114 // Display all customers
115 $sql = get_order_summary('DEF');
117 'customer id' => 'skip',
118 'branch code ' => 'skip',
119 _("Customer") => array('ord' => '', 'fun' => 'customer_link'),
120 _("Branch") => array('ord' => ''),
121 _("Delivery Date") => array('ord' => '', 'type' => 'date'),
122 _("Quantity") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
123 _("Amount") => array('ord' => '', 'type' => 'amount'),
124 _("Avail. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
125 _("Avail. A") => array('ord' => '', 'type' => 'amount', 'dec' => 0),
126 _("Held. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
127 _("required date") => array('ord' => '', 'type' => 'date'),
128 _("Comments") => array('ord' => '', 'fun' => 'aggregate_comment'),
129 _("comment 2 ") => 'skip',
130 _("Q to Pick") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
131 _("A to Pick") => array('ord' => '', 'type' => 'amount'),
132 _("Pick")=> array('insert'=>true, 'fun'=>'pick_checkbox'),
137 $table =& new_db_pager('orders_tbl', $sql, $cols);
139 $table->width = "80%";
141 display_db_pager($table);
143 function display_split_area() {
144 qty_cells('Before', 'start_offset', -5);
145 date_cells('Start', 'start_date', null, null, 0, 0, 1001);
146 date_cells('End', 'end_date', null, null, 0, 0, 1001);
147 qty_cells('After', 'end_offset', 2);
148 qty_cells('Max', 'max_quantity', 6);
149 submit_cells('Split', 'Split');
153 function display_bulk_area() {
154 date_cells('Priority', 'bulk[priority_date]', null, null, 0, 0, 1001);
155 qty_cells(null, 'bulk[priority_time]', '12:00:00');
156 date_cells('Hold', 'bulk[hold_until_date]', null, null, 0, 0, 1001);
157 date_cells('Required', 'bulk[required_date]', null, null, 0, 0, 1001);
158 date_cells('Expiry', 'bulk[expiry_date]', null, null, 0, 0, 1001);
159 text_cells('Comment', 'bulk[comment]');
160 submit_cells('Bulk', 'Bulk');
164 if($customer_id !== null) {
165 start_table(TABLESTYLE_NOBORDER);
166 display_split_area();
168 start_table(TABLESTYLE_NOBORDER);
175 submit_center_first('Update', _("Update"), '', 'default', false);
176 submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
183 span.tooltip{ display:none;}
189 color: rgb(113, 157, 171);
190 background: rgb(255, 255, 255);
191 border: 1px solid rgb(113, 157, 171);
194 :hover > span.tooltip, span.tooltip:hover {
197 span.before-tooltip {
204 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
205 <script text="text/javascript">
208 '#checkAll': function (e) {
209 e.onchange = function() {
210 $('.check_detail').prop('checked', e.checked)
211 $('.check_detail').trigger('change');
215 // find if there is a check detail box on link all input to it
217 var check = tr.find('.check_detail');
218 if(check.length != 1) return;
220 var jcheck = $(check);
221 var inputs = tr.find('input');
222 inputs.each(function(index, input) {
223 if(input === check) return;
224 $(input).prop('disabled', true)
227 check.onchange = function() {
228 inputs.each(function(index, input) {
229 var on = jcheck.prop('checked')
230 if(input == check) return;
231 $(input).prop('disabled', !on);
236 Behaviour.register(inserts);