Subversion-Projekte lars-tiefland.ci

Revision

Revision 1379 | Revision 1391 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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
	{
1388 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
			);
1379 lars 45
 
1388 lars 46
		$ausgabearten_sel = select_tpl("filter[ausgabeart]", $ausgabearten, "id", "name",
47
			$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, "id",
55
				"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);
1379 lars 62
 
1388 lars 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
			);
1379 lars 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("status1", $filter["status1"]);
126
		$this->smarty->assign("dokument", $filter["dokument"]);
127
		$this->smarty->assign("bezahlstatus", $filter["bezahlstatus"]);
128
		$this->smarty->assign("versandstatus", $filter["versandstatus"]);
129
		$this->smarty->assign("user_rechte", $GLOBALS["user_rechte"]);
130
		$this->smarty->assign("web_rechte", $GLOBALS["web_rechte"]);
131
		$this->smarty->assign("web_settings", $web_settings);
132
		$this->smarty->assign("shops", $shops_sel);
133
		$this->smarty->assign("filter_maske", $filter_maske);
134
		$this->smarty->assign("laender_filter", $laender_filter);
135
		$this->smarty->assign("laender_filter_sel", $filter["laender"]);
136
 
137
		if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"]))
138
		{
139
			if ($GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"])
140
			{
141
				list($shortline1_name, $shortline1_size) = explode(";", $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["shortline1"]);
142
			}
143
			else
144
			{
145
				$shortline1_name = "Shortline1:";
146
				$shortline1_size = 10;
147
			}
148
 
149
			$this->smarty->assign("shortline1_size", $shortline1_size);
150
			$this->smarty->assign("shortline1_name", $shortline1_name);
151
		}
152
		if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["status1"]))
153
		{
154
			if ($GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["status1"])
155
			{
156
				list($status1_name, $status1_option_str) = explode(";", $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["status1"],
157
					2);
158
				$status1_options_arr = explode(";", $status1_option_str);
159
				$status1_options = array("");
160
				$status1_options_filter = array("alle");
161
				foreach ($status1_options_arr as $option)
162
				{
163
					$status1_options[$option] = $option;
164
					$status1_options_filter[$option] = $option;
165
				}
166
				//$status1_options = array_merge( $status1_options );
167
			}
168
			$this->smarty->assign("status1_name", $status1_name);
169
			$this->smarty->assign("status1_options", $status1_options);
170
			$this->smarty->assign("status1_options_filter", $status1_options_filter);
171
		}
172
		// Versandstatus
173
		if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["versandstatus"]))
174
		{
175
			$versandstatus_options_filter = array(
176
				"alle",
177
				"offen",
178
				"freigegeben",
179
				"versand",
180
				"ohne",
181
				"offen+ohne",
182
				);
183
			$this->smarty->assign("versandstatus_options_filter", $versandstatus_options_filter);
184
		}
185
 
186
		$start_date = date('Y-m-d', strtotime("-10 days"));
187
		$i = 0;
188
		$versanddatum_options_filter[''] = 'Alle';
189
		while ($i <= 30)
190
		{
191
			$i = $i + 1;
192
			$date = new DateTime($start_date);
193
			$date->modify('+'.$i.' day');
194
			$versanddatum_options_filter[$date->format('Y-m-d')] = $date->format('d.m.Y');
195
		}
196
		$this->smarty->assign("versanddatum_options_filter", $versanddatum_options_filter);
197
 
198
		// Bezahlstatus SELECT BOX
199
		if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bezahlstatus"]["bezahlstatus"]))
200
		{
201
			$bezahlstatus_options_filter[] = "alle";
202
			$bezahlstatus_options_filter[] = "offen";
203
			$bezahlstatus_options_filter[] = "bezahlt";
204
			if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bezahlstatus"]["vorbezahlt_setzen"]))
205
			{
206
				$bezahlstatus_options_filter[] = "vorbezahlt";
207
				$bezahlstatus_options_filter[] = "bezahlt und vorbezahlt";
208
			}
209
 
210
			$this->smarty->assign("bezahlstatus_name", $bezahlstatus_name);
211
			$this->smarty->assign("bezahlstatus_options", $bezahlstatus_options);
212
			$this->smarty->assign("bezahlstatus_options_filter", $bezahlstatus_options_filter);
213
		}
214
		if (isset($_POST["anker"]))
215
		{
216
			$this->smarty->assign("anker", $_POST["anker"] + 1);
217
		}
1133 lars 218
		$orders = $this->order->get_list();
1329 lars 219
		$this->smarty->assign('anker', $anker);
1131 lars 220
		$this->smarty->assign('orders', $orders);
221
		$this->smarty->view('orders.tpl');
222
	}
223
 
224
	/**
225
	 * User::edit()
226
	 *
227
	 * @param mixed $id
228
	 * @return void
229
	 */
230
	public function edit($id = null)
231
	{
1271 lars 232
		$daten["artikel_stati"] = array(
233
			array(
234
				"name" => "offen",
235
				"short" => "O",
236
				"class" => "status_red"),
237
			array(
238
				"name" => "in Bearbeitung",
239
				"short" => "B",
240
				"class" => "status_yellow",
241
				),
242
			array(
243
				"name" => "reserviert",
244
				"short" => "R",
245
				"class" => "status_blue",
246
				),
247
			array(
248
				"name" => "erledigt",
249
				"short" => "E",
250
				"class" => "status_green",
251
				),
252
			array(
253
				"name" => "abgeschlossen",
254
				"short" => "A",
255
				"class" => "status_white",
256
				),
257
			);
258
		$daten["rechnung_stati"] = array(
259
			array(
260
				"name" => "schreiben",
261
				"short" => "S",
262
				"class" => "status_red"),
263
			array(
264
				"name" => "geschrieben",
265
				"short" => "G",
266
				"class" => "status_yellow",
267
				),
268
			array(
269
				"name" => "bezahlt",
270
				"short" => "B",
271
				"class" => "status_green",
272
				),
273
			);
274
		$daten["lieferschein_stati"] = array(
275
			array(
276
				"name" => "schreiben",
277
				"short" => "S",
278
				"class" => "status_yellow"),
279
			array(
280
				"name" => "geschrieben",
281
				"short" => "G",
282
				"class" => "status_green",
283
				),
284
			array(
285
				"name" => "offen",
286
				"short" => "O",
287
				"class" => "status_red",
288
				),
289
			);
290
		$daten["mahnung_stati"] = array(
291
			array(
292
				"name" => "mahnung1",
293
				"short" => "1",
294
				"class" => "status_green"),
295
			array(
296
				"name" => "mahnung2",
297
				"short" => "2",
298
				"class" => "status_yellow",
299
				),
300
			array(
301
				"name" => "mahnung3",
302
				"short" => "3",
303
				"class" => "status_red",
304
				),
305
			);
306
		$daten["garantie_stati"] = array(
307
			array(
308
				"name" => "eingereicht",
309
				"short" => "E",
310
				"class" => "status_red"),
311
			array(
312
				"name" => "abgeschlossen",
313
				"short" => "A",
314
				"class" => "status_green",
315
				),
316
			);
317
		// Modul dokumente
1288 lars 318
		$preise_anzeigen = 1;
319
		if (isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["preise_anzeigen"]))
320
		{
321
			if (!isset($GLOBALS["user_rechte"]["Warenwirtschaft"]["bestellung"]["preise_anzeigen"]))
322
			{
323
				// "<br>für bestimmte user preis verbergen";
324
				$preise_anzeigen = 0;
325
			}
326
		}
1172 lars 327
		$order = $this->order->get($id);
1293 lars 328
		$this->smarty->assign('title', 'Bestellung bearbeiten');
1289 lars 329
		$this->smarty->assign('preise_anzeigen', $preise_anzeigen);
1172 lars 330
		$this->smarty->assign('order', $order);
1271 lars 331
		$this->smarty->assign('daten', $daten);
1172 lars 332
		$this->smarty->view('single_order.tpl');
1131 lars 333
	}
334
 
335
	public function save()
336
	{
1336 lars 337
		$this->order->save();
1131 lars 338
	}
1172 lars 339
 
1131 lars 340
	public function del($id = null)
341
	{
342
	}
343
 
344
}