Skip to content

Commit 1419f9a

Browse files
author
Sebastian Muszytowski
committed
some tweaks and things and stuff
1 parent 3f54967 commit 1419f9a

File tree

7 files changed

+66
-29
lines changed

7 files changed

+66
-29
lines changed

actions/order/printOrder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@
102102
}
103103
if($ok == 1){
104104
$latex = ob_get_clean();
105-
$html = '<html><body><script type="text/javascript">window.opener.location.reload();window.close();</script></body></html>';
105+
#$html = '<html><body><script type="text/javascript">window.opener.location.reload();window.close();</script></body></html>';
106+
$html = var_dump(Order::getOrder(11));
106107
$latexorderids = array();
107108
foreach ($limitedOrders as $order){
108109
$latexorderids[] = $order["orderid"];

config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
"logofile" => "logo.png",
44
"apiuser" => array(
55
),
6-
"alternatives_visible" => 3); ?>
6+
"laserprinter" => "SamsungML1640",
7+
"thermoprinter" => "starTSP143",
8+
"alternatives_visible" => 3); ?>

data/bon/bon.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
}
4141
\newcommand{\addorder}[3]{
4242
\changefont{cmss}{bx}{n}\large#1x\hspace{-3mm}\changefont{cmss}{bx}{n}\large#2&
43-
\changefont{cmss}{bx}{n}\large#3 \euro{}
43+
\changefont{cmss}{bx}{n}\large#3
4444
\\
4545
}
4646
\newcommand{\finishorder}{\end{longtable}}
4747
\newcommand{\total}[1]{
4848
\\
49-
\changefont{cmss}{bx}{n}\large TOTAL&\changefont{cmss}{bx}{n}\large#1 \euro{}
49+
\changefont{cmss}{bx}{n}\large TOTAL&\changefont{cmss}{bx}{n}\large#1
5050
}
5151
\newcommand{\beginfooter}{
5252
\begin{longtable}{c}

genconfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
$content = "<?php return array(\n";
1919
$content .= ' "event" => "'.helper::readline("Eventname: ").'",'."\n";
2020
$content .= ' "logofile" => "'.helper::readline("Logoname (in img/): ").'",'."\n";
21+
$content .= ' "laserprinter" => "'.helper::readline("Laserprinter Name (in CUPS): ").'",'."\n";
22+
$content .= ' "thermoprinter" => "'.helper::readline("Thermoprinter Name (in CUPS): ").'",'."\n";
2123
$content .= ' "apiuser" => array('."\n";
2224
$answer = helper::readline("Add API Users? Y/n: ");
2325
if (in_array($answer,array("Y","y","YES","yes","\n",""))) {

lib/Order.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,37 @@ public static function getOrders($serviceid = null, $status = null, $ordercount
4949

5050
}
5151

52+
public static function getOrder($orderid) {
53+
54+
$query = "select ". ProxyPizza::TABLE_NAME . ".id as pizzaid,
55+
". PizzaService::TABLE_NAME . ".phone as phone,
56+
". Pizza::TABLE_NAME . ".menunumber as menunumber,
57+
". Pizza::TABLE_NAME . ".price as realprice,
58+
". ProxyPizza::TABLE_NAME . ".name as name,
59+
". ProxyPizza::TABLE_NAME . ".price as price,
60+
". PizzaService::TABLE_NAME . ".name as service,
61+
". Order::TABLE_NAME . ".id as orderid,
62+
". Order::TABLE_NAME . ".status as status,
63+
". OrderProxy::TABLE_NAME . ".amount as amount,
64+
". OrderProxy::TABLE_NAME . ".id as orderproxyid
65+
from ". Order::TABLE_NAME ."
66+
left join ". OrderProxy::TABLE_NAME ."
67+
on ". Order::TABLE_NAME .".id = ". OrderProxy::TABLE_NAME .".orderid
68+
left join ". ProxyPizza::TABLE_NAME . "
69+
on " . OrderProxy::TABLE_NAME . ".proxypizzaid = " . ProxyPizza::TABLE_NAME . ".id
70+
left join ". PizzaService::TABLE_NAME . "
71+
on " . Order::TABLE_NAME . ".serviceid = " . PizzaService::TABLE_NAME . ".id
72+
left join ". Pizza::TABLE_NAME . "
73+
on " . Pizza::TABLE_NAME . ".proxyid = " . ProxyPizza::TABLE_NAME . ".id
74+
and ". Order::TABLE_NAME . ".serviceid = " . Pizza::TABLE_NAME . ".serviceid
75+
and ". Order::TABLE_NAME . ".id = " . $orderid;
76+
77+
$stmt = Database::pdo()->query($query);
78+
$result = $stmt->fetchAll();
79+
return $result;
80+
81+
}
82+
5283
public static function getPrintOrders($serviceid, array $orders) {
5384

5485
$ordersInStmt = array();

templates/bon/bon.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
\documentclass{bon}
1+
<?php
22

3-
\usepackage[paperwidth=72mm,paperheight=108mm,top=0mm, bottom=0mm, left=0mm, right=0mm]{geometry}
3+
echo '\documentclass{bon}'."\n";
44

5-
\begin{document}
6-
\code{<?php echo str_pad($order['number'], 4, "0", STR_PAD_LEFT); ?>}
7-
\head
8-
\startorder
9-
<?php
10-
$total = 0;
11-
foreach($order['items'] as $item){
12-
echo "\addorder{".$item['amount']."}{".$item['name'].'}{'.helper::formatPriceLaTeX($item['amount']*$item['price']).'}'."\n";
13-
$total += ($item['amount']*$item['price']);
14-
}
15-
echo '\total{'.helper::formatPriceLaTeX($total).'}'."\n";
16-
?>
17-
\finishorder
18-
<?php
19-
if(count($order['items']) <= 10){
20-
echo '\vspace{'.(120-(count($order['items'])*12)).'pt}';
21-
}
22-
?>
23-
\beginfooter
24-
\addfooter{HTTP://PIZZAPROXY.ORG}
25-
\addfooter{<?php echo date(); ?>}
26-
\finishfooter
27-
\end{document}
5+
echo '\usepackage[paperwidth=72mm,paperheight=108mm,top=0mm, bottom=0mm, left=0mm, right=0mm]{geometry}'."\n";
6+
7+
echo '\begin{document}'."\n";
8+
echo '\code{'.str_pad($order['number'], 4, "0", STR_PAD_LEFT).'}'."\n";
9+
echo '\head'."\n";
10+
echo '\startorder'.'\n';
11+
12+
$total = 0;
13+
foreach($order['items'] as $item){
14+
echo '\addorder{'.$item['amount'].'}{'.$item['name'].'}{'.helper::formatPriceLaTeX($item['amount']*$item['price']).'}'."\n";
15+
$total += ($item['amount']*$item['price']);
16+
}
17+
echo '\total{'.helper::formatPriceLaTeX($total).'}'."\n";
18+
echo '\finishorder'."\n";
19+
20+
if(count($order['items']) <= 10){
21+
echo '\vspace{'.(100-(count($order['items'])*10)).'pt}';
22+
}
23+
echo '\beginfooter'."\n";
24+
echo '\addfooter{HTTP://PIZZAPROXY.ORG}'."\n";
25+
echo '\addfooter{'.date("d.m.j G:i:s").'}'."\n";
26+
echo '\finishfooter'."\n";
27+
echo '\end{document}'."\n";
2828

templates/template.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<a href="/index.php">Home</a>
1414
<a href="/index.php?action=order">Bestellungen</a>
1515
<a href="/index.php?action=preorder">Vorbestellungen</a>
16+
<a href="/index.php?action=print">Ausdrucke</a>
1617
<a href="/index.php?action=admin">Administration</a>
1718
</div>
1819
<div style="clear: both;"></div>

0 commit comments

Comments
 (0)