noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 03/17: Task #2257:improve Détail Action dans


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 03/17: Task #2257:improve Détail Action dans le tableau de bord , mise à jour
Date: Tue, 16 May 2023 14:50:09 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit f48262e20e07bf8a5972e0846e62206413df6033
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Apr 17 20:48:03 2023 +0200

    Task #2257:improve Détail Action dans le tableau de bord , mise à jour
---
 html/ajax_misc.php                                 |  23 +--
 html/js/noalyss_script.js                          |  78 +++++++++
 include/ajax/ajax_event_display_detail.php         |  43 +++++
 include/class/database.class.php                   |   2 +-
 include/class/status_operation_event.class.php     |  96 +++++++++++
 include/dashboard.inc.php                          |  20 +--
 include/lib/ac_common.php                          |  67 +-------
 include/lib/function_javascript.php                |   2 +-
 include/template/dashboard.php                     | 180 +--------------------
 .../status_operation_event-display_event.php       |  66 ++++++++
 .../status_operation_event-main_display.php        | 140 ++++++++++++++++
 11 files changed, 447 insertions(+), 270 deletions(-)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 782d6d7db..fefa7e86f 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -38,15 +38,16 @@
 if ( ! defined('ALLOWED')) define ('ALLOWED',1);
 
 require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/class/database.class.php';
-require_once  NOALYSS_INCLUDE.'/class/fiche.class.php';
-require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
-require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
-require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
-require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
-require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
-require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
+//require_once NOALYSS_INCLUDE.'/class/database.class.php';
+//require_once  NOALYSS_INCLUDE.'/class/fiche.class.php';
+//require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
+//require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
+//require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
+//require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
+//require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+//require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
+//require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
+global $http;
 $http=new HttpInput();
 
 /* we ask a dg box for disconnecting */
@@ -315,7 +316,9 @@ $path = array(
     // other_tax
     "other_tax"=>"ajax_other_tax",
     //visibility quantity
-    "update_visibility_quantity"=>"ajax_update_visibility_quantity"
+    "update_visibility_quantity"=>"ajax_update_visibility_quantity",
+    // detail customer , supplier operation
+    "event_display_detail"=>"ajax_event_display_detail"
 ) ;
 
 if (array_key_exists($op, $path)) {
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 3e08e4016..3e6301e22 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -4147,3 +4147,81 @@ function enlarge_text(p_domid,p_size) {
 
 
 }
+
+/**
+ * @brief display a box with the customer , supplier or event for today or late
+ * @param p_detail , what to do
+ */
+function event_display_detail(p_dossier,p_detail) {
+
+       try
+               {
+                // create div if not exists
+               var dgbox="situation_detail_div";
+               waiting_box();
+
+               var 
queryString={gDossier:p_dossier,op:'event_display_detail','what':p_detail};
+                // call ajax and update content of the div
+               var action = new Ajax.Request(
+                                         "ajax_misc.php" ,
+                                         {
+                                             method:'get',
+                                             parameters:queryString,
+                                             onFailure:ajax_misc_failure,
+                                             onSuccess:function(req){
+                                                       remove_waiting_box();
+                               if (req.responseText == 'NOCONX') {
+                                   reconnect();
+                                   return;
+                               }
+                                if ( ! document.getElementById(dgbox)) {
+                                    var 
div_style="position:absolute;"+";top:30%";
+                                    
add_div({id:dgbox,cssclass:'inner_box',html:loading(),style:div_style,drag:true});
+
+                                }
+
+                                                       
$(dgbox).update(req.responseText)
+
+                                             }
+                                         }
+                     );
+                event_display_main(p_dossier);
+               }catch( e)
+               {
+                       alert_box(e.message);
+               }
+}
+
+/**
+ * @brief refresh the main display in the dashboard to reflect possible changes
+ * @param p_dossier
+ */
+function event_display_main(p_dossier) {
+       try
+               {
+               waiting_box();
+                var dgbox="situation_div";
+                var 
queryString={gDossier:p_dossier,op:'event_display_detail','what':"main_display"};
+               var action = new Ajax.Request(
+                                         "ajax_misc.php" ,
+                                         {
+                                             method:'GET',
+                                             parameters:queryString,
+                                             onFailure:ajax_misc_failure,
+                                             onSuccess:function(req){
+                                                       remove_waiting_box();
+                               if (req.responseText == 'NOCONX') {
+                                   reconnect();
+                                   return;
+                               }
+
+                                  $(dgbox).update(req.responseText)
+
+                                             }
+                                         }
+                     );
+               }catch( e)
+               {
+                       alert_box(e.message);
+               }
+}
\ No newline at end of file
diff --git a/include/ajax/ajax_event_display_detail.php 
b/include/ajax/ajax_event_display_detail.php
new file mode 100644
index 000000000..ee1dba6be
--- /dev/null
+++ b/include/ajax/ajax_event_display_detail.php
@@ -0,0 +1,43 @@
+<?php
+/*
+*   This file is part of NOALYSS.
+*
+*   PhpCompta is free software; you can redistribute it and/or modify
+*   it under the terms of the GNU General Public License as published by
+*   the Free Software Foundation; either version 2 of the License, or
+*   (at your option) any later version.
+*
+*   NOALYSS is distributed in the hope that it will be useful,
+*   but WITHOUT ANY WARRANTY; without even the implied warranty of
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*   GNU General Public License for more details.
+*
+*   You should have received a copy of the GNU General Public License
+*   along with PhpCompta; if not, write to the Free Software
+*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright (2023) Author Dany De Bontridder <dany@alchimerys.be>
+global $g_user;
+
+if (!defined('ALLOWED'))     die('Appel direct ne sont pas permis');
+
+if  ( $g_user->check_module("DASHBOARD") == 0) die();
+
+global $http,$cn;
+
+try {
+    $what=$http->get("what");
+} catch (\Exception $e) {
+    echo $e->getMessage();
+    throw $e;
+}
+
+if ( $what == 'main_display')
+{
+    status_Operation_Event::main_display($cn);
+}else {
+    $status_operation_event=new Status_Operation_Event($cn);
+    $status_operation_event->display($what);
+}
+
+
diff --git a/include/class/database.class.php b/include/class/database.class.php
index f153f20bd..deee87aff 100644
--- a/include/class/database.class.php
+++ b/include/class/database.class.php
@@ -179,7 +179,7 @@ class Database extends DatabaseCore
                 if ($i == 17) {
                     $this->execute_script(NOALYSS_INCLUDE . 
'/sql/patch/upgrade17.sql');
                     $max = $this->get_value('select last_value from 
s_jnt_fic_att_value');
-                    $this->alter_seq($p_cn, 's_jnt_fic_att_value', $max + 1);
+                    $this->alter_seq('s_jnt_fic_att_value', $max + 1);
                 } // version
                 // reset sequence in the modele
                 //--
diff --git a/include/class/status_operation_event.class.php 
b/include/class/status_operation_event.class.php
new file mode 100644
index 000000000..67546d47a
--- /dev/null
+++ b/include/class/status_operation_event.class.php
@@ -0,0 +1,96 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 14/04/23
+
+/*! 
+ * \file
+ * \brief concern the detail in the dashboard, the status of the operations of 
sales or purchase or event
+ */
+
+class Status_Operation_Event
+{
+    private $cn;
+    private $dialog_box_id;
+
+    public function __construct(Database $cn)
+    {
+        $this->cn=$cn;
+        $this->dialog_box_id="situation_detail_div";
+    }
+
+    public function __toString(): string
+    {
+       return "status_operation";
+    }
+
+
+    function display_event($p_title,$p_array,$p_what)
+    {
+        require_once 
NOALYSS_TEMPLATE."/status_operation_event-display_event.php";
+    }
+    /**
+     * @brief Display a box with the contains
+     * @param array $p_array Data to display
+     * @param string $p_title Title of the box
+     * @param div_name $p_div id of the box
+     */
+    function display_operation($p_title,$p_array,$p_what)
+    {
+        require_once 
NOALYSS_TEMPLATE."/status_operation_event-display_operation.php";
+    }
+
+    /**
+     * @brief display what it is asked
+     * @param string $p_what
+     */
+    function display($p_what) {
+        $Ledger=new Acc_Ledger($this->cn,0);
+        $last_ledger=array();
+        $last_ledger=$Ledger->get_last(20);
+
+        switch ($p_what) {
+            case 'supplier_now':
+                $this->display_operation(_("Fournisseurs à payer 
aujourd'hui"),$Ledger->get_supplier_now(),$p_what);
+                break;
+            case 'supplier_late':
+                $this->display_operation(_("Fournisseurs en 
retard"),$Ledger->get_supplier_late(),$p_what);
+                break;
+            case 'customer_now':
+                $this->display_operation(_("Client à payer 
aujourd'hui"),$Ledger->get_customer_now(),$p_what);
+                break;
+            case 'customer_late':
+                $this->display_operation(_("Client en 
retard"),$Ledger->get_customer_late(), $p_what);
+                break;
+            case 'action_now':
+                $Operation=new Follow_Up($this->cn);
+                $this->display_event(_("Action 
aujourd'hui"),$Operation->get_today(),$p_what);
+            case 'action_late':
+                $Operation=new Follow_Up($this->cn);
+                $this->display_event(_("Action en 
retard"),$Operation->get_late(),$p_what);
+                break;
+            default:
+                throw new \Exception("Unknown operation 
[$p_what]",EXC_PARAM_VALUE);
+        }
+    }
+    static function main_display(Database $cn)
+    {
+
+        require_once 
NOALYSS_TEMPLATE."/status_operation_event-main_display.php";
+    }
+}
\ No newline at end of file
diff --git a/include/dashboard.inc.php b/include/dashboard.inc.php
index 3e7c9fdaa..b0f0e1e43 100644
--- a/include/dashboard.inc.php
+++ b/include/dashboard.inc.php
@@ -16,27 +16,9 @@ $cal->get_preference();
 
 $obj=sprintf("{gDossier:%d,invalue:'%s',outdiv:'%s','distype':'%s'}",
         dossier::id(),'per','calendar_zoom_div','cal');
-$Operation=new Follow_Up($cn);
-$last_operation=$Operation->get_today();
-$late_operation=$Operation->get_late();
 
-$Ledger=new Acc_Ledger($cn,0);
-$last_ledger=array();
-$last_ledger=$Ledger->get_last(20);
 
-// Supplier late and now
-$supplier_now=$Ledger->get_supplier_now();
-$supplier_late=$Ledger->get_supplier_late();
-
-// Customer late and now
-$customer_now=$Ledger->get_customer_now();
-$customer_late=$Ledger->get_customer_late();
-
-ob_start();
 require_once NOALYSS_TEMPLATE.'/dashboard.php';
-$ret=ob_get_contents();
-ob_end_clean();
-echo $ret;
 
-echo '</div>';
+
 ?>
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 1268bebda..b9559d6a8 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -1273,66 +1273,7 @@ function ajax_xml_error($p_code,$p_string)
 </data>
 EOF;
 }
-/**
- * @brief Display a box with the contains
- * @param type $p_array Data to display
- * @param type $p_title Title of the box
- * @param type $p_div id of the box
- */
-function display_dashboard_operation($p_array,$p_title,$p_div)
-{
-       ?>
-<div id="<?php echo $p_div;?>" class="inner_box" 
style="display:none;position:fixed;top:250px;left:12%;width: 
75%;min-height:50%;overflow:auto;">
-       <?php
-       echo HtmlInput::title_box($p_title, $p_div, "hide",'','y');
-       ?>
-       <?php if (count($p_array)>0) :?>
-       <table class="result">
-               <tr>
-                       <th><?php echo _('Date')?></th>
-                       <th><?php echo _('Code Interne')?></th>
-                       <th><?php echo _('Pièce')?></th>
-                       <th><?php echo _('Description')?></th>
-                       <th>
-                               <?php echo _('Montant')?>
-                       </th>
-
-               </tr>
-               <?php
-                       for ($i=0;$i<count($p_array);$i++):
-               ?>
-               <tr class="<?php echo (($i%2)==0)?'odd':'even';?>">
-                       <td>
-                               <?php echo 
smaller_date(format_date($p_array[$i]['jr_date']) );?>
-                       </td>
-                       <td>
-                               <?php echo 
HtmlInput::detail_op($p_array[$i]['jr_id'], $p_array[$i]['jr_internal']) ?>
-                       </td>
-                        <td>
-                            <?php echo h($p_array[$i]['jr_pj_number'])?>
-                        </td>
-                       <td>
-                               <?php echo h($p_array[$i]['jr_comment']) ?>
-                       </td>
-                       <td>
-                               <?php echo nbm($p_array[$i]['jr_montant']) ?>
-                       </td>
-               </tr>
-               <?php
-               endfor;
-               ?>
-       </table>
-    <p style="text-align: center">
-        <?php echo HtmlInput::button_hide($p_div)?>
-    </p>
-       <?php else: ?>
-       <h2 class="notice"><?php echo _('Aucune donnée')?></h2>
-       <?php
-       endif;
-       ?>
-</div>
-<?php
-}
+
 function get_array_column($p_array,$key)
 {
     $array=array();
@@ -1356,10 +1297,6 @@ function get_array_column($p_array,$key)
  */
 function factory_Ledger(Database &$p_cn, $ledger_id)
 {
-    include_once NOALYSS_INCLUDE.'/class/acc_ledger_sale.class.php';
-    include_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
-    include_once NOALYSS_INCLUDE.'/class/acc_ledger_fin.class.php';
-    
     $ledger=new Acc_Ledger($p_cn, $ledger_id);
     $type=$ledger->get_type();
 
@@ -1641,7 +1578,7 @@ function noalyss_round($p_first,$p_second)
 }
 
 /**
- * to avoid deprecated in PHP8.1 : explode cannot use a null
+ *  @brief to avoid deprecated in PHP8.1 : explode cannot use a null
  * @param $separator
  * @param $string
  * @return array | empty string
diff --git a/include/lib/function_javascript.php 
b/include/lib/function_javascript.php
index 0b0a4a654..8c30a80c9 100644
--- a/include/lib/function_javascript.php
+++ b/include/lib/function_javascript.php
@@ -2787,7 +2787,7 @@ EOF;
 
 }
 /**
- * Send header and json object
+ * @brief Send header and json object
  * @param array $p_answer this array will be converted to json object
  * @see json_encode
  */
diff --git a/include/template/dashboard.php b/include/template/dashboard.php
index ad242980f..5b1b7c0e7 100644
--- a/include/template/dashboard.php
+++ b/include/template/dashboard.php
@@ -37,100 +37,7 @@ if ( ! empty ($array) )  {
 </div>
 
 <div id="situation_div" class="box"> 
-    <?php echo 
HtmlInput::title_box(_("Situation"),"situation_div",'none','','n')?>
-    <table class='result'>
-               <tr>
-                       <th>
-
-                       </th>
-                       <th>
-                            <?php echo date('d.m.y'); ?>
-                       </th>
-                        <th>
-                            <?php echo _('En retard') ?>
-                        </th>
-               </tr>
-               <tr>
-                       <td>
-                               <?php echo _("Action"); ?>
-                       </td>
-                       <td>
-                               <?php if (count($last_operation)>0): ?>
-                               <A class="mtitle" style="font-weight: 
bolder;"onclick="display_detail('action_now_div')">
-                                       <span class="notice">
-                                       <?php echo count($last_operation) ?>
-                                       &nbsp;<?php echo _("détail"); ?>
-                                       </span>
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-
-                       <td >
-                       <?php if (count($late_operation)>0): ?>
-                               <A class="mtitle"  style="font-weight: bolder" 
onclick="display_detail('action_late_div')">
-                               <span class="notice"><?php echo 
count($late_operation) ?>
-                                       &nbsp;<?php echo _("détail"); ?>
-                                </span>
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-
-               </tr>
-               <tr>
-                       <td>
-                               <?php echo _("Paiement fournisseur"); ?>
-                       </td>
-                       <td >
-                       <?php if (count($supplier_now)>0): ?>
-                               <A class="mtitle"  style="font-weight: bolder" 
onclick="display_detail('supplier_now_div')">
-                               <span class="notice"><?php echo 
count($supplier_now) ?>&nbsp;<?php echo _("détail"); ?></span>
-                                       
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-                       <td >
-                       <?php if (count($supplier_late)>0): ?>
-                               <A class="mtitle"  style="font-weight: bolder" 
onclick="display_detail('supplier_late_div')">
-                               <span class="notice"><?php echo 
count($supplier_late) ?>&nbsp;<?php echo _("détail"); ?></span>
-                                       
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                               <?php echo _("Paiement client"); ?>
-                       </td>
-                       <td>
-                               <?php if (count($customer_now)>0): ?>
-                               <A class="mtitle"  style="font-weight: bolder" 
onclick="display_detail('customer_now_div')">
-                               <span class="notice"><?php echo 
count($customer_now) ?>&nbsp;<?php echo _("détail"); ?></span>
-                                       
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-                       <td>
-                               <?php if (count($customer_late)>0): ?>
-                               <A class="mtitle"  style="font-weight: bolder" 
onclick="display_detail('customer_late_div')">
-                               <span class="notice"><?php echo 
count($customer_late) ?>&nbsp;<?php echo _("détail"); ?></span>
-                                       
-                               </A>
-                       <?php else: ?>
-                                0
-                       <?php endif; ?>
-                       </td>
-               </tr>
-       </table>
+  <?=Status_Operation_Event::main_display($cn)?>
 </div>
 
 <!-- Mini rapport -->
@@ -199,6 +106,10 @@ endif;
 
 <table class="result" >
 <?php
+$Ledger=new Acc_Ledger($cn,0);
+$last_ledger=array();
+$last_ledger=$Ledger->get_last(20);
+
 for($i=0;$i<count($last_ledger);$i++):
        $class=($i%2==0)?' class="even" ':' class="odd" ';
 ?>
@@ -279,85 +190,6 @@ echo 
HtmlInput::button('hide',_('Annuler'),'onClick="Effect.Fold(\'add_todo_list
 ?>
 </form>
 </div>
+</div>
 
-<div id="action_late_div"  class="inner_box" 
style="position:fixed;display:none;margin-left:12%;top:25%;width:75%;min-height:50%;overflow:
 auto;">
-       <?php
-               echo HtmlInput::title_box(_("Action en retard"), 
"action_late_div","hide","","y")
-       ?>
-       <ol>
-       <?php if (count($late_operation)> 0) :
-
-       for($i=0;$i<count($late_operation);$i++):
-       ?>
-       <li>
-       <span>
-       <?php echo smaller_date($late_operation[$i]['ag_timestamp_fmt']) , " ",
-                hb($late_operation[$i]['ag_hour']);
-                ?>
-       </span>
-               <?php echo 
HtmlInput::detail_action($late_operation[$i]['ag_id'],h($late_operation[$i]['ag_ref']))?>
-               <span  style="font-weight: bolder ">
-                       <?php echo h($late_operation[$i]['vw_name'])?>
-               </span>
-       <span>
-       <?php echo h(mb_substr($late_operation[$i]['ag_title'],0,50,'UTF-8'))?>
-       </span>
-       <span style="font-style: italic">
-       <?php echo $late_operation[$i]['dt_value']?>
-       </span>
-       </li>
-       <?php endfor;?>
-       </ol>
-       <?php else : ?>
-       <h2 class='notice'><?php echo _("Aucune action en retard")?></h2>
-       <?php endif; ?>
-         <p style="text-align: center">
-        <?php echo HtmlInput::button_hide("action_late_div")?>
-        </p>
-       </div>
-
-       <div id="action_now_div" class="inner_box" style="display:none">
-       <?php
-               echo HtmlInput::title_box(_("Action pour aujourd'hui"), 
"action_now_div","hide",'','y')
-       ?>
-       <ol>
-       <?php
-       if (count($last_operation)> 0) :
-       for($i=0;$i<count($last_operation);$i++):
-       ?>
-       <li>
-       <span>
-       <?php echo smaller_date($last_operation[$i]['ag_timestamp_fmt'])," ",
-                $last_operation[$i]['ag_hour']?>
-       </span>
-               <?php echo 
HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
-               <span  style="font-weight: bolder ">
-                       <?php echo h($last_operation[$i]['vw_name'])?>
-               </span>
-       <span>
-       <?php echo h(mb_substr($last_operation[$i]['ag_title'],0,50,'UTF-8'))?>
-       </span>
-       <span style="font-style: italic">
-       <?php echo $last_operation[$i]['dt_value']?>
-       </span>
-       </li>
-       <?php endfor;?>
-       </ol>
-        <p style="text-align: center">
-        <?php echo HtmlInput::button_hide("action_now_div")?>
-        </p>
-<?php endif; ?>
-       </div>
-  <?php display_dashboard_operation($supplier_now,_("Fournisseurs à payer 
aujourd'hui"),'supplier_now_div'); ?>
-        <?php display_dashboard_operation($supplier_late,_("Fournisseurs en 
retad"),'supplier_late_div'); ?>
-        <?php display_dashboard_operation($customer_now,_("Encaissement 
clients aujourd'hui"),'customer_now_div'); ?>
-        <?php display_dashboard_operation($customer_late,_("Clients en 
retard"),'customer_late_div'); ?>
-
-<script type="text/javascript" language="javascript" charset="utf-8">
-function display_detail(div) {
-        var div=$(div);
-               div.style.display="block";
-        div.style.top=calcy(50)+"px";
-}
-</script>
 
diff --git a/include/template/status_operation_event-display_event.php 
b/include/template/status_operation_event-display_event.php
new file mode 100644
index 000000000..762995bf4
--- /dev/null
+++ b/include/template/status_operation_event-display_event.php
@@ -0,0 +1,66 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 14/04/23
+/*! 
+ * \file
+ * \brief Display event
+ */
+ ?>
+
+       <?php
+               echo HtmlInput::title_box($p_title, 
$this->dialog_box_id,"close","","y")
+       ?>
+       <ol>
+       <?php if (count($p_array)> 0) :
+
+       for($i=0;$i<count($p_array);$i++):
+       ?>
+       <li>
+       <span>
+       <?php echo smaller_date($p_array[$i]['ag_timestamp_fmt']) , " ",
+                hb($p_array[$i]['ag_hour']);
+                ?>
+       </span>
+               <?php echo 
HtmlInput::detail_action($p_array[$i]['ag_id'],h($p_array[$i]['ag_ref']))?>
+               <span  style="font-weight: bolder ">
+                       <?php echo h($p_array[$i]['vw_name'])?>
+               </span>
+       <span>
+       <?php echo h(mb_substr($p_array[$i]['ag_title'],0,50,'UTF-8'))?>
+       </span>
+       <span style="font-style: italic">
+       <?php echo $p_array[$i]['dt_value']?>
+       </span>
+       </li>
+       <?php endfor;?>
+       </ol>
+       <?php else : ?>
+       <h2 class='notice'><?php echo _("Aucune action en retard")?></h2>
+       <?php endif; ?>
+       <ul class="aligned-block">
+               <li>
+                       
<?=\HtmlInput::button_action(_("Rafraîchir"),sprintf("event_display_detail('%s','%s')",Dossier::id(),$p_what),uniqid(),"smallbutton")?>
+               </li>
+               <li>
+                       <?php echo 
HtmlInput::button_close($this->dialog_box_id);?>
+               </li>
+       </ul>
+
+</div>
+
diff --git a/include/template/status_operation_event-main_display.php 
b/include/template/status_operation_event-main_display.php
new file mode 100644
index 000000000..f2e504383
--- /dev/null
+++ b/include/template/status_operation_event-main_display.php
@@ -0,0 +1,140 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+// Copyright Author Dany De Bontridder danydb@aevalys.eu 17/04/23
+/*! 
+ * \file
+ * \brief main display for situation
+ */
+
+$Operation=new Follow_Up($cn);
+$last_operation=$Operation->get_today();
+$late_operation=$Operation->get_late();
+
+$Ledger=new Acc_Ledger($cn,0);
+
+// Supplier late and now
+$supplier_now=$Ledger->get_supplier_now();
+$supplier_late=$Ledger->get_supplier_late();
+
+// Customer late and now
+$customer_now=$Ledger->get_customer_now();
+$customer_late=$Ledger->get_customer_late();
+
+$gDossier_id=Dossier::id();
+?>
+  <?php echo 
HtmlInput::title_box(_("Situation"),"situation_div",'none','','n')?>
+    <table class='result'>
+               <tr>
+                       <th>
+
+                       </th>
+                       <th>
+                            <?php echo date('d.m.y'); ?>
+                       </th>
+                        <th>
+                            <?php echo _('En retard') ?>
+                        </th>
+               </tr>
+               <tr>
+                       <td>
+                               <?php echo _("Action"); ?>
+                       </td>
+                       <td>
+                               <?php if (count($last_operation)>0): ?>
+                               <A class="mtitle" style="font-weight: 
bolder;"onclick="event_display_detail(<?=$gDossier_id?>,'action_now')">
+                                       <span class="notice">
+                                       <?php echo count($last_operation) ?>
+                                       &nbsp;<?php echo _("détail"); ?>
+                                       </span>
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+
+                       <td >
+                       <?php if (count($late_operation)>0): ?>
+                               <A class="mtitle"  style="font-weight: bolder" 
onclick="event_display_detail(<?=$gDossier_id?>,'action_late')">
+                               <span class="notice"><?php echo 
count($late_operation) ?>
+                                       &nbsp;<?php echo _("détail"); ?>
+                                </span>
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+
+               </tr>
+               <tr>
+                       <td>
+                               <?php echo _("Paiement fournisseur"); ?>
+                       </td>
+                       <td >
+                       <?php if (count($supplier_now)>0): ?>
+                               <A class="mtitle"  style="font-weight: bolder" 
onclick="event_display_detail(<?=$gDossier_id?>,'supplier_now')">
+                               <span class="notice"><?php echo 
count($supplier_now) ?>&nbsp;<?php echo _("détail"); ?></span>
+
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+                       <td >
+                       <?php if (count($supplier_late)>0): ?>
+                               <A class="mtitle"  style="font-weight: bolder" 
onclick="event_display_detail(<?=$gDossier_id?>,'supplier_late')">
+                               <span class="notice"><?php echo 
count($supplier_late) ?>&nbsp;<?php echo _("détail"); ?></span>
+
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <?php echo _("Paiement client"); ?>
+                       </td>
+                       <td>
+                               <?php if (count($customer_now)>0): ?>
+                               <A class="mtitle"  style="font-weight: bolder" 
onclick="event_display_detail(<?=$gDossier_id?>,'customer_now')">
+                               <span class="notice"><?php echo 
count($customer_now) ?>&nbsp;<?php echo _("détail"); ?></span>
+
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+                       <td>
+                               <?php if (count($customer_late)>0): ?>
+                               <A class="mtitle"  style="font-weight: bolder" 
onclick="event_display_detail(<?=$gDossier_id?>,'customer_late')">
+                               <span class="notice"><?php echo 
count($customer_late) ?>&nbsp;<?php echo _("détail"); ?></span>
+
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+               </tr>
+       </table>
+<ul class="aligned-block">
+       <li>
+               
<?=\HtmlInput::button_action(_("Rafraîchir"),sprintf("event_display_main('%s')",Dossier::id()),uniqid(),"smallbutton")?>
+       </li>
+
+</ul>



reply via email to

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