$dispOrder = 0; if ($_POST['dispOrder'] !== "") { $dispOrder = intval($_POST['dispOrder']); } $cat = new \Pasteque\Category($_POST['reference'], $parent_id, $_POST['label'], $img, $dispOrder); $id = \Pasteque\CategoriesService::createCat($cat, $img); if ($id !== FALSE) { $message = \i18n("Category saved. <a href=\"%s\">Go to the category page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'category_edit', array('id' => $id))); } else { $error = \i18n("Unable to save changes"); } } } $category = NULL; if (isset($_GET['id'])) { $category = \Pasteque\CategoriesService::get($_GET['id']); } ?> <h1><?php \pi18n("Edit a category", PLUGIN_NAME); ?> </h1> <?php \Pasteque\tpl_msg_box($message, $error); ?> <form class="edit" action="<?php echo \Pasteque\get_current_url(); ?> " method="post" enctype="multipart/form-data">
<?php } ?> </table> <table cellpadding="0" cellspacing="0"> <thead> <th colspan="2"><?php \pi18n("Sales by category", PLUGIN_NAME); ?> </th> </thead> <tbody> <?php foreach ($zticket->catSales as $cat) { ?> <tr> <td><?php \pi18n(\Pasteque\CategoriesService::get($cat['id'])->label, PLUGIN_NAME); ?> </td> <td class="numeric"><?php \pi18nCurr($cat['amount']); ?> </td> </tr> <?php } ?> </table> <?php
unset($content); $content[0][] = \i18n("Taxes", PLUGIN_NAME); $content[0][] = \i18n("Base", PLUGIN_NAME); $content[0][] = \i18n("Amount", PLUGIN_NAME); $i = 1; foreach ($zticket->taxes as $tax) { $content[$i][] = \Pasteque\TaxesService::getTax($tax["id"])->label; $content[$i][] = \i18nCurr($tax['base']); $content[$i][] = \i18nCurr($tax['amount']); $i++; } if ($i == 1) { $content[1][] = \i18n("No payment", PLUGIN_NAME); $content[1][] = ""; $content[1][] = ""; } echo \Pasteque\row(\Pasteque\standardTable($content)); unset($content); $content[0][] = \i18n("Sales by category", PLUGIN_NAME); $content[0][] = \i18n("Amount", PLUGIN_NAME); $i = 1; foreach ($zticket->catSales as $cat) { $content[$i][] = \i18n(\Pasteque\CategoriesService::get($cat["id"]->label, PLUGIN_NAME)); $content[$i][] = $cat["amount"]; $i++; } if ($i == 1) { $content[1][] = \i18n("No payment", PLUGIN_NAME); $content[1][] = ""; } echo \Pasteque\row(\Pasteque\standardTable($content));