New: Ajout fonction export des relevs et transactions bancaires

Trad: Traduction du solde initial
This commit is contained in:
Laurent Destailleur 2007-07-02 19:42:46 +00:00
parent 16017fb1be
commit f4443856b5
10 changed files with 32 additions and 16 deletions

View File

@ -212,7 +212,7 @@ class Account
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type,emetteur,banque)";
$sql.= " VALUES (now(), '".$this->db->idate($date)."', '".$this->db->idate($datev)."', ";
$sql.= " '".addslashes($label)."', '" . price2num($amount)."', '".$user->id."', ";
$sql.= " '".addslashes($label)."', " . price2num($amount).", '".$user->id."', ";
$sql.= " ".($num_chq?"'".$num_chq."'":"null").", ";
$sql.= " '".$this->rowid."', ";
$sql.= " '".$oper."', ";
@ -282,6 +282,8 @@ class Account
$sql.= "min_allowed=".price2num($this->min_allowed).",min_desired=".price2num($this->min_desired).",";
$sql.= "comment='".addslashes($this->comment)."'";
$sql.= ")";
dolibarr_syslog("Account::create sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{
@ -291,7 +293,7 @@ class 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")."','" . price2num($this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
$sql .= " VALUES (now(),'(".$langs->trans("InitialBankBalance").")'," . price2num($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;

View File

@ -47,7 +47,7 @@ if ($_POST["action"] == 'add')
// Creation compte
$account = new Account($db,0);
$account->ref = ereg_replace(' ','',trim($_POST["ref"]));
$account->ref = sanitize_string(trim($_POST["ref"]));
$account->label = trim($_POST["label"]);
$account->courant = $_POST["type"];
$account->clos = $_POST["clos"];
@ -57,7 +57,7 @@ if ($_POST["action"] == 'add')
$account->account_number = trim($_POST["account_number"]);
$account->solde = $_POST["solde"];
$account->date_solde = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$account->date_solde = dolibarr_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
$account->currency_code = trim($_POST["account_currency_code"]);
$account->country_code = trim($_POST["account_country_code"]);
@ -89,7 +89,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
$account = new Account($db, $_POST["id"]);
$account->fetch($_POST["id"]);
$account->ref = ereg_replace(' ','',trim($_POST["ref"]));
$account->ref = sanitize_string(trim($_POST["ref"]));
$account->label = trim($_POST["label"]);
$account->courant = $_POST["type"];
$account->clos = $_POST["clos"];

View File

@ -315,8 +315,8 @@ if ($step == 2 && $datatoexport)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Entities").'</td>';
print '<td>'.$langs->trans("ExportableFields").'</td>';
print '<td width="4%">&nbsp;</td>';
print '<td width="48%">'.$langs->trans("ExportedFields").'</td>';
print '<td width="12">&nbsp;</td>';
print '<td width="44%">'.$langs->trans("ExportedFields").'</td>';
print '</tr>';
// Champs exportables
@ -344,7 +344,7 @@ if ($step == 2 && $datatoexport)
$entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity;
$entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity;
print '<td>'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
print '<td nowrap="nowrap">'.img_object('',$entityicon).' '.$langs->trans($entitylang).'</td>';
if ((isset($array_selected[$code]) && $array_selected[$code]) || $modelchoice == 1)
{
// Champ sélectionné

View File

@ -66,7 +66,7 @@ class modBanque extends DolibarrModules
$this->depends = array();
$this->requiredby = array("modComptabilite","modComptabiliteExpert");
$this->conflictwith = array();
$this->langfiles = array("banks");
$this->langfiles = array("banks","compta","companies");
// Constantes
$this->const = array();
@ -127,9 +127,9 @@ class modBanque extends DolibarrModules
$r++;
$this->export_code[$r]=$this->id.'_'.$r;
$this->export_label[$r]='Ecritures bancaires et relevés';
$this->export_fields_array[$r]=array('b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation");
$this->export_entities_array[$r]=array('b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account");
$this->export_alias_array[$r]=array('b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec");
$this->export_fields_array[$r]=array('b.rowid'=>'IdTransaction','ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.dateo'=>'DateOperation','b.label'=>'Label','-b.amount'=>'Debit','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation","but.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","s.code_compta_fournisseur"=>"SupplierAccountancyCode");
$this->export_entities_array[$r]=array('b.rowid'=>'account','ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.dateo'=>'account','b.label'=>'account','-b.amount'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account","but.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company");
$this->export_alias_array[$r]=array('b.rowid'=>'tran_id','ba.ref'=>'account_ref','ba.label'=>'account_label','b.datev'=>'datev','b.dateo'=>'dateo','b.label'=>'label','-b.amount'=>'debit','b.amount'=>'credit','b.num_releve'=>'numrel','b.datec'=>"datec","but.url_id"=>"soc_id","s.nom"=>"thirdparty","s.code_compta"=>"customeracccode","s.code_compta_fournisseur"=>"supplieracccode");
$this->export_sql[$r]="select distinct ";
$i=0;
foreach ($this->export_alias_array[$r] as $key => $value)
@ -146,9 +146,12 @@ class modBanque extends DolibarrModules
$this->export_sql[$r].=$key.' as '.$value;
}
}
$this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'bank as b';
//$this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_url as but ON but.fk_bank = b.rowid';
$this->export_sql[$r].=' ORDER BY b.datev, b.num_releve';
$this->export_sql[$r].=' from '.MAIN_DB_PREFIX.'bank_account as ba, '.MAIN_DB_PREFIX.'bank as b';
$this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_url as but ON but.fk_bank = b.rowid';
$this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON but.url_id = s.rowid';
$this->export_sql[$r].=" WHERE IFNULL(but.type,'company') = 'company'";
$this->export_sql[$r].=' AND ba.rowid=b.fk_account';
$this->export_sql[$r].=' ORDER BY b.datev, b.num_releve';
$this->export_permission[$r]=array(array("banque","export"));
}

View File

@ -8,6 +8,8 @@ FinancialAccount=Account
FinancialAccounts=Accounts
BankAccount=Bank account
BankAccounts=Bank accounts
AccountRef=Financial account ref
AccountLabel=Financial account label
CashAccount=Cash account
CashAccounts=Cash accounts
MainAccount=Main account
@ -64,6 +66,7 @@ DeleteAccount=Delete account
ConfirmDeleteAccount=Are you sure you want to delete this account ?
Account=Account
ByCategories=By categories
IdTransaction=Id transaction
BankTransactions=Bank transactions
SearchTransaction=Search transaction
TransactionsToConciliate=Transactions to conciliate

View File

@ -17,6 +17,7 @@ NewSocGroup=Nouveau companies group
NewPrivateIndividual=New private individual (prospect, customer, supplier)
ProspectionArea=Prospection area
SocGroup=Group of companies
IdThirdParty=Id third party
IdCompany=Company Id
IdContact=Contact Id
Company=Company

View File

@ -8,6 +8,8 @@ FinancialAccount=Compte
FinancialAccounts=Comptes
BankAccount=Compte bancaire
BankAccounts=Comptes bancaires
AccountRef=Ref compte financier
AccountLabel=Libellé compte financier
CashAccount=Compte caisse/liquide
CashAccounts=Comptes caisses/liquides
MainAccount=Compte courant
@ -64,6 +66,7 @@ DeleteAccount=Suppression de compte
ConfirmDeleteAccount=Etes-vous sur de vouloir supprimer ce compte ?
Account=Compte
ByCategories=Par catégories
IdTransaction=Id transaction
BankTransactions=Transactions bancaires
SearchTransaction=Recherche écriture
TransactionsToConciliate=Ecritures à rapprocher

View File

@ -17,6 +17,7 @@ NewSocGroup=Nouveau groupement de soci
NewPrivateIndividual=Nouveau particulier (prospect, client, fournisseur)
ProspectionArea=Espace prospection
SocGroup=Groupement de sociétés
IdThirdParty=Id tiers
IdCompany=Id société
IdContact=Id contact
Company=Société

View File

@ -51,7 +51,7 @@ VATPayment=R
VATPayments=Réglements TVA
TotalToPay=Total à payer
CustomerAccountancyCode=Code compta client
SupplierAccountancyCode=Code compta founisseur
SupplierAccountancyCode=Code compta fournisseur
AlreadyPayed=Déjà réglé
AccountNumberShort=N° du compte
AccountNumber=Numéro du compte

View File

@ -689,3 +689,6 @@ ALTER TABLE llx_fichinter ADD COLUMN tms timestamp after ref;
ALTER TABLE llx_fichinter ADD COLUMN fk_contrat integer DEFAULT 0 after fk_projet;
drop table if exists `llx_accountingsystem_det`;
update llx_bank set label='(InitialBankBalance)' where fk_type='SOLD' and label in ('Balance','(Balance)','Solde','(Solde)');