phpcompta-contrib
[Top][All Lists]
Advanced

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

Re: [Phpcompta-contrib] Patch pour rendre le listing TVA annuel et non p


From: Stan Pinte
Subject: Re: [Phpcompta-contrib] Patch pour rendre le listing TVA annuel et non par exercice
Date: Sat, 18 Mar 2006 16:24:23 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Stan Pinte wrote:

>Salut,
>
>mon premier exercice s'étends sur 22 mois (2004-2005), et donc j'ai eu
>besoin de faire ce patch pour pouvoir calculer un listing TVA 2005.
>
>Dany, les autres, dites-moi ce que vous en pensez,
>
>Une autre amélioration serait de ne sélectionner les ventes que pour les
>clients assujetis à la TVA...(par exemple ayant un numéro de TVA non
>null dans leur fiche). Dany, une suggestion pour implémenter cela? Je
>crois que tu as des classes utilitaires pour les fiches, non? qui
>permettent de retrouver un champ?
>  
>

en fait j'ai fait plus simple dans le patch suivant...mais évidemment
c'est un peu dangereux si ou oublie de remplir le numéro de TVA pour les
clients...donc je pense que ce n'est pas une bonne idée...

Que suggérez-vous?

Stan.

>puis si tout le monde est d'accord je committe.
>
>Stan;
>  
>
>------------------------------------------------------------------------
>
>Index: include/class_customer.php
>===================================================================
>RCS file: /cvsroot/phpcompta/phpcompta/include/class_customer.php,v
>retrieving revision 1.1
>diff -u -r1.1 class_customer.php
>--- include/class_customer.php 25 Jul 2005 20:56:42 -0000      1.1
>+++ include/class_customer.php 18 Mar 2006 14:54:59 -0000
>@@ -66,11 +66,8 @@
>  *    - array
>  */
>   function VatListing($p_year) {
>-    $cond_sql=" and A.j_tech_per = B.j_tech_per 
>-         and A.j_tech_per= any (select p_id 
>-             from parm_periode
>-              where 
>-              p_exercice='$p_year')";
>+    $cond_sql=" and A.j_date = B.j_date 
>+      and extract(year from A.j_date) ='$p_year'";
>     
>     // BASE ACCOUNT
>     // for belgium
>@@ -157,4 +154,4 @@
>   }
> }
> 
>-?>
>\ No newline at end of file
>+?>
>Index: include/impress_listing_client.php
>===================================================================
>RCS file: /cvsroot/phpcompta/phpcompta/include/impress_listing_client.php,v
>retrieving revision 1.3
>diff -u -r1.3 impress_listing_client.php
>--- include/impress_listing_client.php 30 Oct 2005 21:17:50 -0000      1.3
>+++ include/impress_listing_client.php 18 Mar 2006 14:54:59 -0000
>@@ -69,7 +69,7 @@
> echo '<TABLE>';
> 
> print '<TR>';
>-$year=make_array($cn,"select distinct p_exercice,p_exercice from  
>parm_periode");
>+$year=make_array($cn,"select distinct extract(year from jr_date), 
>extract(year from jr_date) from jrn");
> $w->label="Année concernée";
> print $w->IOValue('year',$year);
> print "</TR>";
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Phpcompta-contrib mailing list
>address@hidden
>http://lists.nongnu.org/mailman/listinfo/phpcompta-contrib
>  
>

Index: include/class_customer.php
===================================================================
RCS file: /cvsroot/phpcompta/phpcompta/include/class_customer.php,v
retrieving revision 1.1
diff -u -r1.1 class_customer.php
--- include/class_customer.php  25 Jul 2005 20:56:42 -0000      1.1
+++ include/class_customer.php  18 Mar 2006 15:22:46 -0000
@@ -66,11 +66,8 @@
  *     - array
  */
   function VatListing($p_year) {
-    $cond_sql=" and A.j_tech_per = B.j_tech_per 
-         and A.j_tech_per= any (select p_id 
-             from parm_periode
-              where 
-              p_exercice='$p_year')";
+    $cond_sql=" and A.j_date = B.j_date 
+      and extract(year from A.j_date) ='$p_year'";
     
     // BASE ACCOUNT
     // for belgium
@@ -103,7 +100,7 @@
       //---
       $row1=pg_fetch_array($Res,$i);
   
-      // select the customer
+      // select the operation
       //----
       $Res2=ExecSql($this->db,"select j_poste,j_montant,j_debit from jrnx 
where j_grpt=".$row1['j_grpt']); 
       $a_row=array();
@@ -139,17 +136,24 @@
        }
        // store sold
        //---
-       
$a_Res[$customer]['amount']=(isset($a_Res[$customer]['amount']))?$a_Res[$customer]['amount']:0;
-       $a_Res[$customer]['amount']+=$amount;
+       
$a_Res[$customer]['amount']=(isset($a_Res[$customer]['amount']))?$a_Res[$customer]['amount']:0;
         
+  $a_Res[$customer]['amount']+=$amount;
 
        // store vat
        //---
        
$a_Res[$customer]['tva']=(isset($a_Res[$customer]['tva']))?$a_Res[$customer]['tva']:0;
-       $a_Res[$customer]['tva']+=$tva;
-
+       $a_Res[$customer]['tva']+=$tva;  
+  
        // store customef info
        //---
        $a_Res[$customer]['customer']=$customer;
+
+  //if not submitted to VAT, remove from list:
+  if (!isset($a_Res[$customer]['vat_number']) || 
strcmp($a_Res[$customer]['vat_number'], "") == 0)
+  {
+    unset($a_Res[$customer]);
+  }
+  
       }// foreach $a
 
     }
@@ -157,4 +161,4 @@
   }
 }
 
-?>
\ No newline at end of file
+?>
Index: include/impress_listing_client.php
===================================================================
RCS file: /cvsroot/phpcompta/phpcompta/include/impress_listing_client.php,v
retrieving revision 1.3
diff -u -r1.3 impress_listing_client.php
--- include/impress_listing_client.php  30 Oct 2005 21:17:50 -0000      1.3
+++ include/impress_listing_client.php  18 Mar 2006 15:22:46 -0000
@@ -69,7 +69,7 @@
 echo '<TABLE>';
 
 print '<TR>';
-$year=make_array($cn,"select distinct p_exercice,p_exercice from  
parm_periode");
+$year=make_array($cn,"select distinct extract(year from jr_date), extract(year 
from jr_date) from jrn");
 $w->label="Année concernée";
 print $w->IOValue('year',$year);
 print "</TR>";

reply via email to

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