trezo
authorx2000habouzit <x2000habouzit>
Sun, 8 Feb 2004 17:43:20 +0000 (17:43 +0000)
committerx2000habouzit <x2000habouzit>
Sun, 8 Feb 2004 17:43:20 +0000 (17:43 +0000)
etat_migration
include/trezo.inc.php [new file with mode: 0644]
templates/trezo/choix_date.tpl [new file with mode: 0644]
templates/trezo/gere_operations.tpl [new file with mode: 0644]
templates/trezo/index.tpl [new file with mode: 0644]

index ed8fbbd..186c2d9 100644 (file)
@@ -16,8 +16,8 @@
 ------+-------------------------------------------+----------------
 Etat  | Ancien nom                                                               | Nouveau nom
 ------+-[ admin ]---------------------------------+----------------
-         | admin/FormatePrenomNOM.php                            | 
-         | admin/FormatePrenomNOM2.php                           | 
+         | admin/FormatePrenomNOM.php                            | scripts/
+         | admin/FormatePrenomNOM2.php                           | scripts/
          | admin/admin_faqs.php                                          | 
          | admin/admin_trombino.php                              | 
          | admin/comptesPOP.php                                          | 
@@ -73,10 +73,6 @@ Etat  | Ancien nom                                                             | Nouveau nom
          | sondage/resultats.php                                         | 
          | sondage/titre.php                                             | 
          | sondage/validation.php                                        | 
-------+-[ trezo ]---------------------------------+----------------
-         | trezo/gere_operations.php                             | 
-         | trezo/index.php                                                       | 
-         | trezo/trezo.inc.php                                           | 
 ------+-[ emails ... ]----------------------------+----------------
          | emails.php                                                            | 
          | routage-mail.php                                              | 
@@ -196,6 +192,9 @@ xx    | rss.php                                                                       | -
 xx       | secu.php                                                              | docs/secu.php
 xx       | sendmail.php                                                          | -
 xx       | skins.php                                                             | -
+xx       | trezo/gere_operations.php                             | 
+xx       | trezo/index.php                                                       | 
+xx       | trezo/trezo.inc.php                                           | 
 xx       | vcard.php                                                             | -
 ------+-------------------------------------------+----------------
 ---      | trackers/tracker_delete.php                           | -
diff --git a/include/trezo.inc.php b/include/trezo.inc.php
new file mode 100644 (file)
index 0000000..eace898
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+
+$mois_fr = array('01'=>'Janvier',
+                 '02'=>'Février',
+                 '03'=>'Mars',
+                 '04'=>'Avril',
+                 '05'=>'Mai',
+                 '06'=>'Juin',
+                 'O7'=>'Juillet',
+                 '08'=>'Août',
+                 '09'=>'Septembre',
+                 '10'=>'Octobre',
+                 '11'=>'Novembre',
+                 '12'=>'Decembre');
+
+
+$trim_fr = array('01'=>'Janvier-Mars',
+                '04'=>'Avril-Juin',
+                '07'=>'Juillet-Septembre',
+                '10'=>'Octobre-Decembre');
+
+
+function isDate($date)
+{
+  list($d, $m, $y) = split('[/.-]', $date);
+  $dummy = date("d/m/Y", mktime (0,0,0,$m,$d,$y));
+  $date = ereg_replace('-', '/', $date);
+  if ($dummy != $date)
+    return false;
+  else
+    return true;
+}
+
+
+function solde_until($date='')
+{
+    $sql = "select sum(credit)-sum(debit) from trezo.operations";
+    if(!empty($date))
+        $sql .= " where date <= '$date'";
+    $res = mysql_query($sql);
+    list($mysolde) = mysql_fetch_row($res);
+    return $mysolde;
+}
+
+?>
+
diff --git a/templates/trezo/choix_date.tpl b/templates/trezo/choix_date.tpl
new file mode 100644 (file)
index 0000000..a0f83bd
--- /dev/null
@@ -0,0 +1,21 @@
+{* $Id: choix_date.tpl,v 1.1 2004-02-08 17:43:20 x2000habouzit Exp $ *}
+
+{assign var=def_month value=$smarty.now|date_format:"%m"}
+{assign var=def_year value=$smarty.now|date_format:"%Y"}
+{assign var=month value=$smarty.request.mois|default:$def_month}
+
+<div class="center">
+  <form method="POST" action="{$smarty.server.PHP_SELF}">
+    <input type="hidden" name="action" value="lister">
+    Afficher la période suivante :
+    <select name="mois" size="1">
+{foreach key=key item=item from=$month_arr}
+      <option value="{$key}" {if $month eq $key}selected="selected"{/if}>{$item}</option>
+{/foreach}
+    </select>
+    <input type="text" name="annee" size="10" value="{$smarty.request.annee|default:$def_year}">
+    <input type="submit" value="lister"> 
+  </form>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/trezo/gere_operations.tpl b/templates/trezo/gere_operations.tpl
new file mode 100644 (file)
index 0000000..65e78d5
--- /dev/null
@@ -0,0 +1,136 @@
+{* $Id: gere_operations.tpl,v 1.1 2004-02-08 17:43:20 x2000habouzit Exp $ *}
+
+{dynamic}
+
+{if $smarty.request.action eq "edit"}
+<div class="rubrique">
+  Gestion des opérations de trésorerie
+</div>
+
+<form method="POST" action="{$smarty.server.PHP_SEL}">
+  <input type="hidden" name="operation_id" value="{$operation_id}">
+  <input type="hidden" name="action" value="update">
+  <input type="hidden" name="annee" value="{$annee_sel}">
+  <input type="hidden" name="mois" value="{$mois_sel}">
+  <table class="bicol">
+    <tr>
+      <th colspan="2">
+        {if $operation_id}
+        Modifier une opération
+        {else}
+        Ajouter une opération
+        {/if}
+      </th>
+    </tr>
+    <tr>
+      <td>Date (DD/MM/YYYY)</td>
+      <td><input type="text" name="operation_date" size="40" value="{$operation_date|date_format:"%d/%m/%Y"}"></td>
+    </tr>
+    <tr>
+      <td>Description libre</td>
+      <td><input type="text" name="operation_label" size="40" value="{$operation_label}"></td>
+    </tr>
+    <tr>
+      <td>Débit</td>
+      <td><input type="text" name="operation_debit" size="40" value="{$operation_debit}"></td>
+    </tr>
+    <tr>
+      <td>Crédit</td>
+      <td><input type="text" name="operation_credit" size="40" value="{$operation_credit}"></td>
+    </tr>
+    <tr>
+      <td class="center" colspan="2">
+        <input type="submit" value="enregistrer"> 
+      </td>
+    </tr>
+  </table>
+</form>
+
+<a href="{$smarty.server.PHP_SELF}">retour</a>
+{elseif $smarty.request.action eq "update" && $operation_id}
+<strong>modification de l'opération</strong>
+{elseif $smarty.request.action eq "update"}
+<strong>ajout de l'opération</strong>
+{elseif $smarty.request.action eq "del"}
+<strong>suppression de l'opération</strong>
+{/if}
+
+{if $smarty.request.action neq "edit"}
+<div class="rubrique">
+  Tr&eacute;sorerie pour {$mon_sel}
+</div>
+
+<table class="bicol">
+<tr>
+  <th>Solde en début de mois</th>
+</tr>
+<tr>
+  <td align="right">{$from_solde}</td>
+</tr>
+</table>
+
+<br />
+
+<table class="bicol" style="font-size: 90%">
+  <tr>
+    <th>Id</th>
+    <th>Date</th>
+    <th>Description</th>
+    <th>Débit</th>
+    <th>Crédit</th>
+    <th>Action</th>
+  </tr>
+  <tr class="impair">
+    <td>&nbsp;</td>
+    <td>&nbsp;</td>
+    <td><b>Nouvelle opération</b></td>
+    <td>&nbsp;</td>
+    <td>&nbsp;</td>
+    <td>
+      <form method="POST" action="{$smarty.server.PHP_SELF}">
+        <input type="hidden" name="operation_id" value="0">
+        <input type="hidden" name="action" value="edit">
+        <input type="hidden" name="annee" value="{$annee_sel}">
+        <input type="hidden" name="mois" value="{$mois_sel}">
+        <input type="submit" value="new">
+      </form>
+    </td>
+  </tr>
+{foreach item=op from=$ops}
+  <tr class="{cycle values="pair,impair"}">
+    <td>{$op.id}</td>
+    <td>{$op.date|date_format:"%d/%m/%Y"}</td>
+    <td>{$op.label}</td>
+    <td align="right">{$op.debit}</td>
+    <td align="right">{$op.credit}</td>
+    <td>
+      <form method="POST" action="{$smarty.server.PHP_SELF}">
+        <input type="hidden" name="operation_id" value="{$op.id}">
+        <input type="hidden" name="annee" value="{$annee_sel}">
+        <input type="hidden" name="mois" value="{$mois_sel}">
+        <input type="submit" name="action" value="edit">
+        <input type="submit" name="action" value="del">
+      </form>
+    </td>
+  </tr>
+{/foreach}
+</table>
+
+<br />
+
+<table class="bicol">
+<tr>
+  <th>Solde en fin de mois</th>
+</tr>
+<tr>
+  <td align="right">{$to_solde}</td>
+</tr>
+</table>
+
+<br />
+
+{include file=trezo/choix_date.tpl month_arr=$month_arr}
+{/if}
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/trezo/index.tpl b/templates/trezo/index.tpl
new file mode 100644 (file)
index 0000000..6e70047
--- /dev/null
@@ -0,0 +1,54 @@
+{* $Id: index.tpl,v 1.1 2004-02-08 17:43:20 x2000habouzit Exp $ *}
+
+{dynamic}
+
+<div class="rubrique">
+  Tr&eacute;sorerie pour {$mon_sel}
+</div>
+
+<table class="bicol">
+<tr>
+  <th>Solde en début de mois</th>
+</tr>
+<tr>
+  <td align="right">{$from_solde}</td>
+</tr>
+</table>
+
+<br />
+
+<table class="bicol">
+  <tr>
+    <th>Date</th>
+    <th>Description</th>
+    <th>D&eacute;penses</th>
+    <th>Recettes</th>
+  </tr>
+{foreach item=op from=$ops}
+  <tr class="{cycle values="impair,pair"}">
+    <td>{$op.date|date_format:"%d/%m/%Y"}</td>
+    <td>{$op.label}</td>
+    <td align="right">{$op.debit}</td>
+    <td align="right">{$op.credit}</td>
+  </tr>
+{/foreach}
+</table>
+
+<br />
+
+<table class="bicol">
+<tr>
+  <th>Solde en fin de mois</th>
+</tr>
+<tr>
+  <td align="right">{$to_solde}</td>
+</tr>
+</table>
+
+<br />
+
+{include file=trezo/choix_date.tpl month_arr=$month_arr}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}