Skip to content

Commit 9c73d4a

Browse files
vdegrandpreeldy
andauthored
Fix 35017 accounts for local taxes 2 (#36160)
* FIX#35017 add locattaxes accounts to accounting defaults * corr. libellés localtax pour afficher le bon pourcentage * assurer la cohérence de la structure def_tva --------- Co-authored-by: Laurent Destailleur <[email protected]>
1 parent cd30258 commit 9c73d4a

File tree

5 files changed

+70
-10
lines changed

5 files changed

+70
-10
lines changed

htdocs/accountancy/admin/defaultaccounts.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Copyright (C) 2014 Juanjo Menent <[email protected]>
88
* Copyright (C) 2015 Jean-François Ferry <[email protected]>
99
* Copyright (C) 2024 Frédéric France <[email protected]>
10+
* Copyright (C) 2025 Vincent de Grandporé <[email protected]>
1011
*
1112
* This program is free software; you can redistribute it and/or modify
1213
* it under the terms of the GNU General Public License as published by
@@ -102,9 +103,20 @@
102103

103104
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
104105

106+
$list_account[] = 'ACCOUNTING_LT1_SOLD_ACCOUNT';
107+
$list_account[] = 'ACCOUNTING_LT1_BUY_ACCOUNT';
108+
$list_account[] = 'ACCOUNTING_LT1_PAY_ACCOUNT';
109+
$list_account[] = 'ACCOUNTING_LT2_SOLD_ACCOUNT';
110+
$list_account[] = 'ACCOUNTING_LT2_BUY_ACCOUNT';
111+
$list_account[] = 'ACCOUNTING_LT2_PAY_ACCOUNT';
112+
105113
if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) {
106114
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
107115
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
116+
$list_account[] = 'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT';
117+
$list_account[] = 'ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT';
118+
$list_account[] = 'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT';
119+
$list_account[] = 'ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT';
108120
}
109121
if (isModEnabled('bank')) {
110122
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
@@ -285,8 +297,14 @@
285297
print img_picto('', 'service', 'class="pictofixedwidth"');
286298
} elseif (preg_match('/^ACCOUNTING_VAT_PAY_ACCOUNT/', $key)) {
287299
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
300+
} elseif (preg_match('/^ACCOUNTING_LT1_PAY_ACCOUNT/', $key)) {
301+
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
302+
} elseif (preg_match('/^ACCOUNTING_LT2_PAY_ACCOUNT/', $key)) {
303+
print img_picto('', 'payment_vat', 'class="pictofixedwidth"');
288304
} elseif (preg_match('/^ACCOUNTING_VAT/', $key)) {
289305
print img_picto('', 'vat', 'class="pictofixedwidth"');
306+
} elseif (preg_match('/^ACCOUNTING_LT/', $key)) {
307+
print img_picto('', 'vat', 'class="pictofixedwidth"');
290308
} elseif (preg_match('/^ACCOUNTING_ACCOUNT_CUSTOMER/', $key)) {
291309
print img_picto('', 'bill', 'class="pictofixedwidth"');
292310
} elseif (preg_match('/^LOAN_ACCOUNTING_ACCOUNT/', $key)) {

htdocs/accountancy/journal/purchasesjournal.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Copyright (C) 2018-2025 Frédéric France <[email protected]>
1010
* Copyright (C) 2018 Eric Seigne <[email protected]>
1111
* Copyright (C) 2024-2025 MDW <[email protected]>
12+
* Copyright (C) 2025 Vincent de Grandporé <[email protected]>
1213
*
1314
* This program is free software; you can redistribute it and/or modify
1415
* it under the terms of the GNU General Public License as published by
@@ -139,7 +140,7 @@
139140
}
140141

141142
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle as label, f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,";
142-
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
143+
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.localtax1_tx, fd.localtax2_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
143144
$sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
144145
$sql .= " co.code as country_code, co.label as country_label,";
145146
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,";
@@ -225,6 +226,12 @@
225226
$cpttva = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined');
226227
$rcctva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
227228
$rcdtva = getDolGlobalString('ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
229+
$cptlocaltax1 = getDolGlobalString('ACCOUNTING_LT1_BUY_ACCOUNT', 'NotDefined');
230+
$rcclocaltax1 = getDolGlobalString('ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
231+
$rcdlocaltax1 = getDolGlobalString('ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
232+
$cptlocaltax2 = getDolGlobalString('ACCOUNTING_LT2_BUY_ACCOUNT', 'NotDefined');
233+
$rcclocaltax2 = getDolGlobalString('ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT', 'NotDefined');
234+
$rcdlocaltax2 = getDolGlobalString('ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT', 'NotDefined');
228235
$noTaxDispatchingKeepWithLines = getDolGlobalInt('ACCOUNTING_PURCHASES_DO_NOT_DISPATCH_TAXES'); //If enabled, Tax will NOT get split off from the base entry and credited to a separate tax account (good for non-VAT countries like USA)
229236
$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
230237

@@ -257,13 +264,19 @@
257264
$vatdata_cache[$tax_id] = $vatdata;
258265
}
259266
$compta_tva = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
260-
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
261-
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva);
267+
$compta_localtax1 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cptlocaltax1);
268+
$compta_localtax2 = (!empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cptlocaltax2);
262269
$compta_counterpart_tva_npr = getDolGlobalString('ACCOUNTING_COUNTERPART_VAT_NPR', 'NotDefined');
263270

264271
// Define an array to display all VAT rates that use this accounting account $compta_tva
265272
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
266273
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
274+
if ($obj->localtax1_tx > 0.0) {
275+
$def_tva[$obj->rowid][$compta_localtax1][vatrate($obj->localtax1_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '').' LT1'] = (vatrate($obj->localtax1_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
276+
}
277+
if ($obj->localtax2_tx > 0.0) {
278+
$def_tva[$obj->rowid][$compta_localtax2][vatrate($obj->localtax2_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '').' LT2'] = (vatrate($obj->localtax2_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
279+
}
267280
}
268281

269282
//$line = new SupplierInvoiceLine($db);
@@ -301,10 +314,10 @@
301314
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
302315
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
303316
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
304-
$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
305-
$rcd_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
306-
$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
307-
$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
317+
$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcclocaltax1);
318+
$rcd_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdlocaltax1);
319+
$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcclocaltax2);
320+
$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdlocaltax2);
308321
if (price2num($obj->product_buy_vat) || !empty($obj->product_buy_default_vat_code)) {
309322
$vat_key = vatrate($obj->product_buy_vat) . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : '');
310323
$val_value = $vat_key;

htdocs/accountancy/journal/sellsjournal.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Copyright (C) 2014 Raphaël Doursenaud <[email protected]>
1111
* Copyright (C) 2018-2025 Frédéric France <[email protected]>
1212
* Copyright (C) 2024-2025 MDW <[email protected]>
13+
* Copyright (C) 2025 Vincent de Grandporé <[email protected]>
1314
*
1415
* This program is free software; you can redistribute it and/or modify
1516
* it under the terms of the GNU General Public License as published by
@@ -140,7 +141,7 @@
140141
}
141142

142143
$sql = "SELECT f.rowid, f.ref, f.type, f.situation_cycle_ref, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code, f.retained_warranty, f.revenuestamp, f.situation_final,";
143-
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
144+
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.localtax1_tx, fd.localtax2_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code, fd.info_bits,";
144145
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,";
145146
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
146147
$sql .= " spe.accountancy_code_customer_general,";
@@ -223,6 +224,8 @@
223224
// Variables
224225
$cptcli = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined');
225226
$cpttva = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT', 'NotDefined');
227+
$cptlocaltax1 = getDolGlobalString('ACCOUNTING_LT1_SOLD_ACCOUNT', 'NotDefined');
228+
$cptlocaltax2 = getDolGlobalString('ACCOUNTING_LT2_SOLD_ACCOUNT', 'NotDefined');
226229

227230
$result = $db->query($sql);
228231
if ($result) {
@@ -262,12 +265,18 @@
262265
$vatdata_cache[$tax_id] = $vatdata;
263266
}
264267
$compta_tva = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
265-
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
266-
$compta_localtax2 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva);
268+
$compta_localtax1 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cptlocaltax1);
269+
$compta_localtax2 = (!empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cptlocaltax2);
267270

268271
// Define the array to store the detail of each vat rate and code for lines
269272
if (price2num($obj->tva_tx) || !empty($obj->vat_src_code)) {
270273
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
274+
if ($obj->localtax1_tx > 0.0) {
275+
$def_tva[$obj->rowid][$compta_localtax1][vatrate($obj->localtax1_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '').' LT1'] = (vatrate($obj->localtax1_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
276+
}
277+
if ($obj->localtax2_tx > 0.0) {
278+
$def_tva[$obj->rowid][$compta_localtax2][vatrate($obj->localtax2_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '').' LT2'] = (vatrate($obj->localtax2_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
279+
}
271280
}
272281

273282
// Create a compensation rate for situation invoice.

htdocs/langs/en_US/compta.lang

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,21 @@ CalculationMode=Calculation mode
262262
AccountancyJournal=Accounting code journal
263263
ACCOUNTING_VAT_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on sales (used if not defined on VAT dictionary setup)
264264
ACCOUNTING_VAT_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for VAT on purchases (used if not defined on VAT dictionary setup)
265+
ACCOUNTING_LT1_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for local tax 1 on sales
266+
ACCOUNTING_LT1_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for local tax 1 on purchases
267+
ACCOUNTING_LT2_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for local tax 2 on sales
268+
ACCOUNTING_LT2_BUY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for local tax 2 on purchases
265269
ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT=Account (from the Chart Of Account) to be used for the revenue stamp on sales
266270
ACCOUNTING_REVENUESTAMP_BUY_ACCOUNT=Account (from the Chart Of Account) to be used for the revenue stamp on purchases
267271
ACCOUNTING_VAT_PAY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for paying VAT
272+
ACCOUNTING_LT1_PAY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for paying local tax 1
273+
ACCOUNTING_LT2_PAY_ACCOUNT=Account (from the Chart Of Account) to be used as the default account for paying local tax 2
268274
ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT=Account (from the Chart Of Account) to be used as the default account for VAT on purchases for reverse charges (Credit)
269275
ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT=Account (from the Chart Of Account) to be used as the default account for VAT on purchases for reverse charges (Debit)
276+
ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT=Account (from the Chart Of Account) to be used as the default account for local tax 1 on purchases for reverse charges (Credit)
277+
ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT=Account (from the Chart Of Account) to be used as the default account for local tax 1 on purchases for reverse charges (Debit)
278+
ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT=Account (from the Chart Of Account) to be used as the default account for local tax 2 on purchases for reverse charges (Credit)
279+
ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT=Account (from the Chart Of Account) to be used as the default account for local tax 2 on purchases for reverse charges (Debit)
270280
ACCOUNTING_ACCOUNT_CUSTOMER=Account (from the Chart Of Account) used for "customer" third parties
271281
ACCOUNTING_ACCOUNT_CUSTOMER_Desc=The dedicated accounting account defined on third party card will be used for Subledger accounting only. This one will be used for General Ledger and as default value of Subledger accounting if dedicated customer accounting account on third party is not defined.
272282
ACCOUNTING_ACCOUNT_SUPPLIER=Account (from the Chart of Account) used for the "vendor" third parties

htdocs/langs/fr_FR/compta.lang

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,21 @@ CalculationMode=Mode de calcul
259259
AccountancyJournal=Code journal comptable
260260
ACCOUNTING_VAT_SOLD_ACCOUNT=Compte comptable par défaut pour la TVA sur les ventes (utilisé s'il n'est pas défini dans la configuration du dictionnaire TVA)
261261
ACCOUNTING_VAT_BUY_ACCOUNT=Compte comptable par défaut pour la TVA sur les achats (utilisé s'il n'est pas défini dans la configuration du dictionnaire TVA)
262+
ACCOUNTING_LT1_SOLD_ACCOUNT=Compte comptable par défaut pour la taxe locale 1 sur les ventes
263+
ACCOUNTING_LT1_BUY_ACCOUNT=Compte comptable par défaut pour la taxe locale 1 sur les achats
264+
ACCOUNTING_LT2_SOLD_ACCOUNT=Compte comptable par défaut pour la taxe locale 2 sur les ventes
265+
ACCOUNTING_LT2_BUY_ACCOUNT=Compte comptable par défaut pour la taxe locale 2 sur les achats
262266
ACCOUNTING_REVENUESTAMP_SOLD_ACCOUNT=Compte (du plan comptable) à utiliser pour le timbre fiscal sur les ventes
263267
ACCOUNTING_REVENUESTAMP_BUY_ACCOUNT=Compte (du plan comptable) à utiliser pour le timbre fiscal sur les achats
264268
ACCOUNTING_VAT_PAY_ACCOUNT=Compte comptable par défaut pour le paiement de la TVA
265269
ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT=Compte comptable par défaut pour la TVA sur les achats pour les autoliquidations (crédit)
266270
ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT=Compte comptable par défaut pour la TVA sur les achats pour les autoliquidations (débit)
271+
ACCOUNTING_LT1_PAY_ACCOUNT=Compte comptable par défaut pour le paiement de la taxe locale 1
272+
ACCOUNTING_LT1_BUY_REVERSE_CHARGES_CREDIT=Compte comptable par défaut pour la taxe locale 1 sur les achats pour les autoliquidations (crédit)
273+
ACCOUNTING_LT1_BUY_REVERSE_CHARGES_DEBIT=Compte comptable par défaut pour la taxe locale 1 sur les achats pour les autoliquidations (débit)
274+
ACCOUNTING_LT2_PAY_ACCOUNT=Compte comptable par défaut pour le paiement de la taxe locale 2
275+
ACCOUNTING_LT2_BUY_REVERSE_CHARGES_CREDIT=Compte comptable par défaut pour la taxe locale 2 sur les achats pour les autoliquidations (crédit)
276+
ACCOUNTING_LT2_BUY_REVERSE_CHARGES_DEBIT=Compte comptable par défaut pour la taxe locale 2 sur les achats pour les autoliquidations (débit)
267277
ACCOUNTING_ACCOUNT_CUSTOMER=Compte comptable général par défaut pour les tiers "clients"
268278
ACCOUNTING_ACCOUNT_CUSTOMER_Desc=Le compte comptable dédié défini sur la fiche tiers sera utilisé pour l'affectation du compte auxiliaire uniquement. Celui-ci sera utilisé pour la comptabilité générale et comme valeur par défaut de la comptabilité auxiliaire si le compte comptable client dédié du tiers n'est pas défini.
269279
ACCOUNTING_ACCOUNT_SUPPLIER=Compte comptable général par défaut pour les tiers "fournisseurs"

0 commit comments

Comments
 (0)