$readers = get_all_readers(); $response = array("version" => $version, "response" => $readers); echo json_encode($response); } elseif ('payments' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $payment = get_all_payments_by_uid($_GET['id']); $response = array("version" => $version, "response" => $payment); echo json_encode($response); } elseif ('payments' == $_GET['uri']) { send_headers(); $payments = get_all_payments(); $response = array("version" => $version, "response" => $payments); echo json_encode($response); } elseif ('snacks' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $snack = get_snack_by_id($_GET['id']); $response = array("version" => $version, "response" => $snack); echo json_encode($response); } elseif ('snacks' == $_GET['uri']) { send_headers(); $snacks = get_all_snacks(); $response = array("version" => $version, "response" => $snacks); echo json_encode($response); } elseif ('jobs' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $jobs = get_jobs_by_uid($_GET['id']); $response = array("version" => $version, "response" => $jobs); echo json_encode($response); } elseif ('equipments' == $_GET['uri'] && isset($_GET['id'])) { send_headers(); $equipment = get_equipment_by_id($_GET['id']);
function get_money_spent_this_month_by_uid($uid) { $orders = array(); $orders = get_all_orders_this_month_by_uid($uid); $money_spent_this_month = 0.0; foreach ($orders as $order) { $snack = get_snack_by_id($order['snack']); $money_spent_this_month += intval($order['quantity']) * floatval($snack['price']); } return $money_spent_this_month; }
function modify_snack_action($session_uid, $id) { // needed to set the tab active $extras_active = true; $snacks_active = true; //check if the user is admin if (user_is_admin($session_uid)) { $snack = get_snack_by_id($id); require 'templates/snack.php'; } else { require 'templates/login.php'; } }
<?php } ?> <!--<a href="soda?uid=<?php echo $client['uid']; ?> "><button class="ink-button push-right"><i class="icon-beer"></i> <?php $soda = get_snack_by_id(10); echo _("Coca-Cola Zero") . ' ' . money_format('%!n€', $soda['price']); ?> </button></a> <a href="coffee?uid=<?php echo $client['uid']; ?> "><button class="ink-button push-right"><i class="icon-coffee"></i> <?php $coffee = get_snack_by_id(2); echo _("Café express") . ' ' . money_format('%!n€', $coffee['price']); ?> </button></a> --> <form id="orderForm" class="ink-form" method="post" action="dashboard"> <h3><?php echo $client['firstname'] . ' ' . $client['lastname']; ?> </h3> <div style="margin: 0;"><?php echo _('Solde : ') . money_format('%!n€', $client['balance']); ?> </div> <fieldset class="vertical-space"> <input type="hidden" name="client" id="client" value="<?php
echo $order['uid']; ?> </td> <td><span class="tooltip" data-tip-text="<?php echo $order['reader']; ?> " data-tip-where="up" data-tip-color="black"><?php if ($order['reader'] == 0) { echo _('Interface web'); } else { echo $order['location']; } ?> </span></td> <td><?php $snack = get_snack_by_id($order['snack']); echo $snack['description_' . getenv('LANG')]; ?> </td> <td><?php echo $order['quantity']; ?> </td> </tr> <?php } ?> </tbody> </table> <nav class="ink-navigation"><ul class="pagination rounded shadowed grey"></ul></nav> </div>