[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r687 - in trunk/transform: . include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r687 - in trunk/transform: . include |
Date: |
Tue, 4 Feb 2014 23:14:06 +0100 (CET) |
Author: danydb
Date: 2014-02-04 23:14:06 +0100 (Tue, 04 Feb 2014)
New Revision: 687
Added:
trunk/transform/raw.php
Modified:
trunk/transform/include/class_transform_declarant.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
Log:
Add test
Add step
Add export to XML
Modified: trunk/transform/include/class_transform_declarant.php
===================================================================
--- trunk/transform/include/class_transform_declarant.php 2014-02-04
20:26:00 UTC (rev 686)
+++ trunk/transform/include/class_transform_declarant.php 2014-02-04
22:14:06 UTC (rev 687)
@@ -128,8 +128,7 @@
$this->data->d_countrycode=$this->countrycode;
$this->data->d_email=$this->email;
$this->data->d_phone=$this->phone;
- $this->data->d_vat_number=$this->vatnumber;
- $this->data->d_countrycode=$this->countrycode;
+ $this->data->d_vat_number=str_ireplace("be", "", $this->vatnumber);
$this->data->d_periode=$this->year;
$this->data->insert();
}
Modified: trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
2014-02-04 20:26:00 UTC (rev 686)
+++ trunk/transform/include/intervat_listing_assujetti_step_1.inc.php
2014-02-04 22:14:06 UTC (rev 687)
@@ -15,86 +15,130 @@
* 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
require_once 'class_transform_representative.php';
require_once 'class_transform_declarant.php';
-$representative=new Transform_Representative();
+$representative = new Transform_Representative();
$representative->fromPost();
-$declarant=new Transform_Declarant();
+$declarant = new Transform_Declarant();
$declarant->fromPost();
-$radio=new IRadio('p_inputtype');
-$h_tva=new ICheckBox('h_tva[]');
-$h_year=new INum('p_year');
-$h_year->prec=0;
-$h_tva_compute_date=new ISelect('p_compute_date');
-$h_tva_compute_date->value=array(
- array('value'=>1,'label'=>_('Par date paiement')),
- 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','');
-?>
+$radio = new IRadio('p_inputtype');
+$h_tva = new ICheckBox('h_tva[]');
+$h_year = new INum('p_year');
+$h_year->prec = 0;
+$h_tva_compute_date = new ISelect('p_compute_date');
+$h_tva_compute_date->value = array(
+ array('value' => 1, 'label' => _('Par date paiement')),
+ array('value' => 2, 'label' => _('Par date opération'))
+);
+$start_date = new IDate('p_start_date');
+$start_date->id="p_start_date_id";
+$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', '');
+$end_date->id="p_end_date_id";
-<form method="post" enctype="multipart/form-data">
- <h2><?php echo _('Mandataire');?></h2>
-<?php
-$representative->input();
?>
- <h2><?php echo _('Déclarant');?></h2>
-<?php
-$declarant->input();
-?>
- <p>
- <?php echo _('Période'),$h_year->input();?>
- </p>
-
- <p>
+<h2> <?php echo _('Etape 1/3') ?></h2>
+<form method="post" enctype="multipart/form-data" onsubmit="return
check_form()">
+ <h3><?php echo _('Mandataire'); ?></h3>
<?php
-
- $radio->value=1;
- echo $radio->input()._('Par fichier');
- $file = new IFile('client_assujetti');
- echo $file->input();
+ $representative->input();
?>
+ <h3><?php echo _('Déclarant'); ?></h3>
+ <?php
+ $declarant->input();
+ ?>
+ <p>
+ <?php echo _('Période'), $h_year->input(); ?>
</p>
+
<p>
+ <input type="radio" name="p_inputtype" id="file_radio" value="1"
onclick="show_file();">
<?php
- $radio->value=2;
- echo $radio->input()._('Par calcul');
- $atva=$cn->get_array('select tva_id,tva_rate,tva_comment from tva_rate
order by 2');
- $count_atva=count($atva);
+ echo _('Par fichier');
?>
- <ul style="list-style: none">
+ <span id="sp_file" style="display:none">
+ <?php
+ $file = new IFile('client_assujetti');
+ echo $file->input();
+ ?>
+ </span>
+ </p>
+ <p>
+ <input type="radio" name="p_inputtype" id="calc_radio" value="2"
onclick="show_calc()">
<?php
- for ($i=0;$i<$count_atva;$i++):
+ echo _('Par calcul');
?>
- <li>
+ <div id="sp_calcul" style="display:none">
+ <p style="margin-left:30px">
+ <?php printf(_('Entre les date %s et %s'),
$start_date->input(), $end_date->input()); ?>
+ </p>
<?php
- $h_tva->value=$atva[$i]['tva_id'];
- echo $h_tva->input().h($atva[$i]['tva_rate'])."
".h($atva[$i]['tva_comment']);
+ $atva = $cn->get_array('select tva_id,tva_rate,tva_comment from
tva_rate order by 2');
+ $count_atva = count($atva);
?>
- </li>
- <?php
- 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>
+ <ul style="list-style: none">
+ <?php
+ for ($i = 0; $i < $count_atva; $i++):
+ ?>
+ <li>
+ <?php
+ $h_tva->value = $atva[$i]['tva_id'];
+ echo $h_tva->input() . h($atva[$i]['tva_rate']) . " "
. h($atva[$i]['tva_comment']);
+ ?>
+ </li>
+ <?php
+ endfor;
+ ?>
+ </ul>
+
+ <span style="margin-left:30px">
+ <?php echo _('Opération de vente'),
$h_tva_compute_date->input(); ?>
+ </span>
+ </div>
</p>
<p>
<?php
echo HtmlInput::request_to_hidden(array('gDossier', 'ac',
'plugin_code', 'sa'));
- echo HtmlInput::hidden('st_transf',1);
+ echo HtmlInput::hidden('st_transf', 1);
echo HtmlInput::submit('send_list', 'Valider');
?>
</p>
</form>
+<script>
+ function show_file() {
+ $('sp_file').show();
+ $('sp_calcul').hide();
+ }
+ function show_calc() {
+ $('sp_file').hide();
+ $('sp_calcul').show();
+ }
+ function check_form()
+ {
+ if ($('p_year').value=="") {
+ alert('Vous avez oublié la période');
+ $('p_year').style.borderColor="red";
+ return false;
+ }
+ if ( $('p_start_date_id').value=="" && $('calc_radio').checked) {
+ alert('Date incorrect');
+ $('p_start_date_id').style.borderColor="red";
+ return false;
+ }
+ if ( $('p_end_date_id').value=="" && $('calc_radio').checked) {
+ alert('Date incorrect');
+ $('p_end_date_id').style.borderColor="red";
+ return false;
+ }
+ if ( ! $('calc_radio').checked && ! $('file_radio').checked ) {
+ alert('Vous devez choisir par fichier ou par calcul');
+ return false
+ }
+ return true;
+ }
+</script>
\ No newline at end of file
Modified: trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
===================================================================
--- trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
2014-02-04 20:26:00 UTC (rev 686)
+++ trunk/transform/include/intervat_listing_assujetti_step_2.inc.php
2014-02-04 22:14:06 UTC (rev 687)
@@ -1,5 +1,4 @@
<?php
-
/*
* This file is part of NOALYSS.
*
@@ -32,10 +31,10 @@
$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();
-
+$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
if ($inputtype == null)
{
@@ -45,7 +44,7 @@
{
throw new Exception(_('La date donnée est invalide'), 9);
}
-if (isDate($start_date) == null || isDate($end_date) == null )
+if (isDate($start_date) == null || isDate($end_date) == null)
{
throw new Exception(_('La date donnée est invalide'), 9);
}
@@ -83,8 +82,8 @@
*/
$request = new Transform_Request_SQL();
$request->r_type = 'intervat';
-$request->r_start_date=$start_date;
-$request->r_end_date=$end_date;
+$request->r_start_date = $start_date;
+$request->r_end_date = $end_date;
$request->insert();
$representative = new Transform_Representative();
@@ -224,52 +223,58 @@
join f_tvanum on (qs_client=f_tvanum.f_id)
";
}
- $a_listing = $cn->get_array($sql, array($start_date,$end_date));
-
+ $a_listing = $cn->get_array($sql, array($start_date, $end_date));
+
/**
* Save data into Intervat_Client
*/
$o_data = array();
- try
+ try
+ {
+ $cn->start();
+ $nb = count($a_listing);
+ for ($i = 0; $i < $nb; $i++)
{
- $cn->start();
- $nb=count($a_listing);
- for ($i=0;$i <$nb; $i++)
- {
- /*
- * insert into transform.intervat_client
- */
- $o_data[$i] = new Intervat_Client_SQL();
- $o_data[$i]->d_id = $declarant->data->d_id;
- $o_data[$i]->c_name = $a_listing[$i]['name'];
- $o_data[$i]->c_issuedby = "BE";
- $o_data[$i]->c_vatnumber = $a_listing[$i]['tvanumb'];
- $o_data[$i]->c_amount_vat = $a_listing[$i]['vat_amount'];
- $o_data[$i]->c_amount_novat = $a_listing[$i]['amount'];
- $o_data[$i]->insert();
- }
- $cn->commit();
- } catch (Exception $ex)
- {
- $cn->rollback();
- throw new Exception(_('Ne peut pas ajouter ') .
h($o_data[$i]->c_name) . '-' . h($o_data[$i]->c_vatnumber), 3);
+ /*
+ * insert into transform.intervat_client
+ */
+ $o_data[$i] = new Intervat_Client_SQL();
+ $o_data[$i]->d_id = $declarant->data->d_id;
+ $o_data[$i]->c_name = $a_listing[$i]['name'];
+ $o_data[$i]->c_issuedby = "BE";
+ $o_data[$i]->c_vatnumber = $a_listing[$i]['tvanumb'];
+ $o_data[$i]->c_amount_vat = $a_listing[$i]['vat_amount'];
+ $o_data[$i]->c_amount_novat = $a_listing[$i]['amount'];
+ $o_data[$i]->insert();
}
+ $cn->commit();
+ } catch (Exception $ex)
+ {
+ $cn->rollback();
+ throw new Exception(_('Ne peut pas ajouter ') . h($o_data[$i]->c_name)
. '-' . h($o_data[$i]->c_vatnumber), 3);
+ }
}
-
- /**
- * Show the result
- */
-echo $representative->display();
-echo $declarant->display();
-$a_listing=new Intervat_Client_SQL;
-$ret=$a_listing->seek(' where d_id = $1',array($declarant->data->d_id));
-require 'template/listing_client_display.php';
?>
+<h2> <?php echo _('Etape 2/3') ?></h2>
+<h3><?php echo _('Mandataire'); ?></h3>
+<?php
+$representative->display();
+?>
+<h3><?php echo _('Déclarant'); ?></h3>
+<?php
+$declarant->display();
+?>
+<p>
+ <?php
+ $a_listing = new Intervat_Client_SQL;
+ $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');
+ <?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-04 20:26:00 UTC (rev 686)
+++ trunk/transform/include/intervat_listing_assujetti_step_3.inc.php
2014-02-04 22:14:06 UTC (rev 687)
@@ -28,19 +28,14 @@
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();
+?>
+<h2> <?php echo _('Etape 3/3') ?></h2>
+<form method="get" action="extension.raw.php">
+
+ <?php
+ echo
HtmlInput::post_to_hidden(array('r_id','ac','gDossier','plugin_code'));
+ echo HtmlInput::hidden('act','listing_assujetti');
+ echo HtmlInput::submit('get','Fichier XML');
+ ?>
+</form>
Added: trunk/transform/raw.php
===================================================================
--- trunk/transform/raw.php (rev 0)
+++ trunk/transform/raw.php 2014-02-04 22:14:06 UTC (rev 687)
@@ -0,0 +1,56 @@
+<?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
+$act = HtmlInput::default_value_get('act', null);
+
+switch ($act)
+{
+ case 'listing_assujetti':
+ $request_id = HtmlInput::default_value_get('r_id', null);
+
+ if ($request_id == null)
+ {
+ throw new Exception(_('Accès directe incorrecte'), 15);
+ }
+ require_once 'include/class_transform_declarant.php';
+ require_once 'include/class_transform_representative.php';
+ require_once 'include/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);
+ $file = "listing_assujetti" . date('d.m.y.h.mi').".xml";
+ $ref = $_ENV['TMP'] . "/" . $file;
+ echo $xml->domdoc->save($ref);
+ header('Content-type: application/bin');
+ header('Pragma: public');
+ header('Content-Disposition: attachment;filename="'.$ref.'"',FALSE);
+ $file_xml=fopen($ref,'r');
+ while ($in=fread($file_xml,8192)) { echo $in; }
+ break;
+}
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r687 - in trunk/transform: . include,
phpcompta-dev <=