//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace BaseCashes;

$message = NULL;
$error = NULL;
$pdo = \Pasteque\PDOBuilder::getPDO();
$sessId = $_GET['id'];
$session = \Pasteque\CashesService::get($sessId);
$zticket = \Pasteque\CashesService::getZTicket($sessId);
$crSrv = new \Pasteque\CashRegistersService();
$cashRegister = $crSrv->get($session->cashRegisterId);
if ($session->isClosed()) {
    $title = \i18n("Closed session", PLUGIN_NAME);
} else {
    $title = \i18n("Active session", PLUGIN_NAME);
}
?>

<h1><?php 
echo $title;
?>
</h1>

<table cellpadding="0" cellspacing="0">
	<thead>
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
// category_edit action
namespace BaseCashRegisters;

$message = null;
$error = null;
$srv = new \Pasteque\CashRegistersService();
if (isset($_POST['id']) && isset($_POST['label'])) {
    // Update cash register
    $cashReg = \Pasteque\CashRegister::__build($_POST['id'], $_POST['label'], $_POST['locationId']);
    if ($srv->update($cashReg)) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
} else {
    if (isset($_POST['label'])) {
        // New cash register
        $cashReg = new \Pasteque\CashRegister($_POST['label'], $_POST['locationId']);
        $id = $srv->create($cashReg);
        if ($id !== false) {
            $message = \i18n("Cash register saved. <a href=\"%s\">Go to the cash register page</a>.", PLUGIN_NAME, \Pasteque\get_module_url_action(PLUGIN_NAME, 'cashregister_edit', array('id' => $id)));
Example #3
0
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    Pastèque is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with Pastèque.  If not, see <http://www.gnu.org/licenses/>.
namespace BaseCashRegisters;

$message = null;
$error = null;
$srv = new \Pasteque\CashRegistersService();
if (isset($_GET['delete-cashreg'])) {
    if ($srv->delete($_GET['delete-cashreg'])) {
        $message = \i18n("Changes saved");
    } else {
        $error = \i18n("Unable to save changes");
    }
}
$cashRegs = $srv->getAll();
?>
<h1><?php 
\pi18n("Cash registers", PLUGIN_NAME);
?>
</h1>

<?php