diff --git a/include/ac_common.php b/include/ac_common.php index 37b6bb811..ae949e450 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -1031,5 +1031,51 @@ function ajax_xml_error($p_code,$p_string) EOF; } +function display_dashboard_operation($p_array,$p_title,$p_div) +{ + ?> +
+ diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 4b33a76f5..a7ad8eb77 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -3522,4 +3522,65 @@ class Acc_Ledger extends jrn_def_sql } } + 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; + } + } diff --git a/include/dashboard.inc.php b/include/dashboard.inc.php index 8bb594aa6..2fde71b0f 100644 --- a/include/dashboard.inc.php +++ b/include/dashboard.inc.php @@ -22,10 +22,19 @@ $cal->get_preference(); $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(); diff --git a/include/template/dashboard.php b/include/template/dashboard.php index 1dfef6f85..cd2561953 100644 --- a/include/template/dashboard.php +++ b/include/template/dashboard.php @@ -59,40 +59,105 @@ if ( ! empty ($array) ) {| - 0) : ?> - | ++ Pour aujourd'hui + | ++ En retard + | +
|---|---|---|
| + Action + | ++ 0): ?> + + + + + détail + + + 0 + + | + ++ 0): ?> + + + détail + + + 0 + + | + +
| + Paiement fournisseur + | ++ 0): ?> + + + détail + + + 0 + + | ++ 0): ?> + + + détail + + + 0 + + | +
| + Paiement client + | ++ 0): ?> + + + détail + + + 0 + + | ++ 0): ?> + + + détail + + + 0 + + | +