diff --git a/include/class_fiche.php b/include/class_fiche.php index ecf6fde92..48422efc0 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -1284,21 +1284,32 @@ function empty_attribute($p_attr) { * \param $p_search (filter) * \param $p_action show the action column * \param $p_sql SQL to filter the number of card must start with AND + * \param $p_amount true : only cards with at least one operation default : false * \return: string to display */ - function Summary($p_search="",$p_action="",$p_sql="") +function Summary($p_search="",$p_action="",$p_sql="",$p_amount=false) { + $str_dossier=dossier::get(); $p_search=FormatString($p_search); $script=$_SERVER['PHP_SELF']; // Creation of the nav bar // Get the max numberRow - $all_tiers=$this->CountByDef($this->fiche_def_ref,$p_search,$p_sql); + $filter_amount=''; + $User=new User($this->cn); + + $filter_year=" j_tech_per in (select p_id from parm_periode ". + "where p_exercice='".$User->get_exercice()."')"; + + if ( $p_amount) $filter_amount=' and f_id in (select f_id from jrnx where '.$filter_year.')'; + + $all_tiers=$this->CountByDef($this->fiche_def_ref,$p_search,$p_sql.$filter_amount); // Get offset and page variable $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0; $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1; $bar=jrn_navigation_bar($offset,$all_tiers,$_SESSION['g_pagesize'],$page); - // set a filter ? + + // set a filter ? $search=$p_sql; $user=new User($this->cn); @@ -1317,8 +1328,9 @@ function empty_attribute($p_attr) { ad_id=1 and av_text ~* '$p_search')"; } // Get The result Array - $step_tiers=$this->GetAll($offset,$search,'name'); - if ( $all_tiers == 0 ) return ""; + $step_tiers=$this->GetAll($offset,$search.$filter_amount,'name'); + + if ( $all_tiers == 0 || count($step_tiers)==0 ) return ""; $r=$bar; $r.=' @@ -1333,9 +1345,17 @@ $r.=''; return $r; $i=0; + foreach ($step_tiers as $tiers ) { $i++;$odd=""; if ($i % 2 == 0 ) $odd='class="odd"'; + /* Filter on the default year */ + + $amount=$tiers->get_solde_detail($filter_year); + + /* skip the tiers without operation */ + if ( $p_amount && $amount['debit']==0 && $amount['credit'] == 0 && $amount['solde'] == 0 ) continue; + $r.=""; $e=sprintf(' ', $script,$p_action,$tiers->id,$str_dossier); @@ -1348,15 +1368,10 @@ $r.=''; ""; - /* Filter on the default year */ - $User=new User($this->cn); - $filter_year=" j_tech_per in (select p_id from parm_periode ". - "where p_exercice='".$User->get_exercice()."')"; - $a=$tiers->get_solde_detail($filter_year); - $r.=sprintf('',$a['debit']); - $r.=sprintf('',$a['credit']); - $r.=sprintf('',$a['solde']); + $r.=sprintf('',$amount['debit']); + $r.=sprintf('',$amount['credit']); + $r.=sprintf('',$amount['solde']); $r.=""; diff --git a/include/client.inc.php b/include/client.inc.php index 0b0dc3f7b..e81433d48 100644 --- a/include/client.inc.php +++ b/include/client.inc.php @@ -30,14 +30,7 @@ require_once('class_fiche_def.php'); require_once('class_iaction.php'); require_once('class_fiche_def.php'); require_once('class_ipopup.php'); -echo js_include('accounting_item.js'); -echo js_include('prototype.js'); -echo js_include('scriptaculous.js'); -echo js_include('effects.js'); -echo js_include('controls.js'); -echo js_include('dragdrop.js'); -echo JS_CARD; -echo JS_AJAX_FICHE; + echo ICard::ipopup('ipop_newcard'); $ip_cat=new IPopup('ipop_cat'); $ip_cat->title=_('Ajout d\'une catégorie'); @@ -102,6 +95,10 @@ if ( $low_action == "list" ) $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1; $sel_card->javascript=' onchange="submit(this);"'; echo _('Catégorie :').$sel_card->input(); + $nooperation=new ICheckBox('noop'); + $nooperation->selected=(isset($_GET['noop']))?true:false; + + echo _('Inclure les clients sans opération :').$nooperation->input(); ?> @@ -115,9 +112,9 @@ if ( $low_action == "list" ) if ( isset($_GET['cat'])) { if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']); } - - echo '
'; - echo $client->Summary($search,'client',$sql); + $noop=(isset($_GET['noop']))?false:true; + echo '
'; + echo $client->Summary($search,'client',$sql,$noop); echo '
'; diff --git a/include/supplier.inc.php b/include/supplier.inc.php index 11669657b..7fef8c2ba 100644 --- a/include/supplier.inc.php +++ b/include/supplier.inc.php @@ -102,6 +102,10 @@ if ( $low_action == "list" ) $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1; $sel_card->javascript=' onchange="submit(this);"'; echo _('Catégorie :').$sel_card->input(); + $nooperation=new ICheckBox('noop'); + $nooperation->selected=(isset($_GET['noop']))?true:false; + echo _('Inclure les fournisseurs sans opération :').$nooperation->input(); + ?> @@ -114,8 +118,10 @@ if ( $low_action == "list" ) if ( isset($_GET['cat'])) { if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']); } + $noop=(isset($_GET['noop']))?false:true; + echo '
'; - echo $supplier->Summary($search,'supplier',$sql); + echo $supplier->Summary($search,'supplier',$sql,$noop); echo '
';
%15.2f€ %15.2f€ %15.2f€ %15.2f€ %15.2f€ %15.2f€