From 24b56183944a3680e342df8f25cc443534156acd Mon Sep 17 00:00:00 2001 From: Adrien Gallou Date: Mon, 20 Nov 2023 23:42:38 +0100 Subject: [PATCH] =?UTF-8?q?fiscalisation=20:=20ajouter=20la=20TVA=20dans?= =?UTF-8?q?=20les=20entr=C3=A9es=20du=20journal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #1338 * Ajout de nouveaux champs dans la table du journal * dans l'admin on permet de les ajouter/modifier --- db/migrations/20231120220609_tva_journal.php | 19 +++++++++++++ .../pages/administration/compta_journal.php | 28 +++++++++++++++++-- sources/Afup/Comptabilite/Comptabilite.php | 20 ++++++++++--- 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 db/migrations/20231120220609_tva_journal.php diff --git a/db/migrations/20231120220609_tva_journal.php b/db/migrations/20231120220609_tva_journal.php new file mode 100644 index 000000000..77908b6d3 --- /dev/null +++ b/db/migrations/20231120220609_tva_journal.php @@ -0,0 +1,19 @@ +execute($sql); + } +} diff --git a/htdocs/pages/administration/compta_journal.php b/htdocs/pages/administration/compta_journal.php index 2aecc0c28..750c1d8ba 100755 --- a/htdocs/pages/administration/compta_journal.php +++ b/htdocs/pages/administration/compta_journal.php @@ -112,6 +112,11 @@ function paybox_link($description) $champs['obs_regl'] = $champsRecup['obs_regl']; $champs['idevenement'] = $champsRecup['idevenement']; $champs['comment'] = $champsRecup['comment']; + $champs['montant_ht_soumis_tva_0'] = $champsRecup['montant_ht_soumis_tva_0']; + $champs['montant_ht_soumis_tva_5_5'] = $champsRecup['montant_ht_soumis_tva_5_5']; + $champs['montant_ht_soumis_tva_10'] = $champsRecup['montant_ht_soumis_tva_10']; + $champs['montant_ht_soumis_tva_20'] = $champsRecup['montant_ht_soumis_tva_20']; + //$formulaire->setDefaults($champsRecup); @@ -145,6 +150,13 @@ function paybox_link($description) $formulaire->addElement('text', 'montant', 'Montant' , array('size' => 30, 'maxlength' => 40)); $formulaire->addElement('text', 'comment', 'Commentaire' , array('size' => 30, 'maxlength' => 255)); + $formulaire->addElement('header' , '' , 'TVA'); + $formulaire->addElement('text', 'montant_ht_soumis_tva_5_5', 'Montant HT soumis à TVA 5.5%' , array('size' => 30, 'maxlength' => 40)); + $formulaire->addElement('text', 'montant_ht_soumis_tva_10', 'Montant HT soumis à TVA 10%' , array('size' => 30, 'maxlength' => 40)); + $formulaire->addElement('text', 'montant_ht_soumis_tva_20', 'Montant HT soumis à TVA 20%' , array('size' => 30, 'maxlength' => 40)); + $formulaire->addElement('text', 'montant_ht_soumis_tva_0', 'Montant HT non soumis à TVA' , array('size' => 30, 'maxlength' => 40)); + + //reglement $formulaire->addElement('header' , '' , 'Réglement'); $formulaire->addElement('select' , 'idmode_regl', 'Réglement', $compta->obtenirListReglements()); @@ -207,7 +219,12 @@ function paybox_link($description) $date_regl, $valeur['obs_regl'], $valeur['idevenement'], - $valeur['comment'] + $valeur['comment'], + 0, + $valeur['montant_ht_soumis_tva_0'], + $valeur['montant_ht_soumis_tva_5_5'], + $valeur['montant_ht_soumis_tva_10'], + $valeur['montant_ht_soumis_tva_20'] ); } else { $ok = $compta->modifier( @@ -224,10 +241,15 @@ function paybox_link($description) $date_regl, $valeur['obs_regl'], $valeur['idevenement'], - $valeur['comment'] + $valeur['comment'], + null, + 0, + $valeur['montant_ht_soumis_tva_0'], + $valeur['montant_ht_soumis_tva_5_5'], + $valeur['montant_ht_soumis_tva_10'], + $valeur['montant_ht_soumis_tva_20'] ); } - if ($ok) { if ($action == 'ajouter') { Logs::log('Ajout une écriture ' . $formulaire->exportValue('titre')); diff --git a/sources/Afup/Comptabilite/Comptabilite.php b/sources/Afup/Comptabilite/Comptabilite.php index ce109d51a..3458fd51b 100755 --- a/sources/Afup/Comptabilite/Comptabilite.php +++ b/sources/Afup/Comptabilite/Comptabilite.php @@ -483,13 +483,15 @@ public function obtenirListReglementsJournal() function ajouter($idoperation, $idcompte, $idcategorie, $date_ecriture, $nom_frs, $montant, $description, $numero, $idmode_regl, $date_regl, $obs_regl, $idevenement, $numero_operation = null, - $attachmentRequired = 0) + $attachmentRequired = 0, $montantHtSoumisTva0 = null, $montantHtSoumisTva55 = null, $montantHtSoumisTva10 = null, $montantHtSoumisTva20 = null) { $requete = 'INSERT INTO '; $requete .= 'compta ('; $requete .= 'idoperation,idcategorie,date_ecriture,nom_frs,montant,description,'; - $requete .= 'numero,idmode_regl,date_regl,obs_regl,idevenement, numero_operation,idcompte, attachment_required) '; + $requete .= 'numero,idmode_regl,date_regl,obs_regl,idevenement, numero_operation,idcompte, attachment_required, + montant_ht_soumis_tva_0, montant_ht_soumis_tva_5_5, montant_ht_soumis_tva_10, montant_ht_soumis_tva_20 + ) '; $requete .= 'VALUES ('; $requete .= $this->_bdd->echapper($idoperation) . ','; $requete .= $this->_bdd->echapper($idcategorie) . ','; @@ -504,7 +506,11 @@ function ajouter($idoperation, $idcompte, $idcategorie, $date_ecriture, $nom_frs $requete .= $this->_bdd->echapper($idevenement) . ','; $requete .= $this->_bdd->echapper($numero_operation) . ','; $requete .= $this->_bdd->echapper($idcompte) . ','; - $requete .= $this->_bdd->echapper($attachmentRequired) . ''; + $requete .= $this->_bdd->echapper($attachmentRequired) . ','; + $requete .= (!$montantHtSoumisTva0 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva0)) . ','; + $requete .= (!$montantHtSoumisTva55 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva55)) . ','; + $requete .= (!$montantHtSoumisTva10 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva10)) . ','; + $requete .= (!$montantHtSoumisTva20 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva20)) . ''; $requete .= ');'; $resultat = $this->_bdd->executer($requete); @@ -515,7 +521,9 @@ function ajouter($idoperation, $idcompte, $idcategorie, $date_ecriture, $nom_frs } function modifier($id, $idoperation, $idcompte, $idcategorie, $date_ecriture, $nom_frs, $montant, $description, - $numero, $idmode_regl, $date_regl, $obs_regl, $idevenement, $comment, $numero_operation = null, $attachmentRequired = 0) + $numero, $idmode_regl, $date_regl, $obs_regl, $idevenement, $comment, $numero_operation = null, $attachmentRequired = 0, + $montantHtSoumisTva0 = null, $montantHtSoumisTva55 = null, $montantHtSoumisTva10 = null, $montantHtSoumisTva20 = null + ) { $requete = 'UPDATE '; @@ -532,6 +540,10 @@ function modifier($id, $idoperation, $idcompte, $idcategorie, $date_ecriture, $n $requete .= 'date_regl=' . $this->_bdd->echapper($date_regl) . ','; $requete .= 'obs_regl=' . $this->_bdd->echapper($obs_regl) . ','; $requete .= 'idcompte=' . $this->_bdd->echapper($idcompte) . ','; + $requete .= 'montant_ht_soumis_tva_0=' . (!$montantHtSoumisTva0 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva0)) . ','; + $requete .= 'montant_ht_soumis_tva_5_5=' . (!$montantHtSoumisTva55 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva55)) . ','; + $requete .= 'montant_ht_soumis_tva_10=' . (!$montantHtSoumisTva10 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva10)) . ','; + $requete .= 'montant_ht_soumis_tva_20=' . (!$montantHtSoumisTva20 ? 'NULL' : $this->_bdd->echapper($montantHtSoumisTva20)) . ','; $requete .= 'comment=' . (!$comment ? 'NULL' : $this->_bdd->echapper($comment)) . ','; if ($numero_operation) { $requete .= 'numero_operation=' . $this->_bdd->echapper($numero_operation) . ',';