phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r4291 - in phpcompta/trunk: html html/js include
Date: Wed, 2 Nov 2011 20:04:28 +0100 (CET)

Author: danydb
Date: 2011-11-02 20:04:26 +0100 (Wed, 02 Nov 2011)
New Revision: 4291

Modified:
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/style-color.css
   phpcompta/trunk/html/style-light.css
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/compta_ods.inc.php
Log:
412: r?\195?\169?\195?\169criture ODS

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2011-11-02 19:02:27 UTC (rev 
4290)
+++ phpcompta/trunk/html/js/acc_ledger.js       2011-11-02 19:04:26 UTC (rev 
4291)
@@ -45,6 +45,13 @@
                );
 }
 /**
+ address@hidden update ctl id =jrn_name with the value of p_jrn
+ */
+function update_name()
+{
+       
$('jrn_name').innerHTML=$('p_jrn').options[$('p_jrn').selectedIndex].innerHTML;
+}
+/**
  * @brief update the field predef
  */
 function success_get_predef(request,json)

Modified: phpcompta/trunk/html/style-color.css
===================================================================
--- phpcompta/trunk/html/style-color.css        2011-11-02 19:02:27 UTC (rev 
4290)
+++ phpcompta/trunk/html/style-color.css        2011-11-02 19:04:26 UTC (rev 
4291)
@@ -921,3 +921,27 @@
     padding-left:5px;
     padding-right:5px;
 }
+table.info_op
+{
+       margin-left: 30%;
+       margin-right: 30%;
+       width:20%;
+       
+}
+table.info_op tr
+{
+font-size:14;
+background:white;
+width:5%
+}
+h2#jrn_name
+{
+       margin-left:30%;
+       
+}
+tr.footer{
+       font-size:14;
+       font-style: italic;
+       font-weight: bold;
+       
+}
\ No newline at end of file

Modified: phpcompta/trunk/html/style-light.css
===================================================================
--- phpcompta/trunk/html/style-light.css        2011-11-02 19:02:27 UTC (rev 
4290)
+++ phpcompta/trunk/html/style-light.css        2011-11-02 19:04:26 UTC (rev 
4291)
@@ -184,10 +184,11 @@
 div.content{    
          float:left;    
                padding-top:7px;
-         width:100%;            
+         width:96%;             
          font-family:helvetica,arial,sans-serif;       
          clear:both;
-          
+         margin-left:2%;
+         
 
 }
 div.content30{          
@@ -955,3 +956,30 @@
        padding-left:5px;
        padding-right:5px;
 }
+table.info_op
+{
+       margin-left: 30%;
+       margin-right: 30%;
+       width:20%;
+       
+}
+table.info_op tr
+{
+font-size:14;
+background:white;
+width:5%
+}
+h2#jrn_name
+{
+       margin-right:50%;
+       float:right;
+       font-size:18;
+       display: inline;
+       color:#15158e;
+}
+tr.footer{
+       font-size:14;
+       font-style: italic;
+       font-weight: bold;
+       
+}
\ No newline at end of file

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2011-11-02 19:02:27 UTC (rev 4290)
+++ phpcompta/trunk/html/style.css      2011-11-02 19:04:26 UTC (rev 4291)
@@ -951,3 +951,27 @@
        padding-left:5px;
        padding-right:5px;
 }
+table.info_op
+{
+       font-size:18;
+       margin-right:30%;
+       width:20%;
+       
+}
+table.info_op tr
+{
+font-size:14;
+background:white;
+}
+h2#jrn_name
+{
+       margin-left:30%;
+       float: right;
+       
+}
+tr.footer{
+       font-size:14;
+       font-style: italic;
+       font-weight: bold;
+       
+}
\ No newline at end of file

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2011-11-02 19:02:27 UTC 
(rev 4290)
+++ phpcompta/trunk/include/class_acc_ledger.php        2011-11-02 19:04:26 UTC 
(rev 4291)
@@ -1207,7 +1207,7 @@
      * \param $p_array array from the form
      * \return string
      */
-    function show_summary($p_array)
+    function confirm($p_array,$p_readonly=false)
     {
         $this->id=$p_array['p_jrn'];
         if ( empty($p_array)) return 'Aucun résultat';
@@ -1223,22 +1223,25 @@
             $lPeriode->find_periode($e_date);
         }
         $owner=new own($this->db);
+               $total=0;
+               bcscale(2);
 
         $ret="";
-        $ret.="<table>";
+        $ret.="<table >";
         $ret.="<tr><td>"._('Date')." : </td><td>$e_date</td></tr>";
         /* display periode */
         $date_limit=$lPeriode->get_date_limit();
-        $ret.='<tr><td> '._('Période Comptable').' 
'.$date_limit['p_start'].'-'.$date_limit['p_end'].'</td></tr>';
+        $ret.='<tr> '.td(_('Période 
Comptable')).td($date_limit['p_start'].'-'.$date_limit['p_end']).'</tr>';
         $ret.="<tr><td>"._('Libellé')." </td><td>".h($desc)."</td></tr>";
         $ret.="<tr><td>"._('PJ Num')." </td><td>".h($e_pj)."</td></tr>";
         $ret.='</table>';
-        $ret.="<table>";
+        $ret.="<table class=\"result\">";
         $ret.="<tr>";
-        $ret.="<th>"._('Quick Code ou');
+        $ret.="<th>"._('Quick Code ou ');
         $ret.=_("Poste")." </th>";
-        $ret.="<th style=\"text-align:right\"> "._("Montant")." </th>";
-        $ret.="<th>"._("Débit")."</th>";
+        $ret.="<th style=\"text-align:left\"> "._("Libellé")." </th>";
+        $ret.="<th style=\"text-align:right\">"._("Débit")."</th>";
+        $ret.="<th style=\"text-align:right\">"._("Crédit")."</th>";
         /* if we use the AC */
         if ($owner->MY_ANALYTIC!='nu')
         {
@@ -1246,7 +1249,7 @@
             $a_anc=$anc->get_list();
             $x=count($a_anc);
             /* set the width of the col */
-            $ret.='<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
+            $ret.='<th colspan="'.$x.'" style="width:auto;text-align:center" 
>'._('Compt. Analytique').'</th>';
 
             /* add hidden variables pa[] to hold the value of pa_id */
             $ret.=Anc_Plan::hidden($a_anc);
@@ -1273,6 +1276,12 @@
         $count=0;
         for ($i=0;$i<$nb_item;$i++)
         {
+                       if ( $p_readonly == true )
+                       {
+                               if ( ! isset (${'qc_'.$i})) ${'qc_'.$i}='';
+                               if ( ! isset (${'poste'.$i})) ${'poste'.$i}='';
+                               if ( ! isset (${'amount'.$i})) 
${'amount'.$i}='';
+                       }
             $ret.="<tr>";
             if ( trim(${'qc_'.$i})!="")
             {
@@ -1298,9 +1307,12 @@
             if ( trim(${'qc_'.$i})=="" && trim(${'poste'.$i}) == "")
                 continue;
             
$ret.="<td>".h(${"ld".$i}).HtmlInput::hidden('ld'.$i,${'ld'.$i})."</td>";
-            
$ret.="<td>".${"amount".$i}.HtmlInput::hidden('amount'.$i,${'amount'.$i})."</td>";
+            if ( isset(${"ck$i"}))
+                               $ret.="<td 
class=\"num\">".${"amount".$i}.HtmlInput::hidden('amount'.$i,${'amount'.$i})."</td>".td("");
+                       else
+                               $ret.=td("")."<td 
class=\"num\">".${"amount".$i}.HtmlInput::hidden('amount'.$i,${'amount'.$i})."</td>";
+                       $total=bcadd($total,${"amount".$i});
             $ret.="<td>";
-            $ret.=(isset(${"ck$i"}))?"D":"C";
             $ret.=(isset(${"ck$i"}))?HtmlInput::hidden('ck'.$i,${'ck'.$i}):"";
             $ret.="</td>";
             // CA
@@ -1316,8 +1328,9 @@
                     /* op is the operation it contains either a sequence or a 
jrnx.j_id */
                     $ret.=HtmlInput::hidden('op[]=',$i);
 
-                    $ret.='<td>';
-                    
$ret.=$op->display_form_plan($p_array,$null,1,$count,round(${'amount'.$i},2));
+                    $ret.='<td style="text-align:center">';
+                                       $read=($p_readonly==true)?0:1;
+                    
$ret.=$op->display_form_plan($p_array,$null,$read,$count,round(${'amount'.$i},2));
                     $ret.='</td>';
                     $count++;
                 }
@@ -1329,8 +1342,10 @@
 
             $ret.="</tr>";
         }
+               
$ret.=tr(td('').td(_('Totaux')).td($total,'class="num"').td($total,'class="num"'),'class="footer"');
         $ret.="</table>";
-       if ( $owner->MY_ANALYTIC!='nu' )          $ret.='<input type="button" 
class="button" value="'._('verifie CA').'" onClick="verify_ca(\'\');">';
+               if ( $owner->MY_ANALYTIC!='nu'  && $p_readonly==false)
+                       $ret.='<input type="button" class="button" 
value="'._('verifie Imputation Analytique').'" onClick="verify_ca(\'\');">';
         return $ret;
     }
 
@@ -1341,7 +1356,7 @@
      *
      * \return a string containing the form
      */
-    function show_form($p_array=null,$p_readonly=0)
+    function input($p_array=null,$p_readonly=0)
     {
         $user = new User($this->db);
         $owner=new Own($this->db);
@@ -1351,6 +1366,12 @@
 
         if ( $p_array != null )
             extract($p_array);
+        $add_js="";
+        if ( $owner->MY_PJ_SUGGEST=='Y')
+        {
+            $add_js="update_pj();";
+        }
+        $add_js.='get_last_date();';
 
         $ret="";
         /* Add button */
@@ -1359,8 +1380,16 @@
         $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);";
-        $ret.=$f_add_button->input();
+        $f_add_button->input();
 
+               $wLedger=$this->select_ledger('ODS',2);
+        if ($wLedger == null) exit (_('Pas de journal disponible'));
+        
$wLedger->javascript="onChange='update_name();update_predef(\"ods\",\"t\");$add_js'";
+        $label=" Journal ".HtmlInput::infobulle(2) ;
+
+        $ret.=$label.$wLedger->input();
+
+
         // Load the javascript
         //
         $ret.="<table>";
@@ -1435,12 +1464,12 @@
         $ret.=HtmlInput::hidden('nb_item',$nb_row);
         $ret.=dossier::hidden();
 
-        $ret.=HtmlInput::hidden('p_jrn',$this->id);
         $ret.=dossier::hidden();
 
         $ret.=HtmlInput::hidden('jrn_type',$this->get_type());
         $info= HtmlInput::infobulle(0);
         $info_poste=HtmlInput::infobulle(9);
+               $ret.=$f_add_button->input();
         $ret.='<table id="quick_item" style="width:100%">';
         $ret.='<tr>'.
               '<th >Quickcode'.$info.'</th>'.
@@ -2893,4 +2922,6 @@
       $first_name=$this->db->get_value('select ad_value from fiche_detail 
where ad_id=32 and f_id=$1',array($tiers));
       return $name.' '.$first_name;
     }
+
+
 }

Modified: phpcompta/trunk/include/compta_ods.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ods.inc.php  2011-11-02 19:02:27 UTC (rev 
4290)
+++ phpcompta/trunk/include/compta_ods.inc.php  2011-11-02 19:04:26 UTC (rev 
4291)
@@ -20,7 +20,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/*!\file
+/* !\file
  *
  *
  * \brief to write directly into the ledgers,the stock and the tables
@@ -35,118 +35,81 @@
 require_once('function_javascript.php');
 require_once('class_ipopup.php');
 
+global $g_user;
 
+$cn = new Database(dossier::id());
 
-$cn=new Database(dossier::id());
-$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
-/*!\brief show a form for quick_writing */
-function show_qw_menu($def=0)
-{
-    echo '<div class="lmenu">';
-    $id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
-    echo ShowItem(
-                 array(
-                       
array('?p_action='.$_REQUEST['p_action'].'&'.dossier::get().'&p_jrn='.$id.'&show_form',_('Encoder
 une Operation'),
-                             _('Encoder une operation dans  ce journal'),0),
-                       
array('?p_action='.$_REQUEST['p_action'].'&'.dossier::get().'&p_jrn='.$id.'&sa=l',_('Voir
 Operation'),
-                             _('Voir les operations de ce journal'),1),
-                       
array('?p_action='.$_REQUEST['p_action'].'&'.dossier::get(),
-                              _('Autre journal'),
-                              _('Choisir un autre journal')
-                             )),
-                    'H',"mtitle","mtitle",$def,' 
style="width:80%;margin-left:5;"'
-                );
+$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
+$ledger = new Acc_Ledger($cn, $id);
+$first_ledger = $ledger->get_first('ODS');
+$ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id;
 
-    echo '</div>';
-}
-/*!\brief show a form for quick_writing */
-function show_direct_form($cn,$ledger,$p_array)
-{
-    echo '<div class="content">';
+/* !\brief show a form for quick_writing */
+$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
+$def = -1;
+$ledger->with_concerned = true;
 
-    $id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1;
 
-    // Show the predef operation
-    // Don't forget the p_jrn
-    echo '<form method="get">';
-    echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
-    echo dossier::hidden();
-    echo HtmlInput::hidden('p_jrn',$_REQUEST['p_jrn']);
-    $op=new Pre_operation($cn);
-    $op->p_jrn=$_REQUEST['p_jrn'];
-    $op->od_direct='t';
-    if ( $op->count() > 0 )
-    {
-        echo _("Utilisez une operation ");
-        echo $op->show_button();
-        echo HtmlInput::submit('use_opd',_('Utilisez une operation'));
-    }
-    echo '</form>';
 
 
+if ($g_user->check_jrn($id) == 'X')
+{
+       NoAccess();
+       exit - 1;
+}
+if (!isset($_POST['summary']) && !isset($_POST['save']))
+{
+       require('operation_ods_new.inc.php');
+       exit();
+}
+elseif (isset($_POST['summary']))
+{
+       require_once 'operation_ods_confirm.inc.php';
+       exit();
+}
+elseif (isset($_POST['save']))
+{
+       $array = $_POST;
 
-    echo '<form method="post" action="?" class="print">';
-    echo dossier::hidden();
-    echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
+       try
+       {
+               $ledger->save($array);
+               $jr_id = $cn->get_value('select jr_id from jrn where 
jr_internal=$1', array($ledger->internal));
 
-    echo $ledger->show_form($p_array);
+               echo '<h2> Op&eacute;ration enregistr&eacute;e  Piece ' . 
h($ledger->pj) . '</h2>';
+               if (strcmp($ledger->pj, $_POST['e_pj']) != 0)
+               {
+                       echo '<h3 class="notice">' . _('Attention numéro pièce 
existante, elle a du être adaptée') . '</h3>';
+               }
+               printf('<a class="detail" style="display:inline" 
href="javascript:modifyOperation(%d,%d)">%s</a><hr>', $jr_id, dossier::id(), 
$ledger->internal);
 
-
-    echo HtmlInput::button('add',_('Ajout d\'une 
ligne'),'onClick="quick_writing_add_row()"');
-
-    echo HtmlInput::submit('summary',_('Sauvez'));
-    echo '<div class="info">'.
-    _('Débit').' = <span id="totalDeb"></span>'.
-    _('Crédit').' = <span id="totalCred"></span>'.
-    _('Difference').' = <span id="totalDiff"></span></div> ';
-
-
-    echo '</form>';
-
-    echo "<script>checkTotalDirect();</script>";
-
-    echo create_script(" get_last_date()");
-
-    echo '</div>';
-
+               // show feedback
+               echo $ledger->confirm($_POST, true);
+       }
+       catch (Exception $e)
+       {
+               require('operation_ods_new.inc.php');
+               alert($e->getMessage());
+       }
+       exit();
 }
+exit();
 
-$ledger=new Acc_Ledger($cn,$id);
 
-$ledger->with_concerned=true;
-// no ledger selected, propose one
-// Only ODS
-if ($id == -1 )
-{
-    echo '<div class="content">';
 
-    // Vide
-    echo '<FORM method="get" action="?">';
-    echo dossier::hidden();
-    echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
-    echo $ledger->select_ledger('ODS',3)->input();
-    echo HtmlInput::submit('show_form',_('Choix du journal'));
-    echo '</form>';
-    echo '</div>';
-    exit();
-}
-if ( $User->check_jrn($id) == 'X' )
+if ( $g_user->check_jrn($id) == 'X' )
 {
     alert(_("L'acces a ce journal est interdit, \n contactez votre 
responsable"));
     exit();
 }
-echo '<div class="content">';
-echo '<div style="float:right;margin-right:30">';
-echo '<h2 class="info"> '._('Journal').' : '.$ledger->get_name().'</h2>';
-echo '</div>';
-$sa=( isset ($_REQUEST['sa']))?$_REQUEST['sa']:'';
+
 //======================================================================
 // See the ledger listing
 if ($sa == 'l' && $id != -1)
 {
 // Check privilege
 
-    if (  $User->check_jrn($id) == 'X')
+    if (  $g_user->check_jrn($id) == 'X')
     {
         NoAccess();
         exit -1;
@@ -154,19 +117,19 @@
     show_qw_menu(1);
     echo '<div class="content">';
     $Ledger=new Acc_Ledger($cn,$id);
-    
+
     $type=$Ledger->get_type();
     $href=basename($_SERVER['PHP_SELF']);
 
     echo '<form method="GET" action="'.$href.'">';
     echo HtmlInput::hidden("sa","l");
     echo HtmlInput::hidden("p_jrn",$id);
-    echo HtmlInput::hidden("p_action","quick_writing");
+    echo HtmlInput::hidden("ac",$_REQUEST['sa']);
     echo dossier::hidden();
     echo $Ledger->search_form($type,0);
     echo HtmlInput::submit("qwlist",_("Recherche"));
     echo '</form>';
-    
+
     $array=$_GET;
     list($sql,$where)=$Ledger->build_search_sql($array);
 
@@ -185,7 +148,7 @@
    /*
      * Export to csv
      */
-    
$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','p_action'));
+    
$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type','ac'));
     if (isset($_GET['r_jrn'])) {
       foreach ($_GET['r_jrn'] as $k=>$v)
        $r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
@@ -205,27 +168,20 @@
 // User can write ?
 // Write into the ledger
 
-if ( $User->check_jrn($id) == 'X' )
+if ( $g_user->check_jrn($id) == 'X' )
 {
     alert(_("Vous ne pouvez pas accèder à ce journal, contactez votre 
responsable"));
     exit -1;
 }
 
-if ( $User->check_jrn($id)=='W' )
+if ( $g_user->check_jrn($id)=='W' )
 {
-    if ( isset($_GET['show_form']) || isset($_POST['correct_it']) )
+    if ( ($sa=='n' || isset($_POST['correct_it'])) && ! 
isset($_POST['summary']))
     {
         $array=$_POST;
-        $default_periode=$User->get_periode();
+        $default_periode=$g_user->get_periode();
         /* check if the ledger is closed */
-        if ( $ledger->is_closed($default_periode)==1)
-        {
-            echo '<h2 class="error">'._('Désolé mais cette periode est fermee 
pour ce journal').'</h2>';
-            exit();
-        }
-        $periode=new Periode($cn);
-        list($date,$devnull)=$periode->first_day($default_periode);
-        $array['date']=$date;
+
         show_qw_menu();
         show_direct_form($cn,$ledger,$array);
         exit();
@@ -250,42 +206,7 @@
         exit();
 
     }
-    if ( isset($_POST['summary']))
-    {
-        try
-        {
-            $ledger->verify($_POST );
-        }
-        catch (Exception $e)
-        {
-            alert($e->getMessage());
-            show_qw_menu();
-            show_direct_form($cn,$ledger,$_POST);
-            exit();
-        }
 
-        echo '<form method="post"  action="?">';
-        echo $ledger->show_form($_POST,1);
-        echo dossier::hidden();
-        echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
-
-       echo '<hr>';
-       $chk=new ICheckBox();
-       $chk->selected=false;
-       echo $chk->input('opd_save');
-       echo "Sauvez cette op&eacute;ration comme modèle d'opération ?";
-       echo '<br/>';
-       $opd_name=new IText('opd_name');
-       echo "Nom du modèle ".$opd_name->input();
-
-       echo '<br/>';
-        echo HtmlInput::submit('save_it',"Sauver",'onClick="return 
verify_ca();"');
-        echo HtmlInput::submit('correct_it','Corriger');
-
-        echo '</form>';
-        exit();
-
-    }
     if ( isset($_POST['save_it' ]))
     {
         $array=$_POST;




reply via email to

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