phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r686 - in trunk/transform: include include/template sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r686 - in trunk/transform: include include/template sql unit-test
Date: Tue, 4 Feb 2014 21:26:01 +0100 (CET)

Author: danydb
Date: 2014-02-04 21:26:00 +0100 (Tue, 04 Feb 2014)
New Revision: 686

Added:
   trunk/transform/include/class_transform_client.php
   trunk/transform/include/template/listing_client_display.php
Modified:
   trunk/transform/include/class_transform_declarant.php
   trunk/transform/include/class_transform_intervat.php
   trunk/transform/include/class_transform_representative.php
   trunk/transform/include/class_transform_sql.php
   trunk/transform/include/intervat_listing_assujetti.inc.php
   trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
   trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
   trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
   trunk/transform/sql/install.sql
   trunk/transform/unit-test/transform_IntervatTest.php
Log:
create xml file + test ok

Added: trunk/transform/include/class_transform_client.php
===================================================================
--- trunk/transform/include/class_transform_client.php                          
(rev 0)
+++ trunk/transform/include/class_transform_client.php  2014-02-04 20:26:00 UTC 
(rev 686)
@@ -0,0 +1,74 @@
+<?php
+
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// Copyright Author Dany De Bontridder address@hidden
+/**
+ * @brief manage the table intervat_client
+ */
+class Transform_Client
+{
+
+    /**
+     * vat_amount_sum  VAT amount in the listing
+     */
+    var $vat_amount_sum;
+
+    /**
+     * turnoversum amount without vat in the listing
+     */
+    var $turnoversum;
+
+    /**
+     * nb number of customer in the listing
+     */
+    var $nb;
+
+    /**
+     * Array of table intervat_client
+     */
+    var $array;
+
+    /**
+     * compute value from declarant
+     * @param integer id of declarant (intervat_declarant.d_id)
+     */
+    function compute_value($p_declarant)
+    {
+        global $cn;
+        $this->correct_data($p_declarant);
+        $this->array = $cn->get_array('select * from transform.intervat_client 
where d_id=$1', array($p_declarant));
+        $this->nb = count($this->array);
+        
+        $this->vat_amount_sum = $cn->get_value('select 
sum(c_amount_vat::numeric) from 
+            transform.intervat_client where d_id=$1',array($p_declarant));
+        
+        $this->turnoversum = $cn->get_value('select 
sum(c_amount_novat::numeric) from 
+            transform.intervat_client where d_id=$1',array($p_declarant));
+    }
+    private function correct_data($p_declarant)
+    {
+        global $cn;
+        $cn->exec_sql("update transform.intervat_client set 
c_amount_vat=replace(c_amount_vat,',','.'),
+            c_amount_novat=replace(c_amount_novat,',','.') where 
d_id=$1",array($p_declarant));
+    }
+
+}
+
+?>

Modified: trunk/transform/include/class_transform_declarant.php
===================================================================
--- trunk/transform/include/class_transform_declarant.php       2014-02-01 
21:24:58 UTC (rev 685)
+++ trunk/transform/include/class_transform_declarant.php       2014-02-04 
20:26:00 UTC (rev 686)
@@ -128,11 +128,28 @@
         $this->data->d_countrycode=$this->countrycode;
         $this->data->d_email=$this->email;
         $this->data->d_phone=$this->phone;
-        $this->data->d_vatnumber=$this->vatnumber;
+        $this->data->d_vat_number=$this->vatnumber;
         $this->data->d_countrycode=$this->countrycode;
-        
+        $this->data->d_periode=$this->year;
         $this->data->insert();
     }
+    function from_db($request_id)
+    {
+        global $cn;
+        $id = $cn->get_value("select d_id from transform.intervat_declarant 
where r_id=$1", array($request_id));
+        $this->data = new Intervat_Declarant_SQL($id);
+        $this->name = $this->data->d_name;
+        $this->street = $this->data->d_street;
+        $this->postcode = $this->data->d_postcode;
+        $this->city = $this->data->d_city;
+        $this->countrycode = $this->data->d_countrycode;
+        $this->email = $this->data->d_email;
+        $this->phone = $this->data->d_phone;
+        $this->vatnumber = $this->data->d_vat_number;
+        $this->countrycode = $this->data->d_countrycode;
+        $this->year = $this->data->d_periode;
+    }
+
     function display()
     {
         $this->readOnly=true;

Modified: trunk/transform/include/class_transform_intervat.php
===================================================================
--- trunk/transform/include/class_transform_intervat.php        2014-02-01 
21:24:58 UTC (rev 685)
+++ trunk/transform/include/class_transform_intervat.php        2014-02-04 
20:26:00 UTC (rev 686)
@@ -19,6 +19,7 @@
  */
 require_once 'class_transform_declarant.php';
 require_once 'class_transform_representative.php';
+require_once 'class_transform_client.php';
 
 
 /**
@@ -114,13 +115,19 @@
      */
     function append_client_listing(Transform_Declarant $p_declarant)
     {
+        /*
+         * Fetch from intervat_client
+         */
+        $client=new Transform_Client;
+        $client->compute_value($p_declarant->data->d_id);
+        
         // variable
-        $vat_amount_sum = 0;
-        $turnoversum = 0;
-        $clientnb = 2;
+        $vat_amount_sum = $client->vat_amount_sum;
+        $turnoversum = $client->turnoversum;
+        $clientnb = $client->nb;
         $seqnb = 1;
-        $periode = 2009;
-        $commentaire="Commentaire";
+        $periode = $p_declarant->data->d_periode;
+        $commentaire="";
 
         $decl = $this->domdoc->createElementNS($this->ns, "ns2:ClientListing");
         $ai = $decl->setAttribute('VATAmountSum', $vat_amount_sum);
@@ -132,10 +139,10 @@
 
         $this->append_declarant($decl, $p_declarant);
 
-        $periode = $this->domdoc->createElementNS($this->ns, "ns2:Period", 
$periode);
+        $periode = $this->domdoc->createElementNS($this->ns, "ns2:Period", 
$p_declarant->year);
         $decl->appendChild($periode);
 
-        $this->append_listing($decl, $p_declarant);
+        $this->append_listing($decl, $client);
 
 
         $l = $this->domdoc->getElementsByTagNameNS($this->ns, 
"ClientListingConsignment");
@@ -168,7 +175,7 @@
   
 
         $declarant = $this->domdoc->createElementNS($this->ns, 
"ns2:Declarant");
-        $declarant->appendChild($this->domdoc->createElement("VATNumber", 
$p_declarant->vat_number));
+        $declarant->appendChild($this->domdoc->createElement("VATNumber", 
$p_declarant->vatnumber));
         $declarant->appendChild($this->domdoc->createElement("Name", 
$p_declarant->name));
         $declarant->appendChild($this->domdoc->createElement("Street", 
$p_declarant->street));
         $declarant->appendChild($this->domdoc->createElement("PostCode", 
$p_declarant->postcode));
@@ -196,33 +203,32 @@
      * @param type $p_array
      */
 
-    function append_listing(DOMElement $p_dom, Transform_Declarant 
$p_declarant)
+    function append_listing(DOMElement $p_dom, Transform_Client $p_client)
     {
         /*
-         * Client are in array
+         * Client are in array $p_client->array
          */
-        $nb_client = 2;
-        $vat_number = "0000000097";
-        $issued = "BE";
-        $turnover = 500;
-        $vat_amount = 0;
-        $vat_amount_sum = 0;
-
         
-        for ($i = 0; $i < $nb_client; $i++)
+        for ($i = 0; $i < $p_client->nb; $i++)
         {
-            $client = $this->domdoc->createElementNS($this->ns, "ns2:Client");
-            $ai = $client->setAttribute('SequenceNumber', $i+1);
+            $client=$p_client->array[$i];
+            $dom_client = $this->domdoc->createElementNS($this->ns, 
"ns2:Client");
+            $ai = $dom_client->setAttribute('SequenceNumber', $i+1);
             $company = $this->domdoc->createElementNS($this->ns, 
"ns2:CompanyVATNumber");
-            $company->setAttribute('issuedBy', 'BE');
-            $de_vat_number = $this->domdoc->createTextNode($vat_number);
+            $company->setAttribute('issuedBy', $client['c_issuedby']);
+            $de_vat_number = 
$this->domdoc->createTextNode($client['c_vatnumber']);
             $company->appendChild($de_vat_number);
-            $client->appendChild($company);
-            
$client->appendChild($this->domdoc->createElementNS($this->ns,"ns2:TurnOver", 
$turnover));
-            
$client->appendChild($this->domdoc->createElementNS($this->ns,"ns2:VATAmount", 
$vat_amount));
-            $p_dom->appendChild($client);
+            $dom_client->appendChild($company);
+            
$dom_client->appendChild($this->domdoc->createElementNS($this->ns,"ns2:TurnOver",
 $client['c_amount_novat']));
+            
$dom_client->appendChild($this->domdoc->createElementNS($this->ns,"ns2:VATAmount",
 $client['c_amount_vat']));
+            $p_dom->appendChild($dom_client);
         }
         
     }
+    function toxml()
+    {
+        $str=$this->domdoc->saveXML();
+        return $str;
+    }
 
 }

Modified: trunk/transform/include/class_transform_representative.php
===================================================================
--- trunk/transform/include/class_transform_representative.php  2014-02-01 
21:24:58 UTC (rev 685)
+++ trunk/transform/include/class_transform_representative.php  2014-02-04 
20:26:00 UTC (rev 686)
@@ -35,6 +35,7 @@
   @endcode
  */
 require_once 'class_transform_sql.php';
+
 class Transform_Representative
 {
 
@@ -92,15 +93,18 @@
      * Transform_Representative_SQL
      */
     var $data;
+
     /**
      * readOnly
      */
     var $readOnly;
+
     function __construct()
     {
-        $this->readOnly=false;
-        $this->data=new Intervat_Representative_SQL();
+        $this->readOnly = false;
+        $this->data = new Intervat_Representative_SQL();
     }
+
     function fromPost()
     {
         $this->id = HtmlInput::default_value_post("p_id", 1);
@@ -124,25 +128,25 @@
             array("label" => 'other', "value" => "other")
         );
         $h_type->selected = $this->type;
-        $h_type->readOnly=$this->readOnly;
+        $h_type->readOnly = $this->readOnly;
         $h_name = new IText('p_name', $this->name);
-        $h_name->readOnly=$this->readOnly;
+        $h_name->readOnly = $this->readOnly;
         $h_street = new IText('p_street', $this->street);
-        $h_street->readOnly=$this->readOnly;
+        $h_street->readOnly = $this->readOnly;
         $h_postcode = new IText('p_postcode', $this->postcode);
-        $h_postcode->readOnly=$this->readOnly;
+        $h_postcode->readOnly = $this->readOnly;
         $h_city = new IText('p_city', $this->city);
-        $h_city->readOnly=$this->readOnly;
+        $h_city->readOnly = $this->readOnly;
         $h_countrycode = new IText('p_countrycode', $this->countrycode);
-        $h_countrycode->readOnly=$this->readOnly;
+        $h_countrycode->readOnly = $this->readOnly;
         $h_email = new IText('p_email', $this->email);
-        $h_email->readOnly=$this->readOnly;
+        $h_email->readOnly = $this->readOnly;
         $h_phone = new IText('p_phone', $this->phone);
-        $h_phone->readOnly=$this->readOnly;
+        $h_phone->readOnly = $this->readOnly;
         $h_id = new INum('p_id', $this->id);
-        $h_id->readOnly=$this->readOnly;
+        $h_id->readOnly = $this->readOnly;
         $h_issued = new IText("p_issued", $this->issued);
-        $h_issued->readOnly=$this->readOnly;
+        $h_issued->readOnly = $this->readOnly;
         require_once 'template/listing_assujetti_representative.php';
     }
 
@@ -167,4 +171,20 @@
         $this->input();
     }
 
+    function from_db($request_id)
+    {
+        global $cn;
+        $id = $cn->get_value("select rp_id from 
transform.intervat_representative where r_id=$1", array($request_id));
+        $this->data = new Intervat_Representative_SQL($id);
+        $this->id = $this->data->rp_listing_id;
+        $this->issued = $this->data->rp_issued;
+        $this->type = $this->data->rp_type;
+        $this->name = $this->data->rp_name;
+        $this->street = $this->data->rp_street;
+        $this->postcode = $this->data->rp_postcode;
+        $this->countrycode = $this->data->rp_countrycode;
+        $this->email = $this->data->rp_email;
+        $this->phone = $this->data->rp_phone;
+    }
+
 }

Modified: trunk/transform/include/class_transform_sql.php
===================================================================
--- trunk/transform/include/class_transform_sql.php     2014-02-01 21:24:58 UTC 
(rev 685)
+++ trunk/transform/include/class_transform_sql.php     2014-02-04 20:26:00 UTC 
(rev 686)
@@ -37,6 +37,8 @@
     var $r_id;
     var $r_date;
     var $r_type;
+    var $r_start_date;
+    var $r_end_date;
 
     /* example private 
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
 */
 
@@ -50,13 +52,17 @@
         $this->name = array(
             "r_id" => "r_id",
             "r_date" => "r_date",
-            "r_type"=>'r_type'
+            "r_type"=>'r_type',
+            "r_start_date"=>'r_start_date',
+            "r_end_date"=>'r_end_date',
         );
 
         $this->type = array(
             "r_id" => "numeric",
             "r_date" => "date",
-            "r_type"=>"text"
+            "r_type"=>"text",
+            "r_start_date" => "date",
+            "r_end_date" => "date"
         );
 
         $this->default = array(

Modified: trunk/transform/include/intervat_listing_assujetti.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti.inc.php  2014-02-01 
21:24:58 UTC (rev 685)
+++ trunk/transform/include/intervat_listing_assujetti.inc.php  2014-02-04 
20:26:00 UTC (rev 686)
@@ -34,7 +34,7 @@
         require 'intervat_listing_assujetti_step_2.inc.php';
     } catch (Exception $e)
     {
-        echo '<p class="notice">'.$e->getMessage().'</p>';
+        echo '<p class="notice">' . $e->getMessage() . '</p>';
         if ($e->getCode() != 3)
         {
             require 'intervat_listing_assujetti_step_1.inc.php';
@@ -43,6 +43,13 @@
 }
 if ($step == 2)
 {
-    require 'intervat_listing_assujetti_step_3.inc.php';
+    try
+    {
+        require 'intervat_listing_assujetti_step_3.inc.php';
+    } catch (Exception $e)
+    {
+        echo '<p class="notice">' . $e->getMessage() . '</p>';
+        require 'intervat_listing_assujetti_step_1.inc.php';
+    }
 }
 ?>
\ No newline at end of file

Modified: trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_1.inc.php   
2014-02-01 21:24:58 UTC (rev 685)
+++ trunk/transform/include/intervat_listing_assujetti_step_1.inc.php   
2014-02-04 20:26:00 UTC (rev 686)
@@ -32,8 +32,12 @@
 $h_tva_compute_date=new ISelect('p_compute_date');
 $h_tva_compute_date->value=array(
     array('value'=>1,'label'=>_('Par date paiement')),
-    array('value'=>1,'label'=>_('Par date opération'))
+    array('value'=>2,'label'=>_('Par date opération'))
     );
+$start_date=new IDate('p_start_date');
+$start_date->value=HtmlInput::default_value_post('p_start_date','');
+$end_date=new IDate('p_end_date');
+$end_date->value=HtmlInput::default_value_post('p_end_date','');
 ?>
 
 <form method="post" enctype="multipart/form-data">
@@ -46,8 +50,9 @@
 $declarant->input();
 ?>
     <p>
-        <?php echo _('Année'),$h_year->input();?>
+        <?php echo _('Période'),$h_year->input();?>
     </p>
+   
     <p>
     <?php
     
@@ -78,7 +83,9 @@
         endfor;
         ?>
     </ul>
-
+     <p style="margin-left:30px">
+        <?php printf(_('Entre les date %s et 
%s'),$start_date->input(),$end_date->input());?>
+    </p>
     <span style="margin-left:30px">
     <?php echo _('Opération de vente'),$h_tva_compute_date->input();?>
     </span>

Modified: trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_2.inc.php   
2014-02-01 21:24:58 UTC (rev 685)
+++ trunk/transform/include/intervat_listing_assujetti_step_2.inc.php   
2014-02-04 20:26:00 UTC (rev 686)
@@ -32,6 +32,8 @@
 $year = HtmlInput::default_value_post('p_year', NULL);
 $atva = HtmlInput::default_value_post('h_tva', null);
 $compute_date = HtmlInput::default_value_post('p_compute_date', null);
+$start_date=HtmlInput::default_value_post('p_start_date',null);
+$end_date=HtmlInput::default_value_post('p_end_date',null);
 $rejected=array();
     
 // If inputtype is null not choice between file or compute
@@ -39,6 +41,15 @@
 {
     throw new Exception(_('Vous devez choisir par fichier ou par calcul'), 4);
 }
+if ($start_date == null || $end_date == null)
+{
+    throw new Exception(_('La date donnée est invalide'), 9);
+}
+if (isDate($start_date) == null || isDate($end_date) == null )
+{
+    throw new Exception(_('La date donnée est invalide'), 9);
+}
+
 // if inputtype is by computing (=2) then year must existe as exercice 
 // and tva_id must not be empty
 if ($inputtype == 2)
@@ -72,7 +83,8 @@
  */
 $request = new Transform_Request_SQL();
 $request->r_type = 'intervat';
-
+$request->r_start_date=$start_date;
+$request->r_end_date=$end_date;
 $request->insert();
 
 $representative = new Transform_Representative();
@@ -149,20 +161,15 @@
     if ($compute_date == 1)
     {
         $sql = "
-        with  c as 
+      with  c as 
         (select qs_client,
          sum(qs_vat) as vat_amount,
          sum(qs_price) as amount 
          from quant_sold  
+         join jrnx using (j_id)
          where 
-         qs_vat_code in $ltva 
-         and j_id in (select j_id 
-                        from jrnx 
-                        where 
-                        j_tech_per in 
-                            (select  p_id 
-                                from parm_periode 
-                                    where p_exercice=$1) ) 
+         qs_vat_code in $ltva and
+         j_date between to_date($1,'DD.MM.YYYY') and to_date($2,'DD.MM.YYYY')
         group by qs_client)
         ,f_name as 
         (select f_id,ad_value 
@@ -177,7 +184,8 @@
    vat_amount,amount
 from 
     c join f_name on (qs_client=f_name.f_id)
-    join f_tvanum on (qs_client=f_tvanum.f_id)
+    join f_tvanum on (qs_client=f_tvanum.f_id);
+
     ";
     } elseif ($compute_date == 2) //------ Payment date ----------------
     {
@@ -189,12 +197,11 @@
         from 
             quant_sold join jrnx on (jrnx.j_id=quant_sold.j_id) 
         where 
-        qs_vat_code=1 
+        qs_vat_code $ltva
         and j_grpt in (select jr_grpt_id 
                         from jrn 
                         where 
-                        jr_date_paid >= (select min(p_start) from parm_periode 
where p_exercice=$1 ) 
-                        and jr_date_paid <=  (select max(p_start) from 
parm_periode where p_exercice=$1 ))
+                        jr_date_paid between to_date($1,'DD.MM.YYYY') and 
to_date($2,'DD.MM.YYYY'))
          group by qs_client)
     ,f_name as 
     (select f_id,
@@ -217,7 +224,7 @@
    join f_tvanum on (qs_client=f_tvanum.f_id)
 ";
     }
-    $a_listing = $cn->get_array($sql, array($year));
+    $a_listing = $cn->get_array($sql, array($start_date,$end_date));
     
     /**
      * Save data into Intervat_Client
@@ -258,3 +265,11 @@
 $ret=$a_listing->seek(' where d_id = $1',array($declarant->data->d_id));
 require 'template/listing_client_display.php';
 ?>
+<form method="POST">
+    <?php echo HtmlInput::hidden('r_id',$request->r_id);?>
+    <?php 
+        echo HtmlInput::request_to_hidden(array('gDossier', 'ac', 
'plugin_code', 'sa'));
+        echo HtmlInput::hidden('st_transf',2);
+        echo HtmlInput::submit('submit','Valider');
+    ?>
+</form>

Modified: trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_3.inc.php   
2014-02-01 21:24:58 UTC (rev 685)
+++ trunk/transform/include/intervat_listing_assujetti_step_3.inc.php   
2014-02-04 20:26:00 UTC (rev 686)
@@ -21,4 +21,26 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 
+$request_id=HtmlInput::default_value_post('r_id',null);
 
+if ($request_id == null)
+{
+    throw new Exception(_('Accès directe incorrecte'), 15);
+}
+
+require_once 'class_transform_declarant.php';
+require_once 'class_transform_representative.php';
+require_once 'class_transform_intervat.php';
+
+$declarant=new Transform_Declarant();
+$representative=new Transform_Representative;
+
+$declarant->from_db($request_id);
+$representative->from_db($request_id);
+
+$xml=new Transform_Intervat;
+
+$xml->append_root();
+$xml->append_client_listing($declarant);
+
+$xml->toxml();

Added: trunk/transform/include/template/listing_client_display.php
===================================================================
--- trunk/transform/include/template/listing_client_display.php                 
        (rev 0)
+++ trunk/transform/include/template/listing_client_display.php 2014-02-04 
20:26:00 UTC (rev 686)
@@ -0,0 +1,79 @@
+<?php
+
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+// Copyright Author Dany De Bontridder address@hidden
+/**
+ * @brief Display result of insert, 
+ * parameters are $ret (return of seek) and $a_listing  (Intervat_Client_SQL )
+ @see intervat_listing_assujetti_step_2.inc.php
+ */
+$nb=Database::num_row($ret);
+?>
+<table>
+    <tr>
+        <th>
+            <?php echo _('Nom'); ?>
+        </th>
+        <th>
+            <?php echo _('Numéro TVA'); ?>
+        </th>
+        <th>
+            <?php echo _('Montant'); ?>
+        </th>
+        <th>
+            <?php echo _('TVA'); ?>
+        </th>
+        <th>
+            Action
+        </th>
+    </tr>
+<?php    
+    for ($i=0;$i<$nb;$i++):
+        $data=$a_listing->next($ret,$i);
+?>
+    <tr>
+        <td>
+            <?php 
+            echo h($data->c_name);
+            ?>
+        </td>
+        <td>
+            <?php 
+            echo h($data->c_vatnumber);
+            ?>
+        </td>
+        <td>
+            <?php 
+            echo h($data->c_amount_novat);
+            ?>
+        </td>
+        <td>
+            <?php 
+            echo h($data->c_amount_vat);
+            ?>
+        </td>
+        <td>
+            Modifier / enlever
+        </td>
+    </tr>
+    <?php 
+    endfor;
+    ?>
+</table>
\ No newline at end of file

Modified: trunk/transform/sql/install.sql
===================================================================
--- trunk/transform/sql/install.sql     2014-02-01 21:24:58 UTC (rev 685)
+++ trunk/transform/sql/install.sql     2014-02-04 20:26:00 UTC (rev 686)
@@ -46,7 +46,10 @@
        c_issuedby char(2) default 'BE'
 )
 
-alter table transform.request add         r_date date
-alter table transform.request alter r_date set default now()
-alter table transform.request add         r_type text 
+alter table transform.request add         r_date date;
+alter table transform.request alter r_date set default now();
+alter table transform.request add         r_type text ;
+ALTER TABLE transform.request ADD COLUMN r_start_date date;
+ALTER TABLE transform.request ADD COLUMN r_end_date date;
 
+

Modified: trunk/transform/unit-test/transform_IntervatTest.php
===================================================================
--- trunk/transform/unit-test/transform_IntervatTest.php        2014-02-01 
21:24:58 UTC (rev 685)
+++ trunk/transform/unit-test/transform_IntervatTest.php        2014-02-04 
20:26:00 UTC (rev 686)
@@ -50,6 +50,7 @@
 require_once 'bootstrap.php';
 
 require_once 'class_transform_representative.php';
+require_once 'class_transform_sql.php';
 require_once 'class_dossier.php';
 global $cn, $g_parameter;
         $cn = new Database(26);
@@ -86,9 +87,9 @@
     <EmailAddress>address@hidden</EmailAddress>
     <Phone>000000000</Phone>
   </ns2:Representative>
-  <ns2:ClientListing VATAmountSum="0" TurnOverSum="0" ClientsNbr="2" 
SequenceNumber="1">
+  <ns2:ClientListing VATAmountSum="0" TurnOverSum="1000" ClientsNbr="2" 
SequenceNumber="1">
     <ns2:Declarant>
-      <VATNumber>0000000097</VATNumber>
+      <VATNumber>1234567890</VATNumber>
       <Name>Nom Declarant</Name>
       <Street>Rue du declarant</Street>
       <PostCode>9999</PostCode>
@@ -108,13 +109,19 @@
       <ns2:TurnOver>500</ns2:TurnOver>
       <ns2:VATAmount>0</ns2:VATAmount>
     </ns2:Client>
-    <ns2:Comment>Commentaire</ns2:Comment>
+    <ns2:Comment></ns2:Comment>
   </ns2:ClientListing>
 </ns2:ClientListingConsignment>
 ';
+        global $cn, $g_parameter;
+        $cn = new Database(26);
+        $g_parameter = new Own($cn);
+        $_REQUEST['gDossier'] = 26;
         
         $this->request = new Transform_Request_SQL;
         $this->request->r_type = 'phpunit-intervat';
+        $this->request->r_start_date='01.01.1900';
+        $this->request->r_end_date='01.01.1900';
         $this->request->insert();
 
         $this->representative = new Transform_Representative();
@@ -135,7 +142,7 @@
          */
         $this->declarant = new Transform_Declarant();
         $this->declarant->data->r_id = $this->request->r_id;
-        $this->declarant->vat_number = "0000000097";
+        $this->declarant->vatnumber = "1234567890";
         $this->declarant->name = "Nom Declarant";
         $this->declarant->street = "Rue du declarant";
         $this->declarant->postcode = "9999";
@@ -143,7 +150,26 @@
         $this->declarant->countrycode = "BE";
         $this->declarant->email = "address@hidden";
         $this->declarant->phone = "000000000";
+        $this->declarant->year = "2009";
         $this->declarant->insert();
+        
+        $client=new Intervat_Client_SQL;
+        $client->d_id=$this->declarant->data->d_id;
+        $client->c_name="";
+        $client->c_vatnumber="0000000097";
+        $client->c_issuedby="BE";
+        $client->c_amount_vat=0;
+        $client->c_amount_novat=500;
+        $client->insert();
+        //
+        $client=new Intervat_Client_SQL;
+        $client->d_id=$this->declarant->data->d_id;
+        $client->c_name="";
+        $client->c_vatnumber="0000000097";
+        $client->c_issuedby="BE";
+        $client->c_amount_vat=0;
+        $client->c_amount_novat=500;
+        $client->insert();
     }
 
     /**
@@ -217,7 +243,7 @@
 <ns2:ClientListingConsignment 
xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment"; 
xmlns="http://www.minfin.fgov.be/InputCommon"; ClientListingsNbr="1"/>
 <Listing xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment";>
   <ns2:Declarant 
xmlns:ns2="http://www.minfin.fgov.be/ClientListingConsignment";>
-    <VATNumber>0000000097</VATNumber>
+    <VATNumber>1234567890</VATNumber>
     <Name>Nom Declarant</Name>
     <Street>Rue du declarant</Street>
     <PostCode>9999</PostCode>



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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