/** @depends testConstructEmpty */ public function testConstructClosed() { $cash = new Cash(1, 2, stdtimefstr("1900-01-01 00:00:00"), stdtimefstr("1900-01-02 00:00:00"), 10.0, 12.0, 25.0); $this->assertTrue($cash->isOpened(), "Open state check failed"); $this->assertTrue($cash->isClosed(), "Close state check failed"); $this->assertEquals(10.0, $cash->openCash, "Open cash mismatch"); $this->assertEquals(12.0, $cash->closeCash, "Close cash mismatch"); $this->assertEquals(25.0, $cash->expectedCash, "Expected cash mismatch"); }
protected function build($dbCash, $pdo = null) { $db = DB::get(); $cash = Cash::__build($dbCash['MONEY'], $dbCash['CASHREGISTER_ID'], $dbCash['HOSTSEQUENCE'], $db->readDate($dbCash['DATESTART']), $db->readDate($dbCash['DATEEND']), $dbCash['OPENCASH'], $dbCash['CLOSECASH'], $dbCash['EXPECTEDCASH']); if (isset($dbCash['TKTS'])) { $cash->tickets = $dbCash['TKTS']; } if (isset($dbCash['TOTAL'])) { $cash->total = $dbCash['TOTAL']; } return $cash; }
/** * Get minimum notes from a specified value * * @param int $value Input value; * @return array All notes that represent the value */ static function getMinNotes($value) { if (!is_int($value) || $value <= 0) { return ['error' => 'InvalidArgumentException']; } $availableNotes = Cash::availableNotes(); $return = []; foreach ($availableNotes as $note => $qty) { $note = (string) $note; $return[$note] = 0; while ($value >= $note && ($qty > 0 || $qty == true)) { if (is_int($qty)) { $qty--; } $return[$note]++; $value -= $note; } } if (!$value == 0) { return ['error' => 'BillUnavaiableException']; } return array_filter($return); }
/** Run the service and set result. */ protected function proceed() { $srv = new CashesService(); $db = DB::get(); switch ($this->action) { case 'get': if (isset($this->params['id'])) { $ret = $srv->get($this->params['id']); } else { $ret = $srv->getCashRegister($this->params['cashRegisterId']); if ($ret === null || $ret->isClosed()) { $ret = null; } } $this->succeed($ret); break; case 'zticket': $ret = $srv->getZTicket($this->params['id']); $this->succeed($ret); break; case 'search': $cashRegisterId = $this->getParam("cashRegisterId"); $dateStart = $this->getParam("dateStart"); $dateStop = $this->getParam("dateStop"); $conditions = array(); if ($cashRegisterId !== null) { $conditions[] = array("cashRegisterId", "=", $cashRegisterId); } if ($dateStart !== null) { $conditions[] = array("openDate", ">=", $db->dateVal($dateStart)); } if ($dateStop !== null) { $conditions[] = array("closeDate", "<=", $db->dateVal($dateStop)); } $this->succeed($srv->search($conditions)); break; case 'update': $json = json_decode($this->params['cash']); $open = null; $id = null; if (property_exists($json, 'id')) { $id = $json->id; } if (property_exists($json, 'openDate')) { $open = $json->openDate; } $close = null; if (property_exists($json, 'closeDate')) { $close = $json->closeDate; } $openCash = null; if (property_exists($json, 'openCash')) { $openCash = $json->openCash; } $closeCash = null; if (property_exists($json, 'closeCash')) { $closeCash = $json->closeCash; } $expectedCash = null; if (property_exists($json, 'expectedCash')) { $expectedCash = $json->expectedCash; } $cashRegisterId = $json->cashRegisterId; $sequence = null; if (property_exists($json, 'sequence')) { $sequence = $json->sequence; } if ($id !== null) { // Update an existing cash $cash = Cash::__build($id, $cashRegisterId, $sequence, $open, $close, $openCash, $closeCash, $expectedCash); if ($srv->update($cash)) { $this->succeed($cash); } else { $this->fail(APIError::$ERR_GENERIC); } } else { // Create a cash and update with given data if ($srv->add($cashRegisterId)) { $cash = $srv->getCashRegister($cashRegisterId); $cash->openDate = $open; $cash->closeDate = $close; $cash->openCash = $openCash; $cash->closeCash = $closeCash; $cash->expectedCash = $expectedCash; if ($srv->update($cash)) { $this->succeed($cash); } else { $this->fail(APIError::$ERR_GENERIC); } } else { $this->fail(APIError::$ERR_GENERIC); } } break; } }
$socid = $user->societe_id; } //$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); $year_start = GETPOST('year_start'); $year_current = strftime("%Y", time()); if (!$year_start) { $year_start = $year_current - 2; $year_end = $year_current; } else { $year_end = $year_start + 2; } $helpurl = 'EN:Module_DoliPos|FR:Module_DoliPos_FR|ES:Módulo_DoliPos'; llxHeader('', '', $helpurl); $form = new Form($db); // Get account informations $acct = new Cash($db); $result = $acct->fetch($id, $ref); # Ce rapport de tresorerie est base sur llx_bank (car doit inclure les transactions sans facture) # plutot que sur llx_paiement + llx_paiementfourn $sql = "SELECT SUM(total_ttc) as amount"; $sql .= ", date_format(date_creation,'%Y-%m') as dm"; $sql .= " FROM " . MAIN_DB_PREFIX . "pos_ticket"; //$sql.= " WHERE fk_cash = ".$id; $sql .= " WHERE entity = " . $conf->entity; $sql .= " AND fk_statut in (1,2,3,4)"; //$sql.= " AND (type = 0)"; //$sql.= " AND total_ht >= 0"; if ($acct->id) { $sql .= " AND fk_cash IN (" . $acct->id . ")"; } $sql .= " GROUP BY dm";
function currency_converted($total) { /* $currency_selected = Keywords::find(5); $currency_sel = $currency_selected->keyword; */ $currency_sel = Config::get('app.generic_keywords.Currency'); if ($currency_sel == '$') { $currency_sel = "USD"; } else { $currency_sel = Config::get('app.generic_keywords.Currency'); } if ($currency_sel != 'USD') { $check = check_cache($currency_sel); if (!$check) { $url = "http://currency-api.appspot.com/api/USD/" . $currency_sel . ".json?key=65d69f1a909b37e41272574dcd20c30fb2fbb06e"; $result = file_get_contents($url); $result = json_decode($result); $rate = $result->rate; update_cache($currency_sel, $rate); $total = $total * $rate; } else { $rate = Cash::where('key', 'like', '%' . $currency_sel . '%')->first(); $total = $total * $rate->value; } } else { $total = $total; } return $total; }
public function addCash(Cash $l) { $this->collCashs[] = $l; $l->setTransactionStatus($this); }
print '<td nowrap="nowrap">'; $ticketstatic->id = $objp->ticketid; $ticketstatic->ref = $objp->facnumber; print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<td class="nobordernopadding" nowrap="nowrap">'; //print $ticketstatic->ref; print $ticketstatic->getNomUrl(1); print '</td>'; print '</tr></table>'; print "</td>\n"; // Date print '<td align="center" nowrap>'; print dol_print_date($db->jdate($objp->df), 'day'); print '</td>'; print '<td align="left">'; $cash = new Cash($db); $cash->fetch($objp->fk_cash); print $cash->getNomUrl(1); print '</td>'; print '<td align="left">'; if ($objp->fk_user_valid > 0) { $userstatic = new User($db); $userstatic->fetch($objp->fk_user_valid); print $userstatic->getNomUrl(1); } print '</td>'; print '<td align="left">'; if (!$user->rights->societe->client->voir) { print $objp->nom; } else { $thirdparty = new Societe($db);
<div style="text-align: left;"> <?php $presupuesto = substr($object->ref, 0, 2); if ($presupuesto == "TK") { echo "Precios Sujetos a cambio sin Previo Aviso"; } ?> </div> <table class="totpay"> <?php echo '<tr><td></td></tr>'; echo '<tr><td></td></tr>'; $terminal = new Cash($db); $terminal->fetch($object->fk_cash); $pay = $object->getSommePaiement(); if ($object->customer_pay > $pay) { $pay = $object->customer_pay; } $diff_payment = $object->total_ttc - $pay; $listofpayments = $object->getListOfPayments(); foreach ($listofpayments as $paym) { if ($paym['type'] != 'LIQ') { echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'], "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>"; } else { echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>"; } } echo '<tr><th nowrap="nowrap">' . ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . '</th><td nowrap="nowrap">' . price(abs($diff_payment), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
if (!$res) { $res = @(include "../../../main.inc.php"); } // For "custom" directory dol_include_once('/pos/class/pos.class.php'); dol_include_once('/pos/class/mobile_detect.php'); require_once DOL_DOCUMENT_ROOT . "/product/stock/class/entrepot.class.php"; global $db, $langs, $conf; $langs->load("pos@pos"); $langs->load("rewards@rewards"); $langs->load("bills"); $langs->load("companies"); if (empty($_SESSION['uname']) || empty($_SESSION['TERMINAL_ID'])) { accessforbidden(); } $cash = new Cash($db); $cash->fetch($_SESSION['TERMINAL_ID']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html style="height: 100%; overflow: hidden;" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><?php echo $langs->trans("DolibarTPV"); ?> </title> <link rel="stylesheet" type="text/css" href="css/layout-default-latest.css"> <link rel="stylesheet" type="text/css" href="css/jquery.css"> <link rel="stylesheet" type="text/css" href="css/keyboard.css"> <link rel="stylesheet" type="text/css" href="css/jquery.ui.chatbox.css"> <link href="css/jquery-ui.css" type="text/css" rel="Stylesheet" class="ui-theme">
if ((bool) $short) { return; } require_once $root . 'lib/lang.php'; $lng = new Lang(); $lng->set($_COOKIE['LANG']); require_once $root . 'lib/user.php'; require_once $root . 'lib/cash.php'; require_once $root . 'lib/update.php'; if ($debug) { $db->debug = true; } $usr = new User($db, $lng); $usr->auth(); $upd = new Update($db, $lng, $usr); $ch = new Cash($db, $usr, $lng); $settings['version'] = $version; $settings['demo'] = $demo; $settings['debug'] = $debug; $settings['static'] = $static; $settings['extjs'] = $extjs; $settings['ocr_host'] = $ocr_host; //setup or update $settings['setup'] = 0; $settings['update'] = 0; if ($upd->needSetup()) { $settings['setup'] = 1; $settings['site_name'] = $lng->get(213); } else { if ($upd->needUpdate()) { /*$settings['update'] = 1;
print '<input class="flat" type="text" name="search_name" value="' . $search_name . '">'; print '</td>'; print '<td></td>'; print '<td></td>'; print '<td></td>'; print '<td></td>'; print '<td colspan="2" class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print ' '; print '<input type="image" class="liste_titre" name="button_removefilter" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/searchclear.png" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; print '</td>'; print "</tr>\n"; $var = True; while ($i < min($num, $conf->liste_limit)) { $obj = $db->fetch_object($resql); $cashwil = new Cash($db); $cashwil->fetch($obj->rowid); $var = !$var; print "<tr {$bc[$var]}>"; print '<td width="30%">' . $cashwil->getNomUrl(1) . '</td>'; print "<td>" . $cashwil->tactiltype($obj->tactil) . "</td>\n"; print '<td align="left">' . $cashwil->getLibStatut(4) . '</td>'; $url = 'cash.php?id=' . $obj->rowid; if (!$cashwil->is_closed) { if ($cashwil->fk_user_u) { $userstatic = new User($db); $userstatic->fetch($cashwil->fk_user_u); if ($user->rights->pos->backend) { print "<td>" . $userstatic->getNomUrl(1) . "</td>\n"; print '<td align="center">'; print '<form action="' . $url . '" name="free" method="POST">';
// For "custom" directory require_once DOL_DOCUMENT_ROOT . "/core/lib/functions2.lib.php"; dol_include_once('/pos/class/cash.class.php'); dol_include_once('/pos/backend/lib/cash.lib.php'); if (!$user->rights->pos->backend) { accessforbidden(); } $langs->load("pos@pos"); // Security check $socid = 0; $id = GETPOST('id'); if ($user->societe_id) { $socid = $user->societe_id; } //$result=restrictedArea($user,'pos',$id,''); /* * View */ $helpurl = 'EN:Module_DoliPos|FR:Module_DoliPos_FR|ES:Módulo_DoliPos'; llxHeader('', '', $helpurl); $cash = new Cash($db); $cash->fetch($id); $cash->info($id); $head = cash_prepare_head($cash); dol_fiche_head($head, 'info', $langs->trans("Cash"), 0, 'cashdesk'); print '<table width="100%"><tr><td>'; dol_print_object_info($cash); print '</td></tr></table>'; print '</div>'; llxFooter(); $db->close();
/** * * Return the money in cash * * @param bool $open money for open or not * @return double Amount of cash since last closed */ function getMoneyCash($open = false) { global $db, $conf, $langs; $cash = new Cash($db); $cash->fetch($this->terminal); $acount = $cash->fk_paycash; $sql = "SELECT sum( b.amount ) as amount"; $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account AS ba, " . MAIN_DB_PREFIX . "bank AS b"; $sql .= " WHERE b.fk_account =" . $acount; $sql .= " AND b.fk_account = ba.rowid"; $sql .= " AND ba.entity =" . $conf->entity; $sql .= " ORDER BY b.datev ASC , b.datec ASC "; $result = $db->query($sql); if ($result) { if ($db->num_rows($result)) { $obj = $db->fetch_object($result); $amount = $obj->amount; } } if (!$amount) { $amount = 0; } return $amount; }
$object->getLinesArray(); if (!empty($object->lines)) { foreach ($object->lines as $line) { $totalline = $line->qty * $line->subprice; echo '<tr><td align="left">' . $line->libelle . '</td><td align="right">' . $line->qty . "</td></tr>\n"; } } else { echo '<p>' . (print $langs->trans("ErrNoArticles") . '</p>' . "\n"); } } ?> </table> <table class="totaux"> <?php $terminal = new Cash($db); $terminal->fetch($object->fk_cash); if ($object->type == 0) { echo '<tr><th nowrap="nowrap">' . $langs->trans("Pago") . '</th><td nowrap="nowrap">' . $terminal->select_Paymentname($object->mode_reglement_id) . "</td></tr>\n"; } ?> </table> <div class="note"><p><?php print $conf->global->POS_PREDEF_MSG; ?> </p></div> <div><?php // Recuperation et affichage de la date et de l'heure $now = dol_now(); $label = $object->ref;
$i++; } print "</table>"; $db->free($resql); } else { dol_print_error($db); } } } /* ************************************************************************** */ /* */ /* Edition */ /* */ /* ************************************************************************** */ if (GETPOST("id") && $action == 'edit' && $user->rights->pos->backend) { $cash = new Cash($db); $cash->fetch(GETPOST("id")); print_fiche_titre($langs->trans("EditCash")); print "<br>"; print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $cash->id . '" method="post" name="formsoc">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="id" value="' . GETPOST("id", "int") . '">' . "\n\n"; print '<table class="border" width="100%">'; // Code print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("Code") . '</td>'; print '<td colspan="3"><input size="3" type="text" class="flat" name="code" value="' . $cash->code . '"></td></tr>'; // Name print '<tr><td valign="top" class="fieldrequired">' . $langs->trans("Name") . '</td>'; print '<td colspan="3"><input size="30" type="text" class="flat" name="name" value="' . $cash->name . '"></td></tr>'; //Tactil
$sql .= " FROM " . MAIN_DB_PREFIX . "user"; $sql .= " WHERE login = '******'"; $sql .= " AND entity IN (0," . $conf->entity . ")"; $result = $db->query($sql); if ($result) { $tab = $db->fetch_array($res); foreach ($tab as $key => $value) { $return[$key] = $value; } $_SESSION['uid'] = $tab['rowid']; $_SESSION['uname'] = $username; $_SESSION['nom'] = $tab['lastname']; $_SESSION['prenom'] = $tab['firstname']; $_SESSION['TERMINAL_ID'] = $terminalid; dol_include_once('/pos/class/cash.class.php'); $terminal = new Cash($db); $terminal->fetch($terminalid); $userstatic = new User($db); $userstatic->fetch($_SESSION['uid']); $terminal->set_used($userstatic); if ($terminal->is_closed) { $terminal->set_open($userstatic); } //var_dump($_SESSION);exit; if ($terminal->tactil == 2) { if (file_exists(dol_buildpath('/pos/frontend/movil.php'))) { header('Location: ' . dol_buildpath('/pos/frontend/movil.php', 1)); } else { header('Location: ' . dol_buildpath('/pos/frontend/tpv.php', 1)); } } else {
public static function getCash($lifeTime, $path) { $cash = new Cash($lifeTime, $path); return $cash->getCashOb(); }
<br> <?php echo $mysoc->idprof1; ?> <br> <?php echo $mysoc->address; ?> <br> <?php echo $mysoc->zip . ' ' . $mysoc->town; ?> </p> <?php print '<p>' . $langs->trans("CloseCashReport") . ': ' . $ref . '<br>'; $cash = new Cash($db); $cash->fetch($terminal); print $langs->trans("Terminal") . ': ' . $cash->name . '<br>'; $userstatic = new User($db); $userstatic->fetch($fk_user); print $langs->trans("User") . ': ' . $userstatic->firstname . ' ' . $userstatic->lastname . '</p>'; print '<p class="date_heure">' . dol_print_date($db->jdate($date_end), 'dayhour') . '</p>'; ?> </div> </div> <p><?php print $langs->trans("TicketsCash"); ?> </p> <table class="liste_articles"> <tr class="titres"><th><?php
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); } if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } $res = @(include "../../main.inc.php"); // For root directory if (!$res) { $res = @(include "../../../main.inc.php"); } // For "custom" directory dol_include_once('/pos/class/cash.class.php'); // This destroy tag that say "Point of Sale session is on". global $db; $terminal = new Cash($db); $terminal->fetch($_SESSION['TERMINAL_ID']); $terminal->set_unused($user); unset($_SESSION['uid']); unset($_SESSION['TERMINAL_ID']); header('Location: ' . dol_buildpath('/pos/frontend/index.php', 1)); exit;
/** * Return list of contents of a category * * @param string $field Field name for select in table. Full field name will be fk_field. * @param string $classname PHP Class of object to store entity * @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $object_table Table name for select in table. Full table name will be PREFIX_table. * @return void */ function get_prod($idCat, $more, $ticketstate) { global $db, $conf; $objs = array(); $sql = "SELECT o.rowid as id, o.ref, o.label, o.description, "; $sql .= " o.fk_product_type"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as c"; $sql .= ", " . MAIN_DB_PREFIX . "product as o"; if ($conf->global->POS_STOCK || $ticketstate == 1) { $sql .= " WHERE o.entity IN (" . getEntity("product", 1) . ")"; $sql .= " AND c.fk_categorie = " . $idCat; $sql .= " AND c.fk_product = o.rowid"; $sql .= " AND o.tosell = 1"; if (!$conf->global->POS_SERVICES) { $sql .= " AND o.fk_product_type = 0"; } } else { $cashid = $_SESSION['TERMINAL_ID']; $cash = new Cash($db); $cash->fetch($cashid); $warehouse = $cash->fk_warehouse; $sql .= ", " . MAIN_DB_PREFIX . "product_stock as ps"; $sql .= " WHERE o.entity IN (" . getEntity("product", 1) . ")"; $sql .= " AND c.fk_categorie = " . $idCat; $sql .= " AND c.fk_product = o.rowid"; $sql .= " AND o.tosell = 1"; $sql .= " AND o.rowid = ps.fk_product"; $sql .= " AND ps.fk_entrepot = " . $warehouse; $sql .= " AND ps.reel > 0"; if ($conf->global->POS_SERVICES) { $sql .= " union select o.rowid as id, o.ref, o.label, o.description,\t"; $sql .= " o.fk_product_type"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as c,"; $sql .= MAIN_DB_PREFIX . "product as o"; $sql .= " where c.fk_categorie = " . $idCat; $sql .= " AND c.fk_product = o.rowid"; $sql .= " AND o.tosell = 1"; $sql .= " AND fk_product_type=1"; } } if ($more >= 0) { $sql .= " LIMIT " . $more . ",10 "; } $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $objp = $db->fetch_object($resql); $objs[$objp->id]["id"] = $objp->id; $objs[$objp->id]["ref"] = $objp->ref; $objs[$objp->id]["label"] = $objp->label; $objs[$objp->id]["description"] = $objp->description; $objs[$objp->id]["type"] = $objp->fk_product_type; $objs[$objp->id]["image"] = self::getImageProduct($objp->id, false); $objs[$objp->id]["thumb"] = self::getImageProduct($objp->id, true); $i++; } return $objs; } else { return -1; } }
// Code print '<tr><td valign="top" width="25%">' . $langs->trans("Code") . '</td>'; print '<td colspan="3">'; if ($id || $ref) { if (!preg_match('/,/', $id)) { $moreparam = '&month=' . $month . '&year=' . $year . ($mode == 'showalltime' ? '&mode=showalltime' : ''); if (GETPOST('option', 'string') != 'all') { $morehtml = '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&option=all' . $moreparam . '">' . $langs->trans("ShowAllTerminals") . '</a>'; print $form->showrefnav($cash, 'ref', '', 1, 'name', 'ref', '', $moreparam); } else { $morehtml = '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . $moreparam . '">' . $langs->trans("BackToTerminal") . '</a>'; print $langs->trans("All"); //print $morehtml; } } else { $bankaccount = new Cash($db); $listid = explode(',', $id); foreach ($listid as $key => $idb) { $bankaccount->fetch($idb); $bankaccount->name = $bankaccount->name; print $bankaccount->getNomUrl(1); if ($key < sizeof($listid) - 1) { print ', '; } } } } else { print $langs->trans("All"); } print '</td></tr>'; // Name
$arrayforsort = $name; } if ($sortfield == 'amount_ttc' && $sortorder == 'asc') { asort($amount); $arrayforsort = $amount; } if ($sortfield == 'amount_ttc' && $sortorder == 'desc') { arsort($amount); $arrayforsort = $amount; } foreach ($arrayforsort as $key => $value) { $var = !$var; print "<tr " . $bc[$var] . ">"; // Place //$fullname=$name[$key]; $cash = new Cash($db); $cash->fetch($key); /*if ($key > 0) { $linkname='<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$key.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$fullname.'</a>'; }*/ print "<td>" . $cash->getNomUrl(1) . "</td>\n"; // Amount print '<td align="right">'; $url = dol_buildpath('/pos/backend/liste.php?cashid=' . $key, 1); if ($key > 0) { print '<a href="' . $url . '">'; } else { print '<a href="#">'; } print price($amount[$key]); print '</a>';
// For "custom" directory require_once DOL_DOCUMENT_ROOT . "/core/class/html.formcompany.class.php"; dol_include_once('/pos/class/cash.class.php'); dol_include_once('/pos/class/pos.class.php'); global $db, $conf, $langs; $langs->load("pos@pos"); $langs->load('bills'); $action = GETPOST('action', 'alpha'); $terminalid = GETPOST('terminalid', 'int'); $amountreel = GETPOST('amountreel'); if ($user->societe_id) { $socid = $user->societe_id; } //$result=restrictedArea($user,'pos',$id,'pos_cash','','','rowid'); $control = new ControlCash($db, $terminalid); $terminal = new Cash($db); $amountteo = $control->getMoneyCash(); /* * Actions */ if (GETPOST('action', 'alpha') == 'add') { $error = 0; $data['userid'] = $user->id; $data['amount_reel'] = $amountreel; $data['amount_teoric'] = $amountteo; $data['amount_diff'] = $amountreel - $amountteo; $data['type_control'] = 1; $control->Create($data); //controlar error if ($control->error) { setEventMessage("ErrCloseCash", "errors");
/** Return next value * @param objsoc Object third party * @param ticket Object ticket * @param mode 'next' for next value or 'last' for last value * @return string Value if OK, 0 if KO */ function getNextValue($objsoc, $facsim, $mode = 'next') { global $db, $conf; require_once DOL_DOCUMENT_ROOT . "/core/lib/functions2.lib.php"; // Get Mask value $mask = ''; if (is_object($facsim) && $facsim->type == 2) { $mask = $conf->global->FACSIM_MURO_MASK_CREDIT; } else { $mask = $conf->global->FACSIM_MURO_MASK; } if (!$mask) { $this->error = 'NotConfigured'; return 0; } $where = ''; //ww para warehouse if (preg_match('/\\{(w+)\\}/i', $mask, $regWare)) { dol_include_once("/pos/class/cash.class.php"); require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; $terminal = new Cash($db); $terminal->fetch($facsim->fk_cash); $warehouse = new Entrepot($db); $warehouse->fetch($terminal->fk_warehouse); $maskware = $regWare[1]; $maskware_value = substr($warehouse->libelle, 0, dol_strlen($regWare[1])); //get n first characters of warehouse ref where n is length in mask $maskware_value = str_pad($maskware_value, dol_strlen($regWare[1]), "#", STR_PAD_RIGHT); $maskware_maskbefore = '{' . $maskware . '}'; $maskware_maskafter = $maskware_value; $mask = str_replace($maskware_maskbefore, $maskware_maskafter, $mask); } //kk para terminal if (preg_match('/\\{(k+)\\}/i', $mask, $regTerm)) { dol_include_once("/pos/class/cash.class.php"); $terminal = new Cash($db); $terminal->fetch($facsim->fk_cash); $maskterm = $regTerm[1]; $maskterm_value = substr($terminal->ref, 0, dol_strlen($regTerm[1])); //get n first characters of warehouse ref where n is length in mask $maskterm_value = str_pad($maskterm_value, dol_strlen($regTerm[1]), "#", STR_PAD_RIGHT); $maskterm_maskbefore = '{' . $maskterm . '}'; $maskterm_maskafter = $maskterm_value; $mask = str_replace($maskterm_maskbefore, $maskterm_maskafter, $mask); } $numFinal = get_next_value($db, $mask, 'facture', 'facnumber', $where, $objsoc, time(), $mode); if (!preg_match('/([0-9])+/', $numFinal)) { $this->error = $numFinal; } return $numFinal; }
print '</td>'; print '<td width="16" align="right" class="nobordernopadding">'; $filename = dol_sanitizeFileName($objp->facnumber); $filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($objp->facnumber); $urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $objp->facid; $formfile->show_documents('facture', $filename, $filedir, $urlsource, '', '', '', 1, '', 1); print '</td>'; print '</tr></table>'; print "</td>\n"; // Date print '<td align="center" nowrap>'; print dol_print_date($db->jdate($objp->df), 'day'); print '</td>'; //Terminal print '<td>'; $cash = new Cash($db); $cash->fetch($objp->cashid); print $cash->getNomUrl(1); print '</td>'; //User print '<td>'; if ($objp->uservalid > 0) { $userstatic = new User($db); $userstatic->fetch($objp->uservalid); print $userstatic->getNomUrl(1); } print '</td>'; //Customer print '<td>'; $thirdparty = new Societe($db); $thirdparty->id = $objp->socid;