noalyss Version-9
export_printtva_csv.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21// Copyright Author Dany De Bontridder danydb@noalyss.eu
22/**
23 * @file
24 * @brief
25 *
26 */
27if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
28
30$tax_summary = new Tax_Summary($cn,$http->get("date_start"),$http->get("date_end"));
31$tva_type = $http->request("tva_type");
32$tax_summary->set_tva_type($tva_type);
33
34try {
35 $tax_summary->check();
36}catch (Exception $e)
37{
38 if ($e->getCode() <> 100) {
39 echo $e->getMessage();
40 return;
41 }
42}
43
44
45$csv=new Noalyss_Csv("summary_tva");
46$csv->send_header();
47// Sale
48$csv->write_header([
49 _("Journal"),
50 ("Code TVA"),
51 _("Taux"),
52 _("Montant HT"),
53 _("Montant TVA"),
54 _("Montant Autoliquidation")]);
55$array=$tax_summary->get_row_sale();
57for ($i=0;$i < $nb_array;$i++) {
58 $csv->add ($array[$i]['jrn_def_name']);
59 $csv->add ($array[$i]['tva_label']);
60 $csv->add ($array[$i]['tva_rate'],'number');
61 $csv->add ($array[$i]['amount_wovat'],'number');
62 $csv->add ($array[$i]['amount_vat'],'number');
63 $csv->add ($array[$i]['amount_sided'],'number');
64 $csv->write();
65}
66//Purchase
67$csv->write_header([
68 _("Journal"),
69 ("Code TVA"),
70 _("Taux"),
71 _("Montant HT"),
72 _("Privée"),
73 _("Montant TVA"),
74 _("Montant Autoliquidation"),
75 _("Montant ND"),
76 _("TVA Non Déd"),
77 _("TVA Non Déd & récup")
78 ]);
79$array=$tax_summary->get_row_purchase();
80$nb_array=count($array);
81for ($i=0;$i < $nb_array;$i++) {
82 $csv->add ($array[$i]['jrn_def_name']);
83 $csv->add ($array[$i]['tva_label']);
84 $csv->add ($array[$i]['tva_rate'],'number');
85 $csv->add ($array[$i]['amount_wovat'],'number');
86 $csv->add ($array[$i]['amount_private'],'number');
87 $csv->add ($array[$i]['amount_vat'],'number');
88 $csv->add ($array[$i]['amount_sided'],'number');
89 $csv->add ($array[$i]['amount_noded_amount'],'number');
90 $csv->add ($array[$i]['amount_noded_tax'],'number');
91 $csv->add ($array[$i]['amount_noded_return'],'number');
92 $csv->write();
93}
manage the http input (get , post, request) and extract from an array
Manage the CSV : manage files and write CSV record.
Compute , display and export the tax summary.
catch(Exception $e) $csv