50 $this->family =
"financial";
51 $this->module_position =
'51';
53 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
54 $this->
description =
"Gestion des comptes financiers de type Comptes bancaires ou postaux";
57 $this->version =
'dolibarr';
59 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
60 $this->picto =
'account';
63 $this->dirs = array(
"/banque/temp");
67 $this->config_page_url = array(
"bank.php");
70 $this->depends = array();
71 $this->requiredby = array(
"modComptabilite",
"modAccounting",
"modPrelevement");
72 $this->conflictwith = array();
73 $this->langfiles = array(
"banks",
"compta",
"bills",
"companies",
"accounting");
76 $this->
const = array();
79 $this->boxes = array(0=>array(
'file'=>
'box_comptes.php',
'enabledbydefaulton'=>
'Home'));
82 $this->rights = array();
83 $this->rights_class =
'banque';
87 $this->rights[$r][0] = 111;
88 $this->rights[$r][1] =
'Read bank account and transactions';
89 $this->rights[$r][2] =
'r';
90 $this->rights[$r][3] = 0;
91 $this->rights[$r][4] =
'lire';
94 $this->rights[$r][0] = 112;
95 $this->rights[$r][1] =
'Creer/modifier montant/supprimer ecriture bancaire';
96 $this->rights[$r][2] =
'w';
97 $this->rights[$r][3] = 0;
98 $this->rights[$r][4] =
'modifier';
101 $this->rights[$r][0] = 113;
102 $this->rights[$r][1] =
'Configurer les comptes bancaires (creer, gerer categories)';
103 $this->rights[$r][2] =
'a';
104 $this->rights[$r][3] = 0;
105 $this->rights[$r][4] =
'configurer';
108 $this->rights[$r][0] = 114;
109 $this->rights[$r][1] =
'Rapprocher les ecritures bancaires';
110 $this->rights[$r][2] =
'w';
111 $this->rights[$r][3] = 0;
112 $this->rights[$r][4] =
'consolidate';
115 $this->rights[$r][0] = 115;
116 $this->rights[$r][1] =
'Exporter transactions et releves';
117 $this->rights[$r][2] =
'r';
118 $this->rights[$r][3] = 0;
119 $this->rights[$r][4] =
'export';
122 $this->rights[$r][0] = 116;
123 $this->rights[$r][1] =
'Virements entre comptes';
124 $this->rights[$r][2] =
'w';
125 $this->rights[$r][3] = 0;
126 $this->rights[$r][4] =
'transfer';
129 $this->rights[$r][0] = 117;
130 $this->rights[$r][1] =
'Gerer les envois de cheques';
131 $this->rights[$r][2] =
'w';
132 $this->rights[$r][3] = 0;
133 $this->rights[$r][4] =
'cheque';
147 $this->export_code[$r] = $this->rights_class.
'_'.$r;
148 $this->export_label[$r] =
'Ecritures bancaires et releves';
149 $this->export_permission[$r] = array(array(
"banque",
"export"));
150 $this->export_fields_array[$r] = array(
151 'b.rowid'=>
'IdTransaction',
'ba.ref'=>
'AccountRef',
'ba.label'=>
'AccountLabel',
'b.datev'=>
'DateValue',
'b.dateo'=>
'DateOperation',
'b.label'=>
'Label',
152 'b.num_chq'=>
'ChequeOrTransferNumber',
'b.fk_bordereau'=>
'ChequeBordereau',
'-b.amount'=>
'Debit',
'b.amount'=>
'Credit',
153 'b.num_releve'=>
'AccountStatement',
'b.rappro'=>
'BankLineReconciled',
'b.datec'=>
"DateCreation",
"bu.url_id"=>
"IdThirdParty",
154 "s.nom"=>
"ThirdParty",
"s.code_compta"=>
"CustomerAccountancyCode",
"s.code_compta_fournisseur"=>
"SupplierAccountancyCode"
156 $this->export_TypeFields_array[$r] = array(
'ba.ref'=>
'Text',
'ba.label'=>
'Text',
'b.datev'=>
'Date',
'b.dateo'=>
'Date',
'b.label'=>
'Text',
'b.num_chq'=>
'Text',
'b.fk_bordereau'=>
'Text',
'-b.amount'=>
'Numeric',
'b.amount'=>
'Numeric',
'b.num_releve'=>
'Text',
'b.rappro'=>
'Boolean',
'b.datec'=>
"Date",
"bu.url_id"=>
"Text",
"s.nom"=>
"Text",
"s.code_compta"=>
"Text",
"s.code_compta_fournisseur"=>
"Text");
157 $this->export_entities_array[$r] = array(
158 'b.rowid'=>
'account',
'ba.ref'=>
'account',
'ba.label'=>
'account',
'b.datev'=>
'account',
'b.dateo'=>
'account',
'b.label'=>
'account',
159 'b.num_chq'=>
'account',
'b.fk_bordereau'=>
'account',
'-b.amount'=>
'account',
'b.amount'=>
'account',
160 'b.num_releve'=>
'account',
'b.rappro'=>
'account',
'b.datec'=>
"account",
"bu.url_id"=>
"company",
161 "s.nom"=>
"company",
"s.code_compta"=>
"company",
"s.code_compta_fournisseur"=>
"company"
163 $this->export_special_array[$r] = array(
'-b.amount'=>
'NULLIFNEG',
'b.amount'=>
'NULLIFNEG');
164 if (!isModEnabled(
'supplier_order') && !isModEnabled(
'supplier_invoice')) {
165 unset($this->export_fields_array[$r][
's.code_compta_fournisseur']);
166 unset($this->export_entities_array[$r][
's.code_compta_fournisseur']);
168 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
169 $this->export_sql_end[$r] =
' FROM ('.MAIN_DB_PREFIX.
'bank_account as ba, '.MAIN_DB_PREFIX.
'bank as b)';
170 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')";
171 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON bu.url_id = s.rowid';
172 $this->export_sql_end[$r] .=
' WHERE ba.rowid = b.fk_account';
173 $this->export_sql_end[$r] .=
' AND ba.entity IN ('.getEntity(
'bank_account').
')';
174 $this->export_sql_order[$r] =
' ORDER BY b.datev, b.num_releve';
178 $this->export_code[$r] = $this->rights_class.
'_'.$r;
179 $this->export_label[$r] =
'Bordereaux remise Chq/Fact';
180 $this->export_permission[$r] = array(array(
"banque",
"export"));
181 $this->export_fields_array[$r] = array(
"bch.rowid"=>
"DepositId",
"bch.ref"=>
"Numero",
"bch.ref_ext"=>
"RefExt",
'ba.ref'=>
'AccountRef',
'ba.label'=>
'AccountLabel',
'b.datev'=>
'DateValue',
'b.num_chq'=>
'ChequeOrTransferNumber',
'b.amount'=>
'Credit',
'b.num_releve'=>
'AccountStatement',
'b.datec'=>
"DateCreation",
182 "bch.date_bordereau"=>
"Date",
"bch.amount"=>
"Total",
"bch.nbcheque"=>
"NbCheque",
"bu.url_id"=>
"IdThirdParty",
"s.nom"=>
"ThirdParty",
"s.code_compta"=>
"CustomerAccountancyCode",
"f.ref"=>
"InvoiceRef"
184 $this->export_TypeFields_array[$r] = array(
'ba.ref'=>
'Text',
'ba.label'=>
'Text',
'b.datev'=>
'Date',
'b.num_chq'=>
'Text',
'b.amount'=>
'Numeric',
'b.num_releve'=>
'Text',
'b.datec'=>
"Date",
185 "bch.date_bordereau"=>
"Date",
"bch.rowid"=>
"Numeric",
"bch.ref"=>
"Numeric",
"bch.ref_ext"=>
"Text",
"bch.amount"=>
"Numeric",
"bch.nbcheque"=>
"Numeric",
"bu.url_id"=>
"Text",
"s.nom"=>
"Text",
"s.code_compta"=>
"Text",
"f.ref"=>
"Text"
187 $this->export_entities_array[$r] = array(
'ba.ref'=>
'account',
'ba.label'=>
'account',
'b.datev'=>
'account',
'b.num_chq'=>
'account',
'b.amount'=>
'account',
'b.num_releve'=>
'account',
'b.datec'=>
"account",
188 "bu.url_id"=>
"company",
"s.nom"=>
"company",
"s.code_compta"=>
"company",
"s.code_compta_fournisseur"=>
"company",
"f.ref"=>
"invoice");
189 $this->export_special_array[$r] = array(
'b.amount'=>
'NULLIFNEG');
191 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
192 $this->export_sql_end[$r] =
' FROM ('.MAIN_DB_PREFIX.
'bordereau_cheque as bch, '.MAIN_DB_PREFIX.
'bank_account as ba, '.MAIN_DB_PREFIX.
'bank as b)';
193 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"bank_url as bu ON (bu.fk_bank = b.rowid AND bu.type = 'company')";
194 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement as p ON b.rowid = p.fk_bank';
195 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'paiement_facture as pf ON p.rowid = pf.fk_paiement';
196 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'facture as f ON f.rowid = pf.fk_facture';
197 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON f.fk_soc = s.rowid';
198 $this->export_sql_end[$r] .=
' WHERE ba.rowid = b.fk_account AND bch.rowid = b.fk_bordereau and bch.fk_bank_account=ba.rowid';
199 $this->export_sql_end[$r] .=
" AND b.fk_type = 'CHQ'";
200 $this->export_sql_end[$r] .=
' AND p.fk_paiement = 7';
201 $this->export_sql_end[$r] .=
' AND ba.entity IN ('.getEntity(
'bank_account').
')';
202 $this->export_sql_order[$r] =
' ORDER BY b.datev, b.num_releve';
206 $this->export_code[$r] = $this->rights_class.
'_'.$r;
207 $this->export_label[$r] =
'VariousPayment';
208 $this->export_permission[$r] = array(array(
"banque",
"export"));
209 $this->export_fields_array[$r] = array(
210 'v.rowid'=>
'VariousPaymentId',
'v.label'=>
'VariousPaymentLabel',
'v.datev'=>
'DateValue',
'v.datep'=>
'DateOperation',
211 'v.num_payment'=>
'ChequeOrTransferNumber',
'v.amount'=>
'Amount',
'v.sens'=>
'Sens',
212 'cp.id'=>
"PaymentMode",
213 'v.accountancy_code'=>
'AccountAccounting',
'v.subledger_account'=>
'SubledgerAccount',
214 'v.note'=>
'Note',
'v.datec'=>
'DateCreation',
215 'p.ref'=>
'ProjectRef',
'p.title'=>
'ProjectLabel'
217 $this->export_TypeFields_array[$r] = array(
218 'v.rowid'=>
'Text',
'v.label'=>
'Text',
'v.datep'=>
'Date',
'v.datev'=>
'Date',
219 'v.num_payment'=>
'Text',
'v.amount'=>
'Numeric',
'v.sens'=>
'Numeric',
220 'cp.id'=>
'List:c_paiement:code:id:code',
221 "v.accountancy_code"=>
"Text",
"v.subledger_account"=>
"Text",
222 "v.note"=>
"Text",
'v.datec'=>
"Date",
223 "p.ref"=>
"Text",
"p.title"=>
"Text"
225 $this->export_entities_array[$r] = array(
226 'v.rowid'=>
'payment',
'v.label'=>
'payment',
'v.datev'=>
'payment',
'v.datep'=>
'payment',
227 'v.num_payment'=>
'payment',
'v.amount'=>
'payment',
'v.sens'=>
'payment',
229 'v.accountancy_code'=>
'payment',
'v.subledger_account'=>
"payment",
230 'v.note'=>
"payment",
'v.datec'=>
"payment",
231 "p.ref"=>
"project",
"p.title"=>
"project"
233 $this->export_sql_start[$r] =
'SELECT ';
234 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'payment_various as v';
235 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"projet as p ON v.fk_projet = p.rowid";
236 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"c_paiement as cp ON v.fk_typepayment = cp.id";
237 $this->export_sql_end[$r] .=
' WHERE v.entity IN ('.getEntity(
'payment_various').
')';
238 $this->export_sql_order[$r] =
' ORDER BY v.datep';