noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 03/04: Task #1045 - Amélioration apparence


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 03/04: Task #1045 - Amélioration apparence : Comptabilité analytique ajoutée dans fenêtre détail opération Adaptation pour clef de répartition
Date: Sun, 16 Nov 2014 19:13:37 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0c65cced2336158dc0d4620a510fe8dbfb571e12
Author: Dany De Bontridder <address@hidden>
Date:   Sun Nov 16 20:10:50 2014 +0100

    Task #1045 - Amélioration apparence  :
    Comptabilité analytique ajoutée dans fenêtre détail opération
    Adaptation pour clef de répartition
---
 html/js/acc_ledger.js                     |    4 +-
 html/js/anc_script.js                     |   17 ++++--------
 html/style-classic.css                    |   18 +++++++-----
 include/class_anc_operation.php           |   13 +++++---
 include/template/ledger_detail_bottom.php |   41 ++++++++++++++++++++++++----
 include/template/ledger_detail_fin.php    |   22 +++++++++++----
 include/template/ledger_detail_misc.php   |   20 +++++++++-----
 include/template/ledger_detail_ven.php    |   22 ++++++++++-----
 8 files changed, 104 insertions(+), 53 deletions(-)

diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 24aec00..849b739 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -984,8 +984,8 @@ function op_save(obj)
                                   parameters:queryString,
                                   onFailure:null,
                                   onSuccess:infodiv
-                                      }
-                                    );
+                                               }
+                            );
     }
     return false;
        } catch (e)
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index efef197..a4887a9 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -106,8 +106,8 @@ function anc_refresh_remain(p_table, p_seq)
         var tot_table = compute_total_table(p_table, p_seq);
         var remain = tot_line - tot_table;
         remain = Math.round(remain * 100) / 100;
-        var popup_table = p_table.toString();
-        p_table = popup_table.replace("popup", "");
+  //      var popup_table = p_table.toString();
+//        p_table = popup_table.replace("popup", "");
         $('remain' + p_table).innerHTML = remain;
         if (remain == 0)
         {
@@ -432,19 +432,13 @@ function anc_key_compute(p_dossier, p_table, p_amount, 
p_key_id)
  * @param p_amount amount to distribute
  * @param p_ledger
  */
-function anc_key_choice(p_dossier, p_table, p_amount)
+function anc_key_choice(p_dossier, p_table, p_amount,p_ledger)
 {
     waiting_box();
     var op = 'op=anc_key_choice';
     var queryString = op + "&gDossier=" + p_dossier + "&t=" + p_table + 
"&amount=" + p_amount;
     try {
-        var ledger=$('p_jrn');
-        if (ledger == null ) {
-            error_message('error : ledger is null ');
-            return;
-        }
-        
-        queryString+='&led='+ledger.value;
+        queryString+='&led='+p_ledger;
         var action = new Ajax.Request(
                 "ajax_misc.php",
                 {
@@ -467,7 +461,8 @@ function anc_key_choice(p_dossier, p_table, p_amount)
                             var code_html = getNodeText(html[0]); // Firefox 
ne prend que les 4096 car.
                             code_html = unescape_xml(code_html);
                             console.log(code_html);
-                            add_div({id: name_ctl, cssclass: 'inner_box', 
style: 'top:30%;right:35%;position:absolute', drag: 1});
+                            var position=fixed_position(50,120);
+                            add_div({id: name_ctl, cssclass: 'inner_box', 
style: position, drag: 1});
                             $(name_ctl).innerHTML = code_html;
                         } catch (e)
                         {
diff --git a/html/style-classic.css b/html/style-classic.css
index f48707c..762285f 100644
--- a/html/style-classic.css
+++ b/html/style-classic.css
@@ -1519,18 +1519,19 @@ li.tabs_selected {
     color:red;
     margin-left: 2px;
     padding: 12px 15px 15px 15px;
-    border-top-left-radius: 0px;
-    border-top-right-radius: 15px;
+    border-top-left-radius: 10px;
+    border-top-right-radius: 10px;
     border:1px #879ed4 solid;
+    font-weight: bold;
 
 }
 li.tabs {
     display:inline;
     background-color: blue;
     color:wheat;margin-left: 2px;
-    padding: 15px 15px 0px 15px;
-    border-top-left-radius: 15px;
-    border-top-right-radius: 15px;
+    padding: 10px 10px 0px 10px;
+    border-top-left-radius: 10px;
+    border-top-right-radius: 10px;
     border:1px #879ed4 solid;
 
 }
@@ -1538,9 +1539,9 @@ li.tabs:hover {
     display:inline;
     background-color: lightblue;
     color:wheat;margin-left: 2px;
-    padding: 15px 15px 0px 15px;
-    border-top-left-radius: 15px;
-    border-top-right-radius: 15px;
+    padding: 10px 10px 0px 10px;
+    border-top-left-radius: 10px;
+    border-top-right-radius: 10px;
     border:1px #879ed4 solid;
 
 }
@@ -1548,6 +1549,7 @@ ul.tabs a {
     text-decoration: none;
     color:white;
     display:inline;
+    
 }
 ul.tabs a:hover {
     text-decoration: none;
diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php
index 17458c8..c87d953 100644
--- a/include/class_anc_operation.php
+++ b/include/class_anc_operation.php
@@ -59,7 +59,7 @@ class Anc_Operation
      * @brief signed of the amount
      */
     var $oa_positive;
-    
+    var $in_div; /*< name of the div if any, default empty string*/
     /*!\brief constructor
      *
      */
@@ -70,6 +70,7 @@ class Anc_Operation
         $this->oa_jrnx_id_source=null;
         $this->oa_positive='Y';
         $this->has_data=0;
+        $this->in_div="";
     }
     /*!\brief add a row  to the table operation_analytique
      * \note if $this->oa_group if 0 then a sequence id will be computed for
@@ -542,7 +543,7 @@ class Anc_Operation
         $count=0;
 
                $remain=$p_amount;
-               $ctrl_remain="remain".$table_id;
+               $ctrl_remain="remain".$this->in_div.$table_id;
 
         for ( $i=0; $i < $nb_row;$i++)
         {
@@ -585,7 +586,7 @@ class Anc_Operation
 
             }
             $value=new INum();
-                       
$value->javascript='onchange="format_number(this);anc_refresh_remain(\''.$table_id.'\',\''.$p_seq.'\')"';
+           
$value->javascript='onchange="format_number(this);anc_refresh_remain(\''.$this->in_div.$table_id.'\',\''.$p_seq.'\')"';
             $value->name="val[".$p_seq."][]";
             $value->size=6;
             $value->value=(isset($val[$p_seq][$i]))?$val[$p_seq][$i]:$p_amount;
@@ -602,7 +603,7 @@ class Anc_Operation
         {
             $style_remain=($remain==0)?'style="color:green"':' 
style="color:red"';
             $result.=" Reste à imputer =  ".
-                            '<span class="remain" '.$style_remain.' 
id="'.$ctrl_remain.'">'.
+                     '<span class="remain" '.$style_remain.' 
id="'.$ctrl_remain.'">'.
                             $remain.'</span>';
             // add a button to add a row
             $button=new IButton();
@@ -615,9 +616,11 @@ class Anc_Operation
              * Add a button for distribution key
              * 
              */
+            
+            $ledger=$this->db->get_value('select j_jrn_def from jrnx where 
j_id=$1',array($this->j_id));
             $gDossier=Dossier::id();
             $button_key=new IButton();
-            
$button_key->javascript="anc_key_choice(".$gDossier.",'".$p_id."$table_id',$p_amount);";
+            
$button_key->javascript="anc_key_choice(".$gDossier.",'".$p_id."$table_id',$p_amount,'".$ledger."');";
             $button_key->name="js".$p_id.$p_seq;
             $button_key->label=_("Clef");
             $result .= $button_key->input();
diff --git a/include/template/ledger_detail_bottom.php 
b/include/template/ledger_detail_bottom.php
index 7a0afdc..b72a417 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -1,3 +1,4 @@
+<hr>
 <?php
 /**
 //This file is part of NOALYSS and is under GPL 
@@ -31,7 +32,8 @@ 
$a_tab['writing_div']=array('id'=>'writing_div'.$div,'label'=>_('Ecriture Compta
 
$a_tab['info_operation_div']=array('id'=>'info_operation_div'.$div,'label'=>_('Information'),'display'=>'none');
 
$a_tab['linked_operation_div']=array('id'=>'linked_operation_div'.$div,'label'=>_('Opérations
 liées').'('.count($aRap).')','display'=>'none');
 
$a_tab['document_operation_div']=array('id'=>'document_operation_div'.$div,'label'=>_('Document').'('.$nb_document.')','display'=>'block');
-$a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions
 liées').'('.count($a_followup).')','display'=>'none');
+$a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions
 Gestion').'('.count($a_followup).')','display'=>'none');
+$a_tab['analytic_div']=array('id'=>'analytic_div'.$div,'label'=>_('Comptabilité
 Analytique'),'display'=>'none');
 
  
 // show tabs
@@ -45,7 +47,7 @@ if ( $div != "popup") :
     ?>
     <li class="<?php echo $class?>">
         <?php $div_tab_id=$a_value['id'];?>
-        <a href="javascript:void(0)" 
onclick="unselect_other_tab(this.parentNode.parentNode);var 
tab=Array('writing_div<?php echo $div?>','info_operation_div<?php echo 
$div?>','linked_operation_div<?php echo $div?>','document_operation_div<?php 
echo $div?>','linked_action_div<?php echo 
$div?>');this.parentNode.className='tabs_selected' ;show_tabs(tab,'<?php echo 
$div_tab_id; ?>');"><?php echo $a_value['label']?></a>
+        <a href="javascript:void(0)" 
onclick="unselect_other_tab(this.parentNode.parentNode);var 
tab=Array('writing_div<?php echo $div?>','info_operation_div<?php echo 
$div?>','linked_operation_div<?php echo $div?>','document_operation_div<?php 
echo $div?>','linked_action_div<?php echo $div?>','analytic_div<?php echo 
$div?>');this.parentNode.className='tabs_selected' ;show_tabs(tab,'<?php echo 
$div_tab_id; ?>');"><?php echo $a_value['label']?></a>
     </li>
     <?php    endforeach; ?>
 </ul>
@@ -228,6 +230,33 @@ echo '</div>';
 
 require_once('template/ledger_detail_file.php');
 ?>
+
+
+<div id="analytic_div<?php echo $div;?>" style="display:<?php echo 
$a_tab['analytic_div']['display']?>">
+   <?php
+    if ($div == 'popup') :
+    ?> 
+        <h1 class="legend"><?php echo $a_tab['analytic_div']['label']?></h1>
+  <?php endif; ?>
+    <?php if ( $owner->MY_ANALYTIC != "nu") : 
+        if ( strpos('<td>',$str_anc) ==0 ):
+        ?>
+     
+                <table class="result">
+                            <?php echo $str_anc;?>
+                </table>
+        <?php else: ?>
+        <span class="notice">
+        <?php echo _('Aucune donnée'); ?>
+            </span>
+        <?php endif;?>
+<?php else:?>
+    <span class="notice">
+    <?php echo _('Non utilisée'); ?>
+    </span>
+<?php endif;?>
+</div>
+
 <hr>
 <?php 
 
@@ -249,8 +278,8 @@ if ( $div != 'popup' ) {
   if ( $access=='W') {
   echo HtmlInput::submit('save',_('Sauver'),'onClick="return 
verify_ca(\'popup\');"');
   $owner=new Own($cn);
-  if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){
-    echo '<input type="button" class="button" value="'._('verifie CA').'" 
onClick="verify_ca(\'popup\');">';
+  if ($owner->MY_ANALYTIC != 'nu' /*&& $div=='popup' */){
+    echo '<input type="button" class="button" value="'._('verifie CA').'" 
onClick="verify_ca(\''.$div.'\');">';
   }
 
   $per=new Periode($cn,$obj->det->jr_tech_per);
@@ -268,11 +297,11 @@ if ( $div != 'popup' ) {
 
 echo '</form>';
 
-  echo '<div id="ext'.$div.'" style="display:none">';
+  echo '<div id="ext'.$div.'" class="inner_box" 
style="position:relative;top:-150px;display:none">';
   $date=new IDate('ext_date');
   $r="<form id=\"form_".$div."\" onsubmit=\"this.divname='$div';return 
reverseOperation(this);\">";
   
$r.=HtmlInput::hidden('jr_id',$_REQUEST['jr_id']).HtmlInput::hidden('div',$div).dossier::hidden().HtmlInput::hidden('act','reverseop');
-  $r.='<h2 class="info">Extourner </H2>';
+  $r.=HtmlInput::title_box(_('Extourner'), 'ext'.$div, 'hide');
   $r.="entrez une date :".$date->input();
   $r.=HtmlInput::submit('x','accepter','onclick="return confirm(\'Vous 
confirmez  ? \');"');
   $r.='</form>';
diff --git a/include/template/ledger_detail_fin.php 
b/include/template/ledger_detail_fin.php
index f541b77..661b537 100644
--- a/include/template/ledger_detail_fin.php
+++ b/include/template/ledger_detail_fin.php
@@ -1,6 +1,7 @@
 <?php
 //This file is part of NOALYSS and is under GPL 
 //see licence.txt
+$str_anc="";
 ?><?php require_once('template/ledger_detail_top.php'); ?>
 <div class="content" style="padding:0;">
 <?php 
@@ -108,15 +109,15 @@ $detail->get();
     echo th(_('Libellé'));
 echo th(_('Débit'),' style="text-align:right"');
 echo th(_('Crédit'),' style="text-align:right"');
- if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){
+ if ($owner->MY_ANALYTIC != 'nu' /*&& $div == 'popup'*/){
       $anc=new Anc_Plan($cn);
       $a_anc=$anc->get_list(' order by pa_id ');
       $x=count($a_anc);
       /* set the width of the col */
-      echo '<th colspan="'.$x.'" 
style="width:auto;text-align:center">'._('Compt. Analytique').'</th>';
+      $str_anc .= '<th colspan="'.$x.'" 
style="width:auto;text-align:center">'._('Compt. Analytique').'</th>';
 
       /* add hidden variables pa[] to hold the value of pa_id */
-      echo Anc_Plan::hidden($a_anc);
+      $str_anc .= Anc_Plan::hidden($a_anc);
     }
 echo '</tr>';
   for ($e=0;$e<count($detail->det->array);$e++) {
@@ -153,15 +154,24 @@ echo '</tr>';
     $row.=($q[$e]['j_debit']=='t')?$montant:td('');
     $row.=($q[$e]['j_debit']=='f')?$montant:td('');
    /* Analytic accountancy */
-    if ( $owner->MY_ANALYTIC != "nu" && $div == 'popup')
+    if ( $owner->MY_ANALYTIC != "nu" /*&& $div == 'popup'*/)
       {
        $poste=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
        if ( preg_match('/^(6|7)/',$q[$e]['j_poste']))
          {
+            $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
            $anc_op=new Anc_Operation($cn);
            $anc_op->j_id=$q[$e]['j_id'];
-           $row.= HtmlInput::hidden('op[]',$anc_op->j_id);
-           $row.=$anc_op->display_table(1,$q[$e]['j_montant'],$div);
+           $anc_op->in_div=$div;
+            $str_anc.='<tr>';
+            $str_anc.=td($poste);
+            $str_anc.=td($qcode);
+            $str_anc.=td(nbm($q[$e]['j_montant']));
+            $str_anc.='<td>';
+           $str_anc.= HtmlInput::hidden('op[]',$anc_op->j_id);
+           $str_anc.=$anc_op->display_table(1,$q[$e]['j_montant'],$div);
+            $str_anc.='</td>';
+            $str_anc.='</tr>';
 
       }  else {
        $row.=td('');
diff --git a/include/template/ledger_detail_misc.php 
b/include/template/ledger_detail_misc.php
index 517f227..fd7225d 100644
--- a/include/template/ledger_detail_misc.php
+++ b/include/template/ledger_detail_misc.php
@@ -5,7 +5,7 @@
 require_once('template/ledger_detail_top.php');
 require_once('class_anc_operation.php');
 require_once('class_anc_plan.php');
-
+ $str_anc="";
 ?>
 <?php 
 require_once('class_own.php');
@@ -90,15 +90,15 @@ require_once ('class_anc_plan.php');
     echo th(_('Libellé'));
 echo th(_('Débit'), 'style="text-align:right"');
 echo th(_('Crédit'), 'style="text-align:right"');
-    if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup'){
+    if ($owner->MY_ANALYTIC != 'nu' /* && $div == 'popup' */ ){
       $anc=new Anc_Plan($cn);
       $a_anc=$anc->get_list(' order by pa_id ');
       $x=count($a_anc);
       /* set the width of the col */
-      echo '<th colspan="'.$x.'">'._('Compt. Analytique').'</th>';
+       $str_anc.='<tr><th>Code</th><th>Poste</th><th>Montant</th><th 
colspan="' . $x . '">' . _('Compt. Analytique') . '</th>';
 
       /* add hidden variables pa[] to hold the value of pa_id */
-      echo Anc_Plan::hidden($a_anc);
+      $str_anc.= Anc_Plan::hidden($a_anc);
     }
 echo '</tr>';
 $amount_idx=0;
@@ -152,14 +152,20 @@ $amount_idx=0;
     $row.=($q[$e]['j_debit']=='t')?$montant:td('');
     $row.=($q[$e]['j_debit']=='f')?$montant:td('');
     /* Analytic accountancy */
-    if ( $owner->MY_ANALYTIC != "nu" && $div=='popup'){
+    if ( $owner->MY_ANALYTIC != "nu" /*&& $div=='popup'*/){
       if ( preg_match('/^(6|7)/',$q[$e]['j_poste'])) {
 
        echo HtmlInput::hidden("amount_t".$amount_idx,$q[$e]['j_montant']);
        $anc_op=new Anc_Operation($cn);
        $anc_op->j_id=$q[$e]['j_id'];
-       echo HtmlInput::hidden('op[]',$anc_op->j_id);
-       $row.=$anc_op->display_table(1,$q[$e]['j_montant'],$div);
+        $anc_op->in_div=$div;
+        $str_anc.='<tr>';
+       $str_anc.=HtmlInput::hidden('op[]',$anc_op->j_id);
+        $str_anc.=td($q[$e]['j_qcode']);
+        $str_anc.=td($q[$e]['j_poste']);
+        $str_anc.=td($q[$e]['j_montant']);
+       $str_anc.=$anc_op->display_table(1,$q[$e]['j_montant'],$div);
+        $str_anc.='</tr>';
        $amount_idx++;
       }  else {
        $row.=td('');
diff --git a/include/template/ledger_detail_ven.php 
b/include/template/ledger_detail_ven.php
index 0d10c6d..dbb7bf5 100644
--- a/include/template/ledger_detail_ven.php
+++ b/include/template/ledger_detail_ven.php
@@ -7,6 +7,7 @@
     $tab_rapprochement=$div."rapproch";
     $tab_receipt=$div."receipt";
     $tab_document=$div."document";
+    $str_anc="";
  ?>
 <div class="content" style="padding:0;">
     <?php
@@ -141,16 +142,16 @@ echo $ipaid->input();
                 } else
                     echo th(_('Total'), 'style="text-align:right"');
 
-                if ($owner->MY_ANALYTIC != 'nu' && $div == 'popup')
+                if ($owner->MY_ANALYTIC != 'nu' /*&& $div == 'popup'*/)
                 {
                     $anc = new Anc_Plan($cn);
                     $a_anc = $anc->get_list(" order by pa_id ");
                     $x = count($a_anc);
                     /* set the width of the col */
-                    echo '<th colspan="' . $x . '">' . _('Compt. Analytique') 
. '</th>';
+                   $str_anc.='<tr><th>Code</th><th>Montant</th><th colspan="' 
. $x . '">' . _('Compt. Analytique') . '</th>';
 
                     /* add hidden variables pa[] to hold the value of pa_id */
-                    echo Anc_Plan::hidden($a_anc);
+                    $str_anc.=Anc_Plan::hidden($a_anc);
                 }
 
                 echo '</tr>';
@@ -159,7 +160,8 @@ echo $ipaid->input();
                     $row = '';
                     $q = $obj->det->array[$e];
                     $fiche = new Fiche($cn, $q['qs_fiche']);
-                    $view_card_detail = 
HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' 
class="line" ');
+                    $qcode=$fiche->strAttribut(ATTR_DEF_QUICKCODE);
+                    $view_card_detail = HtmlInput::card_detail($qcode, "", ' 
class="line" ');
                     $row.=td($view_card_detail);
                     if ($owner->MY_UPDLAB == 'Y')
                     {
@@ -211,18 +213,22 @@ echo $ipaid->input();
                     $total_tvac = bcadd($total_tvac, $tvac);
                     $total_htva = bcadd($total_htva, $htva);
                     /* Analytic accountancy */
-                    if ($owner->MY_ANALYTIC != "nu" && $div == 'popup')
+                    if ($owner->MY_ANALYTIC != "nu" /*&& $div == 'popup' */ )
                     {
                         $poste = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
                         if (preg_match('/^(6|7)/', $poste))
                         {
                             $anc_op = new Anc_Operation($cn);
+                            $anc_op->in_div=$div;
                             $anc_op->j_id = $q['j_id'];
                             echo HtmlInput::hidden('op[]', $anc_op->j_id);
                             /* compute total price */
                             bcscale(2);
-
-                            $row.=$anc_op->display_table(1, $htva, $div);
+                            $str_anc.='<tr>';
+                            $str_anc.=td($qcode);
+                            $str_anc.=td(nbm($htva));
+                            $str_anc.='<td>'.$anc_op->display_table(1, $htva, 
$div).'</td>';
+                           // $row.=($div == 'popup') ? 
$anc_op->display_table(1, $htva, $div):"";
                         } else
                         {
                             $row.=td('');
@@ -248,7 +254,7 @@ echo $ipaid->input();
             </tr>
             </table>
         </div>
-     
+            
 <?php
 require_once('ledger_detail_bottom.php');
 ?>



reply via email to

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