[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r713 - in trunk/tools: . include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r713 - in trunk/tools: . include |
Date: |
Sat, 15 Feb 2014 17:30:59 +0100 (CET) |
Author: danydb
Date: 2014-02-15 17:30:58 +0100 (Sat, 15 Feb 2014)
New Revision: 713
Added:
trunk/tools/include/export_operation.inc.php
Modified:
trunk/tools/index.php
trunk/tools/raw.php
Log:
Task #985 - R?\195?\169cup?\195?\169ration des donn?\195?\169es comptables sous
format .csv
0000985: R?\195?\169cup?\195?\169ration des donn?\195?\169es comptables sous
format .csv
Colonne suppl?\195?\169mentaire : code journal, lettrage, quickcode
Added: trunk/tools/include/export_operation.inc.php
===================================================================
--- trunk/tools/include/export_operation.inc.php
(rev 0)
+++ trunk/tools/include/export_operation.inc.php 2014-02-15 16:30:58 UTC
(rev 713)
@@ -0,0 +1,57 @@
+<?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
+?>
+<form method="GET" action="extension.raw.php" onsubmit="return check_form()">
+ <?php
+ echo HtmlInput::get_to_hidden(array('gDossier','sa','ac','plugin_code'));
+ echo HtmlInput::hidden("act","export_operation");
+ $date_from=new IDate('p_from');
+ $date_from->id='p_start_date_id';
+ $date_to=new IDate('p_to');
+ $date_to->id="p_end_date_id";
+ ?>
+ <?php echo _("Date début")?> <?php echo $date_from->input()?>
+ <?php echo _("Date fin")?> <?php echo $date_to->input()?>
+ <p>
+ <?php
+ echo HtmlInput::submit("act_sb",_("Export CSV"));
+ ?>
+ </p>
+</form>
+<script>
+
+ function check_form()
+ {
+ if ($('p_start_date_id').value == "" || ! check_date
($('p_start_date_id').value)) {
+ alert('Date incorrect');
+ $('p_start_date_id').style.borderColor = "red";
+ return false;
+ }
+ if ($('p_end_date_id').value == "" || !
check_date($('p_end_date_id').value)) {
+ alert('Date incorrect');
+ $('p_end_date_id').style.borderColor = "red";
+ return false;
+ }
+
+ return true;
+ }
+</script>
\ No newline at end of file
Modified: trunk/tools/index.php
===================================================================
--- trunk/tools/index.php 2014-02-13 19:56:17 UTC (rev 712)
+++ trunk/tools/index.php 2014-02-15 16:30:58 UTC (rev 713)
@@ -40,7 +40,8 @@
$array=array (
array($url.'&sa=op',_('Opération'),_('Changer poste comptable ou
fiche'),1),
array($url.'&sa=pj',_('Pièce'),_('Rénuméroter des pièces
justificative'),2),
- array($url.'&sa=exe',_('Exercice'),_('Ajouter des années
comptables'),3)
+ array($url.'&sa=exe',_('Exercice'),_('Ajouter des années
comptables'),3),
+ array($url.'&sa=exp',_('Export'),_('Exporter les opérations'),4)
);
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"";
@@ -56,6 +57,9 @@
case 'exe':
$def=3;
break;
+ case 'exp':
+ $def=4;
+ break;
}
$cn=new Database(dossier::id());
@@ -86,4 +90,10 @@
require_once 'include/tools_exercice.inc.php';
exit();
}
+ /** export */
+ if ($def == 4 )
+ {
+ require_once 'include/export_operation.inc.php';
+ exit();
+ }
?>
Modified: trunk/tools/raw.php
===================================================================
--- trunk/tools/raw.php 2014-02-13 19:56:17 UTC (rev 712)
+++ trunk/tools/raw.php 2014-02-15 16:30:58 UTC (rev 713)
@@ -1,4 +1,5 @@
<?php
+
/*
* This file is part of PhpCompta.
*
@@ -15,30 +16,88 @@
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
/* $Revision$ */
// Copyright Author Dany De Bontridder address@hidden
-/*!\file
+/* !\file
* \brief raw file for PDF ewa
*/
- //require_once('amortis_constant.php');
+//require_once('amortis_constant.php');
-extract ($_REQUEST);
+$act = HtmlInput::default_value_get("act", null);
-/* export all cards in PDF */
-/* EXAMPLE
-if ( isset($_REQUEST['pdf_all']))
- {
- require_once('include/class_pdf_card.php');
- global $cn;
- $a=new Pdf_Card($cn);
- $a->setDossierInfo(dossier::id());
- $a->AliasNbPages('{nb}');
- $a->AddPage();
- $a->export();
- exit();
- }
-*/
+/**
+ * export operation in CSV
+ */
+if ($act == 'export_operation')
+{
+ // -- parameter
+ $p_from = HtmlInput::default_value_get("p_from", null);
+ $p_to = HtmlInput::default_value_get("p_to", null);
+
+ // -- check date
+ if ( $p_from==null || isDate($p_from)==null || $p_to == null ||
isDate($p_to) == null) {
+ die (_('Date invalide'));
+ }
+ // Security : filter by ledger
+ $ledger=$g_user->get_ledger_sql('ALL',3);
+
+ // SQL stmt
+ $sql = "
+ select to_char(j_date,'DD.MM.YYYY') as str_date,
+ jrn_def_code,
+ jr_internal,
+ jr_pj_number,
+ j_poste,
+ j_qcode,
+ case when coalesce(j_text,'')='' then pcm_lib else j_text end
as text,
+ j_montant,
+ case when j_debit='t' then 'D' else 'C' end as dc,
+ comptaproc.get_letter_jnt(j_id) AS lettrage
+
+ from jrnx
+ join jrn on (j_grpt=jr_grpt_id)
+ join tmp_pcmn on j_poste=pcm_val
+ join jrn_def on jrn_def_id=jr_def_id
+ where
+ j_date between to_date($1,'DD.MM.YYYY') and
to_date($2,'DD.MM.YYYY')
+ and $ledger order by j_date
+ ";
+
+ $ret = $cn->exec_sql($sql, array($p_from, $p_to));
+ $file_name='export_operation-'.date('ymd').'.csv';
+ header('Pragma: public');
+ header('Content-type: application/csv');
+ header('Content-Disposition: attachment;filename="'.$file_name.'"', FALSE);
+ $nb=Database::num_row($ret);
+ printf('"%s";',_("Date DMY"));
+ printf('"%s";',_("Journal"));
+ printf('"%s";',_("n° interne"));
+ printf('"%s";',_("piece"));
+ printf('"%s";',_("poste"));
+ printf('"%s";',_("Code"));
+ printf('"%s";',_("texte"));
+ printf('"%s";',_("montant"));
+ printf('"%s";',_("DC"));
+ printf('"%s"',_("lettrage"));
+ printf ("\r\n");
+
+ for ($i=0;$i < $nb;$i++)
+ {
+ $row=Database::fetch_array($ret,$i);
+ printf('"%s";',$row['str_date']);
+ printf('"%s";',$row['jrn_def_code']);
+ printf('"%s";',$row['jr_internal']);
+ printf('"%s";',$row['jr_pj_number']);
+ printf('"%s";',$row['j_poste']);
+ printf('"%s";',$row['j_qcode']);
+ printf('"%s";',$row['text']);
+ printf('%s;',nb($row['j_montant']));
+ printf('"%s";',$row['dc']);
+ printf('"%s"',$row['lettrage']);
+ printf ("\r\n");
+ }
+}
?>
---
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] r713 - in trunk/tools: . include,
phpcompta-dev <=