phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5422 - in phpcompta/trunk: . include include/template s


From: phpcompta-dev
Subject: [Phpcompta-dev] r5422 - in phpcompta/trunk: . include include/template sql
Date: Thu, 26 Sep 2013 17:33:09 +0200 (CEST)

Author: danydb
Date: 2013-09-26 17:33:08 +0200 (Thu, 26 Sep 2013)
New Revision: 5422

Modified:
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/template/param_jrn.php
   phpcompta/trunk/release-note
   phpcompta/trunk/sql/upgrade.sql
Log:
Suivi type de journal montrer ou cacher les bons d?\195?\169tails + ajout de 
nveau type journaux

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-09-23 21:00:47 UTC 
(rev 5421)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-09-26 15:33:08 UTC 
(rev 5422)
@@ -3229,9 +3229,9 @@
                $r = "";
                $r.='<TABLE>';
                $r.='<TR><TD class="mtitle"><A class="mtitle" HREF="' . 
$base_url . '&sa=add">' . _('Création') . ' </A></TD></TR>';
-               $ret = $this->db->exec_sql("select jrn_def_id,jrn_def_name,
-                       
jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc
-                       from jrn_def join jrn_type on jrn_def_type=jrn_type_id 
order by jrn_def_name");
+               $ret = $this->db->exec_sql("select distinct 
jrn_def_id,jrn_def_name,
+                       jrn_def_class_deb,jrn_def_class_cred,jrn_def_type
+                       from jrn_def order by jrn_def_name");
                $Max = Database::num_row($ret);
 
 
@@ -3258,7 +3258,7 @@
                $type = $this->jrn_def_type;
                $name = $this->jrn_def_name;
                $code = $this->jrn_def_code;
-
+                $str_add_button="";
                /* widget for searching an account */
                $wSearch = new IPoste();
                $wSearch->set_attribute('ipopup', 'ipop_account');
@@ -3312,7 +3312,7 @@
                                $qcode_bank = $fBank->get_quick_code();
                        }
                }
-               $new = false;
+               $new = 0;
                $cn = $this->db;
                echo $hidden;
                require_once('template/param_jrn.php');
@@ -3434,6 +3434,18 @@
         */
        function input_new()
        {
+                global $g_user;
+                $f_add_button=new ISmallButton('add_card');
+                $f_add_button->label=_('Créer une nouvelle fiche');
+                $f_add_button->tabindex=-1;
+                $f_add_button->set_attribute('jrn',-1);
+                $f_add_button->javascript=" 
this.jrn=-1;select_card_type({type_cat:4});";
+
+                $str_add_button="";
+                if ($g_user->check_action(FICADD)==1)
+                {
+                        $str_add_button=$f_add_button->input();
+                }
                $wSearch = new IPoste();
                $wSearch->table = 3;
                $wSearch->set_attribute('ipopup', 'ipop_account');
@@ -3458,8 +3470,12 @@
                $name = "";
                $code = "";
                $wType = new ISelect();
-               $wType->value = $this->db->make_array('select 
jrn_type_id,jrn_desc from jrn_type');
+                $a_jrn= $this->db->make_array("select '-1',' -- choix journal 
-- ' union select jrn_type_id,jrn_desc from jrn_type");
+                $wType->selected='-1';
+               $wType->value =$a_jrn;
                $wType->name = "p_jrn_type";
+               $wType->id= "p_jrn_type_select_id";
+                $wType->javascript=' onchange="show_ledger_div()"';
                $type = $wType->input();
                $rcred = $rdeb = array();
                $wPjPref = new IText();
@@ -3467,16 +3483,15 @@
                $pj_pref = $wPjPref->input();
                $pj_seq = '';
                $last_seq = 0;
-               $new = true;
+               $new = 1;
                /* bank card */
                $qcode_bank = '';
                /* Numbering (only FIN) */
                $num_op = new ICheckBox('numb_operation');
                echo dossier::hidden();
                echo HtmlInput::hidden('ac', $_REQUEST['ac']);
-               echo HtmlInput::hidden('p_jrn', -1);
-               echo HtmlInput::hidden('sa', 'add');
-
+                echo $hidden;
+                
                $cn = $this->db;
                $min_row = new INum("min_row",MAX_ARTICLE);
                $min_row->prec=0;

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-09-23 
21:00:47 UTC (rev 5421)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-09-26 
15:33:08 UTC (rev 5422)
@@ -890,24 +890,14 @@
         $f_add_button=new IButton('add_card');
         $f_add_button->label=_('Créer une nouvelle fiche');
                $f_add_button->tabindex=-1;
-        $f_add_button->set_attribute('ipopup','ipop_newcard');
         $f_add_button->set_attribute('jrn',$this->id);
         $f_add_button->javascript=" 
this.jrn=\$('p_jrn').value;select_card_type(this);";
 
-        $f_add_button2=new IButton('add_card2');
-               $f_add_button2->tabindex=-1;
-        $f_add_button2->label=_('Créer une nouvelle fiche');
-        $f_add_button2->set_attribute('ipopup','ipop_newcard');
-        $f_add_button2->set_attribute('filter',$this->get_all_fiche_def ());
-        //    $f_add_button2->set_attribute('jrn',$this->id);
-        $f_add_button2->javascript="  
this.jrn=\$('p_jrn').value;select_card_type(this);";
-               $str_add_button="";
-               $str_add_button2="";
-               if ($g_user->check_action(FICADD)==1)
-               {
-                       $str_add_button=$f_add_button->input();
-                       $str_add_button2=$f_add_button2->input();
-               }
+        $str_add_button="";
+        if ($g_user->check_action(FICADD)==1)
+        {
+                $str_add_button=$f_add_button->input();
+        }
         // The first day of the periode
         $oPeriode=new Periode($this->db);
         list 
($l_date_start,$l_date_end)=$oPeriode->get_date_limit($g_user->get_periode());

Modified: phpcompta/trunk/include/template/param_jrn.php
===================================================================
--- phpcompta/trunk/include/template/param_jrn.php      2013-09-23 21:00:47 UTC 
(rev 5421)
+++ phpcompta/trunk/include/template/param_jrn.php      2013-09-26 15:33:08 UTC 
(rev 5422)
@@ -3,11 +3,12 @@
 
                <TD><?php echo _('Nom journal')?> </TD>
                <TD> <INPUT TYPE="text" class="input_text" NAME="p_jrn_name" 
VALUE="<?php       echo $name;     ?>"></TD>
+                <td></td>
 </TR>
 <?php
-if ($new || $type=='ODS' ):
+if ( $new || $type=='ODS' ):
 ?>
-<TR>
+<TR id="type_ods">
 <td><?php echo _('Postes utilisables journal (débit/crédit) ')?>
 </TD>
 <td>
@@ -22,9 +23,9 @@
 endif;
 ?>
 <?php
-if ( $new || $type=='FIN') {
+if ( $new|| $type=='FIN') {
 ?>
-<tr>
+<tr id="type_fin">
 <td>
     <?php echo _('Numérotation de chaque opération')?>
 </td>
@@ -32,7 +33,7 @@
     <?php echo $num_op->input();?>
 </td>
 </tr>
-<tr>
+<tr id="type_fin2">
 <TD>
 <?php echo _('Compte en banque')?>
 </td>
@@ -50,6 +51,7 @@
 $card->value=$qcode_bank;
 echo $card->search();
 echo $card->input();
+echo $str_add_button;
 ?>
 </td>
 <td class="notice">
@@ -112,49 +114,241 @@
 </TD>
 </tr>
 
+</TABLE>
+    <?php
+    /////////////////// ACH //////////////////////////////////
+    if ( $new ==1 || $type=='ACH' ) : 
+        ?>
+    <div id='ACH_div' >
+    <H2 class="info"> Fiches </H2>
+    <TABLE class="result" style="width:80%;margin-left:10%;">
+        <tr>
+            <th>
+                Fournisseurs (D)
+            </th>
+            <th>
+                Services ou biens divers achetés (C)
+            </th>
+        </tr>
+    
+        
+    <?php
+    // Show the fiche in deb section
+    $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by 
fd_label");
+    $num=$cn->size();
 
-</TABLE>
-<H2 class="info"> Fiches </H2>
-<TABLE width="100%">
-<TR>
+    for ($i=0;$i<$num;$i++) {
+      $res=$cn->fetch($i);
+      $CHECKED=" unchecked";
+      foreach ( $rdeb as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+            echo '<tr>';
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      $CHECKED=" unchecked";
+      foreach ( $rcred as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      echo '</TR>';
+    }
+    ?>
+    </TABLE>
+</div>
+<?php /////////////////// ACH //////////////////////////////////
+ endif; 
+ ?>
 <?php
-if ( $new || ($type != 'ODS' && $type != 'FIN')) {
-?>
-<th style="text-align:left"><?php echo _('Fiches Débit')?></TH>
-<th style="text-align:left"><?php echo _('Fiches Crédit')?></TH>
-<?php
-}
-?>
-</TR>
-<?php
-// Show the fiche in deb section
-$Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label");
-$num=$cn->size();
+    /////////////////// VEN //////////////////////////////////
+    if ( $new ==1  || $type=='VEN' ) : 
+        ?>
+    <div id='VEN_div' >
+    <H2 class="info"> Fiches </H2>
+    <TABLE class="result" style="width:80%;margin-left:10%;">
+        
+        <tr>
+            <th>
+                Services ou biens divers vendus (D)
+            </th>
+            <th>
+                Clients (C)
+            </th>
+        </tr>
+    
+        
+    <?php
+    // Show the fiche in deb section
+    $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by 
fd_label");
+    $num=$cn->size();
 
-for ($i=0;$i<$num;$i++) {
-  $res=$cn->fetch($i);
-  $CHECKED=" unchecked";
-  foreach ( $rdeb as $element) {
-    if ( $element == $res['fd_id'] ) {
-      $CHECKED="CHECKED";
-      break;
+    for ($i=0;$i<$num;$i++) {
+      $res=$cn->fetch($i);
+      $CHECKED=" unchecked";
+      foreach ( $rdeb as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+            echo '<tr>';
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      $CHECKED=" unchecked";
+      foreach ( $rcred as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      echo '</TR>';
     }
-  }
-       echo '<tr>';
-  printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" 
%s>%s</TD>',
-         $res['fd_id'],$CHECKED,$res['fd_label']);
-  $CHECKED=" unchecked";
-  foreach ( $rcred as $element) {
-    if ( $element == $res['fd_id'] ) {
-      $CHECKED="CHECKED";
-      break;
+    ?>
+    </TABLE>
+</div>
+<?php /////////////////// VEN //////////////////////////////////
+ endif; 
+ ?>
+   <?php
+    /////////////////// ODS //////////////////////////////////
+    if ( $new ==1 || $type=='ODS' ) : 
+        ?>
+    <div id='ODS_div' >
+    <H2 class="info"> Fiches </H2>
+   <TABLE class="result" style="width:60%;margin-left:20%;">
+        <tr>
+            <th>
+                Fiches utilisables (D/C)
+            </th>
+           
+        </tr>
+    
+        
+    <?php
+    // Show the fiche in deb section
+    $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by 
fd_label");
+    $num=$cn->size();
+
+    for ($i=0;$i<$num;$i++) {
+      $res=$cn->fetch($i);
+      $CHECKED=" unchecked";
+      foreach ( $rdeb as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+            echo '<tr>';
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      $CHECKED=" unchecked";
+      foreach ( $rcred as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+      echo '</TR>';
     }
-  }
-if ( $type != 'ODS' && $type != 'FIN' ){
-  printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHECRED[]" 
%s>%s</TD>',
-         $res['fd_id'],$CHECKED,$res['fd_label']);
-}
-  echo '</TR>';
-}
-?>
-</TABLE>
+    ?>
+    </TABLE>
+</div>
+<?php /////////////////// ODS //////////////////////////////////
+ endif; 
+ ?>
+   <?php
+    /////////////////// FIN //////////////////////////////////
+    if ( $new ==1 || $type=='FIN' ) : 
+        ?>
+    <div id='FIN_div' >
+    <H2 class="info"> Fiches </H2>
+     <TABLE class="result" style="width:60%;margin-left:20%;">
+        <tr>
+            <th>
+                Tiers (D/C)
+            </th>
+           
+        </tr>
+    
+        
+    <?php
+    // Show the fiche in deb section
+    $Res=$cn->exec_sql("select fd_id,fd_label from fiche_def order by 
fd_label");
+    $num=$cn->size();
+
+    for ($i=0;$i<$num;$i++) {
+      $res=$cn->fetch($i);
+      $CHECKED=" unchecked";
+      foreach ( $rdeb as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+            echo '<tr>';
+      printf ('<TD> <INPUT TYPE="CHECKBOX" VALUE="%s" NAME="FICHEDEB[]" 
%s>%s</TD>',
+              $res['fd_id'],$CHECKED,$res['fd_label']);
+      $CHECKED=" unchecked";
+      foreach ( $rcred as $element) {
+        if ( $element == $res['fd_id'] ) {
+          $CHECKED="CHECKED";
+          break;
+        }
+      }
+      echo '</TR>';
+    }
+    ?>
+    </TABLE>
+</div>
+<?php /////////////////// FIN //////////////////////////////////
+ endif; 
+ ?>
+<?php if ( $new == 1 ) : ?>
+<script>
+    var a_div=Array('VEN_div','ODS_div','ACH_div','FIN_div');
+    function hide_ledger()
+    {
+        for (var i=0;i<a_div.length;i++)
+        {
+            $(a_div[i]).style.display='none';
+        }
+    }
+    function hide_row()
+    {
+        $('type_ods').style.display='none';
+        $('type_fin').style.display='none';
+        $('type_fin2').style.display='none';
+    }
+   function show_ledger_div()
+   {
+       hide_ledger();
+       var 
ch=$('p_jrn_type_select_id').options[$('p_jrn_type_select_id').selectedIndex].value;
+       console.log(" div = "+ch);
+       $(ch+'_div').style.display='block';
+       switch (ch) {
+           case 'FIN':
+             hide_row();
+             $('type_fin').style.display='table-row';
+             $('type_fin2').style.display='table-row';         
+             break;
+           case 'ODS':
+               hide_row();
+               $('type_ods').style.display='table-row';
+               break;
+           default:
+               hide_row();
+       }
+   }
+    hide_ledger();
+    hide_row();
+</script>
+<?php endif; ?>

Modified: phpcompta/trunk/release-note
===================================================================
--- phpcompta/trunk/release-note        2013-09-23 21:00:47 UTC (rev 5421)
+++ phpcompta/trunk/release-note        2013-09-26 15:33:08 UTC (rev 5422)
@@ -36,6 +36,15 @@
  Sécurité : vérifier que l'utilisateur peut ajouter ou enlever des tags à une 
action 
 Changement présentation Détail action : les détails (qui/quand) sont à mettre 
dans la colonne de gauche
 
+Journaux
+========
+Suivi type de journal montrer ou cacher les bons détails
+Pour ACH indiquer Fournisseur (D) et Services ou Marchandises achetés
+Pour VEN indiquer Client (C) et Services ou Marchandises vendus
+Pour FIN indiquer Compte tiers (D/C) et surtout permettre de créer un fiche de 
type trésorerie (frd_id=4)
+
+Ajout de journaux dans jrn_type
+
 ===================================================================
 || A faire
 ===================================================================
@@ -49,6 +58,11 @@
 Par journal
 ou par profil
 
+
+
+
+
+
 Fiche
 =====
 Si aucun quickcode donné, un calculé un en se basant sur le nom de la fiche 
(5ière lettre) + n° si duplicate

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2013-09-23 21:00:47 UTC (rev 5421)
+++ phpcompta/trunk/sql/upgrade.sql     2013-09-26 15:33:08 UTC (rev 5422)
@@ -189,4 +189,14 @@
 
 insert into profile_menu (me_code,me_code_dep,p_id,p_order, 
p_type_display,pm_default) 
 values
-('CFGTAG','PARAM',1,390,'E',0);
\ No newline at end of file
+('CFGTAG','PARAM',1,390,'E',0);
+
+update fiche_def set    fd_label='Trésorerie' where fd_id=3;
+update fiche_def_ref set    frd_text='Trésorerie' where frd_id=4;
+update jrn_def set jrn_def_name='Trésorerie' where jrn_def_id=1;
+update jrn_type set jrn_desc = 'Trésorerie' where jrn_type_id='FIN';
+
+alter table jrn_type drop constraint jrn_type_pkey cascade;
+alter table jrn_type add t_id serial;
+alter table jrn_type add  primary key (t_id);
+insert into jrn_type(jrn_type_id,jrn_desc) values ('ACH','Note de frais'), 
('ACH','Note de débit (reçu d''fournisseur)'),('VEN','Note de crédit (délivré à 
un client)'),('ODS','A Nouveau'),('ODS','Amortissement');
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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