NEW : solde() function evolution to be able to get solde until a chosen date
This commit is contained in:
parent
e96061dd18
commit
517562b465
@ -1188,9 +1188,11 @@ class Account extends CommonObject
|
||||
* Return current sold
|
||||
*
|
||||
* @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold)
|
||||
* @return int Current sold (value date <= today)
|
||||
* @param tms $date_end Date until we want to get bank account sold
|
||||
* @param string $field dateo or datev
|
||||
* @return int current sold (value date <= today)
|
||||
*/
|
||||
public function solde($option = 0)
|
||||
public function solde($option = 0, $date_end='', $field='dateo')
|
||||
{
|
||||
$solde = 0;
|
||||
|
||||
@ -1198,7 +1200,7 @@ class Account extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " WHERE fk_account = ".((int) $this->id);
|
||||
if ($option == 1) {
|
||||
$sql .= " AND dateo <= '".$this->db->idate(dol_now())."'";
|
||||
$sql .= " AND ".$this->db->escape($field)." <= '".(!empty($date_end) ? $this->db->idate($date_end) : $this->db->idate(dol_now()))."'";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user