Filter item with like and regexp.
[order_line_extra.git] / order_lines_view.php
1 <?php
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 = "../..";
13
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");
18
19 include_once("includes/order_lines.inc");
20 include_once("includes/splitter.inc");
21
22 $page_security = 'SA_ORDERLINEX_EDIT';
23 add_access_extensions();
24
25 $_SESSION['page_title'] = _($help_context = "Edit lines extra parameters");
26
27 // Process POST
28 update_extra_order_details();
29 split_order_details();
30
31
32 $js = "";
33 if ($use_popup_windows)
34         $js .= get_js_open_window(900, 600);
35 if ($use_date_picker)
36         $js .= get_js_date_picker();
37 page($_SESSION['page_title'], false, false, "", $js);
38
39 //---------------------------------------------------------------------------------------------
40
41 start_form();
42
43 start_table(TABLESTYLE_NOBORDER);
44 start_row();
45
46
47 if(!isset($_POST['customer_id'])) {
48         if(isset($_GET['customer_id'])) {
49                 $customer_id = $_GET['customer_id'];
50                 $_POST['customer_id'] = $customer_id;
51         }
52 else $customer_id = null;
53
54 }
55 else {
56         $customer_id = $_POST['customer_id'];
57 }
58 customer_list_cells(_("Select a customer: "), 'customer_id', $customer_id, true, true);
59
60 if($customer_id !== null) {
61         if(!isset($_POST['item_like'])) {
62                 if(isset($_GET['item_like'])) {
63                         $item_like = $_GET['item_like'];
64                         $_POST['item_like'] = $item_like;
65                 }
66                 else $item_like = null;
67         }
68         else $item_like = $_POST['item_like'];
69         text_cells_ex('Filter Item', 'item_like', 50, null, $item_like,
70                         null, null, null, true );
71 }
72
73
74
75
76
77 //submit_cells('SearchOrders', _("Search"),'',_('Select documents'), 'default');
78
79 end_row();
80
81 end_table(1);
82
83 //---------------------------------------------------------------------------------------------
84 //      Orders inquiry table
85 //
86 if($customer_id) {
87         $sql = get_order_details_extra($customer_id, 'DEF', $item_like);
88         $cols = array(
89                 'detail_id' => 'skip'
90                 ,       _("Order #") => array('fun'=>'view_link', 'ord' => '')
91                 ,_("Item Code") => array('ord' => '', 'fun' => 'item_link')
92                 ,_("Quantity") => array('type' => 'qty', 'dec' => 0)
93                 ,_("Available") => array('fun' => 'available_quantity', 'dec' => 0, 'ord' => '')
94                 ,_("Before") => 'skip'
95                 ,_("Priority") => array('type' => 'time', 'ord' => '')
96                 ,_("Hold Until") => array('fun' => 'input_hold_until_date_details', 'ord' => '')
97                 ,_("Require By") => array('fun' => 'input_required_date_details', 'ord' => '')
98                 ,_("Expiry Date") => array('fun' => 'input_expiry_date_details', 'ord' => '')
99         ,_("Comment") => array('fun' => 'input_comment_details', 'ord' => '')
100         );
101 }
102 else {
103         $sql = get_order_summary('DEF');
104         $cols = array(
105         'customer id' => 'skip',
106 _("Customer") => array('ord' => '', 'fun' => 'customer_link'),
107 _("Branch") => array('ord' => ''),
108 _("Delivery Date") => array('ord' => '', 'type' => 'date'),
109 _("Quantity") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
110 _("Amount") => array('ord' => '', 'type' => 'amount'),
111 _("Avail. Q") => array('ord' => '', 'type' => 'qty', 'dec' => 0),
112 _("Avail. A") => array('ord' => '', 'type' => 'amount', 'dec' => 0),
113 _("required date") => array('ord' => '', 'type' => 'date'),
114 _("Comments") => array('ord' => '', 'fun' => 'aggregate_comment'),
115 _("comment 2 ") =>  'skip'
116         );
117 }
118
119
120 $table =& new_db_pager('orders_tbl', $sql, $cols);
121
122 $table->width = "80%";
123
124 display_db_pager($table);
125
126 function display_split_area() {
127 start_table(TABLESTYLE_NOBORDER);
128 qty_cells('Before', 'start_offset', -5);
129 date_cells('Start', 'start_date');
130 date_cells('End', 'end_date');
131 qty_cells('After', 'end_offset', 2);
132 qty_cells('Max', 'max_quantity', 6);
133 submit_cells('Split', 'Split');
134 end_table();
135
136 }
137 display_split_area();
138
139
140 br(1);
141 submit_center_first('Update', _("Update"), '', 'default', false);
142 submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
143
144         end_form();
145         end_page();
146 ?>
147 <style>
148 span.tooltip{ display:none;}
149 span.tooltip {
150       position: absolute;
151                         right: -0px;
152                         top: 20px;
153       width: 200px;
154       color: rgb(113, 157, 171);
155       background: rgb(255, 255, 255);
156       border: 1px solid rgb(113, 157, 171);
157 }
158
159 :hover > span.tooltip, span.tooltip:hover {
160         display: inline;
161 }
162 span.before-tooltip {
163         color: #800;
164         font-style: italic;
165         position: relative;
166 }
167
168 </style>