phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4709 - in phpcompta/trunk: html html/js include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4709 - in phpcompta/trunk: html html/js include
Date: Tue, 10 Jan 2012 19:02:04 +0100 (CET)

Author: danydb
Date: 2012-01-10 19:02:03 +0100 (Tue, 10 Jan 2012)
New Revision: 4709

Removed:
   phpcompta/trunk/html/ajax_report.php
   phpcompta/trunk/html/js/acc_report.js
Modified:
   phpcompta/trunk/html/export.php
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/include/class_acc_report.php
   phpcompta/trunk/include/function_javascript.php
   phpcompta/trunk/include/report.inc.php
Log:




Deleted: phpcompta/trunk/html/ajax_report.php
===================================================================
--- phpcompta/trunk/html/ajax_report.php        2012-01-10 14:02:28 UTC (rev 
4708)
+++ phpcompta/trunk/html/ajax_report.php        2012-01-10 18:02:03 UTC (rev 
4709)
@@ -1,76 +0,0 @@
-<?php
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta 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.
- *
- *   PhpCompta 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 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
- * \brief export definition of a report
- */
-
-
-require_once  ("constant.php");
-require_once('class_database.php');
-require_once ("user_common.php");
-require_once('class_dossier.php');
-require_once('class_acc_report.php');
-require_once('class_user.php');
-if ( ! isset($_GET['gDossier']) ||
-        ! isset($_GET['f']) )
-{
-    $a='{"answer":"nok"}';
-    header("Content-type: text/html; charset: utf8",true);
-    print $a;
-    exit();
-}
-$cn=new Database(dossier::id());
-
-$User=new User($cn);
-$User->Check();
-$User->check_dossier(dossier::id());
-
-
-
-$gDossier=dossier::id();
-if ( ! is_dir('tmp') )
-{
-    mkdir ('tmp');
-}
-
-$cn=new Database($gDossier);
-if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1)
-{
-    $rap=new Acc_Report($cn,$_GET['f']);
-
-    $name=tempnam('tmp','report_').'.bin';
-
-    $file= fopen($name,"a+");
-    $rap->export($file);
-    fclose ($file);
-    $name='tmp'.DIRECTORY_SEPARATOR.basename($name);
-    $name=dirname($_SERVER['REQUEST_URI']).DIRECTORY_SEPARATOR.$name;
-
-    $a='{"answer":"ok","link":"'.$name.'"}';
-
-}
-else
-    $a='{"answer":"nok"}';
-header("Content-type: text/html; charset: utf8",true);
-print $a;
-?>

Modified: phpcompta/trunk/html/export.php
===================================================================
--- phpcompta/trunk/html/export.php     2012-01-10 14:02:28 UTC (rev 4708)
+++ phpcompta/trunk/html/export.php     2012-01-10 18:02:03 UTC (rev 4709)
@@ -158,6 +158,9 @@
   case 'CSV:AncGrandLivre':
       require_once 'export_anc_grandlivre_csv.php';
       break;
+  case 'CSV:reportinit':
+         require_once('export_reportinit_csv.php');
+         break;
    default:
     alert('Action inconnue '.$_GET['act']);
     exit();

Deleted: phpcompta/trunk/html/js/acc_report.js
===================================================================
--- phpcompta/trunk/html/js/acc_report.js       2012-01-10 14:02:28 UTC (rev 
4708)
+++ phpcompta/trunk/html/js/acc_report.js       2012-01-10 18:02:03 UTC (rev 
4709)
@@ -1,84 +0,0 @@
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta 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.
- *
- *   PhpCompta 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 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
- * \brief javascript script for the report (in accountancy)
- *
- */
-/**
- * @brief add a line in the form for the report 
- * @param p_dossier dossier id to connect
- */
-function rapport_add_row(p_dossier)
-{
-    style='style="border: 1px solid blue;"';
-    var table=$("rap1");
-    var line=table.rows.length;
-
-    var row=table.insertRow(line);
-    // left cell
-    var cellPos = row.insertCell(0);
-    cellPos.innerHTML='<input type="text" '+style+' size="3" id="pos'+line+'" 
name="pos'+line+'" value="'+line+'">';
-
-    // right cell
-    var cellName = row.insertCell(1);
-    cellName.innerHTML='<input type="text" '+style+' size="40" 
id="text'+line+'" name="text'+line+'">';
-
-    // button + formula
-    var cellbutton = row.insertCell(2);
-    var but_html=table.rows[1].cells[2].innerHTML;
-    but_html=but_html.replace(/form0/g,"form"+line);
-    cellbutton.innerHTML=but_html;
-    but_html.evalScripts();
-
-    g('form'+line).value='';
-}
-
-/**
- * @brief create a file to export a report
- * @param p_dossier the dossier id
- */
-function report_export(p_dossier,p_fr_id)
-{
-    var queryString="?&gDossier="+p_dossier+"&f="+p_fr_id;
-    var action=new Ajax.Request(
-                   "ajax_report.php",
-                   {
-                   method:'get',
-                   parameters:queryString,
-                   onSuccess:report_export_success
-                   }
-               );
-
-}
-/**
- * @brief callback function for exporting a report
- * @param request object request
- * @param json json answer
- */
-function report_export_success(request,json)
-{
-    var answer = request.responseText.evalJSON(true);
-    var ok=answer.answer;
-    var link=answer.link;
-    $('export').hide();
-    $('export_link').innerHTML='<a class="mtitle" href="'+link+'"> Cliquez ici 
pour télécharger le rapport</a>';
-}
\ No newline at end of file

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2012-01-10 14:02:28 UTC (rev 4708)
+++ phpcompta/trunk/html/js/scripts.js  2012-01-10 18:02:03 UTC (rev 4709)
@@ -1351,3 +1351,31 @@
     }
     alert(s_type+a_array.join(","));
 }
+/**
+ * @brief add a line in the form for the report
+ * @param p_dossier dossier id to connect
+ */
+function rapport_add_row(p_dossier)
+{
+    style='style="border: 1px solid blue;"';
+    var table=$("rap1");
+    var line=table.rows.length;
+
+    var row=table.insertRow(line);
+    // left cell
+    var cellPos = row.insertCell(0);
+    cellPos.innerHTML='<input type="text" '+style+' size="3" id="pos'+line+'" 
name="pos'+line+'" value="'+line+'">';
+
+    // right cell
+    var cellName = row.insertCell(1);
+    cellName.innerHTML='<input type="text" '+style+' size="40" 
id="text'+line+'" name="text'+line+'">';
+
+    // button + formula
+    var cellbutton = row.insertCell(2);
+    var but_html=table.rows[1].cells[2].innerHTML;
+    but_html=but_html.replace(/form0/g,"form"+line);
+    cellbutton.innerHTML=but_html;
+    but_html.evalScripts();
+
+    g('form'+line).value='';
+}

Modified: phpcompta/trunk/include/class_acc_report.php
===================================================================
--- phpcompta/trunk/include/class_acc_report.php        2012-01-10 14:02:28 UTC 
(rev 4708)
+++ phpcompta/trunk/include/class_acc_report.php        2012-01-10 18:02:03 UTC 
(rev 4709)
@@ -100,7 +100,7 @@
     }
     /*!
      * \brief  Display a form for encoding a new report or update one
-     * 
+     *
      * \param $p_line number of line
      *
      */
@@ -346,7 +346,7 @@
     }
     /*!\brief To make a SELECT button with the needed value, it is used
      *by the SELECT widget
-     *\return string with html code 
+     *\return string with html code
      */
     function make_array()
     {
@@ -356,9 +356,9 @@
 
 
     /*!\brief write to a file the definition of a report
-     * \param p_file is the file name
+     * \param p_file is the file name (default php://output)
      */
-    function export($p_file)
+    function export_csv($p_file)
     {
         $this->load();
 

Modified: phpcompta/trunk/include/function_javascript.php
===================================================================
--- phpcompta/trunk/include/function_javascript.php     2012-01-10 14:02:28 UTC 
(rev 4708)
+++ phpcompta/trunk/include/function_javascript.php     2012-01-10 18:02:03 UTC 
(rev 4709)
@@ -2743,7 +2743,6 @@
     echo js_include('slider.js');
     echo js_include('acc_ledger.js');
     echo js_include('accounting_item.js');
-    echo js_include('acc_report.js');
     echo js_include('ajax_fiche.js');
     echo js_include('anc_script.js');
     echo js_include('builder.js');

Modified: phpcompta/trunk/include/report.inc.php
===================================================================
--- phpcompta/trunk/include/report.inc.php      2012-01-10 14:02:28 UTC (rev 
4708)
+++ phpcompta/trunk/include/report.inc.php      2012-01-10 18:02:03 UTC (rev 
4709)
@@ -128,20 +128,22 @@
     {
         echo '<DIV class="redcontent">';
         $rap->id=$_REQUEST ['fr_id'];
-        echo '<form method="post">';
+        echo '<form method="post" style="display:inline">';
         $rap->load();
         echo $rap->form();
         echo HtmlInput::hidden("fr_id",$rap->id);
         echo HtmlInput::hidden("action","record");
         echo HtmlInput::submit("update",_("Mise a jour"));
         echo HtmlInput::submit("del_form",_("Effacement"));
-        $w=new IButton();
-        $w->name="export";
-        $w->javascript="report_export('".$gDossier."','".$rap->id."')";
-        $w->label='Export';
-        echo $w->input();
-        echo '<span id="export_link"></span>';
+
         echo '</form>';
+               echo '<form method="get" action="export.php" 
style="display:inline">';
+               echo dossier::hidden();
+               echo HtmlInput::hidden("act","CSV:reportinit");
+               echo HtmlInput::hidden('f',$rap->id);
+               echo HtmlInput::submit('bt_csv',"Export CSV");
+               echo 
HtmlInput::request_to_hidden(array('ac','action','p_action','fr_id'));
+               echo '</form>';
         echo '<span class="notice">'._("Les lignes vides seront 
effacées").'</span>';
         echo "</DIV>";
     }




reply via email to

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