Author: danydb Date: 2012-08-27 22:28:22 +0200 (Mon, 27 Aug 2012) New Revision: 400
Added: trunk/tools/include/class_tool_exercice.php trunk/tools/include/template/tool_exercice_input.php trunk/tools/include/tools_exercice.inc.php Removed: trunk/tva/class_tva_param.php Modified: trunk/ trunk/amortis/ajax.php trunk/amortis/index.php trunk/coprop/index.php trunk/import_card/include/class_import_card.php trunk/import_card/include/template/test_file.php trunk/import_doli/doc/ trunk/import_doli/doc/import-donnee-dolibarr test.csv trunk/import_doli/doc/import-donnee-dolibarr test.ods trunk/import_doli/include/class_impdol_operation.php trunk/import_doli/include/class_import_card.php trunk/import_doli/include/template/test_file.php trunk/import_doli/include/template/test_operation.php trunk/import_doli/index.php trunk/importbank/ajax.php trunk/importbank/include/template/confirm_transfer.php trunk/importbank/include/template/show_transfer.php trunk/importbank/include/template/test_file.php trunk/importbank/index.php trunk/skel/ajax.php trunk/skel/index.php trunk/tools/ajax.php trunk/tools/index.php trunk/tva/ajax.php trunk/tva/class_ext_tva.php trunk/tva/class_ext_tvagen.php trunk/tva/list_tva.inc.php trunk/tva/sql/patch2.sql Log: Merged revisions 387-396 via svnmerge from svn+ssh://[email protected]/svn_extension/tag/rel650 ........ r387 | danydb | 2012-07-01 17:12:46 +0200 (Sun, 01 Jul 2012) | 1 line correct bug with unexisting tva_id ........ r388 | danydb | 2012-07-01 17:14:00 +0200 (Sun, 01 Jul 2012) | 1 line correct bug with unexisting tva_id ........ r389 | danydb | 2012-07-01 17:23:31 +0200 (Sun, 01 Jul 2012) | 1 line forget the commit into sql patch ........ r390 | danydb | 2012-07-09 18:12:43 +0200 (Mon, 09 Jul 2012) | 1 line Import BANK Problem VMSKEYTRADE : extra invisible char. make the insert failed ........ r391 | danydb | 2012-07-20 06:44:45 +0200 (Fri, 20 Jul 2012) | 1 line Sort table for history of form ........ r392 | danydb | 2012-07-29 15:09:32 +0200 (Sun, 29 Jul 2012) | 1 line New Tool for adding exercice ........ r393 | danydb | 2012-07-29 15:19:11 +0200 (Sun, 29 Jul 2012) | 1 line remove obsolete ........ r394 | danydb | 2012-07-30 20:19:07 +0200 (Mon, 30 Jul 2012) | 1 line fix bug : receipt missing ........ r395 | danydb | 2012-08-24 21:46:38 +0200 (Fri, 24 Aug 2012) | 1 line TOOLS : Feedback when adding a new exercice ........ r396 | danydb | 2012-08-24 22:28:12 +0200 (Fri, 24 Aug 2012) | 1 line replace ob_clean by ob_end_clean ........ Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /tag/rel650:1-385 + /tag/rel650:1-399 Modified: trunk/amortis/ajax.php =================================================================== --- trunk/amortis/ajax.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/amortis/ajax.php 2012-08-27 20:28:22 UTC (rev 400) @@ -43,7 +43,7 @@ echo $close; require_once('include/material_add.inc.php'); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; /* * save the new material @@ -53,13 +53,13 @@ echo $close; require_once('include/material_new.inc.php'); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; case 'display_modify': ob_start(); require_once('include/material_modify.inc.php'); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; case 'save_modify': @@ -70,13 +70,13 @@ $f=$cn->get_value("select f_id from fiche join fiche_detail using (f_id) where ad_id=23 and ad_value=$1",array($_POST['p_card'])); require_once('include/material_modify.inc.php'); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; case 'rm': ob_start(); require_once('include/material_delete.inc.php'); $html=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; } Modified: trunk/amortis/index.php =================================================================== --- trunk/amortis/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/amortis/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -34,7 +34,7 @@ ob_start(); require_once('amortize_javascript.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); $url='?'.dossier::get().'&plugin_code='.$_REQUEST['plugin_code'].'&ac='.$_REQUEST['ac']; Modified: trunk/coprop/index.php =================================================================== --- trunk/coprop/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/coprop/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -35,7 +35,7 @@ ob_start(); require_once('coprop-javascript.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); $url='?'.dossier::get().'&plugin_code='.$_REQUEST['plugin_code'].'&ac='.$_REQUEST['ac']; Modified: trunk/import_card/include/class_import_card.php =================================================================== --- trunk/import_card/include/class_import_card.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_card/include/class_import_card.php 2012-08-27 20:28:22 UTC (rev 400) @@ -52,7 +52,7 @@ $encodage->selected = true; require_once('template/input_file.php'); $r = ob_get_contents(); - ob_clean(); + ob_end_clean(); echo $r; } /** @@ -197,7 +197,7 @@ echo '</tr>'; } $table_content = ob_get_contents(); - ob_clean(); + ob_end_clean(); echo '<tr>'; echo th(''); for ($e = 0; $e < count($header); $e++) Modified: trunk/import_card/include/template/test_file.php =================================================================== --- trunk/import_card/include/template/test_file.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_card/include/template/test_file.php 2012-08-27 20:28:22 UTC (rev 400) @@ -64,7 +64,7 @@ echo '</tr>'; } $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo '<table style="border:solid 1px black;width:100%"> Property changes on: trunk/import_doli/doc ___________________________________________________________________ Name: svn:ignore - .~lock.import-donnee-fiche.ods# .~lock.import-donnee-dolibarr test.ods# .~lock.import-donnee-dolibarr.ods# .~lock.import-donnee-dolibarr test.csv# + .~lock.import-donnee-fiche.ods# .~lock.import-donnee-dolibarr test.ods# .~lock.import-donnee-dolibarr.ods# .~lock.import-donnee-dolibarr test.csv# .~lock.import_doli.odt# Modified: trunk/import_doli/doc/import-donnee-dolibarr test.csv =================================================================== --- trunk/import_doli/doc/import-donnee-dolibarr test.csv 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/doc/import-donnee-dolibarr test.csv 2012-08-27 20:28:22 UTC (rev 400) @@ -1,5 +1,5 @@ -1;"13.03.2012";"WOOHA";"achat de marchandises";;;;;; -1;"13.03.2012";"M1";"Marchandise 1";;3;1,62;9;0,06;28,62 -1;"13.03.2012";"M2";"Marchandise 2";;12;0,72;1;0,06;12,72 -2;"14.03.2012";"TANGRAM";"Facture n°121212121 : Electricté";;;;;; -2;"14.03.2012";"ELEC";"Électricté";;125;7,5;1;0,06;132,5 +3;"13.03.2012";"T";"WOOHA";"achat de marchandises";"A1";;;;; +3;"13.03.2012";"S";"M1";"Marchandise 1";"A1";3;1,62;9;0,06;28,62 +3;"13.03.2012";"S";"M2";"Marchandise 2";"A1";12;0,72;1;0,06;12,72 +2;"14.03.2012";"T";"TANGRAM";"Facture n°121212121 : Electricté";"B1";;;;; +2;"14.03.2012";"S";"FID1070";"Électricté";"B1";125;7,5;1;0,06;132,5 Modified: trunk/import_doli/doc/import-donnee-dolibarr test.ods =================================================================== (Binary files differ) Modified: trunk/import_doli/include/class_impdol_operation.php =================================================================== --- trunk/import_doli/include/class_impdol_operation.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/include/class_impdol_operation.php 2012-08-27 20:28:22 UTC (rev 400) @@ -434,6 +434,7 @@ $acc_jrn->grpt = $grpt; $acc_jrn->periode = 0; $acc_jrn->insert_jrn(); + $cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2',array($oper->getp('pj'),$acc_jrn->jr_id)); /* Update info */ $ledger->grpt_id = $grpt; Modified: trunk/import_doli/include/class_import_card.php =================================================================== --- trunk/import_doli/include/class_import_card.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/include/class_import_card.php 2012-08-27 20:28:22 UTC (rev 400) @@ -60,7 +60,7 @@ require_once('template/input_file.php'); $r = ob_get_contents(); - ob_clean(); + ob_end_clean(); echo $r; } @@ -224,7 +224,7 @@ echo '</tr>'; } $table_content = ob_get_contents(); - ob_clean(); + ob_end_clean(); echo '<tr>'; echo th(''); for ($e = 0; $e < count($header); $e++) Modified: trunk/import_doli/include/template/test_file.php =================================================================== --- trunk/import_doli/include/template/test_file.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/include/template/test_file.php 2012-08-27 20:28:22 UTC (rev 400) @@ -64,7 +64,7 @@ echo '</tr>'; } $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo '<table style="border:solid 1px black;width:100%"> Modified: trunk/import_doli/include/template/test_operation.php =================================================================== --- trunk/import_doli/include/template/test_operation.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/include/template/test_operation.php 2012-08-27 20:28:22 UTC (rev 400) @@ -64,7 +64,7 @@ echo '</tr>'; } $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo '<table style="border:solid 1px black;width:100%"> Modified: trunk/import_doli/index.php =================================================================== --- trunk/import_doli/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/import_doli/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -46,7 +46,7 @@ ob_start(); require_once('impdol.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); Modified: trunk/importbank/ajax.php =================================================================== --- trunk/importbank/ajax.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/importbank/ajax.php 2012-08-27 20:28:22 UTC (rev 400) @@ -78,7 +78,7 @@ else $bi->show_item($ctl); $r=ob_get_contents(); - ob_clean(); + ob_end_clean(); } $html=escape_xml($r); Modified: trunk/importbank/include/template/confirm_transfer.php =================================================================== --- trunk/importbank/include/template/confirm_transfer.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/importbank/include/template/confirm_transfer.php 2012-08-27 20:28:22 UTC (rev 400) @@ -35,7 +35,7 @@ echo '</tr>'; } $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); $nb_col->value=($nb_col->value=='')?$max:$nb_col->value; Modified: trunk/importbank/include/template/show_transfer.php =================================================================== --- trunk/importbank/include/template/show_transfer.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/importbank/include/template/show_transfer.php 2012-08-27 20:28:22 UTC (rev 400) @@ -50,7 +50,7 @@ $libelle=utf8_encode($array_row[$i]); break; case 3: - $operation_nb=$array_row[$i]; + $operation_nb=preg_replace('/[^[:print:]]/','',$array_row[$i]); break; case 4: $third=utf8_encode($array_row[$i]); @@ -95,7 +95,7 @@ echo '</table>'; $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); $cn->commit(); $nb_col->value=($nb_col->value=='')?$max:$nb_col->value; ?> Modified: trunk/importbank/include/template/test_file.php =================================================================== --- trunk/importbank/include/template/test_file.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/importbank/include/template/test_file.php 2012-08-27 20:28:22 UTC (rev 400) @@ -64,7 +64,7 @@ echo '</tr>'; } $table=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo '<table style="border:solid 1px black;width:100%"> Modified: trunk/importbank/index.php =================================================================== --- trunk/importbank/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/importbank/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -42,7 +42,7 @@ ob_start(); require_once('bank_js.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); /* Modified: trunk/skel/ajax.php =================================================================== --- trunk/skel/ajax.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/skel/ajax.php 2012-08-27 20:28:22 UTC (rev 400) @@ -19,7 +19,7 @@ $html=ob_get_contents(); -ob_clean(); +ob_end_clean(); $html=escape_xml($html); Modified: trunk/skel/index.php =================================================================== --- trunk/skel/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/skel/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -31,7 +31,7 @@ ob_start(); require_once('skel_javascript.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); global $version_plugin; $version_plugin=SVNINFO; Modified: trunk/tools/ajax.php =================================================================== --- trunk/tools/ajax.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tools/ajax.php 2012-08-27 20:28:22 UTC (rev 400) @@ -21,7 +21,7 @@ $html=ob_get_contents(); -ob_clean(); +ob_end_clean(); $html=escape_xml($html); Copied: trunk/tools/include/class_tool_exercice.php (from rev 396, tag/rel650/tools/include/class_tool_exercice.php) =================================================================== --- trunk/tools/include/class_tool_exercice.php (rev 0) +++ trunk/tools/include/class_tool_exercice.php 2012-08-27 20:28:22 UTC (rev 400) @@ -0,0 +1,130 @@ +<?php + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * Description of class_tool_exercice + * + * @author dany + */ +class Tool_Exercice +{ + + function __construct($cn) + { + $this->cn = $cn; + } + + /** + * Show form to input data for new exercice + */ + function input() + { + $exercice = new INum('p_exercice'); + $exercice->prec = 0; + $exercice->value = HtmlInput::default_value_post('p_exercice', ''); + + $year = new INum('year'); + $year->prec = 0; + $year->value = HtmlInput::default_value_post('year', ''); + + $nb_month = new INum('nb_month'); + $nb_month->prec = 0; + $nb_month->value = HtmlInput::default_value_post('nb_month', ''); + + $from = new ISelect('from_month'); + $from->selected= HtmlInput::default_value_post('from_month', ''); + $amonth = array(); + for ($i = 1; $i < 13; $i++) + { + $amonth[] = array("value" => $i, "label" => $i); + } + $from->value = $amonth; + + require_once 'template/tool_exercice_input.php'; + } + + function fromPost() + { + $this->exercice = $_POST['p_exercice']; + $this->nb_month = $_POST['nb_month']; + $this->from = $_POST['from_month']; + $this->year= $_POST['year']; + } + + function verify() + { + if (isNumber($this->exercice) == 0) + throw new Exception("Exercice n'est pas un nombre"); + + if ($this->exercice > COMPTA_MAX_YEAR|| $this->exercice < COMPTA_MIN_YEAR) + throw new Exception("Exercice doit être entre ".COMPTA_MAX_YEAR."& ".COMPTA_MIN_YEAR); + if (isNumber($this->year) == 0) + throw new Exception("Année n'est pas un nombre"); + + if ($this->year > COMPTA_MAX_YEAR|| $this->year < COMPTA_MIN_YEAR) + throw new Exception("Année doit être entre ".COMPTA_MAX_YEAR."& ".COMPTA_MIN_YEAR); + + if (isNumber($this->nb_month) == 0) + throw new Exception("Nombre de mois n'est pas un nombre"); + if ($this->nb_month < 1 || $this->nb_month > 60) + throw new Exception("Nombre de mois doit être compris entre 1 & 60 "); + if (isNumber($this->from) == 0) + throw new Exception("Mois de début n'existe pas "); + if ($this->from > 13 || $this->from < 1) + throw new Exception("Mois de début n'existe pas "); + } + + function save() + { + try + { + $this->verify(); + } + catch (Exception $e) + { + alert($e->getMessage()); + return -1; + } + $this->cn->start(); + try + { + $periode = new Periode($this->cn); + $exercice=$this->exercice; + $year=$this->year; + $month=$this->from; + for ($i = 1; $i <= $this->nb_month; $i++) + { + + + $date_start = sprintf('01.%02d.%d', $month, $year); + $date_end = $this->cn->get_value("select to_char(to_date('$date_start','DD.MM.YYYY')+interval '1 month'-interval '1 day','DD.MM.YYYY')"); + if ($periode->insert($date_start, $date_end, $this->exercice) != 0) + { + throw new Exception('Erreur insertion période'); + } + if ($month>11 ) + { + $year++; + $month=1; + } + else + { + $month++; + } + } + } + catch (Exception $e) + { + var_dump($e->getTraceAsString()); + return -1; + } + return 0; + } + +} + +?> Copied: trunk/tools/include/template/tool_exercice_input.php (from rev 396, tag/rel650/tools/include/template/tool_exercice_input.php) =================================================================== --- trunk/tools/include/template/tool_exercice_input.php (rev 0) +++ trunk/tools/include/template/tool_exercice_input.php 2012-08-27 20:28:22 UTC (rev 400) @@ -0,0 +1,69 @@ +<?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 [email protected] + +/** + * @file + * @brief Input data for new Exercice + * + */ +?> +<form method="POST"> + <table> + <tr> + <td> + Exercice + </td> + <td> + <?=$exercice->input()?> + </td> + </tr> + <tr> + <td> + Année + </td> + <td> + <?=$year->input()?> + </td> + </tr> + <tr> + <td> + Nombre de mois + </td> + <td> + <?=$nb_month->input()?> + </td> + </tr> + <tr> + <td> + A partir du mois de + </td> + <td> + <?=$from->input()?> + </td> + </tr> + </table> +<? +echo HtmlInput::submit('save','Valider'); +echo HtmlInput::request_to_hidden(array('sa','ac','plugin_code','gDossier')); +?> +</form> \ No newline at end of file Copied: trunk/tools/include/tools_exercice.inc.php (from rev 396, tag/rel650/tools/include/tools_exercice.inc.php) =================================================================== --- trunk/tools/include/tools_exercice.inc.php (rev 0) +++ trunk/tools/include/tools_exercice.inc.php 2012-08-27 20:28:22 UTC (rev 400) @@ -0,0 +1,50 @@ +<?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 [email protected] + +/** + * @file + * @brief add an exercice of 12 month starting when we want + * + */ +require_once 'class_tool_exercice.php'; +global $g_succeed; +if (isset ($_POST['save'])) +{ + try + { + $exercice=new Tool_Exercice($cn); + $exercice->fromPost(); + $exercice->save(); + printf (_("%s Vous avez ajouté %d mois depuis le %d/%d pour l'exercice %d "),$g_succeed,$_POST['nb_month'],$_POST['from_month'],$_POST['year'],$_POST['p_exercice']); + exit(); + } + catch (Exception $e) + { + var_dump($e->getTraceAsString()); + } + +} + +$exercice=new Tool_Exercice($cn); +echo $exercice->input(); +?> Modified: trunk/tools/index.php =================================================================== --- trunk/tools/index.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tools/index.php 2012-08-27 20:28:22 UTC (rev 400) @@ -25,7 +25,7 @@ */ global $version_plugin; $version_plugin=SVNINFO; -Extension::check_version(4400); +Extension::check_version(5082); /* * load javascript @@ -33,13 +33,14 @@ ob_start(); require_once('tools_javascript.js'); $j=ob_get_contents(); -ob_clean(); +ob_end_clean(); echo create_script($j); $url='?'.dossier::get()."&plugin_code=".$_REQUEST['plugin_code']."&ac=".$_REQUEST['ac']; $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=pj',_('Pièce'),_('Rénuméroter des pièces justificative'),2), + array($url.'&sa=exe',_('Exercice'),_('Ajouter des années comptables'),3) ); $sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; @@ -52,6 +53,9 @@ case 'pj': $def=2; break; + case 'exe': + $def=3; + break; } $cn=new Database(dossier::id()); @@ -76,4 +80,10 @@ require_once('include/receipt.inc.php'); exit(); } +/* Exercice */ + if ($def == 3 ) + { + require_once 'include/tools_exercice.inc.php'; + exit(); + } ?> Modified: trunk/tva/ajax.php =================================================================== --- trunk/tva/ajax.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/ajax.php 2012-08-27 20:28:22 UTC (rev 400) @@ -159,7 +159,7 @@ echo alert($e->getMessage()); } $r=ob_get_contents(); - ob_clean(); + ob_end_clean(); break; case 'rm_form': switch($type) Modified: trunk/tva/class_ext_tva.php =================================================================== --- trunk/tva/class_ext_tva.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/class_ext_tva.php 2012-08-27 20:28:22 UTC (rev 400) @@ -319,7 +319,7 @@ ob_start(); require_once('form_decl.php'); $r=ob_get_contents(); - ob_clean(); + ob_end_clean(); $r.=HtmlInput::hidden('periode_dec',$this->periode_dec); return $r; Modified: trunk/tva/class_ext_tvagen.php =================================================================== --- trunk/tva/class_ext_tvagen.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/class_ext_tvagen.php 2012-08-27 20:28:22 UTC (rev 400) @@ -125,7 +125,7 @@ ob_start(); require_once('form_periode.php'); $r=ob_get_contents(); - ob_clean(); + ob_end_clean(); return $r; } @@ -200,7 +200,7 @@ ob_start(); require_once('form_decl_info.php'); $r=ob_get_contents(); - ob_clean(); + ob_end_clean(); return $r; } Deleted: trunk/tva/class_tva_param.php =================================================================== --- trunk/tva/class_tva_param.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/class_tva_param.php 2012-08-27 20:28:22 UTC (rev 400) @@ -1,111 +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 [email protected] - -/*!\file - * \brief manage the table tva.parameters - */ - -/*!\brief - * - * - */ -class -{ - /* example private $variable=array("val1"=>1,"val2"=>"Seconde valeur","val3"=>0); */ - private static $variable; - function __construct ($p_init) { - /* example $this->set_parameter("val3",$p_init); */ - } - public function get_parameter($p_string) { - if ( array_key_exists($p_string,self::$variable) ) { - $idx=self::$variable[$p_string]; - return $this->$idx; - } - else - exit (__FILE__.":".__LINE__.'Erreur attribut inexistant'); - } - public function set_parameter($p_string,$p_value) { - if ( array_key_exists($p_string,self::$variable) ) { - $idx=self::$variable[$p_string]; - $this->$idx=$p_value; - } - else - exit (__FILE__.":".__LINE__.'Erreur attribut inexistant'); - - - } - public function get_info() { return var_export(self::$variable,true); } - public function verify() { - // Verify that the elt we want to add is correct - } - public function save() { - $this->update(); - } - - public function update() { - if ( $this->verify() != 0 ) return; - /* please adapt - $sql="update tva_rate set tva_label=$1,tva_rate=$2,tva_comment=$3,tva_poste=$4 ". - " where tva_id = $5"; - $res=ExecSqlParam($this->cn, - $sql, - array($this->tva_label, - $this->tva_rate, - $this->tva_comment, - $this->tva_poste, - $this->tva_id) - ); - */ - } - - public function load() { - - $sql="select tva_label,tva_rate, tva_comment,tva_poste from tva_rate where tva_id=$1"; - /* please adapt - $res=ExecSqlParam($this->cn, - $sql, - array($this->tva_id) - ); - */ - if ( pg_NumRows($res) == 0 ) return; - $row=pg_fetch_array($res,0); - foreach ($row as $idx=>$value) { $this->$idx=$value; } - } - public function delete() { -/* $sql="delete from tva_rate where tva_id=$1"; - $res=ExecSqlParam($this->cn,$sql,array($this->tva_id)); -*/ - } - /*!\brief - *\param - *\return - *\note - *\see - *\todo - */ - static function test_me() { - } - -} - -/* test::test_me(); */ - Modified: trunk/tva/list_tva.inc.php =================================================================== --- trunk/tva/list_tva.inc.php 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/list_tva.inc.php 2012-08-27 20:28:22 UTC (rev 400) @@ -15,16 +15,17 @@ * 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 [email protected] require_once('class_iselect.php'); +require_once 'class_sort_table.php'; echo '<div id="detail" style="display:none; width:80%;margin-left:10%">'; echo '<image src="image/loading.gif" border="0" alt="Chargement...">'; echo '</div>'; -/*!\file +/* !\file * \brief show all the declaration by date */ @@ -32,24 +33,35 @@ echo '<form method="get">'; echo HtmlInput::request_to_hidden(array('ac')); echo _('Filtrer par '); -$choice=new ISelect('type'); -$choice->value=array( - array('label'=> 'Toutes','value'=> 0 ), - array('label'=> 'Déclarations','value'=> 1 ), - array('label'=> 'Listings assujetti','value'=> 2), - array('label'=> 'Listings intracom','value'=> 3) - ); -$choice->selected=(isset($_REQUEST['type']))?$_REQUEST['type']:0; -$choice->javascript=' onchange="submit(this)"'; +$choice = new ISelect('type'); +$choice->value = array( + array('label' => 'Toutes', 'value' => 0), + array('label' => 'Déclarations', 'value' => 1), + array('label' => 'Listings assujetti', 'value' => 2), + array('label' => 'Listings intracom', 'value' => 3) +); +$choice->selected = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : 0; +$choice->javascript = ' onchange="submit(this)"'; echo HtmlInput::extension(); -echo HtmlInput::hidden('sa','ltva'); +echo HtmlInput::hidden('sa', 'ltva'); echo dossier::hidden(); echo $choice->input(); -echo HtmlInput::submit('rc','Recharger'); +echo HtmlInput::submit('rc', 'Recharger'); echo '</form>'; -switch($choice->selected) { -case 0: - $sql=" + +$url = HtmlInput::request_to_string(array('ac', 'plugin_code', 'gDossier', 'sa', 'type')); +$sort= new Sort_Table(); +$sort->add('Date déclaration ', $url, ' order by date_decl asc', ' order by date_decl desc', 'da', 'dd'); +$sort->add('Période ', $url, ' order by exercice asc,periode_dec asc', ' order by exercice desc,periode_dec desc', 'pa', 'pd'); + +$option_order = (isset($_GET['ord'])) ? $_GET['ord'] : 'dd'; + +$sql_order = $sort->get_sql_order($option_order); + +switch ($choice->selected) +{ + case 0: + $sql = " select da_id as id, 'Déclaration trim/mens' as type_title,1 as type_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl, case when periodicity ='1' then 'Mensuel' when periodicity = '2' then 'Trimestriel' @@ -69,15 +81,13 @@ 'Annuel' as fmt_periodicity, periode_dec,exercice from tva_belge.assujetti - -order by date_decl desc "; - break; + break; -case 1: + case 1: - $sql=" + $sql = " select da_id as id, 'Déclaration trim/mens' as type_title,1 as type_decl,to_char(date_decl,'DD.MM.YYYY') as date_fmt, case when periodicity ='1' then 'Mensuel' when periodicity = '2' then 'Trimestriel' @@ -85,18 +95,17 @@ periode_dec,exercice from tva_belge.declaration_amount order by date_decl desc "; - break; -case 2: -$sql=" + break; + case 2: + $sql = " select a_id as id, 'Listing assujetti' as type_title, 2 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl, 'Annuel' as fmt_periodicity, periode_dec,exercice from tva_belge.assujetti -order by date_decl desc "; -break; -case 3: -$sql=" + break; + case 3: + $sql = " select i_id as id, 'Listing Intracom' as type_title, 3 as type_decl, to_char(date_decl,'DD.MM.YYYY') as date_fmt,date_decl, case when periodicity ='1' then 'Mensuel' when periodicity = '2' then 'Trimestriel' @@ -104,26 +113,31 @@ end as fmt_periodicity, periode_dec,exercice from tva_belge.intracomm -order by date_decl desc "; - break; - + break; } -$res=$cn->get_array($sql); -echo '<table class="result" >'; -echo tr(th('Type de déclaration').th('Periodicité').th('Mois/année').th('Date').th('Année')); -for ($i=0;$i<count($res);$i++){ - $aref=sprintf('<a href="javascript:void(0)" onclick="show_declaration(\'%s\',\'%s\')">', - $res[$i]['type_decl'],$res[$i]['id']); - $row=td($aref.$res[$i]['type_title'].'</a>'); - $row.=td($aref.$res[$i]['fmt_periodicity'].'</a>'); - $row.=td($aref.$res[$i]['periode_dec'].'</a>'); - $row.=td($aref.$res[$i]['date_fmt'].'</a>'); - $row.=td($aref.$res[$i]['exercice'].'</a>'); +$sql = $sql . $sql_order; +$res = $cn->get_array($sql); +?> +<table class="result" > + <tr> + <th>Type de déclaration</th> + <th>Periodicité</th> + <th> <?=$sort->get_header(1)?></th> + <th><?=$sort->get_header(0)?></th> - echo tr($row); -} -echo '</table>'; -echo '</div>'; + <? for ($i = 0; $i < count($res); $i++):?> + <tr> + <? + $aref = sprintf('<a href="javascript:void(0)" onclick="show_declaration(\'%s\',\'%s\')">', $res[$i]['type_decl'], $res[$i]['id']); + echo td($aref . $res[$i]['type_title'] . '</a>'); + echo td($aref . $res[$i]['fmt_periodicity'] . '</a>'); + echo td($aref.$res[$i]['periode_dec'].' - '.$res[$i]['exercice'].'</a>'); + echo td($aref.$res[$i]['date_fmt'].'</a>'); + ?> + </tr> + <? endfor;?> +</table> +</div> Modified: trunk/tva/sql/patch2.sql =================================================================== --- trunk/tva/sql/patch2.sql 2012-08-27 12:05:36 UTC (rev 399) +++ trunk/tva/sql/patch2.sql 2012-08-27 20:28:22 UTC (rev 400) @@ -36,7 +36,7 @@ f record; n_size_tva int; n_size_account int; - + n_exist_tva int; begin for i in select pcode,pvalue,paccount from tva_belge.parameter @@ -56,9 +56,13 @@ while n_size_account <> 0 loop - insert into tva_belge.parameter_chld (pcode,tva_id,pcm_val) - values (i.pcode,a_tva_id[n_size_tva]::numeric,a_account[n_size_account]::account_type); + select count(*) into n_exist_tva from tva_rate where tva_id=a_tva_id[n_size_tva]::numeric; + if n_exist_tva != 0 then + + insert into tva_belge.parameter_chld (pcode,tva_id,pcm_val) + values (i.pcode,a_tva_id[n_size_tva]::numeric,a_account[n_size_account]::account_type); + end if; n_size_account := n_size_account -1; end loop; n_size_account := array_upper(a_account,1); @@ -86,7 +90,7 @@ f record; n_size_tva int; n_size_account int; - + n_exist_tva int; begin for i in select distinct pvalue from tva_belge.parameter WHERE pcode in ('GRIL00','GRIL01','GRIL02','GRIL03') @@ -101,9 +105,12 @@ while n_size_tva <> 0 loop + select count(*) into n_exist_tva from tva_rate where tva_id=a_tva_id[n_size_tva]::numeric; - insert into tva_belge.parameter_chld (pcode,tva_id) - values ('ASSUJETTI',a_tva_id[n_size_tva]::numeric); + if n_exist_tva != 0 then + insert into tva_belge.parameter_chld (pcode,tva_id) + values ('ASSUJETTI',a_tva_id[n_size_tva]::numeric); + end if; n_size_tva := n_size_tva -1; end loop; @@ -124,4 +131,4 @@ alter table tva_belge.parameter drop column paccount; alter table tva_belge.parameter drop column pvalue; insert into tva_belge.version(vdesc) values ('Version 2 : amélioration plugin'); -commit; \ No newline at end of file +commit; --- PhpCompta est un logiciel de comptabilité libre en ligne (full web) Projet opensource http://www.phpcompta.eu _______________________________________________ Phpcompta est un logiciel libre de comptabilité en ligne (http://www.phpcompta.eu) Phpcompta-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/phpcompta-dev
