noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 71/323: task #1531: Historique poste et fich


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 71/323: task #1531: Historique poste et fiche d'après exercice opération
Date: Wed, 14 Mar 2018 17:38:20 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 49f2103403b3955947a14a5bec8097ed5c3895a6
Author: Dany De Bontridder <address@hidden>
Date:   Mon Jan 22 22:09:16 2018 +0100

    task #1531: Historique poste et fiche d'après exercice opération
---
 html/js/acc_ledger.js                      | 15 +++++++++------
 include/ajax/ajax_history.php              | 10 ++++++----
 include/balance.inc.php                    |  3 +--
 include/class/acc_bilan.class.php          |  7 +++++--
 include/class/anc_grandlivre.class.php     | 14 +++++++++++---
 include/lib/html_input.class.php           | 20 ++++++++++++++------
 include/template/ledger_detail_bottom.php  | 13 +++++++++----
 include/template/ledger_detail_misc.php    | 11 ++++++-----
 include/template/operation_detail_misc.php |  5 +++--
 9 files changed, 64 insertions(+), 34 deletions(-)

diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 94bc14b..9df198f 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -656,13 +656,13 @@ function go_next_concerned()
  * @param {type} dossier
  * @returns {undefined}
  */
-function view_history_account(p_value, dossier)
+function view_history_account(p_value, dossier,p_exercice)
 {
     layer++;
     var idbox = 'det' + layer;
     var popup = {'id': idbox, 'cssclass': 'inner_box', 'html': loading(), 
'drag': false};
 
-    var 
querystring={'gDossier':dossier,'act':'de','pcm_val':p_value,'div':idbox,'l':layer,'op':'history'};
+    var 
querystring={'gDossier':dossier,'act':'de','pcm_val':p_value,'div':idbox,'l':layer,'op':'history','exercice':p_exercice};
     waiting_box();
 
     var action = new Ajax.Request(
@@ -696,7 +696,8 @@ function update_history_account(obj)
             "gDossier" : obj.gDossier,
             "pcm_val" : obj.pcm_val ,
             "ex" : obj.select.options[obj.select.selectedIndex].text,
-            "op":"history"
+            "op":"history",
+            "exercice":obj.exercice
         };
         waiting_box();
         var action = new Ajax.Request(
@@ -722,7 +723,7 @@ function update_history_account(obj)
 /*!\brief Change the view of card history
  * \param p_value f_id of the card
  */
-function view_history_card(p_value, dossier)
+function view_history_card(p_value, dossier,p_exercice)
 {
     layer++;
     var idbox = 'det' + layer;
@@ -735,7 +736,8 @@ function view_history_card(p_value, dossier)
          'f_id' : p_value , 
          'div' : idbox ,
           "l" : layer,
-          "op":"history"};
+          "op":"history",
+      "exercice":p_exercice};
     waiting_box();
     var action = new Ajax.Request(
             "ajax_misc.php",
@@ -767,7 +769,8 @@ function update_history_card(obj)
             "gDossier" : obj.gDossier,
             "f_id" : obj.f_id ,
             "ex" : obj.select.options[obj.select.selectedIndex].text,
-            "op":"history"
+            "op":"history",
+            "exercice":obj.exercice
         };
         waiting_box();
         var action = new Ajax.Request(
diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php
index 1d9101e..128fc6d 100644
--- a/include/ajax/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -52,7 +52,8 @@ if ( isset($_GET['f_id']))
     $old='';
     $f_id=$http->get('f_id',"number");
     $fiche=new Fiche($cn,$f_id);
-    $year=$g_user->get_exercice();
+    
+    $year=$http->get("exercice","string",$g_user->get_exercice());
     if ( $year == 0 )
       {
         $html=_("erreur aucune période par défaut, allez dans préférence pour 
en choisir une");
@@ -83,7 +84,7 @@ if ( isset($_GET['f_id']))
            $dossier=dossier::id();
            if ( $div != 'popup')
              {
-               
$obj="{op:'history',div:'$div',f_id:'".$_GET['f_id']."',gDossier:'$dossier',select:this}";
+               
$obj="{op:'history',div:'$div',f_id:'".$_GET['f_id']."',gDossier:'$dossier',select:this,exercice:{$year}}";
                $is=$exercice->select('p_exercice',$default,' 
onchange="update_history_card('.$obj.');"');
                $old=_("Autre exercice")." ".$is->input();
              }
@@ -96,6 +97,7 @@ if ( isset($_GET['f_id']))
                $old.=HtmlInput::hidden('act',$_GET['act']);
                $old.=HtmlInput::hidden('f_id',$_GET['f_id']);
                $old.=HtmlInput::hidden('ajax',$_GET['ajax']);
+               $old.=HtmlInput::hidden('exercice',$year);
                $old.=dossier::hidden();
                 $old.=HtmlInput::hidden('op','history');
                $old.='</form>';
@@ -135,7 +137,7 @@ if ( isset($_REQUEST['pcm_val']))
   {
     $poste=new Acc_Account_Ledger($cn,$_REQUEST['pcm_val']);
     $poste->load();
-    $year=$g_user->get_exercice();
+    $year=$http->get("exercice","string",$g_user->get_exercice());
     if ( $year == 0 )
       {
         $html=_("erreur aucune période par défaut, allez dans préférence pour 
en choisir une");
@@ -167,7 +169,7 @@ if ( isset($_REQUEST['pcm_val']))
            $dossier=dossier::id();
            if ( $div != 'popup')
              {
-               
$obj="{op:'history',div:'$div',pcm_val:'".$_GET['pcm_val']."',gDossier:'$dossier',select:this}";
+               
$obj="{op:'history',div:'$div',pcm_val:'".$_GET['pcm_val']."',gDossier:'$dossier',select:this,exercice:{$year}}";
                $is=$exercice->select('p_exercice',$default,' 
onchange="update_history_account('.$obj.');"');
                $old=_("Autre exercice")." ".$is->input();
              }
diff --git a/include/balance.inc.php b/include/balance.inc.php
index dd2b020..92db13b 100644
--- a/include/balance.inc.php
+++ b/include/balance.inc.php
@@ -347,8 +347,7 @@ if ( isset($_GET['view'] ) )
             $tr="even";
         else
             $tr="odd";
-        $view_history= sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
-                               $r['poste'], $gDossier, $r['poste']);
+        $view_history=HtmlInput::history_account($r['poste'], $r['poste'], 
"",$exercice);
 
        /*
         * level x
diff --git a/include/class/acc_bilan.class.php 
b/include/class/acc_bilan.class.php
index e2b408b..1dff742 100644
--- a/include/class/acc_bilan.class.php
+++ b/include/class/acc_bilan.class.php
@@ -121,6 +121,9 @@ class Acc_Bilan
         $ret="";
         $obj=new Acc_Account_Ledger($this->db,0);
         
$sql=sql_filter_per($this->db,$this->from,$this->to,'p_id','j_tech_per');
+        // Find exercice
+        $periode=new Periode($this->db,$this->from);
+        $exercice=$periode->get_exercice();
         for ($i=0;$i<$nRow;$i++)
         {
 
@@ -134,9 +137,9 @@ class Acc_Bilan
                 ($solde_signed > 0 && $p_deb == 'C' )
             )
             {
-                $ret.= '<li> 
'.HtmlInput::history_account($line['pcm_val'],'Anomalie pour le compte 
'.$line['pcm_val'].' '.h($line['pcm_lib']).
+                $ret.= '<li> 
'.HtmlInput::history_account($line['pcm_val'],_('Anomalie pour le compte 
').$line['pcm_val'].' '.h($line['pcm_lib']).
                        "  D: ".$line['amount_debit'].
-                       "  C: ".$line['amount_credit']." diff 
".(abs($solde_signed)));
+                       "  C: ".$line['amount_credit']." diff 
".(abs($solde_signed)),"",$exercice);
                 $count++;
             }
 
diff --git a/include/class/anc_grandlivre.class.php 
b/include/class/anc_grandlivre.class.php
index 6318df9..4139b97 100644
--- a/include/class/anc_grandlivre.class.php
+++ b/include/class/anc_grandlivre.class.php
@@ -85,7 +85,8 @@ class Anc_GrandLivre extends Anc_Print
                 (select ad_value from fiche_Detail where f_id=b.f_id and 
ad_id=23)
        end
                 as qcode,
-        jr_pj_number
+        jr_pj_number,
+        jr_tech_per
        from operation_analytique as B join poste_analytique using(po_id)
        left join jrnx using (j_id)
        left join jrn on  (j_grpt=jr_grpt_id)
@@ -227,10 +228,17 @@ class Anc_GrandLivre extends Anc_Print
             }
             $class = ($idx % 2 == 0) ? 'even' : 'odd';
             $idx++;
+            // find out exercice
+            $exercice="";
+            if ( $row['jr_tech_per'] != null )
+            {
+                $periode=new Periode($this->db,$row['jr_tech_per']);
+                $exercice=$periode->get_exercice();
+            }
             $r.='<tr class="' . $class . '">';
             $detail = ($row['jr_id'] != null) ? 
HtmlInput::detail_op($row['jr_id'], $row['jr_internal']) : '';
-            $post_detail = ($row['j_poste'] != null) ? 
HtmlInput::history_account($row['j_poste'], $row['j_poste']) : '';
-            $card_detail = ($row['f_id'] != null) ? 
HtmlInput::history_card($row['f_id'], $row['qcode']) : '';
+            $post_detail = ($row['j_poste'] != null) ? 
HtmlInput::history_account($row['j_poste'], $row['j_poste'],"",$exercice) : '';
+            $card_detail = ($row['f_id'] != null) ? 
HtmlInput::history_card($row['f_id'], $row['qcode'],"",$exercice) : '';
             $amount_deb = ($row['oa_debit'] == 't') ? $row['oa_amount'] : 0;
             $amount_cred = ($row['oa_debit'] == 'f') ? $row['oa_amount'] : 0;
             $tot_deb = bcadd($tot_deb, $amount_deb);
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index b048154..a6fbe21 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -308,10 +308,14 @@ class HtmlInput
     /**
      * display a div with the history of the card
      */
-    static function history_card($f_id, $p_mesg, $p_style="")
+    static function history_card($f_id, $p_mesg, $p_style="",$p_exercice="")
     {
-        $view_history=sprintf('<A class="detail"  
style="text-decoration:underline;%s" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
-                $p_style, $f_id, dossier::id(), $p_mesg);
+        global $g_user;
+        if ( $p_exercice=="") {
+            $p_exercice=$g_user->get_exercice();
+        }
+        $view_history=sprintf('<A class="detail"  
style="text-decoration:underline;%s" 
HREF="javascript:view_history_card(\'%s\',\'%s\',\'%s\')" >%s</A>',
+                $p_style, $f_id, dossier::id(),$p_exercice, $p_mesg);
         return $view_history;
     }
 
@@ -331,10 +335,14 @@ class HtmlInput
     /**
      * display a div with the history of the account
      */
-    static function history_account($p_account, $p_mesg, $p_style="")
+    static function history_account($p_account, $p_mesg, 
$p_style="",$p_exercice="")
     {
-        $view_history=sprintf('<A class="detail" 
style="text-decoration:underline;%s" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
-                $p_style, $p_account, dossier::id(), $p_mesg);
+        global $g_user;
+        if ( $p_exercice=="") {
+            $p_exercice=$g_user->get_exercice();
+        }
+        $view_history=sprintf('<A class="detail" 
style="text-decoration:underline;%s" 
HREF="javascript:view_history_account(\'%s\',\'%s\',\'%s\')" >%s</A>',
+                $p_style, $p_account, dossier::id(),$p_exercice, $p_mesg);
         return $view_history;
     }
 
diff --git a/include/template/ledger_detail_bottom.php 
b/include/template/ledger_detail_bottom.php
index cc8d521..7135578 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -10,7 +10,7 @@
  * Variables : $div = popup or box (det[0-9]
  * 
  */
-
+$cn=Dossier::connect();
 // Contains all the linked actions
 $a_followup = Follow_Up::get_all_operation($jr_id);
 //
@@ -23,6 +23,11 @@ $aRap=$oRap->get();
  $detail = new Acc_Misc($cn, $obj->jr_id);
  $detail->get();
  
+ // find out exercice
+ $periode_id=new Periode($cn,$detail->det->jr_tech_per);
+ $exercice=$periode_id->get_exercice();
+ 
+ 
  $nb_document=($detail->det->jr_pj_name != "")?1:0;
 
 
@@ -90,14 +95,14 @@ endif;
                     {
                         $row = '';
                         $q = $detail->det->array;
-                        $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', 
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
-
+                        $view_history = 
HtmlInput::history_account($q[$e]['j_poste'], $q[$e]['j_poste'], "", $exercice);
+                                
                         $row.=td($view_history);
                         if ($q[$e]['j_qcode'] != '')
                         {
                             $fiche = new Fiche($cn);
                             $fiche->get_by_qcode($q[$e]['j_qcode']);
-                            $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, 
$gDossier, $q[$e]['j_qcode']);
+                            $view_history = 
HtmlInput::history_card($fiche->id,  $q[$e]['j_qcode'],"",$exercice);
                         } else
                             $view_history = '';
                         $row.=td($view_history);
diff --git a/include/template/ledger_detail_misc.php 
b/include/template/ledger_detail_misc.php
index 17176c6..27ce898 100644
--- a/include/template/ledger_detail_misc.php
+++ b/include/template/ledger_detail_misc.php
@@ -6,6 +6,10 @@ require_once NOALYSS_TEMPLATE.'/ledger_detail_top.php';
 require_once NOALYSS_INCLUDE.'/class/anc_operation.class.php';
 require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
  $str_anc="";
+ $cn=Dossier::connect();
+ // find out exercice
+ $periode_id=new Periode($cn,$obj->det->jr_tech_per);
+ $exercice=$periode_id->get_exercice();
 ?>
 <?php 
 require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
@@ -111,16 +115,13 @@ echo '</tr>';
 $amount_idx=0;
   for ($e=0;$e<count($obj->det->array);$e++) {
     $row=''; $q=$obj->det->array;
-    $view_history= sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>',
-                          $q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
-
+    $view_history = HtmlInput::history_account($q[$e]['j_poste'], 
$q[$e]['j_poste'], "", $exercice);
     $row.=td($view_history);
 
     if ( $q[$e]['j_qcode'] !='') {
       $fiche=new Fiche($cn);
       $fiche->get_by_qcode($q[$e]['j_qcode']);
-      $view_history= sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>',
-                          $fiche->id, $gDossier, $q[$e]['j_qcode']);
+      $view_history=HtmlInput::history_card($fiche->id, $q[$e]['j_qcode'], "", 
$exercice);
     }
     else
       $view_history='';
diff --git a/include/template/operation_detail_misc.php 
b/include/template/operation_detail_misc.php
index 9b3710e..967d99d 100644
--- a/include/template/operation_detail_misc.php
+++ b/include/template/operation_detail_misc.php
@@ -40,7 +40,7 @@ for ($e = 0; $e < count($obj->det->array); $e++)
 {
        $row = '';
        $q = $obj->det->array;
-       $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', 
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
+       $view_history = HtmlInput::history_account($q[$e]['j_poste'], 
$q[$e]['j_poste'], "", $exercice);
 
        $row.=td($view_history);
 
@@ -48,7 +48,8 @@ for ($e = 0; $e < count($obj->det->array); $e++)
        {
                $fiche = new Fiche($cn);
                $fiche->get_by_qcode($q[$e]['j_qcode']);
-               $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, 
$gDossier, $q[$e]['j_qcode']);
+                $view_history=HtmlInput::history_card($fiche->id, 
$q[$e]['j_qcode'], "", $exercice);
+
        }
        else
                $view_history = '';



reply via email to

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