}
 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>';
     print '</td>';
     // Percent;
     print '<td align="right">' . ($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2) . '%' : '&nbsp;') . '</td>';
     // Other stats
     print '<td align="center">';
        $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
print '<tr><td valign="top">' . $langs->trans("Name") . '</td>';
print '<td colspan="3">';
if ($id && GETPOST('option', 'string') != 'all') {
    print $cash->name;
} else {
 $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);
     $thirdparty->id = $objp->socid;
     $thirdparty->nom = $objp->nom;
 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 '&nbsp; ';
 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">';
                 print '<input type="hidden" name="id" value="' . $cashwil->id . '">';
                 print '<input type="hidden" name="action" value="freeterminal">';
                 print '<input class="button" type="submit" value="' . $langs->trans("FreeIt") . '">';
                 print '</form>';