From 622f5aaf826895fcf0aabb7ebe164e1e19632af3 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 18 Jan 2011 23:42:45 +0000 Subject: [PATCH] #16: Ajout balance for supplier, customer and adminstration --- include/adm_card.inc.php | 24 +++++++++++- include/balance_card.inc.php | 74 +++++++++++++++++++++++++++++++++++ include/class_fiche.php | 19 ++++++--- include/client_card.inc.php | 12 +++++- include/supplier_card.inc.php | 13 +++++- 5 files changed, 131 insertions(+), 11 deletions(-) create mode 100644 include/balance_card.inc.php diff --git a/include/adm_card.inc.php b/include/adm_card.inc.php index 9cf2df5ec..82ba60897 100644 --- a/include/adm_card.inc.php +++ b/include/adm_card.inc.php @@ -29,8 +29,6 @@ require_once('class_contact.php'); require_once('class_ipopup.php'); -echo ICard::ipopup('ipopcard'); - /* $sub_action = sb = detail */ /* $cn database conx */ $return=new IAction(); @@ -53,6 +51,12 @@ case 'cn': case 'op': $def=4; break; +case 'bal': + $def=7; + break; +case 'let': + $def=6; + break; default: $def=1; $ss_action='dc'; @@ -64,6 +68,8 @@ echo ShowItem(array( array($root.'&sc=sv',_('Suivi'),_('Suivi adm, devis, bon de commande, courrier'),2), array($root.'&sc=cn',_('Contact'),_('Liste de contacts de cette administration'),3), array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4), + array($root.'&sc=bal',_('Balance'),_('Balance du fournisseur'),7), + array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6), array('?p_action=adm&'.dossier::get(),_('Retour liste'),_('Retour à la liste des administration'),5) ), 'H',"mtitle","mtitle",$def,' '); @@ -128,3 +134,17 @@ if ( $ss_action == 'cn') echo $f_add_button->input(); echo ''; } +/*------------------------------------------------------------------------- + * Balance of the card + *-------------------------------------------------------------------------*/ +if ( $ss_action=='bal') + { + require_once('balance_card.inc.php'); + } +/*---------------------------------------------------------------------------- + * Lettering + *----------------------------------------------------------------------------*/ +if ( $def==6 ) +{ + require_once('lettering.gestion.inc.php'); +} diff --git a/include/balance_card.inc.php b/include/balance_card.inc.php new file mode 100644 index 000000000..a2716a44a --- /dev/null +++ b/include/balance_card.inc.php @@ -0,0 +1,74 @@ +'; +$exercice=new Exercice($cn); +$old=''; +$fiche=new Fiche($cn,$_GET['f_id']); +$year=$User->get_exercice(); +if ( $year == 0 ) + { + $html="erreur aucune période par défaut, allez dans préférence pour en choisir une"; + } +else + { + $per=new Periode($cn); + $limit_periode=$per->get_limit($year); + $array['from_periode']=$limit_periode[0]->first_day(); + $array['to_periode']=$limit_periode[1]->last_day(); + if (isset($_GET['ex'])) + { + $limit_periode=$per->get_limit($_GET['ex']); + $array['from_periode']=$limit_periode[0]->first_day(); + } + + /* + * Add button to select another year + */ + if ($exercice->count() > 1 ) + { + $default=(isset($_GET['ex']))?$_GET['ex']:$year; + $dossier=dossier::id(); + + $old='
'; + $is=$exercice->select('ex',$default,'onchange = "submit(this)"'); + $old.="Autre exercice ".$is->input(); + $old.=HtmlInput::hidden('f_id',$_GET['f_id']); + $old.=HtmlInput::hidden('p_action',$_GET['p_action']); + $old.=HtmlInput::hidden('sb',$_GET['sb']); + $old.=HtmlInput::hidden('sc',$_GET['sc']); + $old.=dossier::hidden(); + $old.='
'; + } + + if ( $fiche->HtmlTable($array,0,0)==-1){ + echo h2("Aucun opération pour l'exercice courant",'class="error"'); + } + echo $old; + + } + +echo ''; diff --git a/include/class_fiche.php b/include/class_fiche.php index 374b84a7b..0c31ab688 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -1190,10 +1190,11 @@ class Fiche /*! * \brief HtmlTable, display a HTML of a card for the asked period * \param $p_array default = null keys = from_periode, to_periode - * \param $op_let lettering of operation 0 - * \return -1 if nothing is found otherwise 0 + *\param $op_let 0 all operation, 1 only lettered one, 2 only unlettered one + *\return -1 if nothing is found otherwise 0 + *\see get_row_date */ - function HtmlTable($p_array=null,$op_let=0) + function HtmlTable($p_array=null,$op_let=0,$from_div=1) { if ( $p_array == null) $p_array=$_REQUEST; @@ -1209,9 +1210,15 @@ class Fiche return -1; $rep=""; - - echo '

'." ".$name.'

'; - echo ""; + if ( $from_div==1) + { + echo '

'." ".$name.'

'; + echo "
"; + } + else + { + echo "
"; + } echo ''; echo "". "". diff --git a/include/client_card.inc.php b/include/client_card.inc.php index 1f115ce62..133853380 100644 --- a/include/client_card.inc.php +++ b/include/client_card.inc.php @@ -29,7 +29,6 @@ require_once('class_contact.php'); require_once('class_ipopup.php'); -echo ICard::ipopup('ipopcard'); /* $sub_action = sb = detail */ /* $cn database conx */ @@ -53,6 +52,9 @@ case 'op': case 'let': $def=6; break; +case 'bal': + $def=7; + break; default: $def=1; $ss_action='dc'; @@ -64,6 +66,7 @@ echo ShowItem(array( array($root.'&sc=sv',_('Suivi'),_('Suivi client, devis, bon de commande, courrier'),2), array($root.'&sc=cn',_('Contact'),_('Liste de contacts de ce client'),3), array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4), + array($root.'&sc=bal',_('Balance'),_('Balance du client'),7), array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6), array('?p_action=client&'.dossier::get(),_('Retour liste'),_('Retour à la liste des clients'),5) ), @@ -137,3 +140,10 @@ if ( $def==6 ) { require_once('lettering.gestion.inc.php'); } +/*------------------------------------------------------------------------- + * Balance of the card + *-------------------------------------------------------------------------*/ +if ( $ss_action=='bal') + { + require_once('balance_card.inc.php'); + } diff --git a/include/supplier_card.inc.php b/include/supplier_card.inc.php index e8f037d09..9849eb209 100644 --- a/include/supplier_card.inc.php +++ b/include/supplier_card.inc.php @@ -27,9 +27,7 @@ * the customer category */ require_once('class_contact.php'); -require_once('class_ipopup.php'); -echo ICard::ipopup('ipopcard'); /* $sub_action = sb = detail */ /* $cn database conx */ @@ -56,6 +54,9 @@ case 'op': case 'let': $def=6; break; +case 'bal': + $def=7; + break; default: $def=1; $ss_action='dc'; @@ -68,6 +69,7 @@ echo ShowItem(array( array($root.'&sc=sv',_('Suivi'),_('Suivi Fournisseur, devis, bon de commande, courrier'),2), array($root.'&sc=cn',_('Contact'),_('Liste de contacts de ce fournisseur'),3), array($root.'&sc=op',_('Opérations'),_('Toutes les opérations'),4), + array($root.'&sc=bal',_('Balance'),_('Balance du fournisseur'),7), array($root.'&sc=let',_('Lettrage'),_('Opérations & Lettrages'),6), array('?p_action=supplier&'.dossier::get(),_('Retour liste'),_('Retour à la liste des fournisseurs'),5) ), @@ -101,6 +103,13 @@ if ( $ss_action == 'op') { require_once('operation_supplier.inc.php'); } +/*------------------------------------------------------------------------- + * Balance of the card + *-------------------------------------------------------------------------*/ +if ( $ss_action=='bal') + { + require_once('balance_card.inc.php'); + } /*---------------------------------------------------------------------- * All the contact *
"._('Date')."