print ' ';
 	print '</td>';
 	print '<td class="liste_titre" align="right">';
 	print '&nbsp;';
 	print '</td>';
 	print '<td class="liste_titre" align="right">';
 	print '&nbsp;';
 	print '</td>';*/
 print '<td class="liste_titre" align="right"><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 '<td class="liste_titre" align="left">&nbsp;</td>';
 print "</td></tr>\n";
 if ($num > 0) {
     $var = True;
     $total = 0;
     $totalrecu = 0;
     $controlstatic = new ControlCash($db, $objp->fk_cash);
     $controlstatic->type_control = $objp->type_control;
     while ($i < min($num, $limit)) {
         $objp = $db->fetch_object($resql);
         $var = !$var;
         //$datelimit=$db->jdate($objp->datelimite);
         print '<tr ' . $bc[$var] . '>';
         print '<td nowrap="nowrap">';
         print '<table class="nobordernopadding"><tr class="nocellnopadd">';
         //Id cash control
         print '<td class="nobordernopadding" nowrap="nowrap">';
         if ($objp->type_control) {
             if ($conf->global->POS_FACTURE == 1) {
                 print '<a href="listefac.php?closeid=' . $objp->rowid . '&viewstatut=2">' . $objp->ref . '</a>';
             } else {
                 print '<a href="liste.php?closeid=' . $objp->rowid . '&viewstatut=2">' . $objp->ref . '</a>';
 /**
  * 
  * Enter description here ...
  * @param $aryClose
  */
 public static function setControlCash($aryClose)
 {
     global $db, $user;
     $function = "closeCash";
     $error = 0;
     $terminalid = $_SESSION['TERMINAL_ID'];
     $userpos = new User($db);
     $userpos->fetch($aryClose['employeeId']);
     $userpos->getrights('pos');
     if ($userpos->rights->pos->closecash || !$aryClose['type']) {
         $cash = new ControlCash($db, $terminalid);
         $data['userid'] = $aryClose['employeeId'];
         $data['amount_reel'] = $aryClose['moneyincash'];
         $data['amount_teoric'] = $cash->getMoneyCash();
         $data['amount_diff'] = $data['amount_reel'] - $data['amount_teoric'];
         $data['type_control'] = $aryClose['type'];
         $data['print'] = $aryClose['print'];
         $res = $cash->create($data);
         if ($res > 0) {
             $terminal = new Cash($db);
             $userstatic = new User($db);
             $userstatic->fetch($id);
             $terminal->fetch($terminalid);
             if ($aryClose['type'] == 1) {
                 if (!$terminal->set_closed($userstatic)) {
                     $error++;
                 }
             } elseif ($aryClose['type'] == 2) {
                 if (!$terminal->set_open($userstatic)) {
                     $error++;
                 }
             }
         } else {
             $error++;
         }
     } else {
         $error = 2;
     }
     if ($error == 0) {
         $error = $res;
     } else {
         $error = $error * -1;
     }
     return ErrorControl($error, $function);
 }
}
// 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) {