dol_print_error('','account is not defined but $mode_balance_ok is true');
exit;
}
//Loop on each record
//Loop on each record before
$sign=1;
$i=0;
$sqlforbalance='SELECT SUM(b.amount) as balance';
...
...
@@ -912,7 +912,8 @@ if ($resql)
$sqlforbalance.=" WHERE b.fk_account = ba.rowid";
$sqlforbalance.=" AND ba.entity IN (".getEntity('bank_account',1).")";
$sqlforbalance.=" AND b.fk_account = ".$account;
$sqlforbalance.=" AND b.datev < '".$db->idate($db->jdate($objp->dv))."'";
//$sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "')";
$sqlforbalance.=" AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
if($massactionbutton||$massaction)// If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined