Gestion des comptes "caisses"
This commit is contained in:
parent
70e230cd4a
commit
6b9a6059df
@ -23,432 +23,433 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/bank/account.class.php
|
||||
\file htdocs/compta/bank/account.class.php
|
||||
\ingroup banque
|
||||
\brief Fichier de la classe des comptes bancaires
|
||||
\version $Revision$
|
||||
\brief Fichier de la classe des comptes bancaires
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
|
||||
/** \class Account
|
||||
\brief Classe permettant la gestion des comptes bancaires
|
||||
/**
|
||||
\class Account
|
||||
\brief Classe permettant la gestion des comptes bancaires
|
||||
*/
|
||||
|
||||
class Account
|
||||
{
|
||||
var $rowid;
|
||||
var $rowid;
|
||||
|
||||
var $label;
|
||||
var $type;
|
||||
var $bank;
|
||||
var $clos;
|
||||
var $code_banque;
|
||||
var $code_guichet;
|
||||
var $number;
|
||||
var $cle_rib;
|
||||
var $bic;
|
||||
var $iban_prefix;
|
||||
var $proprio;
|
||||
var $adresse_proprio;
|
||||
var $type_lib=array();
|
||||
var $label;
|
||||
var $type;
|
||||
var $bank;
|
||||
var $clos;
|
||||
var $code_banque;
|
||||
var $code_guichet;
|
||||
var $number;
|
||||
var $cle_rib;
|
||||
var $bic;
|
||||
var $iban_prefix;
|
||||
var $proprio;
|
||||
var $adresse_proprio;
|
||||
var $type_lib=array();
|
||||
|
||||
|
||||
function Account($DB, $rowid=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $DB;
|
||||
$this->rowid = $rowid;
|
||||
|
||||
$this->clos = 0;
|
||||
$this->solde = 0;
|
||||
|
||||
$this->type_lib[0]=$langs->trans("BankType0");
|
||||
$this->type_lib[1]=$langs->trans("BankType1");
|
||||
$this->type_lib[2]=$langs->trans("BankType2");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Efface une entree dans la table ".MAIN_DB_PREFIX."bank
|
||||
*/
|
||||
function deleteline($rowid)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function add_url_line($line_id, $url_id, $url, $label)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (fk_bank, url_id, url, label)";
|
||||
$sql .= " VALUES ('$line_id', '$url_id', '$url', '$label')";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url");
|
||||
|
||||
return $rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function get_url($line_id)
|
||||
{
|
||||
$lines = array();
|
||||
$sql = "SELECT fk_bank, url_id, url, label FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank = $line_id";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows();
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$lines[$i][0] = $obj->url;
|
||||
$lines[$i][1] = $obj->url_id;
|
||||
$lines[$i][2] = $obj->label;
|
||||
$i++;
|
||||
}
|
||||
return $lines;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank
|
||||
* \return int rowid de l'entrée ajoutée, < 0 si erreur
|
||||
*/
|
||||
function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='')
|
||||
{
|
||||
if ($this->rowid)
|
||||
function Account($DB, $rowid=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$this->db = $DB;
|
||||
$this->rowid = $rowid;
|
||||
|
||||
$this->clos = 0;
|
||||
$this->solde = 0;
|
||||
|
||||
$this->type_lib[0]=$langs->trans("BankType0");
|
||||
$this->type_lib[1]=$langs->trans("BankType1");
|
||||
$this->type_lib[2]=$langs->trans("BankType2");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Efface une entree dans la table ".MAIN_DB_PREFIX."bank
|
||||
*/
|
||||
function deleteline($rowid)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=$rowid";
|
||||
$result = $this->db->query($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function add_url_line($line_id, $url_id, $url, $label)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (fk_bank, url_id, url, label)";
|
||||
$sql .= " VALUES ('$line_id', '$url_id', '$url', '$label')";
|
||||
|
||||
switch ($oper)
|
||||
{
|
||||
case 1:
|
||||
$oper = 'TIP';
|
||||
break;
|
||||
case 2:
|
||||
$oper = 'VIR';
|
||||
break;
|
||||
case 3:
|
||||
$oper = 'PRE';
|
||||
break;
|
||||
case 4:
|
||||
$oper = 'LIQ';
|
||||
break;
|
||||
case 5:
|
||||
$oper = 'VAD';
|
||||
break;
|
||||
case 6:
|
||||
$oper = 'CB';
|
||||
break;
|
||||
case 7:
|
||||
$oper = 'CHQ';
|
||||
break;
|
||||
}
|
||||
|
||||
$datev = $date;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq,fk_account, fk_type)";
|
||||
$sql.= " VALUES (now(), '".$date."', '$datev', '$label', '" . ereg_replace(',','.',$amount) . "', '".$user->id."' ,'$num_chq', '".$this->rowid."', '$oper')";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
|
||||
if ($categorie)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ('$rowid', '$categorie')";
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url");
|
||||
|
||||
return $rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function get_url($line_id)
|
||||
{
|
||||
$lines = array();
|
||||
$sql = "SELECT fk_bank, url_id, url, label FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank = $line_id";
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows();
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$lines[$i][0] = $obj->url;
|
||||
$lines[$i][1] = $obj->url_id;
|
||||
$lines[$i][2] = $obj->label;
|
||||
$i++;
|
||||
}
|
||||
return $lines;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank
|
||||
* \return int rowid de l'entrée ajoutée, < 0 si erreur
|
||||
*/
|
||||
function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='')
|
||||
{
|
||||
if ($this->rowid)
|
||||
{
|
||||
|
||||
switch ($oper)
|
||||
{
|
||||
case 1:
|
||||
$oper = 'TIP';
|
||||
break;
|
||||
case 2:
|
||||
$oper = 'VIR';
|
||||
break;
|
||||
case 3:
|
||||
$oper = 'PRE';
|
||||
break;
|
||||
case 4:
|
||||
$oper = 'LIQ';
|
||||
break;
|
||||
case 5:
|
||||
$oper = 'VAD';
|
||||
break;
|
||||
case 6:
|
||||
$oper = 'CB';
|
||||
break;
|
||||
case 7:
|
||||
$oper = 'CHQ';
|
||||
break;
|
||||
}
|
||||
|
||||
$datev = $date;
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq,fk_account, fk_type)";
|
||||
$sql.= " VALUES (now(), '".$date."', '$datev', '$label', '" . ereg_replace(',','.',$amount) . "', '".$user->id."' ,'$num_chq', '".$this->rowid."', '$oper')";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
|
||||
if ($categorie)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ('$rowid', '$categorie')";
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
return $rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Creation du compte bancaire en base
|
||||
* \return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function create()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Chargement librairie pour acces fonction controle RIB
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php';
|
||||
|
||||
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
||||
$this->error="Le contrôle de la clé indique que les informations de votre compte bancaire sont incorrectes.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $pcgnumber) $pcgnumber="51";
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (datec, label, account_number) values (now(),'$this->label','$pcgnumber');";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_account");
|
||||
if ( $this->update() )
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, label, amount, fk_account,datev,dateo,fk_type,rappro) ";
|
||||
$sql .= " VALUES (now(),'".$langs->trans("Balance")."','" . ereg_replace(',','.',$this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$this->error=$langs->trans("ErrorBankLabelAlreadyExists");
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
$this->error=$this->db->error();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Mise a jour compte
|
||||
* \param user Object utilisateur qui modifie
|
||||
*/
|
||||
function update($user='')
|
||||
{
|
||||
// Chargement librairie pour acces fonction controle RIB
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php';
|
||||
|
||||
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
||||
$this->error="Le contrôle de la clé indique que les informations de votre compte bancaire sont incorrectes.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $this->label) $this->label = "???";
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
|
||||
|
||||
$sql .= " bank = '" .$this->bank ."'";
|
||||
$sql .= ",label = '".$this->label ."'";
|
||||
|
||||
$sql .= ",code_banque='".$this->code_banque."'";
|
||||
$sql .= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql .= ",number='".$this->number."'";
|
||||
$sql .= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql .= ",bic='".$this->bic."'";
|
||||
$sql .= ",iban_prefix = '".$this->iban_prefix."'";
|
||||
$sql .= ",domiciliation='".$this->domiciliation."'";
|
||||
$sql .= ",proprio = '".$this->proprio."'";
|
||||
$sql .= ",adresse_proprio = '".$this->adresse_proprio."'";
|
||||
$sql .= ",courant = ".$this->courant;
|
||||
$sql .= ",clos = ".$this->clos;
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge en memoire depuis la base le compte
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
$sql = "SELECT rowid, label, bank, number, courant, clos, code_banque, code_guichet, cle_rib, bic, iban_prefix, domiciliation, proprio, adresse_proprio FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->label = $obj->label;
|
||||
$this->type = $obj->courant;
|
||||
$this->courant = $obj->courant;
|
||||
$this->bank = $obj->bank;
|
||||
$this->clos = $obj->clos;
|
||||
$this->code_banque = $obj->code_banque;
|
||||
$this->code_guichet = $obj->code_guichet;
|
||||
$this->number = $obj->number;
|
||||
$this->cle_rib = $obj->cle_rib;
|
||||
$this->bic = $obj->bic;
|
||||
$this->iban_prefix = $obj->iban_prefix;
|
||||
$this->domiciliation = $obj->domiciliation;
|
||||
$this->proprio = $obj->proprio;
|
||||
$this->adresse_proprio = $obj->adresse_proprio;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Efface le compte
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE rowid = ".$this->rowid;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Creation du compte bancaire
|
||||
*
|
||||
*/
|
||||
function create()
|
||||
|
||||
/*
|
||||
* \brief Renvoi si un compte peut etre supprimer ou non (sans mouvements)
|
||||
* \return boolean vrai si peut etre supprimé, faux sinon
|
||||
*/
|
||||
function can_be_deleted()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Chargement librairie pour acces fonction controle RIB
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php';
|
||||
$can_be_deleted=false;
|
||||
|
||||
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
||||
$this->error="Le contrôle de la clé indique que les informations de votre compte bancaire sont incorrectes.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $pcgnumber) $pcgnumber="51";
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (datec, label, account_number) values (now(),'$this->label','$pcgnumber');";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_account");
|
||||
if ( $this->update() )
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, label, amount, fk_account,datev,dateo,fk_type,rappro) ";
|
||||
$sql .= " VALUES (now(),'".$langs->trans("Balance")."','" . ereg_replace(',','.',$this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account=".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
if ($obj->nb <= 1) $can_be_deleted=true; // Juste le solde
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $can_be_deleted;
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Mise a jour compte
|
||||
* \param user Object utilisateur qui modifie
|
||||
*/
|
||||
function update($user='')
|
||||
{
|
||||
// Chargement librairie pour acces fonction controle RIB
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php';
|
||||
|
||||
if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) {
|
||||
$this->error="Le contrôle de la clé indique que les informations de votre compte bancaire sont incorrectes.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! $this->label) $this->label = "???";
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
|
||||
|
||||
$sql .= " bank = '" .$this->bank ."'";
|
||||
$sql .= ",label = '".$this->label ."'";
|
||||
|
||||
$sql .= ",code_banque='".$this->code_banque."'";
|
||||
$sql .= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql .= ",number='".$this->number."'";
|
||||
$sql .= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql .= ",bic='".$this->bic."'";
|
||||
$sql .= ",iban_prefix = '".$this->iban_prefix."'";
|
||||
$sql .= ",domiciliation='".$this->domiciliation."'";
|
||||
$sql .= ",proprio = '".$this->proprio."'";
|
||||
$sql .= ",adresse_proprio = '".$this->adresse_proprio."'";
|
||||
$sql .= ",courant = ".$this->courant;
|
||||
$sql .= ",clos = ".$this->clos;
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Charge en memoire depuis la base le compte
|
||||
*
|
||||
*/
|
||||
function fetch($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
$sql = "SELECT rowid, label, bank, number, courant, clos, code_banque, code_guichet, cle_rib, bic, iban_prefix, domiciliation, proprio, adresse_proprio FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->label = $obj->label;
|
||||
$this->type = $obj->courant;
|
||||
$this->courant = $obj->courant;
|
||||
$this->bank = $obj->bank;
|
||||
$this->clos = $obj->clos;
|
||||
$this->code_banque = $obj->code_banque;
|
||||
$this->code_guichet = $obj->code_guichet;
|
||||
$this->number = $obj->number;
|
||||
$this->cle_rib = $obj->cle_rib;
|
||||
$this->bic = $obj->bic;
|
||||
$this->iban_prefix = $obj->iban_prefix;
|
||||
$this->domiciliation = $obj->domiciliation;
|
||||
$this->proprio = $obj->proprio;
|
||||
$this->adresse_proprio = $obj->adresse_proprio;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Efface le compte
|
||||
*
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE rowid = ".$this->rowid;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Renvoi si un compte peut etre supprimer ou non (sans mouvements)
|
||||
* \return boolean vrai si peut etre supprimé, faux sinon
|
||||
*/
|
||||
function can_be_deleted()
|
||||
{
|
||||
$can_be_deleted=false;
|
||||
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE fk_account=".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj=$this->db->fetch_object($resql);
|
||||
if ($obj->nb <= 1) $can_be_deleted=true; // Juste le solde
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($this->db);
|
||||
}
|
||||
return $can_be_deleted;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function error()
|
||||
{
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function solde()
|
||||
{
|
||||
$sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE fk_account=$this->id AND dateo <=" . $this->db->idate(time() );
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function solde()
|
||||
{
|
||||
$sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE fk_account=$this->id AND dateo <=" . $this->db->idate(time() );
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$solde = $this->db->result(0,0);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
return $solde;
|
||||
}
|
||||
$this->db->free();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function datev_next($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows())
|
||||
{
|
||||
$solde = $this->db->result(0,0);
|
||||
|
||||
$sql .= " datev = adddate(datev, interval 1 day)";
|
||||
|
||||
$sql .= " WHERE rowid = $rowid";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->affected_rows())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print "<p>$sql</p>";
|
||||
return 0;
|
||||
}
|
||||
return $solde;
|
||||
}
|
||||
$this->db->free();
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function datev_previous($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
||||
|
||||
$sql .= " datev = adddate(datev, interval -1 day)";
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function datev_next($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
||||
|
||||
$sql .= " WHERE rowid = $rowid";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->affected_rows())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
print "<p>$sql</p>";
|
||||
return 0;
|
||||
}
|
||||
$sql .= " datev = adddate(datev, interval 1 day)";
|
||||
|
||||
$sql .= " WHERE rowid = $rowid";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->affected_rows())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
function datev_previous($rowid)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
||||
|
||||
$sql .= " datev = adddate(datev, interval -1 day)";
|
||||
|
||||
$sql .= " WHERE rowid = $rowid";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->affected_rows())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -205,7 +205,10 @@ if ($account > 0)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("Value").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td><td align="right">'.$langs->trans("Credit").'</td><td align="right">'.$langs->trans("BankBalance").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AccountStatement").'</td></tr>';
|
||||
print '<td align="center">';
|
||||
if ($acct->type != 2) print $langs->trans("AccountStatement");
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<form method="post" action="account.php">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
@ -217,7 +220,7 @@ if ($account > 0)
|
||||
print '<td align="right"><input type="text" class="flat" name="req_credit" value="'.$_POST["req_credit"].'" size="6"></td>';
|
||||
print '<td align="center"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'"></td>';
|
||||
print '<td align="center">';
|
||||
if ($user->rights->banque->modifier)
|
||||
if ($user->rights->banque->modifier && $acct->type != 2) // Si non compte cash
|
||||
{
|
||||
print '<a class="tabAction" href="rappro.php?account='.$acct->id.'">'.$langs->trans("Rappro").'</a>';
|
||||
}
|
||||
@ -392,7 +395,7 @@ function _print_lines($db,$result,$sql,$acct)
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
if ($objp->rappro && $acct->type != 2) // Si non compte cash)
|
||||
{
|
||||
print "<td align=\"center\"><a href=\"releve.php?num=$objp->num_releve&account=$acct->id\">$objp->num_releve</a></td>";
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ if ($user->societe_id > 0)
|
||||
{
|
||||
$socidp = $user->societe_id;
|
||||
}
|
||||
$title=$langs->trans("IOMonthlyReporting").", ".$langs->trans("BankAccount")." : <a href=\"account.php?account=".$acct->id."\">".$acct->label."</a>";
|
||||
$title=$langs->trans("IOMonthlyReporting").", ".$langs->trans("FinancialAccount")." : <a href=\"account.php?account=".$acct->id."\">".$acct->label."</a>";
|
||||
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
|
||||
print_fiche_titre($title,$lien);
|
||||
print '<br>';
|
||||
@ -67,13 +67,14 @@ $sql .= " WHERE f.amount >= 0";
|
||||
if ($_GET["account"]) { $sql .= " AND fk_account = ".$_GET["account"]; }
|
||||
$sql .= " GROUP BY dm";
|
||||
|
||||
if ($db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($i);
|
||||
$row = $db->fetch_row($resql);
|
||||
$encaiss[$row[1]] = $row[0];
|
||||
$i++;
|
||||
}
|
||||
@ -86,14 +87,14 @@ $sql .= " FROM llx_bank as f";
|
||||
$sql .= " WHERE f.amount <= 0";
|
||||
if ($_GET["account"]) { $sql .= " AND fk_account = ".$_GET["account"]; }
|
||||
$sql .= " GROUP BY dm";
|
||||
|
||||
if ($db->query($sql))
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($i);
|
||||
$row = $db->fetch_row($resql);
|
||||
$decaiss[$row[1]] = -$row[0];
|
||||
$i++;
|
||||
}
|
||||
@ -102,10 +103,10 @@ if ($db->query($sql))
|
||||
}
|
||||
|
||||
|
||||
// Affiche tableau
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td rowspan=2>'.$langs->trans("Month").'</td>';
|
||||
|
||||
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="center" width="20%" colspan="2">'.$annee.'</td>';
|
||||
@ -118,48 +119,76 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
$var=true;
|
||||
for ($mois = 1 ; $mois < 13 ; $mois++)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print "<td>".strftime("%B",mktime(1,1,1,$mois,1,2000))."</td>";
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print "<td>".strftime("%B",mktime(1,1,1,$mois,1,2000))."</td>";
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="right" width="10%"> ';
|
||||
$case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee));
|
||||
if ($decaiss[$case]>0)
|
||||
{
|
||||
print price($decaiss[$case]);
|
||||
$totsorties[$annee]+=$decaiss[$case];
|
||||
}
|
||||
print "</td>";
|
||||
print '<td align="right" width="10%"> ';
|
||||
$case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee));
|
||||
if ($decaiss[$case]>0)
|
||||
{
|
||||
print price($decaiss[$case]);
|
||||
$totsorties[$annee]+=$decaiss[$case];
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print '<td align="right" width="10%"> ';
|
||||
$case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee));
|
||||
if ($encaiss[$case]>0)
|
||||
{
|
||||
print price($encaiss[$case]);
|
||||
$totentrees[$annee]+=$encaiss[$case];
|
||||
}
|
||||
print "</td>";
|
||||
print '<td align="right" width="10%"> ';
|
||||
$case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee));
|
||||
if ($encaiss[$case]>0)
|
||||
{
|
||||
print price($encaiss[$case]);
|
||||
$totentrees[$annee]+=$encaiss[$case];
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td><b>".$langs->trans("Total")."</b></td>";
|
||||
// Total debit-credit
|
||||
print '<tr class="liste_total"><td><b>'.$langs->trans("Total")."</b></td>";
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="right"><b>'.price($totsorties[$annee]).'</b></td><td align="right"><b>'.price($totentrees[$annee]).'</b></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
// Ligne vierge
|
||||
print '<tr><td> </td>';
|
||||
$nbcol=0;
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
$nbcol+=2;
|
||||
}
|
||||
print "</tr>\n";
|
||||
print '<td colspan="'.$nbcol.'"> </td>';
|
||||
|
||||
// Solde actuel
|
||||
$balance=0;
|
||||
$sql = "SELECT sum(f.amount) as total";
|
||||
$sql .= " FROM llx_bank as f";
|
||||
if ($_GET["account"]) { $sql .= " WHERE fk_account = ".$_GET["account"]; }
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $balance=$obj->total;
|
||||
}
|
||||
else {
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '<tr class="liste_total"><td><b>'.$langs->trans("CurrentBalance")."</b></td>";
|
||||
print '<td colspan="'.($nbcol).'" align="right">'.price($balance).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@ -67,12 +67,12 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
if ($account->label) {
|
||||
$id = $account->create($user->id);
|
||||
if (! $id) {
|
||||
$message=$account->error();
|
||||
$_GET["action"]='create'; // Force chargement page en mode creation
|
||||
if ($id > 0) {
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
}
|
||||
else {
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
$message='<div class="error">'.$account->error().'</div>';
|
||||
$_GET["action"]='create'; // Force chargement page en mode creation
|
||||
}
|
||||
} else {
|
||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("LabelBankCashAccount")).'</div>';
|
||||
@ -162,7 +162,7 @@ if ($_GET["action"] == 'create')
|
||||
print $form->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankBalance").'</td>';
|
||||
print '<tr><td valign="top">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" name="solde" value="0.00"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
||||
@ -225,7 +225,7 @@ else
|
||||
$head[$h][1] = $langs->trans("AccountCard");
|
||||
$h++;
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("FinancialAccount")." ".$account->number);
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("FinancialAccount")." ".($account->number?$account->number:$account->label));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
|
||||
@ -45,8 +45,10 @@ function llxHeader($head = "")
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
|
||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_account where clos = 0 AND courant = 1";
|
||||
$sql = "SELECT rowid, label, courant";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE clos = 0";
|
||||
$sql.= " AND courant in (1,2)";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -57,7 +59,7 @@ function llxHeader($head = "")
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/account.php?account=" . $objp->rowid, $objp->label);
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/releve.php?account=" . $objp->rowid ,$langs->trans("AccountStatements"));
|
||||
if ($objp->courant != 2) $menu->add_submenu(DOL_URL_ROOT."/compta/bank/releve.php?account=" . $objp->rowid ,$langs->trans("AccountStatements"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=" . $objp->rowid ,$langs->trans("IOMonthlyReporting"));
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -210,11 +210,11 @@ if ($result)
|
||||
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||
print "<td> </td><td align=\"right\" nowrap>".price($objp->amount)."</td>\n";
|
||||
}
|
||||
|
||||
if ($objp->rappro)
|
||||
|
||||
@ -76,11 +76,10 @@ if (! isset($_GET["num"]))
|
||||
$sql .= $db->plimit($limit,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$numrows = $db->num_rows();
|
||||
$numrows = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("AccountStatements").", ".$langs->trans("BankAccount")." : <a href=\"account.php?account=".$acct->id."\">".$acct->label."</a>", $page, "releve.php","&account=".$_GET["account"],$sortfield,$sortorder,'',$numrows);
|
||||
@ -111,41 +110,47 @@ if (! isset($_GET["num"]))
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
/**
|
||||
* Vue d'un releve
|
||||
*
|
||||
*/
|
||||
if ($_GET["rel"] == 'prev')
|
||||
{
|
||||
// Recherche valeur pour num = numéro relevé précédent
|
||||
$sql = "SELECT distinct(num_releve) FROM ".MAIN_DB_PREFIX."bank WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"]." ORDER BY num_releve DESC";
|
||||
$sql = "SELECT distinct(num_releve) as num";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"];
|
||||
$sql.= " ORDER BY num_releve DESC";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$numrows = $db->num_rows();
|
||||
$numrows = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($numrows > 0)
|
||||
{
|
||||
$row = $db->fetch_row(0);
|
||||
$num = $row[0];
|
||||
$obj = $db->fetch_object($result);
|
||||
$num = $obj->num;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($_GET["rel"] == 'next')
|
||||
{
|
||||
// Recherche valeur pour num = numéro relevé précédent
|
||||
$sql = "SELECT distinct(num_releve) FROM ".MAIN_DB_PREFIX."bank WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"]." ORDER BY num_releve ASC";
|
||||
$sql = "SELECT distinct(num_releve) as num";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
|
||||
$sql.= " WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"];
|
||||
$sql.= " ORDER BY num_releve ASC";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$numrows = $db->num_rows();
|
||||
$numrows = $db->num_rows($result);
|
||||
$i = 0;
|
||||
if ($numrows > 0)
|
||||
{
|
||||
$row = $db->fetch_row(0);
|
||||
$num = $row[0];
|
||||
$obj = $db->fetch_object($result);
|
||||
$num = $obj->num;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -168,18 +173,18 @@ else
|
||||
print '<td>'.$langs->trans("Date").'</td><td>'.$langs->trans("DateValue").'</td><td>'.$langs->trans("Type").'</td><td width="30%">'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Debit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Credit").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Solde").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Balance").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE num_releve < $num AND fk_account = ".$acct->id;
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$total = $db->result (0, 0);
|
||||
$db->free();
|
||||
}
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = $db->result(0, 0);
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -193,7 +198,7 @@ else
|
||||
if ($result)
|
||||
{
|
||||
$var=True;
|
||||
$numrows = $db->num_rows();
|
||||
$numrows = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
// Ligne Solde début releve
|
||||
@ -228,7 +233,7 @@ else
|
||||
$resc = $db->query($sql);
|
||||
if ($resc)
|
||||
{
|
||||
$numc = $db->num_rows();
|
||||
$numc = $db->num_rows($resc);
|
||||
$ii = 0;
|
||||
while ($ii < $numc)
|
||||
{
|
||||
@ -271,7 +276,7 @@ else
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
$db->free($result);
|
||||
}
|
||||
// Ligne Total
|
||||
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total")." :</td><td align=\"right\">".price($totald)."</td><td align=\"right\">".price($totalc)."</td><td> </td><td> </td></tr>";
|
||||
@ -282,5 +287,5 @@ else
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user