fiche_def_ref=FICHE_TYPE_FOURNISSEUR; fiche::fiche($p_cn,$p_id) ; } /*! \brief Get all info contains in the view * thanks to the poste elt (account) */ function get_by_account($p_poste=0) { $this->poste=($p_poste==0)?$this->poste:$p_poste; $sql="select * from vw_supplier where poste_comptable=".$this->poste; $Res=ExecSql($this->cn,$sql); if ( pg_NumRows($Res) == 0) return null; // There is only _one_ row by supplier $row=pg_fetch_array($Res,0); $this->name=$row['name']; $this->id=$row['f_id']; $this->street=$row['rue']; $this->cp=$row['code_postal']; $this->country=$row['pays']; $this->vat_number=$row['tva_num']; } /*! ************************************************** * \brief show the default screen * * \param p_search (filter) * \return string to display */ function Summary($p_search) { $str_dossier=dossier::get(); $p_search=FormatString($p_search); $url=urlencode($_SERVER['REQUEST_URI']); $script=basename($_SERVER['PHP_SELF']); // Creation of the nav bar // Get the max numberRow $all_supplier=$this->CountByDef($this->fiche_def_ref,$p_search); // 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_supplier,$_SESSION['g_pagesize'],$page); // set a filter ? $search=""; $user=new User($this->cn); $exercice=$user->get_exercice(); $tPeriode=new Periode($this->cn); list($max,$min)=$tPeriode->get_limit($exercice); if ( trim($p_search) != "" ) { $search=" and f_id in (select f_id from jnt_fic_att_value join fiche using (f_id) join attr_value using (jft_id) where ad_id=1 and av_text ~* '$p_search')"; } // Get The result Array $step_supplier=$this->GetAll($offset,$search); if ( $all_supplier == 0 ) return ""; $r=$bar; $r.='
| Quick Code | Nom | Adresse | Total débit | Total crédit | Solde | Action | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| $e".$supplier->strAttribut(ATTR_DEF_QUICKCODE)." | "; $r.="".h($supplier->strAttribut(ATTR_DEF_NAME))." | "; $r.="".h($supplier->strAttribut(ATTR_DEF_ADRESS). " ".$supplier->strAttribut(ATTR_DEF_CP). " ".$supplier->strAttribut(ATTR_DEF_PAYS)). " | "; /* 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=$supplier->get_solde_detail($filter_year); $r.=sprintf('%15.2f€ | ',$a['debit']); $r.=sprintf('%15.2f€ | ',$a['credit']); $r.=sprintf('%15.2f€ | ',$a['solde']); if ( $script == 'commercial.php') { $r.=sprintf('Contact | ', $script,$supplier->strAttribut(ATTR_DEF_QUICKCODE),$str_dossier,$url); $r.=sprintf('Courrier | ', $script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$str_dossier,$url); } $r.='Facture | '; $r.=sprintf('Financier | ', $supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$url); $r.=sprintf('Operation | ', $supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$str_dossier,$max->p_id,$min->p_id); $r.=''; $r.="