370 lines
14 KiB
PHP
370 lines
14 KiB
PHP
|
<?php
|
||
|
require_once ('Config/config.php');
|
||
|
require_once ('../includes/giant/modulesGiants/Functions.php');
|
||
|
require_once ('../includes/giant/modulesGiants/Class/Rapport.Class.php');
|
||
|
require_once ('../includes/giant/RapportGiant.php');
|
||
|
|
||
|
$commande_id = $_GET['OrderId'];
|
||
|
abstract class AccountItem { }
|
||
|
class AmountAccountItem extends AccountItem { }
|
||
|
class AccountItemGroup extends AccountItem { }
|
||
|
class AmountType { }
|
||
|
$c = $rapport->Company;
|
||
|
$structure = new RapportFormat();
|
||
|
$structure->_CompanyIdentitie($config, $configNace);
|
||
|
?>
|
||
|
<div id="center">
|
||
|
<?php
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Identite de l'entreprise
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h2>IDENTITÉ DE L\'ENTREPRISE</h2>';
|
||
|
echo '<table style="margin-left:30px">';
|
||
|
foreach($rapport->Company as $objs => $valeur)
|
||
|
{?>
|
||
|
<tr>
|
||
|
<td width="30%" valign="top">
|
||
|
<?php if($icon = _getLient($objs))?>
|
||
|
<img alt="" src="pages/giant/media/icons/<?php echo $icon;?>" />
|
||
|
<b><?php echo SelectTrueLabel($config['Section_rapportIdentitie'], $objs)?></b>
|
||
|
</td>
|
||
|
<td width="600"><?php $structure->CompanyIdentitie->_selectFunction($objs, $valeur); ?></td>
|
||
|
<td width="10"></td>
|
||
|
</tr>
|
||
|
<?php }
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Activite(s) et chiffre d'affaire
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
if (isset($c->Operations->IndustryCode) == true ||
|
||
|
isset($c->FinancialSummary) == true ||
|
||
|
isset($capital) == true ||
|
||
|
isset($c->Employees) == true) {
|
||
|
print '<h2>Activité(s) & Chiffre d\'affaire</h2>';
|
||
|
print '<table>';
|
||
|
if (isset($c->Operations->IndustryCode) == true) {
|
||
|
$libelle = 'Activité(s)';
|
||
|
foreach (getArray($c->Operations->IndustryCode) as $t) {
|
||
|
$desc = 'Nace '.$t->NaceCode;
|
||
|
if ( isset($t->Description->_) == true) {
|
||
|
$desc .= ' '.$t->Description->_;
|
||
|
}
|
||
|
dRow($libelle, $desc);
|
||
|
$libelle = '';
|
||
|
}
|
||
|
}
|
||
|
if (isset($c->FinancialSummary) == true) {
|
||
|
$tab = getArray($c->FinancialSummary);
|
||
|
$date = 0;
|
||
|
foreach ($tab as $t) {
|
||
|
if ($t->SummaryDate->_ > $date &&
|
||
|
isset($t->AuthorizedCapital) == true) {
|
||
|
$capital = $t->AuthorizedCapital->_;
|
||
|
$date = $t->SummaryDate->_;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if (isset($capital) == false &&
|
||
|
isset($c->ShareCapital->AuthorizedCapital->_) == true &&
|
||
|
(isset($c->ShareCapital->AuthorizedCapital->currency) == false ||
|
||
|
$c->ShareCapital->AuthorizedCapital->currency == 'EUR')) {
|
||
|
$capital = $c->ShareCapital->AuthorizedCapital->_;
|
||
|
}
|
||
|
if (isset($capital) == true) {
|
||
|
dRow('Capital', $capital.' €');
|
||
|
}
|
||
|
if (isset($c->Employees) == true) {
|
||
|
$annee = 0;
|
||
|
$total = 0;
|
||
|
foreach (getArray($c->Employees) as $t) {
|
||
|
if (isset($t->Period) == true) {
|
||
|
if (isset($t->Period->StartDate->_) == true &&
|
||
|
$t->Period->StartDate->_ > $annee) {
|
||
|
$annee = $t->Period->StartDate->_;
|
||
|
$total = $t->TotalStaffEmployed + 0;
|
||
|
} else if (isset($t->Period->EndDate->_) == true &&
|
||
|
$t->Period->EndDate->_ > $annee) {
|
||
|
$annee = $t->Period->EndDate->_;
|
||
|
$total = $t->TotalStaffEmployed + 0;
|
||
|
}
|
||
|
} else {
|
||
|
$total = $t->TotalStaffEmployed + 0;
|
||
|
}
|
||
|
}
|
||
|
if ($total > 0) {
|
||
|
if ($annee > 0) {
|
||
|
dRow('Effectif de l\'entreprise',
|
||
|
$total.' salarié(s) en '.substr($annee, 0, 4));
|
||
|
} else {
|
||
|
dRow('Effectif de l\'entreprise', $total.' salarié(s)');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
print '</table>';
|
||
|
}
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Bilans
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
if (isset($c->AnnualAccounts) == true) {
|
||
|
print '<h1>ÉLÉMENTS FINANCIERS - BILANS</h1>';
|
||
|
print '<center>';
|
||
|
print '<table rules="groups" cellpadding="4">';
|
||
|
printAccountItem($c, 'ACTIF');
|
||
|
printAccountItem($c, 'PASSIF');
|
||
|
printAccountItem($c, 'COMPTE DE RÉSULTAT');
|
||
|
print '</table>';
|
||
|
print '</center>';
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Etablissements
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
if (isset($c->Branch) == true) {
|
||
|
print '<h1>Établissements</h1>';
|
||
|
print '<table>';
|
||
|
foreach (getArray($c->Branch) as $t) {
|
||
|
if (isset($t->BranchName->_) == true) {
|
||
|
$libelle = $t->BranchName->_;
|
||
|
} else if (isset($t->BranchName) == true) {
|
||
|
$libelle = $t->BranchName;
|
||
|
} else if (isset($t->BranchId) == true) {
|
||
|
$libelle = $t->BranchId;
|
||
|
}
|
||
|
dRow($libelle,
|
||
|
$c->CompanyAddress->HouseNumber.' '.
|
||
|
$c->CompanyAddress->Street.' '.
|
||
|
$c->CompanyAddress->PostCode.' '.
|
||
|
$c->CompanyAddress->City.' '.
|
||
|
$c->CompanyAddress->Country);
|
||
|
}
|
||
|
print '</table>';
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Paiements
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
if (isset($c->PaymentBehaviour) == true) {
|
||
|
print '<h1>Paiements</h1>';
|
||
|
print '<table>';
|
||
|
$date = '';
|
||
|
if (isset($c->PaymentBehaviour->Period->StartDate) == true) {
|
||
|
$date = pdate($c->PaymentBehaviour->Period->StartDate);
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->Period->EndDate) == true) {
|
||
|
$date .= ' -> '.pdate($c->PaymentBehaviour->Period->EndDate);
|
||
|
}
|
||
|
if (empty($date) == false) {
|
||
|
dRow('Date', $date);
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->DebtorDays) == true) {
|
||
|
dRow('DebtorDays', $c->PaymentBehaviour->DebtorDays);
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->CreditorDays) == true) {
|
||
|
dRow('CreditorDays', $c->PaymentBehaviour->CreditorDays);
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->LiquidityAssessment) == true) {
|
||
|
$desc = $c->PaymentBehaviour->LiquidityAssessment->Qualification;
|
||
|
if (isset($c->PaymentBehaviour->LiquidityAssessment
|
||
|
->AdditionalQualification) == true) {
|
||
|
$desc .= ', '.$c->PaymentBehaviour->LiquidityAssessment
|
||
|
->AdditionalQualification->_;
|
||
|
}
|
||
|
dRow('LiquidityAssessment', $desc);
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->PaymentQualification) == true) {
|
||
|
$desc = $c->PaymentBehaviour->PaymentQualification->Qualification;
|
||
|
if (isset($c->PaymentBehaviour->PaymentQualification
|
||
|
->AdditionalQualification) == true) {
|
||
|
$desc .= ', '.$c->PaymentBehaviour->PaymentQualification
|
||
|
->AdditionalQualification->_;
|
||
|
}
|
||
|
dRow('PaymentQualification', $desc);
|
||
|
}
|
||
|
print '</table>';
|
||
|
if (isset($c->PaymentBehaviour->AnalysisByPeriod) == true) {
|
||
|
$ap = $c->PaymentBehaviour->AnalysisByPeriod;
|
||
|
$tab = array();
|
||
|
foreach ($ap->Category as $cat) {
|
||
|
$trim =
|
||
|
pdate($cat->Period->StartDate).' - '.
|
||
|
pdate($cat->Period->EndDate);
|
||
|
$total = 0;
|
||
|
foreach (getArray($cat->DueDateExceeds) as $e) {
|
||
|
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
|
||
|
$total += $e->Percentage;
|
||
|
} else {
|
||
|
$lab =
|
||
|
$e->NrOfDaysExceeds->LowerLimit->_.' to '.
|
||
|
$e->NrOfDaysExceeds->UpperLimit->_;
|
||
|
$tab[$lab][$trim] = $e->Percentage;
|
||
|
}
|
||
|
}
|
||
|
$tab['90-'][$trim] = $total;
|
||
|
}
|
||
|
ksort($tab);
|
||
|
print '<h2>'.$ap->Description->_.'</h2>';
|
||
|
print '<table cellpadding="10">';
|
||
|
print '<tr>';
|
||
|
print '<td>Quarter</td>';
|
||
|
print '<td>Within term</td>';
|
||
|
foreach ($tab as $tranche => $valeurs) {
|
||
|
print '<td>'.$tranche.'</td>';
|
||
|
}
|
||
|
print '</tr>';
|
||
|
foreach ($ap->Category as $cat) {
|
||
|
$trim =
|
||
|
pdate($cat->Period->StartDate).' - '.
|
||
|
pdate($cat->Period->EndDate);
|
||
|
print '<tr align="right">'.
|
||
|
'<td>'.$trim.'</td>'.
|
||
|
'<td>'.$cat->PercentageWithinTerms.' %</td>';
|
||
|
foreach ($tab as $tranche => $valeurs) {
|
||
|
if (isset($tab[$tranche][$trim]) == true) {
|
||
|
print '<td>'.$tab[$tranche][$trim].' %</td>';
|
||
|
} else {
|
||
|
print '<td>0 %</td>';
|
||
|
}
|
||
|
}
|
||
|
print '</tr>';
|
||
|
}
|
||
|
print '</table>';
|
||
|
}
|
||
|
if (isset($c->PaymentBehaviour->AnalysisByAmount) == true) {
|
||
|
$ap = $c->PaymentBehaviour->AnalysisByAmount;
|
||
|
$tab = array();
|
||
|
foreach ($ap->Category as $cat) {
|
||
|
$amount = '';
|
||
|
if ( isset($cat->AmountCategory->LowerLimit) == true) {
|
||
|
$amount .= $cat->AmountCategory->LowerLimit->_;
|
||
|
}
|
||
|
$amount .= '-';
|
||
|
if ( isset($cat->AmountCategory->HigherLimit) == true) {
|
||
|
$amount .= $cat->AmountCategory->HigherLimit->_;
|
||
|
}
|
||
|
$total = 0;
|
||
|
foreach (getArray($cat->DueDateExceeds) as $e) {
|
||
|
if ($e->NrOfDaysExceeds->LowerLimit->_ >= 90) {
|
||
|
$total += $e->Percentage;
|
||
|
} else {
|
||
|
$lab =
|
||
|
$e->NrOfDaysExceeds->LowerLimit->_.' to '.
|
||
|
$e->NrOfDaysExceeds->UpperLimit->_;
|
||
|
$tab[$lab][$amount] = $e->Percentage;
|
||
|
}
|
||
|
}
|
||
|
$tab['90-'][$amount] = $total;
|
||
|
}
|
||
|
ksort($tab);
|
||
|
print '<h2>'.$ap->Description->_.'</h2>';
|
||
|
print '<table cellpadding="10">';
|
||
|
print '<tr>';
|
||
|
print '<td>Amount</td>';
|
||
|
print '<td>Within term</td>';
|
||
|
foreach ($tab as $tranche => $valeurs) {
|
||
|
print '<td>'.$tranche.'</td>';
|
||
|
}
|
||
|
print '</tr>';
|
||
|
foreach ($ap->Category as $cat) {
|
||
|
$amount = '';
|
||
|
if ( isset($cat->AmountCategory->LowerLimit) == true) {
|
||
|
$amount .= $cat->AmountCategory->LowerLimit->_;
|
||
|
}
|
||
|
$amount .= '-';
|
||
|
if ( isset($cat->AmountCategory->HigherLimit) == true) {
|
||
|
$amount .= $cat->AmountCategory->HigherLimit->_;
|
||
|
}
|
||
|
print '<tr>'.
|
||
|
'<td>'.$amount.'</td>'.
|
||
|
'<td>'.$cat->PercentageWithinTerms.' %</td>';
|
||
|
foreach ($tab as $tranche => $valeurs) {
|
||
|
if (isset($tab[$tranche][$amount]) == true) {
|
||
|
print '<td>'.$tab[$tranche][$amount].' %</td>';
|
||
|
} else {
|
||
|
print '<td>0 %</td>';
|
||
|
}
|
||
|
}
|
||
|
print '</tr>';
|
||
|
}
|
||
|
print '</table>';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Score
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
print '<h1>Score</h1>';
|
||
|
print '<table>';
|
||
|
if (isset($c->CreditRecommendation->Date) == true) {
|
||
|
dRow('Date', pdate($c->CreditRecommendation->Date));
|
||
|
}
|
||
|
if (isset($c->CreditRecommendation->RiskClasses) == true) {
|
||
|
foreach (getArray($c->CreditRecommendation
|
||
|
->RiskClasses->ProviderRiskClass) as $t) {
|
||
|
if (isset($t->Description->_) == true) {
|
||
|
$desc = ' '.
|
||
|
'<img src="img/info.gif"'.
|
||
|
' style="vertical-align:middle;"'.
|
||
|
' title="'.$t->Description->_.'"/>';
|
||
|
} else {
|
||
|
$desc = '';
|
||
|
}
|
||
|
dRow($t->RatingName->_.$desc, $t->RatingValue);
|
||
|
}
|
||
|
$t = $c->CreditRecommendation->RiskClasses->CommonRiskClass;
|
||
|
if (isset($t->Description->_) == true) {
|
||
|
$desc = ' '.
|
||
|
'<img src="img/info.gif"'.
|
||
|
' style="vertical-align:middle;"'.
|
||
|
' title="'.$t->Description->_.'"/>';
|
||
|
} else {
|
||
|
$desc = '';
|
||
|
}
|
||
|
dRow($t->RatingName->_.$desc, $t->RatingValue);
|
||
|
}
|
||
|
dRow('AmountAdvised', $c->CreditRecommendation->AmountAdvised->_.' '.
|
||
|
$c->CreditRecommendation->AmountAdvised->currency);
|
||
|
print '</table>';
|
||
|
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
// Ratios secteur
|
||
|
// --------------------------------------------------------------------------- //
|
||
|
/*if (isset($c->PeerGroup->FlexibleComparisonItems
|
||
|
->ComparisonItemsGroup[0]->FlexibleComparisonItem) == true) {
|
||
|
print '<h1>Ratios secteur</h1>';
|
||
|
print '<table>';
|
||
|
print '<tr>';
|
||
|
print '<td>';
|
||
|
print '</td>';
|
||
|
foreach ($c->PeerGroup->FlexibleComparisonItems->ComparisonItemsGroup as
|
||
|
$group) {
|
||
|
print '<td align="right"><b>';
|
||
|
print substr($group->Period->EndDate->_, 0, 4);
|
||
|
print '</b></td>';
|
||
|
print '<td align="right">';
|
||
|
print 'secteur';
|
||
|
print '</td>';
|
||
|
}
|
||
|
print '<tr>';
|
||
|
foreach ($c->PeerGroup->FlexibleComparisonItems
|
||
|
->ComparisonItemsGroup[0]->FlexibleComparisonItem as $i => $item) {
|
||
|
print '<tr>';
|
||
|
print '<td>';
|
||
|
print $item->ItemName->_;
|
||
|
print '</td>';
|
||
|
foreach ($c->PeerGroup->FlexibleComparisonItems->ComparisonItemsGroup as
|
||
|
$group) {
|
||
|
print '<td align="right">';
|
||
|
print $group->FlexibleComparisonItem[$i]->SubjectValue;
|
||
|
print '</td>';
|
||
|
print '<td align="right">';
|
||
|
print $group->FlexibleComparisonItem[$i]->AverageValue;
|
||
|
print '</td>';
|
||
|
}
|
||
|
print '</tr>';
|
||
|
}
|
||
|
print '</table>';
|
||
|
}
|
||
|
|
||
|
print '</div>';*/
|
||
|
?>
|
||
|
</div>
|