diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 8dd3eca5e33..a6f68b31330 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -54,6 +54,12 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortfield) $sortfield = 'rowid'; if (!$sortorder) $sortorder = 'ASC'; +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist'; + +if ($contextpage == 'takepos') +{ + $_GET['optioncss'] = 'print'; +} // Security check if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) @@ -178,6 +184,13 @@ elseif ($action == "add") $action = "view"; } } + if ($contextpage == 'takepos'){ + print " + "; + exit; + } } if ($action == "valid") // validate = close @@ -211,6 +224,13 @@ if ($action == "valid") // validate = close $db->commit(); } + if ($contextpage == 'takepos'){ + print " + "; + exit; + } $action = "view"; } @@ -364,6 +384,7 @@ if ($action == "create" || $action == "start" || $action == 'close') print '
'; print ''; + if ($contextpage == 'takepos') print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; @@ -668,7 +689,7 @@ if (empty($action) || $action == "view" || $action == "close") if ($object->status == CashControl::STATUS_DRAFT) { - print '
'.$langs->trans('Close').'
'; + print '
'.$langs->trans('Close').'
'; print '
'.$langs->trans('Delete').'
'; } else { @@ -677,10 +698,11 @@ if (empty($action) || $action == "view" || $action == "close") print ''; - print '
'; + if ($contextpage != 'takepos') print '
'; } else { print ''; print ''; + if ($contextpage == 'takepos') print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index c492417e2a8..f2bab886b64 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -97,4 +97,7 @@ TakeposNumpadUsePaymentIcon=Use payment icon on numpad CashDeskRefNumberingModules=Numbering module for cash desk CashDeskGenericMaskCodes6 =
{TN} tag is used to add the terminal number TakeposGroupSameProduct=Group same products lines -StartAParallelSale=Start a new parallel sale \ No newline at end of file +StartAParallelSale=Start a new parallel sale +ControlCashOpening=Control cash box at opening pos +CloseCashFence=Close cash fence +CashReport=Cash report \ No newline at end of file diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index d21936bdaef..bdc40934a16 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -370,6 +370,13 @@ if (is_array($formmail->lines_model)) { print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename, $conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE, 'None', 1, 0, '', 0, 0, 0, '', '', 1); print "\n"; +// Control cash box at opening pos +print ''; +print $langs->trans('ControlCashOpening'); +print ''; +print ajax_constantonoff("TAKEPOS_CONTROL_CASH_OPENING", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + // Numbering module //print ''; //print $langs->trans("BillsNumberingModule"); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 9f3a259e441..1012e62f65d 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -50,7 +50,7 @@ if ($setterminal > 0) $_SESSION["urlfrom"] = '/takepos/index.php'; -$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); +$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks")); $categorie = new Categorie($db); @@ -661,6 +661,21 @@ function MoreActions(totalactions){ } } +function ControlCashOpening() +{ + $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?action=create&contextpage=takepos", width:"90%", height:"60%", transition:"none", iframe:"true", title:"trans("NewCashFence"); ?>"}); +} + +function CloseCashFence(rowid) +{ + $.colorbox({href:"../compta/cashcontrol/cashcontrol_card.php?id="+rowid+"&contextpage=takepos", width:"90%", height:"90%", transition:"none", iframe:"true", title:"trans("NewCashFence"); ?>"}); +} + +function CashReport(rowid) +{ + $.colorbox({href:"../compta/cashcontrol/report.php?id="+rowid+"&contextpage=takepos", width:"60%", height:"90%", transition:"none", iframe:"true", title:"trans("CashReport"); ?>"}); +} + // Popup to select the terminal to use function TerminalsDialog() { @@ -708,6 +723,18 @@ $( document ).ready(function() { if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; else print "TerminalsDialog();"; } + if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) + { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE "; + $sql .= "date(date_creation) = CURDATE() "; + $sql .= ""; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + // If there is no cash control from today open it + if ($obj->rowid == null) print "ControlCashOpening();"; + } + } ?> }); @@ -872,6 +899,20 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { ); } +$sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE "; +$sql .= "date(date_creation) = CURDATE() "; +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + if ($num) + { + $obj = $db->fetch_object($resql); + $menus[$r++] = array('title'=>'
'.$langs->trans("CashReport").'
', 'action'=>'CashReport('.$obj->rowid.');'); + if ($obj->status == 0) $menus[$r++] = array('title'=>'
'.$langs->trans("CloseCashFence").'
', 'action'=>'CloseCashFence('.$obj->rowid.');'); + } +} + $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) {