Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Supplier Class Reference

class Supplier are a specific kind of card More...

Inheritance diagram for Supplier:

fiche

Public Member Functions

 Supplier ($p_cn, $p_id=0)
 Constructor /* only a db connection is needed.
 GetFromPoste ($p_poste=0)
 Get all info contains in the view thanks to the poste elt (account).
 Summary ($p_search)

Data Fields

 $poste
 $name
 $street
 $country
 $cp
 $vat_number

Detailed Description

class Supplier are a specific kind of card

Definition at line 38 of file class_supplier.php.


Constructor & Destructor Documentation

Supplier::Supplier p_cn,
p_id = 0
 

Constructor /* only a db connection is needed.

Definition at line 49 of file class_supplier.php.

References fiche::fiche().

00049                                    {
00050       $this->fiche_def_ref=FICHE_TYPE_FOURNISSEUR;
00051       fiche::fiche($p_cn,$p_id) ;
00052 
00053   }


Member Function Documentation

Supplier::GetFromPoste p_poste = 0  ) 
 

Get all info contains in the view thanks to the poste elt (account).

Definition at line 57 of file class_supplier.php.

References $Res, $row, $sql, ExecSql(), f_id, and name.

00057                                     {
00058     $this->poste=($p_poste==0)?$this->poste:$p_poste;
00059     $sql="select * from vw_supplier where poste_comptable=".$this->poste;
00060     $Res=ExecSql($this->cn,$sql);
00061     if ( pg_NumRows($Res) == 0) return null;
00062     // There is only _one_ row by supplier
00063     $row=pg_fetch_array($Res,0);
00064     $this->name=$row['name'];
00065     $this->id=$row['f_id'];    
00066     $this->street=$row['rue'];    
00067     $this->cp=$row['code_postal'];
00068     $this->country=$row['pays'];
00069     $this->vat_number=$row['tva_num'];
00070 
00071   }

Supplier::Summary p_search  ) 
 

Summary

show the default screen

parm :

  • p_search (filter) gen :
  • return: string to display

Definition at line 83 of file class_supplier.php.

References $a, $bar, $e, $filter_year, $offset, $page, $r, $search, $url, $User, fiche::CountByDef(), FormatString(), fiche::GetAll(), jrn_navigation_bar(), poste, and table.

00084     {
00085       $p_search=FormatString($p_search);
00086       $url=urlencode($_SERVER['REQUEST_URI']);
00087       $script=$_SERVER['SCRIPT_NAME'];
00088       // Creation of the nav bar
00089       // Get the max numberRow
00090       $all_supplier=$this->CountByDef($this->fiche_def_ref,$p_search); 
00091       // Get offset and page variable
00092       $offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
00093       $page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
00094       $bar=jrn_navigation_bar($offset,$all_supplier,$_SESSION['g_pagesize'],$page);
00095       // set a filter ?
00096       $search="";
00097       if ( trim($p_search) != "" )
00098         {
00099           $search=" and f_id in
00100 (select f_id from jnt_fic_att_value 
00101                   join fiche using (f_id) 
00102                   join attr_value using (jft_id)
00103                 where
00104                 ad_id=1 and av_text ~* '$p_search')";
00105         }
00106       // Get The result Array
00107       $step_supplier=$this->GetAll($offset,$search);
00108       if ( $all_supplier == 0 ) return "";
00109       $r=$bar;
00110       $r.='<table>
00111 <TR style="background-color:lightgrey;">
00112 <TH>Quick Code</TH>
00113 <th>Nom</th>
00114 <th>Adresse</th>
00115 <th>Solde</th>
00116 <th colspan="3">Action </th>
00117 </TR>';
00118       if ( sizeof ($step_supplier ) == 0 )
00119         return $r;
00120       foreach ($step_supplier as $supplier ) {
00121         $r.="<TR>";
00122         $e=sprintf('<A HREF="%s?p_action=fournisseur&sa=detail&f_id=%d&url=%s" title="Détail"> ',
00123                     $script,$supplier->id,$url);
00124 
00125         $r.="<TD> $e".$supplier->strAttribut(ATTR_DEF_QUICKCODE)."</A></TD>";
00126         $r.="<TD>".$supplier->strAttribut(ATTR_DEF_NAME)."</TD>";
00127         $r.="<TD>".$supplier->strAttribut(ATTR_DEF_ADRESS).
00128           " ".$supplier->strAttribut(ATTR_DEF_CP).
00129           " ".$supplier->strAttribut(ATTR_DEF_PAYS).
00130           "</TD>";
00131 
00132         $post=new poste($this->cn,$supplier->strAttribut(ATTR_DEF_ACCOUNT));
00133         /* Filter on the default year */
00134         $User=new cl_user($this->cn);
00135         $filter_year="  j_tech_per in (select p_id from parm_periode ".
00136                      "where p_exercice='".$User->getExercice()."')";
00137         $a=$post->GetSoldeDetail($filter_year);
00138 
00139 
00140         $r.=sprintf('<TD align="right"> %15.2f&euro;</TD>',$a['solde']);
00141 
00142 
00143         $r.=sprintf('<td><A HREF="%s?p_action=contact&qcode=%s&url=%s" title="Contact">Contact</A></td>',
00144                     $script,$supplier->strAttribut(ATTR_DEF_QUICKCODE),$url);
00145         $r.=sprintf('<td><A HREF="%s?p_action=suivi_courrier&sa=list&qcode=%s&url=%s" title="Action">Courrier</A></td> ',
00146                     $script,$supplier->strAttribut(ATTR_DEF_QUICKCODE) ,$url);
00147 
00148 
00149 
00150         $r.='<td><A HREF="commercial.php?p_action=depense&sa=list&p_periode=-1&qcode='.$supplier->strAttribut(ATTR_DEF_QUICKCODE).'&url='.$url.'" title="Historique Facture">Facture</A></td>';
00151 
00152         $r.='</TD>';
00153 
00154         $r.="</TR>";
00155 
00156       }
00157       $r.="</TABLE>";
00158       $r.=$bar;
00159       return $r;
00160     }


Field Documentation

Supplier::$country
 

Country

Definition at line 43 of file class_supplier.php.

Supplier::$cp
 

Zip code

Definition at line 44 of file class_supplier.php.

Supplier::$name
 

name of the company

Definition at line 41 of file class_supplier.php.

Supplier::$poste
 

poste comptable

Definition at line 40 of file class_supplier.php.

Supplier::$street
 

Street

Definition at line 42 of file class_supplier.php.

Supplier::$vat_number
 

vat number

Definition at line 45 of file class_supplier.php.


The documentation for this class was generated from the following file: