[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r467 - in trunk/amortis/include: . template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r467 - in trunk/amortis/include: . template |
Date: |
Thu, 21 Mar 2013 19:45:20 +0100 (CET) |
Author: danydb
Date: 2013-03-21 19:45:19 +0100 (Thu, 21 Mar 2013)
New Revision: 467
Modified:
trunk/amortis/include/am_generate.inc.php
trunk/amortis/include/class_am_generate.php
trunk/amortis/include/template/util_generate.php
Log:
0000798: Refus de g?\195?\169n?\195?\169rer l'?\195?\169criture d'un
amortissement
Modified: trunk/amortis/include/am_generate.inc.php
===================================================================
--- trunk/amortis/include/am_generate.inc.php 2013-03-05 15:38:23 UTC (rev
466)
+++ trunk/amortis/include/am_generate.inc.php 2013-03-21 18:45:19 UTC (rev
467)
@@ -1,4 +1,5 @@
<?php
+
/*
* This file is part of PhpCompta.
*
@@ -15,12 +16,13 @@
* 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 let you generate the accounting for the paid off for a selected
* year
*/
@@ -28,59 +30,65 @@
require_once('class_amortissement_sql.php');
global $cn;
-$am=new Am_Generate();
+$am = new Am_Generate();
-if (isset( $_POST['generate'] ))
- {
- /*
- * propose writing
- */
- if ( $am->propose_writing($_POST) == false )
- {
- echo '<div class="content" style="width:80%;margin-left:10%">';
- echo $am->input($_POST );
- echo '</div>';
- }
- exit();
- }
+if (isset($_POST['generate']))
+{
+ try
+ {
+ /*
+ * propose writing
+ */
+ if ($am->propose_writing($_POST) == false)
+ {
+ echo '<div class="content"
style="width:80%;margin-left:10%">';
+ echo $am->input($_POST);
+ echo '</div>';
+ }
+ exit();
+ }
+ catch (Exception $e)
+ {
+ var_dump($e->getTraceAsString());
+ }
+}
if (isset($_POST['save']))
- {
- $ledger=new Acc_Ledger($cn,$_POST['p_jrn']);
- try
- {
- $cn->start();
- $ledger->save($_POST);
+{
+ $ledger = new Acc_Ledger($cn, $_POST['p_jrn']);
+ try
+ {
+ $cn->start();
+ $ledger->save($_POST);
- $jr_id=$cn->get_value("select jr_id from jrn where
jr_internal=$1",array($ledger->internal));
+ $jr_id = $cn->get_value("select jr_id from jrn where
jr_internal=$1", array($ledger->internal));
- $m=$am->save($_POST,$ledger->internal);
- /*
- * if $m is not empty, some mat. were already encoded
- */
- if ( $m != '' )
- {
- throw new Exception ($m);
- }
- echo '<div class="content" style="width:80%;margin-left:10%">';
+ $m = $am->save($_POST, $ledger->internal);
+ /*
+ * if $m is not empty, some mat. were already encoded
+ */
+ if ($m != '')
+ {
+ throw new Exception($m);
+ }
+ echo '<div class="content" style="width:80%;margin-left:10%">';
- $p_mesg="Opération sauvée : ".$ledger->internal;
- echo sprintf('<A class="detail"
style="display:inline;text-decoration:underline"
HREF="javascript:modifyOperation(%d,%d)">%s</A>',
- $jr_id,dossier::id(),$p_mesg);
+ $p_mesg = "Opération sauvée : " . $ledger->internal;
+ echo sprintf('<A class="detail"
style="display:inline;text-decoration:underline"
HREF="javascript:modifyOperation(%d,%d)">%s</A>', $jr_id, dossier::id(),
$p_mesg);
- echo '</div>';
- $cn->commit();
- exit();
- }
- catch (Exception $e)
- {
- echo alert($e->getMessage());
- $cn->rollback();
- }
- }
+ echo '</div>';
+ $cn->commit();
+ exit();
+ }
+ catch (Exception $e)
+ {
+ echo alert($e->getMessage());
+ $cn->rollback();
+ }
+}
echo '<div class="content" style="width:80%;margin-left:10%">';
-echo $am->input($_POST );
+echo $am->input($_POST);
echo '</div>';
\ No newline at end of file
Modified: trunk/amortis/include/class_am_generate.php
===================================================================
--- trunk/amortis/include/class_am_generate.php 2013-03-05 15:38:23 UTC (rev
466)
+++ trunk/amortis/include/class_am_generate.php 2013-03-21 18:45:19 UTC (rev
467)
@@ -37,13 +37,13 @@
*/
function input($p_array)
{
- global $cn;
+ global $cn,$g_user;
/*
* select ledger
*/
- $legder = new Acc_Ledger($cn,0);
- $sel_ledger=$legder->select_ledger('ODS',2);
+ $ledger = new Acc_Ledger($cn,0);
+ $sel_ledger=$ledger->select_ledger('ODS',2);
$sel_ledger->selected=(isset($p_array['p_jrn']))?$p_array['p_jrn']:'';
/*
* Operation Date
@@ -63,6 +63,33 @@
*/
$pj=new IText('p_pj');
$pj->size=10;
+ /*
+ * If we use the periode
+ */
+ if ($ledger->check_periode() == true)
+ {
+ $l_user_per = $g_user->get_periode();
+ $def = (isset($periode)) ? $periode : $l_user_per;
+ $period = new IPeriod("period");
+ $period->user = $g_user;
+ $period->cn = $cn;
+ $period->value = $def;
+ $period->type = OPEN;
+ try
+ {
+ $l_form_per = $period->input();
+ }
+ catch (Exception $e)
+ {
+ if ($e->getCode() == 1)
+ {
+ echo _("Aucune période ouverte");
+ exit();
+ }
+ }
+ $label = HtmlInput::infobulle(3);
+ $f_periode = _("Période comptable") . " $label " ;
+ }
/*
* show all the visible material
*/
@@ -94,8 +121,8 @@
if ( isDate($p_array['p_date']) == null) $msg.="Date invalide ";
if ( $msg != '')
{
- echo alert($msg);
- return false;
+ echo alert($msg);
+ return false;
}
$array=array(
@@ -107,6 +134,9 @@
'e_pj_suggest' => $p_array['p_pj'] ,
);
+ if ( isset($p_array['period'])) {
+ $array['period']=$p_array['period'];
+ }
$idx=0;
for ($i =0;$i<count($p_array['a_id']);$i++)
{
@@ -158,7 +188,7 @@
}
echo '</form>';
- /*
+ /*
* correct
*/
echo '<form method="POST" style="display:inline">';
Modified: trunk/amortis/include/template/util_generate.php
===================================================================
--- trunk/amortis/include/template/util_generate.php 2013-03-05 15:38:23 UTC
(rev 466)
+++ trunk/amortis/include/template/util_generate.php 2013-03-21 18:45:19 UTC
(rev 467)
@@ -43,7 +43,17 @@
<td>Date de l'opération</td>
<td><?=$p_date->input()?></td>
</tr>
+<? if ( isset ($f_periode)) : ?>
<tr>
+ <td>
+ <?=$f_periode?>
+ </td>
+ <td>
+ <?=$l_form_per?>
+ </td>
+</tr>
+<? endif; ?>
+<tr>
<td>Pièce</td>
<td><?=$pj->input()?></td>
</tr>
---
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] r467 - in trunk/amortis/include: . template,
phpcompta-dev <=