| 1131 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* User
|
|
|
5 |
*
|
|
|
6 |
* @package
|
|
|
7 |
* @author WebanOS CI
|
|
|
8 |
* @copyright Lars Tiefland
|
|
|
9 |
* @version 2016
|
|
|
10 |
* @access public
|
|
|
11 |
*/
|
|
|
12 |
class Order extends CI_Controller
|
|
|
13 |
{
|
|
|
14 |
|
|
|
15 |
public function __construct()
|
|
|
16 |
{
|
|
|
17 |
parent::__construct();
|
|
|
18 |
$this->load->model('order_model', 'order');
|
|
|
19 |
}
|
|
|
20 |
/**
|
|
|
21 |
* User::index()
|
|
|
22 |
*
|
|
|
23 |
* @return
|
|
|
24 |
*/
|
| 1329 |
lars |
25 |
public function index($anker = '')
|
| 1131 |
lars |
26 |
{
|
| 1379 |
lars |
27 |
$ausgabearten = array(
|
|
|
28 |
array(
|
|
|
29 |
"id" => 0,
|
|
|
30 |
"name" => "Bestellung",
|
|
|
31 |
),
|
|
|
32 |
array(
|
|
|
33 |
"id" => 1,
|
|
|
34 |
"name" => "Artikel",
|
|
|
35 |
),
|
|
|
36 |
array(
|
|
|
37 |
"id" => 2,
|
|
|
38 |
"name" => "Schnelleditor",
|
|
|
39 |
),
|
|
|
40 |
array(
|
|
|
41 |
"id" => 3,
|
|
|
42 |
"name" => "Bestelldetail",
|
|
|
43 |
),
|
|
|
44 |
);
|
|
|
45 |
|
|
|
46 |
$ausgabearten_sel = select_tpl( "filter[ausgabeart]", $ausgabearten, "id",
|
|
|
47 |
"name", $filter["ausgabeart"], true );
|
|
|
48 |
$bestellarten_sel = "";
|
|
|
49 |
if ( is_array( $bestellarten ) )
|
|
|
50 |
{
|
|
|
51 |
$showAlle = ( isset( $user_rechte["Warenwirtschaft"]["bestellung"]["bestellart"] ) &&
|
|
|
52 |
isset( $_SESSION["datenquellen"]["bestellarten"] ) && count( $_SESSION["datenquellen"]["bestellarten"] ) <=
|
|
|
53 |
1 );
|
|
|
54 |
$bestellarten_sel = select_tpl( "filter[bestellart_id]", $bestellarten,
|
|
|
55 |
"id", "name", $filter["bestellart_id"], $showAlle );
|
|
|
56 |
}
|
|
|
57 |
$shops_neu = getShops();
|
|
|
58 |
$showAlle = ( isset( $_SESSION["datenquellen"]["shops"] ) && count( $_SESSION["datenquellen"]["shops"] ) <=
|
|
|
59 |
1 );
|
|
|
60 |
$shops_sel = select_tpl( "filter[shopID]", $shops_neu, "ID", "Name", $filter["shopID"],
|
|
|
61 |
$showAlle );
|
|
|
62 |
|
|
|
63 |
$stati = array(
|
|
|
64 |
"" => "alle",
|
|
|
65 |
"op_ib" => "offen und in B.",
|
|
|
66 |
"op_ib_re" => "of.,in B.u.res.",
|
|
|
67 |
"op" => "offene Posten",
|
|
|
68 |
"ib" => "in Bearbeitung",
|
|
|
69 |
"re" => "reserviert",
|
|
|
70 |
"er" => "erledigt",
|
|
|
71 |
"ab" => "abgeschlossen",
|
|
|
72 |
);
|
|
|
73 |
$zeiten = array(
|
|
|
74 |
"alle",
|
|
|
75 |
"heute",
|
|
|
76 |
"gestern",
|
|
|
77 |
"vorgestern",
|
|
|
78 |
"lfd. Woche",
|
|
|
79 |
"letzte Woche",
|
|
|
80 |
strftime( "%B %G" ),
|
|
|
81 |
strftime( "%B %G", strtotime( "-1 month" ) ),
|
|
|
82 |
strftime( "%B %G", strtotime( "-2 months" ) ),
|
|
|
83 |
strftime( "%B %G", strtotime( "-3 months" ) ),
|
|
|
84 |
strftime( "%B %G", strtotime( "-4 months" ) ),
|
|
|
85 |
strftime( "%B %G", strtotime( "-5 months" ) ),
|
|
|
86 |
strftime( "%B %G", strtotime( "-6 months" ) ),
|
|
|
87 |
strftime( "%B %G", strtotime( "-7 months" ) ),
|
|
|
88 |
strftime( "%Y", time() ),
|
|
|
89 |
strftime( "%Y", strtotime( "-1 year" ) ) );
|
|
|
90 |
$rstati = array(
|
|
|
91 |
"" => "alle",
|
|
|
92 |
"S" => "schreiben",
|
|
|
93 |
"G" => "geschrieben",
|
|
|
94 |
"B" => "bezahlt",
|
|
|
95 |
"O" => "ohne",
|
|
|
96 |
);
|
|
|
97 |
|
|
|
98 |
$laender_filter = getBestelllaender();
|
|
|
99 |
|
|
|
100 |
if (isset($GLOBALS["web_rechte"]["Warenwirtschaft"]["logistiker"]["logistiker"]))
|
|
|
101 |
{
|
|
|
102 |
$logistiker_filter = getLogistikerFilter();
|
|
|
103 |
$this->smarty->assign("logistiker_filter", $logistiker_filter);
|
|
|
104 |
$this->smarty->assign("logistiker_filter_sel", $filter["logistiker"]);
|
|
|
105 |
}
|
|
|
106 |
// Variablen zu Template zuweisen
|
|
|
107 |
$this->smarty->assign("stati", $stati);
|
|
|
108 |
$this->smarty->assign("stati_sel", $filter["status"]);
|
|
|
109 |
$this->smarty->assign("rstati", $rstati);
|
|
|
110 |
$this->smarty->assign("rstati_sel", $filter["rechnungsstatus"]);
|
|
|
111 |
$this->smarty->assign("zeiten", $zeiten);
|
|
|
112 |
$this->smarty->assign("zeiten_sel", $filter["zeit"]);
|
|
|
113 |
$this->smarty->assign("bStatus", $bStatus);
|
|
|
114 |
$this->smarty->assign("bStatus_sel", $filter["bStatus"]);
|
|
|
115 |
$this->smarty->assign("ausgabearten", $ausgabearten_sel);
|
|
|
116 |
$this->smarty->assign("bestellarten", $bestellarten_sel);
|
|
|
117 |
$this->smarty->assign("bestellart", $bestellart);
|
|
|
118 |
$this->smarty->assign("bestellung_ID", $filter["bestellung_ID"]);
|
|
|
119 |
$this->smarty->assign("fremd_ID", $filter["fremd_ID"]);
|
|
|
120 |
$this->smarty->assign("artikelsuche", $filter["artikelsuche"]);
|
|
|
121 |
$this->smarty->assign("kundensuche", $filter["kundensuche"]);
|
|
|
122 |
$this->smarty->assign("paketnummer", $filter["paketnummer"]);
|
|
|
123 |
$this->smarty->assign("start", $filter["start"]);
|
|
|
124 |
$this->smarty->assign("shortline1", $filter["shortline1"]);
|
|
|
125 |
$this->smarty->assign("webs", $webs);
|
|
|
126 |
$this->smarty->assign("status1", $filter["status1"]);
|
|
|
127 |
$this->smarty->assign("dokument", $filter["dokument"]);
|
|
|
128 |
$this->smarty->assign("bezahlstatus", $filter["bezahlstatus"]);
|
|
|
129 |
$this->smarty->assign("versandstatus", $filter["versandstatus"]);
|
|
|
130 |
$this->smarty->assign("user_rechte", $GLOBALS["user_rechte"]);
|
|
|
131 |
$this->smarty->assign("web_rechte", $GLOBALS["web_rechte"]);
|
|
|
132 |
$this->smarty->assign("web_settings", $web_settings);
|
|
|
133 |
$this->smarty->assign("shops", $shops_sel);
|
|
|
134 |
$this->smarty->assign("filter_maske", $filter_maske);
|
|
|
135 |
$this->smarty->assign("laender_filter", $laender_filter);
|
|
|
136 |
$this->smarty->assign("laender_filter_sel", $filter["laender"]);
|
|
|
137 |
|
|
|
138 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"]))
|
|
|
139 |
{
|
|
|
140 |
if ($GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"])
|
|
|
141 |
{
|
|
|
142 |
list($shortline1_name, $shortline1_size) = explode(";", $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"]);
|
|
|
143 |
}
|
|
|
144 |
else
|
|
|
145 |
{
|
|
|
146 |
$shortline1_name = "Shortline1:";
|
|
|
147 |
$shortline1_size = 10;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
$this->smarty->assign("shortline1_size", $shortline1_size);
|
|
|
151 |
$this->smarty->assign("shortline1_name", $shortline1_name);
|
|
|
152 |
}
|
|
|
153 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["status1"]))
|
|
|
154 |
{
|
|
|
155 |
if ($GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["status1"])
|
|
|
156 |
{
|
|
|
157 |
list($status1_name, $status1_option_str) = explode(";", $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["status1"],
|
|
|
158 |
2);
|
|
|
159 |
$status1_options_arr = explode(";", $status1_option_str);
|
|
|
160 |
$status1_options = array("");
|
|
|
161 |
$status1_options_filter = array("alle");
|
|
|
162 |
foreach ($status1_options_arr as $option)
|
|
|
163 |
{
|
|
|
164 |
$status1_options[$option] = $option;
|
|
|
165 |
$status1_options_filter[$option] = $option;
|
|
|
166 |
}
|
|
|
167 |
//$status1_options = array_merge( $status1_options );
|
|
|
168 |
}
|
|
|
169 |
$this->smarty->assign("status1_name", $status1_name);
|
|
|
170 |
$this->smarty->assign("status1_options", $status1_options);
|
|
|
171 |
$this->smarty->assign("status1_options_filter", $status1_options_filter);
|
|
|
172 |
}
|
|
|
173 |
// Versandstatus
|
|
|
174 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["versandstatus"]))
|
|
|
175 |
{
|
|
|
176 |
$versandstatus_options_filter = array(
|
|
|
177 |
"alle",
|
|
|
178 |
"offen",
|
|
|
179 |
"freigegeben",
|
|
|
180 |
"versand",
|
|
|
181 |
"ohne",
|
|
|
182 |
"offen+ohne",
|
|
|
183 |
);
|
|
|
184 |
$this->smarty->assign("versandstatus_options_filter", $versandstatus_options_filter);
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
$start_date = date('Y-m-d', strtotime("-10 days"));
|
|
|
188 |
$i = 0;
|
|
|
189 |
$versanddatum_options_filter[''] = 'Alle';
|
|
|
190 |
while ($i <= 30)
|
|
|
191 |
{
|
|
|
192 |
$i = $i + 1;
|
|
|
193 |
$date = new DateTime($start_date);
|
|
|
194 |
$date->modify('+'.$i.' day');
|
|
|
195 |
$versanddatum_options_filter[$date->format('Y-m-d')] = $date->format('d.m.Y');
|
|
|
196 |
}
|
|
|
197 |
$this->smarty->assign("versanddatum_options_filter", $versanddatum_options_filter);
|
|
|
198 |
|
|
|
199 |
// Bezahlstatus SELECT BOX
|
|
|
200 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bezahlstatus"]["bezahlstatus"]))
|
|
|
201 |
{
|
|
|
202 |
$bezahlstatus_options_filter[] = "alle";
|
|
|
203 |
$bezahlstatus_options_filter[] = "offen";
|
|
|
204 |
$bezahlstatus_options_filter[] = "bezahlt";
|
|
|
205 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bezahlstatus"]["vorbezahlt_setzen"]))
|
|
|
206 |
{
|
|
|
207 |
$bezahlstatus_options_filter[] = "vorbezahlt";
|
|
|
208 |
$bezahlstatus_options_filter[] = "bezahlt und vorbezahlt";
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
$this->smarty->assign("bezahlstatus_name", $bezahlstatus_name);
|
|
|
212 |
$this->smarty->assign("bezahlstatus_options", $bezahlstatus_options);
|
|
|
213 |
$this->smarty->assign("bezahlstatus_options_filter", $bezahlstatus_options_filter);
|
|
|
214 |
}
|
|
|
215 |
if (isset($_POST["anker"]))
|
|
|
216 |
{
|
|
|
217 |
$this->smarty->assign("anker", $_POST["anker"] + 1);
|
|
|
218 |
}
|
| 1133 |
lars |
219 |
$orders = $this->order->get_list();
|
| 1329 |
lars |
220 |
$this->smarty->assign('anker', $anker);
|
| 1131 |
lars |
221 |
$this->smarty->assign('orders', $orders);
|
|
|
222 |
$this->smarty->view('orders.tpl');
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
/**
|
|
|
226 |
* User::edit()
|
|
|
227 |
*
|
|
|
228 |
* @param mixed $id
|
|
|
229 |
* @return void
|
|
|
230 |
*/
|
|
|
231 |
public function edit($id = null)
|
|
|
232 |
{
|
| 1271 |
lars |
233 |
$daten["artikel_stati"] = array(
|
|
|
234 |
array(
|
|
|
235 |
"name" => "offen",
|
|
|
236 |
"short" => "O",
|
|
|
237 |
"class" => "status_red"),
|
|
|
238 |
array(
|
|
|
239 |
"name" => "in Bearbeitung",
|
|
|
240 |
"short" => "B",
|
|
|
241 |
"class" => "status_yellow",
|
|
|
242 |
),
|
|
|
243 |
array(
|
|
|
244 |
"name" => "reserviert",
|
|
|
245 |
"short" => "R",
|
|
|
246 |
"class" => "status_blue",
|
|
|
247 |
),
|
|
|
248 |
array(
|
|
|
249 |
"name" => "erledigt",
|
|
|
250 |
"short" => "E",
|
|
|
251 |
"class" => "status_green",
|
|
|
252 |
),
|
|
|
253 |
array(
|
|
|
254 |
"name" => "abgeschlossen",
|
|
|
255 |
"short" => "A",
|
|
|
256 |
"class" => "status_white",
|
|
|
257 |
),
|
|
|
258 |
);
|
|
|
259 |
$daten["rechnung_stati"] = array(
|
|
|
260 |
array(
|
|
|
261 |
"name" => "schreiben",
|
|
|
262 |
"short" => "S",
|
|
|
263 |
"class" => "status_red"),
|
|
|
264 |
array(
|
|
|
265 |
"name" => "geschrieben",
|
|
|
266 |
"short" => "G",
|
|
|
267 |
"class" => "status_yellow",
|
|
|
268 |
),
|
|
|
269 |
array(
|
|
|
270 |
"name" => "bezahlt",
|
|
|
271 |
"short" => "B",
|
|
|
272 |
"class" => "status_green",
|
|
|
273 |
),
|
|
|
274 |
);
|
|
|
275 |
$daten["lieferschein_stati"] = array(
|
|
|
276 |
array(
|
|
|
277 |
"name" => "schreiben",
|
|
|
278 |
"short" => "S",
|
|
|
279 |
"class" => "status_yellow"),
|
|
|
280 |
array(
|
|
|
281 |
"name" => "geschrieben",
|
|
|
282 |
"short" => "G",
|
|
|
283 |
"class" => "status_green",
|
|
|
284 |
),
|
|
|
285 |
array(
|
|
|
286 |
"name" => "offen",
|
|
|
287 |
"short" => "O",
|
|
|
288 |
"class" => "status_red",
|
|
|
289 |
),
|
|
|
290 |
);
|
|
|
291 |
$daten["mahnung_stati"] = array(
|
|
|
292 |
array(
|
|
|
293 |
"name" => "mahnung1",
|
|
|
294 |
"short" => "1",
|
|
|
295 |
"class" => "status_green"),
|
|
|
296 |
array(
|
|
|
297 |
"name" => "mahnung2",
|
|
|
298 |
"short" => "2",
|
|
|
299 |
"class" => "status_yellow",
|
|
|
300 |
),
|
|
|
301 |
array(
|
|
|
302 |
"name" => "mahnung3",
|
|
|
303 |
"short" => "3",
|
|
|
304 |
"class" => "status_red",
|
|
|
305 |
),
|
|
|
306 |
);
|
|
|
307 |
$daten["garantie_stati"] = array(
|
|
|
308 |
array(
|
|
|
309 |
"name" => "eingereicht",
|
|
|
310 |
"short" => "E",
|
|
|
311 |
"class" => "status_red"),
|
|
|
312 |
array(
|
|
|
313 |
"name" => "abgeschlossen",
|
|
|
314 |
"short" => "A",
|
|
|
315 |
"class" => "status_green",
|
|
|
316 |
),
|
|
|
317 |
);
|
|
|
318 |
// Modul dokumente
|
| 1288 |
lars |
319 |
$preise_anzeigen = 1;
|
|
|
320 |
if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["preise_anzeigen"]))
|
|
|
321 |
{
|
|
|
322 |
if (!isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["preise_anzeigen"]))
|
|
|
323 |
{
|
|
|
324 |
// "<br>für bestimmte user preis verbergen";
|
|
|
325 |
$preise_anzeigen = 0;
|
|
|
326 |
}
|
|
|
327 |
}
|
| 1172 |
lars |
328 |
$order = $this->order->get($id);
|
| 1293 |
lars |
329 |
$this->smarty->assign('title', 'Bestellung bearbeiten');
|
| 1289 |
lars |
330 |
$this->smarty->assign('preise_anzeigen', $preise_anzeigen);
|
| 1172 |
lars |
331 |
$this->smarty->assign('order', $order);
|
| 1271 |
lars |
332 |
$this->smarty->assign('daten', $daten);
|
| 1172 |
lars |
333 |
$this->smarty->view('single_order.tpl');
|
| 1131 |
lars |
334 |
}
|
|
|
335 |
|
|
|
336 |
public function save()
|
|
|
337 |
{
|
| 1336 |
lars |
338 |
$this->order->save();
|
| 1131 |
lars |
339 |
}
|
| 1172 |
lars |
340 |
|
| 1131 |
lars |
341 |
public function del($id = null)
|
|
|
342 |
{
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
}
|