noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 01/04: Recherche : sur base TVA


From: dwm
Subject: [Noalyss-commit] [noalyss] 01/04: Recherche : sur base TVA
Date: Thu, 27 Jul 2023 14:23:32 -0400 (EDT)

sparkyx pushed a commit to branch devel
in repository noalyss.

commit 887d407a87b2c2406ba5aed91a8fd8ca9ac6f49c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Jul 19 18:16:13 2023 +0200

    Recherche : sur base TVA
---
 include/class/acc_ledger_search.class.php | 20 ++++++++++++++++++--
 include/history_operation.inc.php         |  2 +-
 include/template/ledger_search.php        | 15 ++++++++++++++-
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/include/class/acc_ledger_search.class.php 
b/include/class/acc_ledger_search.class.php
index 8f678346d..fb043c4ad 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -242,7 +242,9 @@ class Acc_Ledger_Search
         $sCurrency->id=$this->div."p_currency_code";
         $sCurrency->value[]=array("label"=>_("Toutes"),"value"=>-1);
         $sCurrency->selected=$currency_id;
-        
+        $tva_id_search=new ITva_Popup("tva_id_search",
+                                $http->request("tva_id_search","string",null),
+                                $this->div."tva_id_search");
         ob_start();
         $search_filter=$this->build_search_filter();
         require_once NOALYSS_TEMPLATE.'/ledger_search.php';
@@ -490,6 +492,7 @@ class Acc_Ledger_Search
         $fil_hide_operation='';
         $fil_tag='';
         $fil_currency="";
+        $fil_vat="";
 
         $and='';
         $g_user=new Noalyss_user($this->cn);
@@ -679,8 +682,21 @@ class Acc_Ledger_Search
            $fil_currency=$and." x.currency_id = ".sql_string($p_currency_code);
            $and=" and ";
         }
+        // VAT Code
+        if ( isset($tva_id_search) && ! empty (trim($tva_id_search??"")))
+        {
+            $fil_vat = $and." jr_internal in 
+                (   select distinct qp_internal 
+                        from quant_purchase 
+                        where qp_vat_code=".sql_string($tva_id_search).
+                "  union all  
+                    select distinct qs_internal 
+                        from quant_sold 
+                        where qs_vat_code=".sql_string($tva_id_search).")";
+
+        }
         
$where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.$fil_amount.
-            
$fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation.$fil_tag.$fil_currency;
+            
$fil_qcode.$fil_paid.$fil_account.$fil_date_paid.$fil_hide_operation.$fil_tag.$fil_currency.$fil_vat;
         
         $sql.=" where ".$where;
         
diff --git a/include/history_operation.inc.php 
b/include/history_operation.inc.php
index 5330b1aab..56b8ab3c2 100644
--- a/include/history_operation.inc.php
+++ b/include/history_operation.inc.php
@@ -171,7 +171,7 @@ echo '</form>';
 $r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end',
                                    'date_start', 'date_end', 'desc', 
'amount_min', 'amount_max', 'qcode','operation_filter',
                                    'accounting', 'unpaid', 'gDossier', 
'ledger_type', 
-                                    
'p_action','search_optag_option','p_currency_code'));
+                                    
'p_action','search_optag_option','p_currency_code','tva_id_search'));
 if (isset($_GET['search_opr_jrn']))
 {
     foreach ($a_search_opr_jrn as $k => $v)
diff --git a/include/template/ledger_search.php 
b/include/template/ledger_search.php
index 458512af3..a5ac3bba8 100644
--- a/include/template/ledger_search.php
+++ b/include/template/ledger_search.php
@@ -1,6 +1,7 @@
 <?php
 //This file is part of NOALYSS and is under GPL 
 //see licence.txt
+global $g_parameter;
 ?>
 <table id="<?=$this->div?>table_search">
     
@@ -77,7 +78,19 @@
 echo $f_accounting->input();  ?>
 </td>
 </tr>
-
+    <?php
+    // if TVA
+    if ( $g_parameter->MY_TVA_USE=="Y"):
+    ?>
+<tr>
+    <td  style="text-align:right;width:30em">
+        <?=_("Code TVA")?>
+    </td>
+    <td>
+        <?=$tva_id_search->input()?>
+    </td>
+</tr>
+    <?php endif;?>
 <tr>
 <td style="text-align:right;width:30em">
        <?php echo _('Etat')?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]