Subversion-Projekte lars-tiefland.ci

Revision

Revision 848 | Revision 1380 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 848 Revision 1378
Zeile 1203... Zeile 1203...
1203
		$gewicht += $artikel['gewicht'];
1203
		$gewicht += $artikel['gewicht'];
1204
	}
1204
	}
1205
	return $gewicht;
1205
	return $gewicht;
1206
}
1206
}
Zeile -... Zeile 1207...
-
 
1207
 
-
 
1208
function select_tpl($formTagName, $options, $optionValueKey, $optionLabelKey, $preSelectValue = false,
-
 
1209
	$required = false, $onChange = null)
-
 
1210
{
-
 
1211
 
-
 
1212
	if ($required == false)
-
 
1213
	{
-
 
1214
		array_unshift($options, array($optionValueKey => false, $optionLabelKey =>
-
 
1215
				"----------- alle -----------"));
-
 
1216
	}
-
 
1217
 
-
 
1218
	$ret = '<select name="'.$formTagName.
-
 
1219
		'" onChange="$onChange" class="filterStatistik">';
-
 
1220
	foreach ($options as $option)
-
 
1221
	{
-
 
1222
		$ret .= '<option value="'.$option[$optionValueKey].'"';
-
 
1223
		if ($option[$optionValueKey] == $preSelectValue)
-
 
1224
		{
-
 
1225
			$ret .= ' selected="selected"';
-
 
1226
		}
-
 
1227
		$ret .= '>'.$option[$optionLabelKey].'</option>';
-
 
1228
 
-
 
1229
	}
-
 
1230
	$ret .= '</select>';
-
 
1231
	return $ret;
-
 
1232
}
-
 
1233
 
-
 
1234
function select($formTagName, $options, $optionValueKey, $optionLabelKey, $preSelectValue = false,
-
 
1235
	$required = false, $onChange = null)
-
 
1236
{
-
 
1237
	echo select_tpl($formTagName, $options, $optionValueKey, $optionLabelKey, $preSelectValue,
-
 
1238
		$required, $onChange);
-
 
1239
}
-
 
1240
 
-
 
1241
function getShops($shop_id = null, $filter = false, $start = 0, $ende = 0, $start_v =
-
 
1242
	0, $ende_v = 0)
-
 
1243
{
-
 
1244
 
-
 
1245
	$buffer = array();
-
 
1246
	$where = "";
-
 
1247
 
-
 
1248
	if (isset($_SESSION["datenquellen"]["shops"]) && count($_SESSION["datenquellen"]["shops"]) >
-
 
1249
		0)
-
 
1250
	{
-
 
1251
		$where = " WHERE id IN ( ".implode(",", $_SESSION["datenquellen"]["shops"]).
-
 
1252
			" )";
-
 
1253
	}
-
 
1254
 
-
 
1255
	$query = "
-
 
1256
            SELECT  *
-
 
1257
            FROM    shops
-
 
1258
        ";
-
 
1259
	$query .= (!empty($shop_id)) ? " WHERE ID = ".$shop_id : $where;
-
 
1260
 
-
 
1261
	$result = mysql_query($query) or die(mysql_errno().": ".mysql_error()."<hr>$query<hr>");
-
 
1262
	while ($zeile = mysql_fetch_assoc($result))
-
 
1263
	{
-
 
1264
		$buffer[] = $zeile;
-
 
1265
	}
-
 
1266
	if ($filter)
-
 
1267
	{
-
 
1268
 
-
 
1269
		//Shops filtern
-
 
1270
		foreach ($buffer as $id => $shop)
-
 
1271
		{
-
 
1272
			if (get_umsatz($start, $ende, $shop["ID"], 0) > 0.0 || get_umsatz($start_v, $ende_v,
-
 
1273
				$shop["ID"], 0) > 0.0)
-
 
1274
			{
-
 
1275
				$shops[] = $shop;
-
 
1276
			}
-
 
1277
		}
-
 
1278
	}
-
 
1279
	else
-
 
1280
	{
-
 
1281
		$shops = $buffer;
-
 
1282
	}
-
 
1283
	unset($buffer);
-
 
1284
	return $shops;
-
 
1285
}
-
 
1286
 
-
 
1287
function getLogistikerFilter()
-
 
1288
{
-
 
1289
	$logistiker[0] = "alle";
-
 
1290
 
-
 
1291
	$sql = "SELECT
-
 
1292
			id,
-
 
1293
			name
-
 
1294
		FROM
-
 
1295
			logistiker
-
 
1296
  	";
-
 
1297
	$result = $GLOBALS["order_db"]->query($sql);
-
 
1298
 
-
 
1299
	while ($row = $result->unbuffered_row('array'))
-
 
1300
	{
-
 
1301
		$logistiker[$row["id"]] = $row["name"];
-
 
1302
	}
-
 
1303
 
-
 
1304
	return $logistiker;
-
 
1305
}
-
 
1306
function getBestelllaender()
-
 
1307
{
-
 
1308
	global $web_rechte;
-
 
1309
	$laender[0] = "alle";
-
 
1310
	$laender[1] = "Ausland";
-
 
1311
 
-
 
1312
	if (isset($web_rechte["Warenwirtschaft"]["bestellung"]["adressbuch"]))
-
 
1313
	{
-
 
1314
 
-
 
1315
		$countryTable = "countries co";
-
 
1316
 
-
 
1317
		if ($web_rechte["online_shop"]["language"]["standardsprache"] == "UK")
-
 
1318
		{
-
 
1319
			$coFeld = "co.`name-en` AS liefer_Land";
-
 
1320
		}
-
 
1321
		else
-
 
1322
		{
-
 
1323
			$coFeld = "co.`name-ger` AS liefer_Land";
-
 
1324
		}
-
 
1325
		$query = "SELECT 
-
 
1326
				".$coFeld."
-
 
1327
    		FROM
-
 
1328
				".$countryTable."
-
 
1329
    	";
-
 
1330
		$result = $GLOBALS["db_red"]->query($query);
-
 
1331
 
-
 
1332
		while ($row = $query->unbuffered_row('array'))
-
 
1333
		{
-
 
1334
			$laender[] = $row["liefer_Land"];
-
 
1335
		}
-
 
1336
	}
-
 
1337
	else
-
 
1338
	{
-
 
1339
		$Laender = array(
-
 
1340
			"Deutschland",
-
 
1341
			"Niederlande",
-
 
1342
			"Österreich",
-
 
1343
			"Belgien",
-
 
1344
			"Luxemburg",
-
 
1345
			"Dänemark",
-
 
1346
			"Schweiz",
-
 
1347
			"Frankreich",
-
 
1348
			"Großbritannien",
-
 
1349
			"Italien",
-
 
1350
			"Spanien",
-
 
1351
			"Portugal",
-
 
1352
			"Schweden",
-
 
1353
			"Finnland",
-
 
1354
			"Norwegen",
-
 
1355
			"Irland",
-
 
1356
			"Griechenland",
-
 
1357
			"Estland",
-
 
1358
			"Lettland",
-
 
1359
			"Malta",
-
 
1360
			"Litauen",
-
 
1361
			"Polen",
-
 
1362
			"Slowenien",
-
 
1363
			"Slowakei",
-
 
1364
			"Tschechien",
-
 
1365
			"Türkei",
-
 
1366
			"Ungarn",
-
 
1367
			"Zypern",
-
 
1368
			"Kanada",
-
 
1369
			"USA",
-
 
1370
			"Kroatien",
-
 
1371
			"Bulgarien",
-
 
1372
			"Rumänien",
-
 
1373
			"Südafrika",
-
 
1374
			"Japan",
-
 
1375
			"China",
-
 
1376
			"Singapur",
-
 
1377
			"Dubai (VAE)",
-
 
1378
			);
-
 
1379
		$laender = array_merge($laender, $Laender);
-
 
1380
		if (isset($web_rechte["general"]["zeichenkodierung"]["utf-8"]))
-
 
1381
		{
-
 
1382
			foreach ($laender as $index => $landname)
-
 
1383
			{
-
 
1384
				$laender[$index] = utf8_encode($landname);
-
 
1385
			}
-
 
1386
		}
-
 
1387
		else
-
 
1388
		{
-
 
1389
			foreach ($laender as $index => $landname)
-
 
1390
			{
-
 
1391
				//Es muss dieses gemacht werden, nur wegen Marine-Sales, da dort sonst die Länder mit Umlauten nicht rauskommen.
-
 
1392
				$laender[$index] = htmlentities($landname, ENT_COMPAT, "ISO-8859-15");
-
 
1393
			}
-
 
1394
		}
-
 
1395
	}
-
 
1396
 
-
 
1397
	return $laender;
-
 
1398
}
-
 
1399
 
-
 
1400
function getBestellarten()
-
 
1401
{
-
 
1402
	global $user_rechte;
-
 
1403
	$bestellarten = false;
-
 
1404
	if (isset($user_rechte["Warenwirtschaft"]["bestellung"]["bestellart"]))
-
 
1405
	{
-
 
1406
 
-
 
1407
		if (isset($_SESSION["datenquellen"]["bestellarten"]) && count($_SESSION["datenquellen"]["bestellarten"]) >
-
 
1408
			0)
-
 
1409
		{
-
 
1410
			$where = implode(",", $_SESSION["datenquellen"]["bestellarten"]);
-
 
1411
			$sql = "SELECT * FROM bestellart WHERE id IN ( ".$where." )";
-
 
1412
		}
-
 
1413
		else
-
 
1414
		{
-
 
1415
 
-
 
1416
			$sql = "SELECT * FROM bestellart";
-
 
1417
		}
-
 
1418
		$query = $GLOBALS["order_db"]->query($sql);
-
 
1419
		if (!$query)
-
 
1420
		{
-
 
1421
			return false;
-
 
1422
		}
-
 
1423
 
-
 
1424
		while ($db = $query->unbuffered_row('array'))
-
 
1425
		{
-
 
1426
			$bestellarten[$db["id"]] = $db;
-
 
1427
		}
-
 
1428
	}
-
 
1429
	return $bestellarten;
-
 
1430
}
-
 
1431
 
-
 
1432
function getZahlungsarten()
-
 
1433
{
-
 
1434
	global $user_rechte;
-
 
1435
	$zahlungsarten = false;
-
 
1436
	if (isset($user_rechte["Warenwirtschaft"]["bestellung"]["zahlungsart"]))
-
 
1437
	{
-
 
1438
		$sql = "SELECT * FROM zahlungsarten";
-
 
1439
		$query = $GLOBALS["order_db"]->query($sql);
-
 
1440
		if (!$query)
-
 
1441
		{
-
 
1442
			return false;
-
 
1443
		}
-
 
1444
		while ($r = $query->unbuffered_row('array'))
-
 
1445
		{
-
 
1446
			$zahlungsarten[$r['id']] = $r['name'];
-
 
1447
		}
-
 
1448
	}
-
 
1449
	return $zahlungsarten;
-
 
1450
}
-
 
1451
 
-
 
1452
function getDates()
-
 
1453
{
-
 
1454
	$start = strtotime(date("Y-m-01"));
-
 
1455
	$buffer[] = array(
-
 
1456
		"datum" => strftime("%Y-%m"),
-
 
1457
		"datumText" => strftime("%B %G"),
-
 
1458
		);
-
 
1459
	for ($i = 1; $i <= 25; $i++)
-
 
1460
	{
-
 
1461
		$buffer[] = array(
-
 
1462
			"datum" => strftime("%Y-%m", strtotime("-$i months", $start)),
-
 
1463
			"datumText" => strftime("%B %Y", strtotime("-$i months", $start)),
-
 
1464
			);
-
 
1465
	}
-
 
1466
	if (strftime("%w") != 1)
-
 
1467
	{
-
 
1468
		$start = strtotime("last monday");
-
 
1469
	}
-
 
1470
	else
-
 
1471
	{
-
 
1472
		$start = time();
-
 
1473
	}
-
 
1474
	$buffer[] = array(
-
 
1475
		"datum" => strftime("%Y", $start),
-
 
1476
		"datumText" => strftime("Jahr %Y", $start),
-
 
1477
		);
-
 
1478
	$buffer[] = array(
-
 
1479
		"datum" => strftime("%Y", strtotime("-1 year", $start)),
-
 
1480
		"datumText" => strftime("Jahr %Y", strtotime("-1 year", $start)),
-
 
1481
		);
-
 
1482
	$buffer[] = array(
-
 
1483
		"datum" => strftime("%Y", strtotime("-2 year", $start)),
-
 
1484
		"datumText" => strftime("Jahr %Y", strtotime("-2 year", $start)),
-
 
1485
		);
-
 
1486
	$buffer[] = array(
-
 
1487
		"datum" => strftime("%G-%m-%dW", $start),
-
 
1488
		"datumText" => strftime("Woche %V %G", $start),
-
 
1489
		);
-
 
1490
	$buffer[] = array(
-
 
1491
		"datum" => strftime("%G-%m-%dW", strtotime("-1 week", $start)),
-
 
1492
		"datumText" => strftime("Woche %V %G", strtotime("-1 week", $start)),
-
 
1493
		);
-
 
1494
	for ($i = 2; $i <= 5; $i++)
-
 
1495
	{
-
 
1496
		$buffer[] = array(
-
 
1497
			"datum" => strftime("%G-%m-%dW", strtotime("-$i weeks", $start)),
-
 
1498
			"datumText" => strftime("Woche %V %G", strtotime("-$i weeks", $start)),
-
 
1499
			);
-
 
1500
	}
-
 
1501
	return $buffer;
-
 
1502
}
-
 
1503
 
-
 
1504
function getWeeks($year = 2008, $maxReverse = 6)
-
 
1505
{
-
 
1506
	$paramYear = $year;
-
 
1507
	$scalar = 0;
-
 
1508
	$weekNow = date("W", time());
-
 
1509
	$monthNow = date("n", time());
-
 
1510
	$dateArray = array();
-
 
1511
	$monthArray = array();
-
 
1512
 
-
 
1513
	$countedWeek = $weekNow;
-
 
1514
	$countedMonth = $monthNow;
-
 
1515
 
-
 
1516
	for ($i = $weekNow; $i > ($weekNow - $maxReverse); $i--)
-
 
1517
	{
-
 
1518
		$dateArray[$scalar]['week'] = $countedWeek;
-
 
1519
		$dateArray[$scalar]['year'] = $year;
-
 
1520
		$dateArray[$scalar]['date_string'] = "kw,".$countedWeek.",".$year;
-
 
1521
		$dateArray[$scalar]['human_string'] = "$countedWeek/$year";
-
 
1522
 
-
 
1523
		if ($countedWeek == 1)
-
 
1524
		{
-
 
1525
			$year -= 1;
-
 
1526
			$countedWeek = 1;
-
 
1527
		}
-
 
1528
		else
-
 
1529
		{
-
 
1530
			$countedWeek--;
-
 
1531
		}
-
 
1532
 
-
 
1533
		$scalar++;
-
 
1534
	}
-
 
1535
 
-
 
1536
	$year = $paramYear;
-
 
1537
 
-
 
1538
	for ($i = $monthNow; $i > ($monthNow - $maxReverse); $i--)
-
 
1539
	{
-
 
1540
		$dateArray[$scalar]['month'] = $countedMonth;
-
 
1541
		$dateArray[$scalar]['year'] = $paramYear;
-
 
1542
		$dateArray[$scalar]['date_string'] = "mon,".$countedMonth.",".$year;
-
 
1543
		$dateArray[$scalar]['human_string'] = date("M", mktime(0, 0, 0, $countedMonth, 1,
-
 
1544
			$year))." $year";
-
 
1545
 
-
 
1546
		if ($countedMonth == 1)
-
 
1547
		{
-
 
1548
			$year -= 1;
-
 
1549
			$countedMonth = 12;
-
 
1550
		}
-
 
1551
		else
-
 
1552
		{
-
 
1553
			$countedMonth--;
-
 
1554
		}
-
 
1555
 
-
 
1556
		$scalar++;
-
 
1557
	}
-
 
1558
	return $dateArray;
-
 
1559
}
1207
 
1560
 
1208
?>
1561
?>