195 lines
6.4 KiB
PHP
195 lines
6.4 KiB
PHP
|
<?php
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// giant_rapport.php
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
$commande_id = $_GET['OrderId'];
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// dRow
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
function dRow($lib, $data, $title = '')
|
||
|
{
|
||
|
$html = '<tr>'."\n";
|
||
|
$html.= ' <td width="30"> </td>'."\n";
|
||
|
$html.= ' <td width="200" class="StyleInfoLib">'.$lib.'</td>'."\n";
|
||
|
|
||
|
if ($title!='') {
|
||
|
$title = ' title="'.$title.'"';
|
||
|
}
|
||
|
$html.= ' <td width="350" class="StyleInfoData"'.
|
||
|
$title.'>'.$data.'</td>'."\n";
|
||
|
$html.= '</tr>'."\n";
|
||
|
print $html;
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// getArray
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
function getArray($obj)
|
||
|
{
|
||
|
if (is_array($obj) == false) {
|
||
|
return array($obj);
|
||
|
} else {
|
||
|
return $obj;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// printObj
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
function printObj($obj)
|
||
|
{
|
||
|
$ret = '';
|
||
|
foreach ($obj as $val) {
|
||
|
if (is_object($val) == true) {
|
||
|
$ret .= printObj($val);
|
||
|
} else {
|
||
|
$ret .= $val.' ';
|
||
|
}
|
||
|
}
|
||
|
return $ret;
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Type de rapport
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
require_once 'dbbootstrap.php';
|
||
|
setDbConn('giantclient');
|
||
|
|
||
|
$r = Doctrine_Query::create()
|
||
|
->from('Rapports')
|
||
|
->where('OrderId = ?', $commande_id)
|
||
|
->fetchOne();
|
||
|
|
||
|
print '<div id="center">';
|
||
|
switch ($r->DataSetType) {
|
||
|
case 'Full':
|
||
|
print '<h1>RAPPORT COMPLET</h1>';
|
||
|
break;
|
||
|
case 'Compact':
|
||
|
print '<h1>RAPPORT DE SYNTHESE</h1>';
|
||
|
break;
|
||
|
}
|
||
|
$d = unserialize($r->DataSet);
|
||
|
$c = $d->Company;
|
||
|
print '<p id="rsynthese">SOCIÉTÉ : '.$c->CompanyName->_.'</p>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Identite de l'entreprise
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h1>IDENTITE DE L\'ENTREPRISE</h1>';
|
||
|
print '<table>';
|
||
|
dRow('Numéro identifiant', $c->CompanyId);
|
||
|
dRow('Numéro de TVA Intracom.', $c->Vat->VatNumber);
|
||
|
dRow('Numéro de Securité Sociale', $c->SocialSecurityNumber);
|
||
|
dRow('Etablissement actif', ($c->CompanyStatus == 'Active')? 'Oui':'Non');
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Raison sociale et coordonnees
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h2>Raison sociale & Coordonnées</h2>';
|
||
|
print '<table>';
|
||
|
dRow('Raison Sociale', $c->CompanyName->_);
|
||
|
dRow('Forme juridique', $c->LegalForm->CountryLegalForm->code.' : '.
|
||
|
$c->LegalForm->CountryLegalForm->_);
|
||
|
dRow('Adresse',
|
||
|
$c->CompanyAddress->HouseNumber.' '.
|
||
|
$c->CompanyAddress->Street.' '.
|
||
|
$c->CompanyAddress->PostCode.' '.
|
||
|
$c->CompanyAddress->City.' '.
|
||
|
$c->CompanyAddress->Country);
|
||
|
$libelle = 'Téléphone(s)';
|
||
|
foreach (getArray($c->TelephoneNumber) as $t) {
|
||
|
$mobile = (isset($t->isMobile) == true &&
|
||
|
$t->isMobile == 1) ? ' (mobile)' : '';
|
||
|
dRow($libelle, $t->_.$mobile);
|
||
|
$libelle = '';
|
||
|
}
|
||
|
dRow('Fax', $c->Telefax);
|
||
|
dRow('Site Internet',
|
||
|
'<a href="'.$c->WebAddress.'" target="_blank">'.$c->WebAddress.'</a>');
|
||
|
dRow('Courriel',
|
||
|
'<a href="mailto:'.$c->EmailAddress.'" target="_blank">'.
|
||
|
$c->EmailAddress.'</a>');
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Activite(s) et chiffre d'affaire
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h2>Activité(s) & Chiffre d\'affaire</h2>';
|
||
|
print '<table>';
|
||
|
$libelle = 'Activité(s)';
|
||
|
foreach (getArray($c->Operations->IndustryCode) as $t) {
|
||
|
dRow($libelle, $t->NaceCode.' '.$t->Description->_);
|
||
|
$libelle = '';
|
||
|
}
|
||
|
dRow('Capital', $c->FinancialSummary->AuthorizedCapital->_.' €');
|
||
|
$annee = 0;
|
||
|
$total = 0;
|
||
|
foreach (getArray($c->Employees) as $t) {
|
||
|
if ($t->Period->EndDate->_ > $annee) {
|
||
|
$annee = $t->Period->EndDate->_;
|
||
|
$total = $t->TotalStaffEmployed;
|
||
|
}
|
||
|
}
|
||
|
if ($total > 0) {
|
||
|
dRow('Effectif de l\'entreprise',
|
||
|
$total.' salarié(s) en '.substr($annee, 0, 4));
|
||
|
}
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Annonces legales
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h1>ANNONCES LÉGALES</h1>';
|
||
|
print '<table>';
|
||
|
foreach (getArray($c->Event) as $t) {
|
||
|
if (isset($t->Value) == true) {
|
||
|
dRow($t->Date->_, $t->Description->_.' '.printObj($t->Value));
|
||
|
} else {
|
||
|
dRow($t->Date->_, $t->Description->_);
|
||
|
}
|
||
|
}
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Dirigeants
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h1>DIRIGEANTS</h1>';
|
||
|
print '<table>';
|
||
|
foreach (getArray($c->Position) as $i => $t) {
|
||
|
if (isset($t->Person) == false) {
|
||
|
continue;
|
||
|
}
|
||
|
$date = '';
|
||
|
if (isset($t->Period->StartDate) == true) {
|
||
|
$date .= $t->Period->StartDate->_;
|
||
|
}
|
||
|
$date .= '-';
|
||
|
if (isset($t->Period->EndDate) == true) {
|
||
|
$date .= $t->Period->EndDate->_;
|
||
|
}
|
||
|
dRow($date,
|
||
|
$t->PositionTitle->_.' '.
|
||
|
$t->Person->LastName.' '.
|
||
|
$t->Person->FirstName);
|
||
|
}
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Synthese
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h1>Synthèse</h1>';
|
||
|
print '<table>';
|
||
|
dRow('Revenue', $c->FinancialSummary->Revenue->_);
|
||
|
dRow('TotalEquity', $c->FinancialSummary->TotalEquity->_);
|
||
|
dRow('ProfitLossBeforeTax', $c->FinancialSummary->ProfitLossBeforeTax->_);
|
||
|
dRow('ProfitLoss', $c->FinancialSummary->ProfitLoss->_);
|
||
|
dRow('WorkingCapital', $c->FinancialSummary->WorkingCapital->_);
|
||
|
dRow('AuthorizedCapital', $c->FinancialSummary->AuthorizedCapital->_);
|
||
|
dRow('PaidUpCapital', $c->FinancialSummary->PaidUpCapital->_);
|
||
|
print '</table>';
|
||
|
print '</div>';
|
||
|
?>
|