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