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");
30 function get_parameter($param) {
32 if(!isset($_POST[$param])) {
33 if(isset($_GET[$param])) {
34 $value = $_GET[$param];
35 $_POST[$param] = $value;
38 else $value = $_POST[$param];
44 update_extra_order_details();
45 split_order_details();
46 bulk_update_order_details();
48 unpick_order_details();
50 process_picking_flag();
54 if ($use_popup_windows)
55 $js .= get_js_open_window(900, 600);
57 $js .= get_js_date_picker();
58 page($_SESSION['page_title'], false, false, "", $js);
60 //---------------------------------------------------------------------------------------------
62 div_start('order_line_view');
65 start_table(TABLESTYLE_NOBORDER);
68 $order_id = get_parameter('order_id');
69 text_cells_ex(_('Order #'), 'order_id', 10, null, $order_id,
70 null, null, null, true );
72 if(!isset($_POST['customer_id'])) {
73 if(isset($_GET['customer_id'])) {
74 $customer_id = $_GET['customer_id'];
75 $_POST['customer_id'] = $customer_id;
84 $customer_id = $_POST['customer_id'];
87 // find the customer owing the order
88 $result = db_query("SELECT debtor_no FROM ".TB_PREF."sales_orders WHERE order_no = $order_id AND trans_type =".ST_SALESORDER );
89 if($result && $row=db_fetch($result)) $customer_id= $row['debtor_no'];
91 customer_list_cells(_("Select a customer: "), 'customer_id', $customer_id, true, true);
93 if($customer_id != null) {
94 if(!isset($_POST['item_like'])) {
95 if(isset($_GET['item_like'])) {
96 $item_like = $_GET['item_like'];
97 $_POST['item_like'] = $item_like;
99 else $item_like = null;
101 else $item_like = $_POST['item_like'];
102 text_cells_ex('Filter Item', 'item_like', 50, null, $item_like,
103 null, null, null, true );
111 //submit_cells('SearchOrders', _("Search"),'',_('Select documents'), 'default');
117 //---------------------------------------------------------------------------------------------
118 // Orders inquiry table
121 // Display all item for one customer
122 $sql = get_order_details_extra($customer_id, 'DEF', $item_like, $order_id);
124 'detail_id' => 'skip'
125 , _("Order #") => array('fun'=>'edit_link', 'ord' => '')
126 ,_("Item Code") => array('ord' => '', 'fun' => 'item_link')
127 ,_("Quantity") => array('ord' => '', 'type' => 'qty', 'dec' => 0)
128 ,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '')
129 ,_("Before") => 'skip'
131 ,_("To Pick") => array('type' => 'qty', 'ord' => '', 'dec' => 0)
132 ,_("Priority") => array('type' => 'time', 'ord' => '')
133 ,_("Hold Until") => array('fun' => 'input_hold_until_date_details', 'ord' => '')
134 ,_("Require By") => array('fun' => 'input_required_date_details', 'ord' => '')
135 ,_("Expiry Date") => array('fun' => 'input_expiry_date_details', 'ord' => '')
136 ,_("Comment") => array('fun' => 'input_comment_details', 'ord' => '')
137 ,_("Reference") => array( 'ord' => '')
138 ,'<input id="checkAll" type="checkbox">' => array('fun' => 'input_check_details')
142 // Display all customers
143 $sql = get_order_summary('DEF');
145 'customer id' => 'skip',
146 'branch code ' => 'skip',
147 _("Customer") => array('ord' => '', 'fun' => 'customer_link'),
148 _("Branch") => array('ord' => ''),
149 _("Delivery Date") => array('ord' => '', 'type' => 'date'),
150 _("Quantity") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
151 _("Amount") => array('ord' => '', 'type' => 'amount'),
152 _("Avail. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
153 _("Avail. A") => array('ord' => '', 'type' => 'amount', 'dec' => 0),
154 _("Held. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
155 _("required date") => array('ord' => '', 'type' => 'date'),
156 _("Comments") => array('ord' => '', 'fun' => 'aggregate_comment'),
157 _("comment 2 ") => 'skip',
158 _("Q to Pick") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
159 _("A to Pick") => array('ord' => '', 'type' => 'amount'),
160 _("Pick")=> array('insert'=>true, 'fun'=>'pick_checkbox'),
165 $table =& new_db_pager('orders_tbl', $sql, $cols);
167 $table->width = "80%";
169 display_db_pager($table);
171 function display_split_area() {
172 qty_cells('Before', 'start_offset', -5);
173 date_cells('Start', 'start_date', null, null, 0, 0, 1001);
174 date_cells('End', 'end_date', null, null, 0, 0, 1001);
175 qty_cells('After', 'end_offset', 2);
176 qty_cells('Max', 'max_quantity', 6);
177 submit_cells('Split', 'Split');
181 function display_bulk_area() {
182 date_cells('Priority', 'bulk[priority_date]', null, null, 0, 0, 1001);
183 qty_cells(null, 'bulk[priority_time]', '12:00:00');
184 date_cells('Hold', 'bulk[hold_until_date]', null, null, 0, 0, 1001);
185 date_cells('Required', 'bulk[required_date]', null, null, 0, 0, 1001);
186 date_cells('Expiry', 'bulk[expiry_date]', null, null, 0, 0, 1001);
187 text_cells('Comment', 'bulk[comment]');
188 submit_cells('Bulk', 'Bulk');
191 function display_pick_area() {
192 submit_cells('Pick', 'Pick');
193 submit_cells('Unpick', 'Unpick');
197 if($customer_id !== null) {
198 start_table(TABLESTYLE_NOBORDER);
199 display_split_area();
201 start_table(TABLESTYLE_NOBORDER);
204 start_table(TABLESTYLE_NOBORDER);
211 submit_center_first('Update', _("Update"), '', 'default', false);
212 submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
219 span.tooltip{ display:none;}
225 color: rgb(113, 157, 171);
226 background: rgb(255, 255, 255);
227 border: 1px solid rgb(113, 157, 171);
230 :hover > span.tooltip, span.tooltip:hover {
233 span.before-tooltip {
245 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
246 <script text="text/javascript">
249 '#checkAll': function (e) {
250 e.onchange = function() {
251 $('.check_detail').prop('checked', e.checked)
252 $('.check_detail').trigger('change');
256 // find if there is a check detail box on link all input to it
258 var check = tr.find('.check_detail');
259 if(check.length != 1) return;
261 var jcheck = $(check);
262 var inputs = tr.find('input');
263 inputs.each(function(index, input) {
264 if(input === check) return;
265 $(input).prop('disabled', true)
268 check.onchange = function() {
269 inputs.each(function(index, input) {
270 var on = jcheck.prop('checked')
271 if(input == check) return;
272 $(input).prop('disabled', !on);
277 Behaviour.register(inserts);