phpcompta-dev
[Top][All Lists]
Advanced

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

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


From: phpcompta-dev
Subject: [Phpcompta-dev] r5289 - in phpcompta/trunk/include: . template
Date: Sun, 19 May 2013 20:59:29 +0200 (CEST)

Author: danydb
Date: 2013-05-19 20:59:29 +0200 (Sun, 19 May 2013)
New Revision: 5289

Modified:
   phpcompta/trunk/include/ac_common.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/dashboard.inc.php
   phpcompta/trunk/include/template/dashboard.php
Log:
task #0000846: Voir les factures ?\195?\160 encaisser ou ?\195?\160 payer en 
retard dans le tableau de bord

Modified: phpcompta/trunk/include/ac_common.php
===================================================================
--- phpcompta/trunk/include/ac_common.php       2013-05-18 20:20:48 UTC (rev 
5288)
+++ phpcompta/trunk/include/ac_common.php       2013-05-19 18:59:29 UTC (rev 
5289)
@@ -1031,5 +1031,51 @@
 </data>
 EOF;
 }
+function display_dashboard_operation($p_array,$p_title,$p_div)
+{
+       ?>
+<div id="<?php echo $p_div;?>" class="inner_box" 
style="display:none;top:250;left:25%;width: 50%">
+       <?php
+       echo HtmlInput::title_box($p_title, $p_div, "hide");
+       ?>
+       <?php if (count($p_array)>0) :?>
+       <table class="result">
+               <tr>
+                       <th>Date</th>
+                       <th>Code Interne</th>
+                       <th>Description</th>
+                       <th>
+                               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($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_comment']) ?>
+                       </td>
+                       <td>
+                               <?php echo nbm($p_array[$i]['jr_montant']) ?>
+                       </td>
+               </tr>
+               <?php
+               endfor;
+               ?>
+       </table>
+       <?php else: ?>
+       <h2 class="notice">Aucune donnée</h2>
+       <?php
+       endif;
+       ?>
+</div>
+<?php
+}
 ?>

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-05-18 20:20:48 UTC 
(rev 5288)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-05-19 18:59:29 UTC 
(rev 5289)
@@ -3522,4 +3522,65 @@
                }
        }
 
+       function get_operation_date($p_date,$p_ledger_type,$sql_op)
+       {
+               global $g_user;
+               switch ($p_ledger_type)
+               {
+                       case 'ACH':
+                               $filter=$g_user->get_ledger_sql('ACH',3);
+                               break;
+                       case 'VEN':
+                               $filter=$g_user->get_ledger_sql('VEN',3);
+                               break;
+                       default:
+                               throw new Exception ('Ledger_type invalid : 
'.$p_ledger_type);
+               }
+
+
+               $sql = "select jr_id, jr_internal, jr_date, 
jr_comment,jr_comment,jr_montant
+                               from jrn
+                               join jrn_def on (jrn_def_id=jr_def_id)
+                               where
+                               jr_ech is not null
+                               and jr_ech $sql_op to_date($1,'DD.MM.YYYY')
+                               and coalesce (jr_rapt,'xx') <> 'paid'
+                               and $filter
+                               ";
+               $array=$this->db->get_array($sql,array($p_date));
+               return $array;
+       }
+       /**
+        * @brief get info from supplier to pay today
+        */
+       function get_supplier_now()
+       {
+               $array=$this->get_operation_date(Date('d.m.Y'), 'ACH', '=');
+               return $array;
+       }
+       /**
+        * @brief get info from supplier not yet paid
+        */
+       function get_supplier_late()
+       {
+               $array=$this->get_operation_date(Date('d.m.Y'), 'ACH', '<');
+               return $array;
+       }
+       /**
+        * @brief get info from customer to pay today
+        */
+       function get_customer_now()
+       {
+               $array=$this->get_operation_date(Date('d.m.Y'), 'VEN', '=');
+               return $array;
+       }
+       /**
+        * @brief get info from customer not yet paid
+        */
+       function get_customer_late()
+       {
+               $array=$this->get_operation_date(Date('d.m.Y'), 'VEN', '<');
+               return $array;
+       }
+
 }

Modified: phpcompta/trunk/include/dashboard.inc.php
===================================================================
--- phpcompta/trunk/include/dashboard.inc.php   2013-05-18 20:20:48 UTC (rev 
5288)
+++ phpcompta/trunk/include/dashboard.inc.php   2013-05-19 18:59:29 UTC (rev 
5289)
@@ -22,10 +22,19 @@
 $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('template/dashboard.php');
 $ret=ob_get_contents();

Modified: phpcompta/trunk/include/template/dashboard.php
===================================================================
--- phpcompta/trunk/include/template/dashboard.php      2013-05-18 20:20:48 UTC 
(rev 5288)
+++ phpcompta/trunk/include/template/dashboard.php      2013-05-19 18:59:29 UTC 
(rev 5289)
@@ -59,62 +59,165 @@
 </div>
 <div style="float:left;clear:both"></div>
 <div style="float:right;width: 49%">
-<?php if (count($last_operation)> 0) : ?>
-       <fieldset>
-       <legend><?php echo _('Action pour aujourd\'hui')?>
-       </legend>
-       <ol>
+       <table class='result'>
+               <tr>
+                       <th>
+
+                       </th>
+                       <th>
+                               Pour aujourd'hui
+                       </th>
+                       <th>
+                               En retard
+                       </th>
+               </tr>
+               <tr>
+                       <td>
+                               Action
+                       </td>
+                       <td>
+                               <?php if (count($last_operation)>0): ?>
+                               <A class="mtitle" 
style="text-decoration:underline"onclick="display_detail('action_now_div')">
+                                       <span class="notice">
+                                       <?php echo count($last_operation) ?>
+                                       </span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+
+                       <td >
+                       <?php if (count($late_operation)>0): ?>
+                               <A class="mtitle"  
style="text-decoration:underline" onclick="display_detail('action_late_div')">
+                               <span class="notice"><?php echo 
count($late_operation) ?></span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+
+               </tr>
+               <tr>
+                       <td>
+                               Paiement fournisseur
+                       </td>
+                       <td >
+                       <?php if (count($supplier_now)>0): ?>
+                               <A class="mtitle"  
style="text-decoration:underline" onclick="display_detail('supplier_now_div')">
+                               <span class="notice"><?php echo 
count($supplier_now) ?></span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+                       <td >
+                       <?php if (count($supplier_late)>0): ?>
+                               <A class="mtitle"  
style="text-decoration:underline" onclick="display_detail('supplier_late_div')">
+                               <span class="notice"><?php echo 
count($supplier_late) ?></span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               Paiement client
+                       </td>
+                       <td>
+                               <?php if (count($customer_now)>0): ?>
+                               <A class="mtitle"  
style="text-decoration:underline" onclick="display_detail('customer_now_div')">
+                               <span class="notice"><?php echo 
count($customer_now) ?></span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+                       <td>
+                               <?php if (count($customer_late)>0): ?>
+                               <A class="mtitle"  
style="text-decoration:underline" onclick="display_detail('customer_late_div')">
+                               <span class="notice"><?php echo 
count($customer_late) ?></span>
+                                       &nbsp;détail
+                               </A>
+                       <?php else: ?>
+                                0
+                       <?php endif; ?>
+                       </td>
+               </tr>
+       </table>
+<div id="action_late_div"  class="inner_box" 
style="display:none;margin-left:25%;width: 50%">
        <?php
-       for($i=0;$i<count($last_operation);$i++):
+               echo HtmlInput::title_box("Action en retard", 
"action_late_div","hide")
        ?>
+       <ol>
+       <?php if (count($late_operation)> 0) :
+
+       for($i=0;$i<count($late_operation);$i++):
+       ?>
        <li>
-               <?php echo 
HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
+               <?php echo 
HtmlInput::detail_action($late_operation[$i]['ag_id'],h($late_operation[$i]['ag_ref']))?>
        <span>
-       <?php echo smaller_date($last_operation[$i]['ag_timestamp_fmt'])?>
+       <?php echo smaller_date($late_operation[$i]['ag_timestamp_fmt'])?>
        </span>
                <span  style="font-weight: bolder ">
-                       <?php echo h($last_operation[$i]['vw_name'])?>
+                       <?php echo h($late_operation[$i]['vw_name'])?>
                </span>
        <span>
-       <?php echo h(mb_substr($last_operation[$i]['ag_title'],0,50,'UTF-8'))?>
+       <?php echo h(mb_substr($late_operation[$i]['ag_title'],0,50,'UTF-8'))?>
        </span>
        <span style="font-style: italic">
-       <?php echo $last_operation[$i]['dt_value']?>
+       <?php echo $late_operation[$i]['dt_value']?>
        </span>
        </li>
        <?php endfor;?>
        </ol>
-       </fieldset>
-<?php endif; ?>
+       <?php else : ?>
+       <h2 class='notice'>Aucune action en retard</h2>
+       <?php endif; ?>
+       </div>
 
-<?php if (count($late_operation)> 0) : ?>
-               <fieldset>
-       <legend><?php echo _('Action en retard ')?>
-       </legend>
+       <div id="action_now_div" class="inner_box" 
style="display:none;margin-left:25%;width: 50%">
+       <?php
+               echo HtmlInput::title_box("Action pour aujourd'hui", 
"action_now_div","hide")
+       ?>
        <ol>
        <?php
-       for($i=0;$i<count($late_operation);$i++):
+       if (count($last_operation)> 0) :
+       for($i=0;$i<count($last_operation);$i++):
        ?>
        <li>
-               <?php echo 
HtmlInput::detail_action($late_operation[$i]['ag_id'],h($late_operation[$i]['ag_ref']))?>
+               <?php echo 
HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
        <span>
-       <?php echo smaller_date($late_operation[$i]['ag_timestamp_fmt'])?>
+       <?php echo smaller_date($last_operation[$i]['ag_timestamp_fmt'])?>
        </span>
                <span  style="font-weight: bolder ">
-                       <?php echo h($late_operation[$i]['vw_name'])?>
+                       <?php echo h($last_operation[$i]['vw_name'])?>
                </span>
        <span>
-       <?php echo h(mb_substr($late_operation[$i]['ag_title'],0,50,'UTF-8'))?>
+       <?php echo h(mb_substr($last_operation[$i]['ag_title'],0,50,'UTF-8'))?>
        </span>
        <span style="font-style: italic">
-       <?php echo $late_operation[$i]['dt_value']?>
+       <?php echo $last_operation[$i]['dt_value']?>
        </span>
        </li>
        <?php endfor;?>
        </ol>
-       </fieldset>
+       <?php else : ?>
+               <h2 class='notice'>Aucune action pour aujourd'hui</h2>
 <?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'); ?>
 </div>
+<!-- Mini rapport -->
        <div style="float:left;width: 49%">
 <?php
 /*
@@ -222,3 +325,20 @@
 ?>
 </form>
 </div>
+<script type="text/javascript" language="javascript" charset="utf-8">
+function display_detail(div) {
+       $(div).style.display="block";
+       //Effect.Grow(div,{});
+}
+try {
+var 
array=Array('customer_now_div','customer_late_div','supplier_now_div','supplier_late_div','action_now_div','action_late_div');
+var i=0;
+for  (i=0;i < array.length;i++) {
+
+       if ( ! document.getElementById(array[i])) {
+               console.log('ATTENTION'+array[i]);
+       }
+       new Draggable(array[i],{});
+}
+} catch (e) { alert(e.getMessage);}
+</script>
\ No newline at end of file



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



reply via email to

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