From 760486d21ebfade95780b52b5898100fe49a991a Mon Sep 17 00:00:00 2001 From: Sebastien BEAUGRAND Date: Fri, 14 Jan 2011 10:22:47 +0000 Subject: [PATCH] giant: suppr getArray suite --- includes/giant/client.php | 1 + includes/giant/rapport-html.php | 901 +++++++++++++++++++++++++++++++ includes/liasse/functions.php | 265 ++++------ www/pages/giant_rapport.php | 905 +------------------------------- 4 files changed, 1015 insertions(+), 1057 deletions(-) create mode 100644 includes/giant/rapport-html.php diff --git a/includes/giant/client.php b/includes/giant/client.php index 6bfefc4c2..944707fa5 100644 --- a/includes/giant/client.php +++ b/includes/giant/client.php @@ -96,6 +96,7 @@ function giantEtatDeCommande(&$commande) $O = $gclient->__call('RetrieveOrderStatus', array($o)); } catch (SoapFault $f) { giantErreurSoap($gclient, $f, true); + return $commande->OrderStatus; } $status = $O->Order->OrderStatus; diff --git a/includes/giant/rapport-html.php b/includes/giant/rapport-html.php new file mode 100644 index 000000000..1aa67ddb5 --- /dev/null +++ b/includes/giant/rapport-html.php @@ -0,0 +1,901 @@ +'."\n"; + $html .= '  '."\n"; + $html .= ' '.$lib.''."\n"; + + if ($title != '') { + $title = ' title="'.$title.'"'; + } + $html .= ' '.$data.''."\n"; + $html .= ''."\n"; + print $html; +} + +// -------------------------------------------------------------------------- // +// dRow2 +// -------------------------------------------------------------------------- // +function dRow2($lib, $data, $id) +{ + $html = ''."\n"; + $html .= '  '."\n"; + $html .= ' '.$lib .''."\n"; + $html .= ' '.$data.''."\n"; + $html .= ' '.$id .''."\n"; + $html .= ''."\n"; + print $html; +} + +// -------------------------------------------------------------------------- // +// printObj +// -------------------------------------------------------------------------- // +function printObj($obj) +{ + $ret = ''; + foreach ($obj as $val) { + if (is_object($val) == true || is_array($val) == true) { + $ret .= printObj($val); + } else if ($val == 'OldValue' || + $val == 'NewValue') { + $ret .= '('.$val.') '; + } else if ($val != 'eq') { + $ret .= $val.' '; + } + } + return $ret; +} + +// -------------------------------------------------------------------------- // +// cmp +// -------------------------------------------------------------------------- // +function cmp($a, $b) +{ + if ($a->Date->_ == $b->Date->_) { + return 0; + } + return ($a->Date->_ < $b->Date->_) ? 1 : -1; +} + +// -------------------------------------------------------------------------- // +// pdate +// -------------------------------------------------------------------------- // +function pdate($d) +{ + if (isset($d->format) == false) { + if (isset($d->_) == true) { + return $d->_; + } else { + return $d; + } + } + $f = substr($d->format, 0, 1); + $date = ''; + for ($i = 0; $i < strlen($d->format); ++$i) { + if (substr($d->format, $i, 1) != $f) { + $f = substr($d->format, $i, 1); + $date .= ' / '; + } + $date .= substr($d->_, $i, 1); + } + return $date; +} + +// -------------------------------------------------------------------------- // +// arrayInsert +// -------------------------------------------------------------------------- // +function arrayInsert($array, $pos, $value) +{ + return array_merge(array_slice($array, 0 , $pos), + array($value), + array_slice($array, $pos)); +} + +// -------------------------------------------------------------------------- // +// fillAccountItem +// -------------------------------------------------------------------------- // +function fillAccountItem(&$tab, &$num, &$item, $year, $level = 0, $desPrec = '') +{ + if (isset($item->AccountItem) == true || + isset($item->GroupTotalAmount) == true) { + if (isset($item->AccountItem) == true) { + foreach ($item->AccountItem as $it) { + if (isset($item->Description->_) == true) { + fillAccountItem($tab, $num, $it, $year, + $level + 1, $desPrec.$item->Description->_); + } else { + fillAccountItem($tab, $num, $it, $year, + $level + 1, $desPrec); + } + } + } + if (isset($item->GroupTotalAmount) == true) { + if (isset($tab[$num]) == true) { + for ($i = $num; $i < count($tab); ++$i) { + if (isset($item->Description->code) == true) { + $code = $item->Description->code; + } else { + $code = $desPrec.$item->Description->_; + } + if ($tab[$i]->cde == $code) { + $num = $i; + $tab[$num]->val[$year] = $item->GroupTotalAmount->_; + return; + } + } + $obj = new StdClass; + $obj->des = $item->Description->_; + $obj->val[$year] = $item->GroupTotalAmount->_; + if (isset($item->Description->code) == true) { + $obj->cde = $item->Description->code; + } else { + $obj->cde = $desPrec.$item->Description->_; + } + $obj->niv = $level; + $tab = arrayInsert($tab, $num, $obj); + } else { + $obj = new StdClass; + $obj->des = $item->Description->_; + $obj->val[$year] = $item->GroupTotalAmount->_; + if (isset($item->Description->code) == true) { + $obj->cde = $item->Description->code; + } else { + $obj->cde = $desPrec.$item->Description->_; + } + $obj->niv = $level; + $tab[$num] = $obj; + } + ++$num; + } + } else { + if (isset($tab[$num]) == true) { + for ($i = 0; $i < count($tab); ++$i) { + if (isset($item->Description->code) == true) { + $code = $item->Description->code; + } else { + $code = $desPrec.$item->Description->_; + } + if ($tab[$i]->cde == $code) { + $num = $i; + $tab[$num]->val[$year] = $item->Value->_; + return; + } + } + $obj = new StdClass; + $obj->des = $item->Description->_; + $obj->val[$year] = $item->Value->_; + if (isset($item->Description->code) == true) { + $obj->cde = $item->Description->code; + } else { + $obj->cde = $desPrec.$item->Description->_; + } + $obj->niv = $level; + $tab = arrayInsert($tab, $num, $obj); + } else { + $obj = new StdClass; + $obj->des = $item->Description->_; + $obj->val[$year] = $item->Value->_; + if (isset($item->Description->code) == true) { + $obj->cde = $item->Description->code; + } else { + $obj->cde = $desPrec.$item->Description->_; + } + $obj->niv = $level; + $tab[$num] = $obj; + } + ++$num; + } +} + +// -------------------------------------------------------------------------- // +// printAccountItem +// -------------------------------------------------------------------------- // +function printAccountItem(&$company, $title) +{ + $tab = array(); + $years = array(); + foreach ($company->AnnualAccounts as $a) { + switch ($title) { + case 'ACTIF': + $account = $a->OriginalAnnualAccounts->BalanceSheet->Assets[0]; + break; + case 'PASSIF': + $account = $a->OriginalAnnualAccounts->BalanceSheet->Liabilities[0]; + break; + default: + $account = $a->OriginalAnnualAccounts->ProfitAndLoss; + } + $num = 0; + $year = substr($a->AccountsDate->_, 0, 4); + $years[] = $year; + fillAccountItem($tab, $num, $account, $year); + } + rsort($years); + print ''. + ''. + $title.''; + foreach ($years as $y) { + print ''.$y.''; + } + $level = 0; + foreach ($tab as $line) { + while ($line->niv < $level) { + print ''; + --$level; + } + $level = $line->niv; + print ''; + print ''; + for ($i = 0; $i < $line->niv; ++$i) { + print ' '; + } + print $line->des; + print ''; + foreach ($years as $y) { + print ''; + if (isset($line->val[$y]) == true) { + print $line->val[$y]; + } + print ''; + } + print ''; + } +} + +// -------------------------------------------------------------------------- // +// printLiensFinanciers +// -------------------------------------------------------------------------- // +function printLiensFinanciers(&$company, $type) +{ + foreach ($company->Associated as $t) { + if ($t->RelationShip == $type) { + $libelle = ''; + if (isset($t->Shares) == true) { + $libelle = $t->Shares->Percentage.' %'; + } + $id = ''; + if (isset($t->Company->CompanyId) == true) { + $id = $t->Company->CompanyId; + } else if (isset($t->Company->CompanyAddress) == true && + isset($t->Company->CompanyAddress->Country) == true) { + $id = '('.$t->Company->CompanyAddress->Country.')'; + } + $name = ''; + if (isset($t->Company->CompanyName) == true) { + foreach ($t->Company->CompanyName as $n) { + $name .= ' '.$n->_; + } + } + dRow2($libelle, $name, $id); + } + } +} + +// -------------------------------------------------------------------------- // +// Type de rapport +// -------------------------------------------------------------------------- // +print '
'; +switch ($r->DataSetType) { +case 'Full': + print '

RAPPORT COMPLET

'; + break; +case 'Compact': + print '

RAPPORT DE SYNTHESE

'; + break; +case 'CreditRecommendation': + print '

RAPPORT DE SCORE

'; + break; +} +$d = unserialize($r->DataSet); +$c = $d->Company; +print '

SOCIÉTÉ : '; +if (count($c->CompanyName) > 1) { + foreach ($c->CompanyName as $name) { + print '
'.$name->_; + } +} else { + print $c->CompanyName[0]->_; +} +print '

'; + +// -------------------------------------------------------------------------- // +// Identite de l'entreprise +// -------------------------------------------------------------------------- // +print '

IDENTITÉ DE L\'ENTREPRISE

'; +print ''; +dRow('Numéro identifiant', $c->CompanyId); +if (isset($c->Vat->VatNumber) == true) { + dRow('Numéro de TVA Intracom.', $c->Vat->VatNumber); +} +if (isset($c->SocialSecurityNumber) == true) { + dRow('Numéro de Securité Sociale', $c->SocialSecurityNumber); +} +if (isset($c->CompanyStatus) == true) { + dRow('Etablissement actif', + ($c->CompanyStatus == 'Active') ? 'Oui' : 'Non'); +} +print '
'; + +// -------------------------------------------------------------------------- // +// Raison sociale et coordonnees +// -------------------------------------------------------------------------- // +print '

Raison sociale & Coordonnées

'; +print ''; +foreach ($c->CompanyName as $name) { + dRow('Raison Sociale', $name->_); +} +if (isset($c->TradeName) == true) { + $libelle = 'Enseigne(s)'; + foreach ($c->TradeName as $t) { + dRow($libelle, $t->_); + $libelle = ''; + } +} +if (isset($c->LegalForm->CountryLegalForm) == true) { + dRow('Forme juridique', + $c->LegalForm->CountryLegalForm->code.' : '. + $c->LegalForm->CountryLegalForm->_); +} +foreach ($c->CompanyAddress as $address) { + dRow('Adresse', + $address->HouseNumber.' '. + $address->Street.' '. + $address->PostCode.' '. + $address->City.' '. + $address->Country); +} +if (isset($c->TelephoneNumber) == true) { + $libelle = 'Téléphone(s)'; + foreach ($c->TelephoneNumber as $t) { + $mobile = (isset($t->isMobile) == true && + $t->isMobile == 1) ? ' (mobile)' : ''; + dRow($libelle, $t->_.$mobile); + $libelle = ''; + } +} +if (isset($c->Telefax) == true) { + $libelle = 'Fax'; + foreach ($c->Telefax as $t) { + dRow($libelle, $t); + $libelle = ''; + } +} +if (isset($c->WebAddress) == true) { + dRow('Site Internet', + ''.$c->WebAddress.''); +} +if (isset($c->EmailAddress) == true) { + dRow('Courriel', + ''. + $c->EmailAddress.''); +} +print '
'; + +// -------------------------------------------------------------------------- // +// Banques +// -------------------------------------------------------------------------- // +if (isset($c->Bank) == true) { + print '

Banques

'; + print ''; + foreach ($c->Bank as $t) { + $libelle = $t->BankName; + if (isset($t->BankIdentifierCode) == true) { + dRow($libelle, 'BIC: '.$t->BankIdentifierCode); + $libelle = ''; + } + if (isset($t->BankAccount) == true) { + foreach ($t->BankAccount as $ac) { + dRow($libelle, $ac->AccountType.': '. $ac->AccountNumber); + $libelle = ''; + } + } + if (isset($t->BankAddress) == true) { + $adresse = ''; + if ( isset($t->BankAddress->HouseNumber) == true) { + $adresse .= $t->BankAddress->HouseNumber.' '; + } + if ( isset($t->BankAddress->Street) == true) { + $adresse .= $t->BankAddress->Street.' '; + } + if ( isset($t->BankAddress->PostCode) == true) { + $adresse .= $t->BankAddress->PostCode.' '; + } + if ( isset($t->BankAddress->City) == true) { + $adresse .= $t->BankAddress->City.' '; + } + if ( isset($t->BankAddress->Country) == true) { + $adresse .= $t->BankAddress->Country.' '; + } + dRow($libelle, $adresse); + } + } + print '
'; +} + +// -------------------------------------------------------------------------- // +// Activite(s) et chiffre d'affaire +// -------------------------------------------------------------------------- // +if (isset($c->Operations->IndustryCode) == true || + isset($c->FinancialSummary) == true || + isset($capital) == true || + isset($c->Employees) == true) { + print '

Activité(s) & Chiffre d\'affaire

'; + print ''; + if (isset($c->Operations->IndustryCode) == true) { + $libelle = 'Activité(s)'; + foreach ($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 = $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 ($c->Employees as $t) { + if (isset($t->Period) == true) { + if (isset($t->Period->StartDate->_) == true && + $t->Period->StartDate->_ > $annee) { + $annee = $t->Period->StartDate->_; + $total = intval($t->TotalStaffEmployed); + } else if (isset($t->Period->EndDate->_) == true && + $t->Period->EndDate->_ > $annee) { + $annee = $t->Period->EndDate->_; + $total = intval($t->TotalStaffEmployed); + } + } else { + $total = intval($t->TotalStaffEmployed); + } + } + 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 '
'; +} + +// -------------------------------------------------------------------------- // +// Annonces legales +// -------------------------------------------------------------------------- // +if (isset($c->Event) == true) { + print '

ANNONCES LÉGALES

'; + print ''; + $tab = $c->Event; + usort($tab, 'cmp'); + foreach ($tab as $t) { + if (isset($t->Value) == true) { + $desc = printObj($t->Value); + if ( isset($t->Description->_) == true) { + $desc = $t->Description->_.' '.$desc; + } + dRow(pdate($t->Date), $desc); + } else if (isset($t->Description->_) == true) { + dRow(pdate($t->Date), $t->Description->_); + } else { + dRow(pdate($t->Date), '('.$t->EventCode.')'); + } + } + print '
'; +} + +// -------------------------------------------------------------------------- // +// Dirigeants +// -------------------------------------------------------------------------- // +if (isset($c->Position) == true) { + print '

DIRIGEANTS

'; + print ''; + foreach ($c->Position as $t) { + if (isset($t->Person) == false) { + continue; + } + $date = ''; + if (isset($t->Period->StartDate) == true) { + $date .= pdate($t->Period->StartDate); + } + $date .= ' - '; + if (isset($t->Period->EndDate) == true) { + $date .= pdate($t->Period->EndDate); + } + $desc = $t->PositionTitle->_.' '.$t->Person->LastName; + if (isset($t->Person->FirstName) == true) { + $desc .= ' '.$t->Person->FirstName; + } + dRow($date, $desc); + } + print '
'; +} + +// -------------------------------------------------------------------------- // +// Employés +// -------------------------------------------------------------------------- // +if (isset($c->Employees) == true) { + print '

EMPLOYÉS

'; + print ''; + foreach ($c->Employees as $t) { + if (isset($t->Period) == true) { + if (isset($t->Period->StartDate) == true) { + dRow(pdate($t->Period->StartDate), + intval($t->TotalStaffEmployed)); + } else if (isset($t->Period->EndDate) == true) { + dRow(pdate($t->Period->EndDate), + intval($t->TotalStaffEmployed)); + } + } else { + dRow('', intval($t->TotalStaffEmployed)); + } + } + print '
'; +} + +// -------------------------------------------------------------------------- // +// Synthese +// -------------------------------------------------------------------------- // +if (isset($c->FinancialSummary) == true) { + print '

Synthèse

'; + print '
'; + print ''; + $tab = $c->FinancialSummary; + print ''; + foreach ($tab as $t) { + print ''; + } + print ''; + foreach (array('Revenue', + 'TotalEquity', + 'ProfitLossBeforeTax', + 'ProfitLoss', + 'WorkingCapital', + 'AuthorizedCapital') as $n) { + print ''; + print ''; + foreach ($tab as $t) { + print ''; + } + print ''; + } + print '
'.substr($t->SummaryDate->_, 0, 4). + '
'; + print $n; + print ''; + if (isset($t->$n) == true) { + $val = $t->$n->_; + if (is_numeric($val) == true) { + print $val * $t->Unit; + } else { + print $val; + } + } + print '
'; + print '
'; +} + +// -------------------------------------------------------------------------- // +// Bilans +// -------------------------------------------------------------------------- // +if (isset($c->AnnualAccounts) == true) { + print '

ÉLÉMENTS FINANCIERS - BILANS

'; + print '
'; + print ''; + printAccountItem($c, 'ACTIF'); + printAccountItem($c, 'PASSIF'); + printAccountItem($c, 'COMPTE DE RÉSULTAT'); + print '
'; + print '
'; +} + +// -------------------------------------------------------------------------- // +// Etablissements +// -------------------------------------------------------------------------- // +if (isset($c->Branch) == true) { + print '

Établissements

'; + print ''; + foreach ($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; + } + foreach ($c->CompanyAddress as $address) { + dRow($libelle, + $address->HouseNumber.' '. + $address->Street.' '. + $address->PostCode.' '. + $address->City.' '. + $address->Country); + } + } + print '
'; +} + +// -------------------------------------------------------------------------- // +// Liens financiers +// -------------------------------------------------------------------------- // +if (isset($c->Associated) == true) { + print '

Liens financiers

'; + print '

Actionnariat

'; + print ''; + printLiensFinanciers($c, 'Shareholder'); + print '
'; + print '

Participations

'; + print ''; + printLiensFinanciers($c, 'Participation'); + print '
'; +} + +// -------------------------------------------------------------------------- // +// Paiements +// -------------------------------------------------------------------------- // +if (isset($c->PaymentBehaviour) == true) { + $pb = $c->PaymentBehaviour[0]; + print '

Paiements

'; + print ''; + $date = ''; + if (isset($pb->Period->StartDate) == true) { + $date = pdate($pb->Period->StartDate); + } + if (isset($pb->Period->EndDate) == true) { + $date .= ' -> '.pdate($pb->Period->EndDate); + } + if (empty($date) == false) { + dRow('Date', $date); + } + if (isset($pb->DebtorDays) == true) { + dRow('DebtorDays', $pb->DebtorDays); + } + if (isset($pb->CreditorDays) == true) { + dRow('CreditorDays', $pb->CreditorDays); + } + if (isset($pb->LiquidityAssessment) == true) { + $desc = $pb->LiquidityAssessment->Qualification; + if (isset($pb->LiquidityAssessment->AdditionalQualification) == true) { + $desc .= ', '.$pb->LiquidityAssessment->AdditionalQualification->_; + } + dRow('LiquidityAssessment', $desc); + } + if (isset($pb->PaymentQualification) == true) { + $desc = $pb->PaymentQualification->Qualification; + if (isset($pb->PaymentQualification->AdditionalQualification) == true) { + $desc .= ', '.$pb->PaymentQualification->AdditionalQualification->_; + } + dRow('PaymentQualification', $desc); + } + print '
'; + if (isset($pb->AnalysisByPeriod) == true) { + $ap = $pb->AnalysisByPeriod; + $tab = array(); + foreach ($ap->Category as $cat) { + $trim = + pdate($cat->Period->StartDate).' - '. + pdate($cat->Period->EndDate); + $total = 0; + if (isset($cat->DueDateExceeds) == true) { + foreach ($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 '

'.$ap->Description->_.'

'; + print ''; + print ''; + print ''; + print ''; + foreach ($tab as $tranche => $valeurs) { + print ''; + } + print ''; + foreach ($ap->Category as $cat) { + $trim = + pdate($cat->Period->StartDate).' - '. + pdate($cat->Period->EndDate); + print ''. + ''. + ''; + foreach ($tab as $tranche => $valeurs) { + if (isset($tab[$tranche][$trim]) == true) { + print ''; + } else { + print ''; + } + } + print ''; + } + print '
QuarterWithin term'.$tranche.'
'.$trim.''.$cat->PercentageWithinTerms.' %'.$tab[$tranche][$trim].' %0 %
'; + } + if (isset($pb->AnalysisByAmount) == true) { + $ap = $pb->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; + if (isset($cat->DueDateExceeds) == true) { + foreach ($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 '

'.$ap->Description->_.'

'; + print ''; + print ''; + print ''; + print ''; + foreach ($tab as $tranche => $valeurs) { + print ''; + } + print ''; + 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 ''. + ''. + ''; + foreach ($tab as $tranche => $valeurs) { + if (isset($tab[$tranche][$amount]) == true) { + print ''; + } else { + print ''; + } + } + print ''; + } + print '
AmountWithin term'.$tranche.'
'.$amount.''.$cat->PercentageWithinTerms.' %'.$tab[$tranche][$amount].' %0 %
'; + } +} + +// -------------------------------------------------------------------------- // +// Score +// -------------------------------------------------------------------------- // +print '

Score

'; +print ''; +foreach ($c->CreditRecommendation as $cr) { + if (isset($cr->Date) == true) { + dRow('Date', pdate($cr->Date)); + } + if (isset($cr->RiskClasses) == true) { + foreach ($cr->RiskClasses->ProviderRiskClass as $t) { + if (isset($t->Description->_) == true) { + $desc = '    '. + ''; + } else { + $desc = ''; + } + dRow($t->RatingName->_.$desc, $t->RatingValue); + } + $t = $cr->RiskClasses->CommonRiskClass; + if (isset($t->Description->_) == true) { + $desc = '    '. + ''; + } else { + $desc = ''; + } + dRow($t->RatingName->_.$desc, $t->RatingValue); + } + dRow('AmountAdvised', + $cr->AmountAdvised->_.' '. + $cr->AmountAdvised->currency); +} +print '
'; + +// -------------------------------------------------------------------------- // +// Ratios secteur +// -------------------------------------------------------------------------- // +if (isset($c->PeerGroup[0]->FlexibleComparisonItems + ->ComparisonItemsGroup[0]->FlexibleComparisonItem) == true) { + print '

Ratios secteur

'; + print ''; + print ''; + print ''; + foreach ($c->PeerGroup[0]->FlexibleComparisonItems->ComparisonItemsGroup as + $group) { + print ''; + print ''; + } + print ''; + foreach ($c->PeerGroup[0]->FlexibleComparisonItems + ->ComparisonItemsGroup[0]->FlexibleComparisonItem as $i => $item) { + print ''; + print ''; + foreach ($c->PeerGroup[0]->FlexibleComparisonItems + ->ComparisonItemsGroup as $group) { + print ''; + print ''; + } + print ''; + } + print '
'; + print ''; + print substr($group->Period->EndDate->_, 0, 4); + print ''; + print 'secteur'; + print '
'; + print $item->ItemName->_; + print ''; + if (isset($group->FlexibleComparisonItem[$i]->SubjectValue)) { + print $group->FlexibleComparisonItem[$i]->SubjectValue; + } + print ''; + if (isset($group->FlexibleComparisonItem[$i]->AverageValue)) { + print $group->FlexibleComparisonItem[$i]->AverageValue; + } + print '
'; +} + +print '
'; +?> diff --git a/includes/liasse/functions.php b/includes/liasse/functions.php index fe4aaeb08..3ff77caf3 100644 --- a/includes/liasse/functions.php +++ b/includes/liasse/functions.php @@ -1,168 +1,126 @@ '010', - 'AI'=>'012', - 'AJ'=>'014', - 'AK'=>'016', - 'AT'=>'028', - 'AU'=>'030', - 'BH'=>'040', - 'BI'=>'042', - 'BJ'=>'044', - 'BK'=>'048', - 'BT'=>'060', - 'BU'=>'062', - 'BV'=>'064', - 'BW'=>'066', - 'BX'=>'068', - 'BY'=>'070', - 'BZ'=>'072', - 'CA'=>'074', - 'CD'=>'080', - 'CE'=>'082', - 'CF'=>'084', - 'CG'=>'086', - 'CH'=>'092', - 'CI'=>'094', - 'CJ'=>'096', - 'CK'=>'098', - 'CO'=>'110', - '1A'=>'112', - 'DA'=>'120', - 'DC'=>'124', - 'DD'=>'126', - 'DF'=>'130', - 'DG'=>'132', - 'DH'=>'134', - 'DI'=>'136', - 'DK'=>'140', - 'DL'=>'142', - 'DR'=>'154', - 'DP'=>'154', - 'DU'=>'156', - 'DV'=>'169', - 'DW'=>'164', - 'DX'=>'166', - 'EA'=>'172-169', - 'EB'=>'174', - 'EC'=>'176', - 'EE'=>'180', - 'EH'=>'156-195', - 'FA'=>'210-209', - 'FB'=>'209', - 'FC'=>'210', - 'FD'=>'214-215', - 'FE'=>'215', - 'FF'=>'214', - 'FH'=>'217', - 'FI'=>'218', - 'FK'=>'209+215+217', - 'FL'=>'210+214+218', - 'FM'=>'222', - 'FN'=>'224', - 'FO'=>'226', - 'FQ'=>'230', - 'FR'=>'232', - 'FS'=>'234', - 'FT'=>'236', - 'FU'=>'238', - 'FV'=>'240', - 'FW'=>'242', - 'FX'=>'244', - 'FY'=>'250', - 'FZ'=>'252', - 'GA'=>'254', - 'GE'=>'262', - 'GF'=>'264', - 'GG'=>'270', - 'GP'=>'280', - 'GU'=>'294', - 'GW'=>'270+280+294', - 'HD'=>'290', - 'HH'=>'300', - 'HI'=>'290-300', - 'HK'=>'306', - 'HL'=>'232+280+290', - 'HM'=>'264+294+300+306', - 'HN'=>'310', - 'YY'=>'374', - 'YZ'=>'378', - 'YP'=>'376', - ); +// -------------------------------------------------------------------------- // +// bilanSimplifie2Normal +// -------------------------------------------------------------------------- // +function bilanSimplifie2Normal($bilanRS) +{ + $tabBS2BN = + array('AH' => '010', 'AI' => '012', 'AJ' => '014', 'AK' => '016', + 'AT' => '028', 'AU' => '030', 'BH' => '040', 'BI' => '042', + 'BJ' => '044', 'BK' => '048', 'BT' => '060', 'BU' => '062', + 'BV' => '064', 'BW' => '066', 'BX' => '068', 'BY' => '070', + 'BZ' => '072', 'CA' => '074', 'CD' => '080', 'CE' => '082', + 'CF' => '084', 'CG' => '086', 'CH' => '092', 'CI' => '094', + 'CJ' => '096', 'CK' => '098', 'CO' => '110', '1A' => '112', + 'DA' => '120', 'DC' => '124', 'DD' => '126', 'DF' => '130', + 'DG' => '132', 'DH' => '134', 'DI' => '136', 'DK' => '140', + 'DL' => '142', 'DR' => '154', 'DP' => '154', 'DU' => '156', + 'DV' => '169', 'DW' => '164', 'DX' => '166', 'EA' => '172-169', + 'EB' => '174', 'EC' => '176', 'EE' => '180', 'EH' => '156-195', + 'FA' => '210-209', + 'FB' => '209', 'FC' => '210', 'FD' => '214-215', + 'FE' => '215', 'FF' => '214', 'FH' => '217', 'FI' => '218', + 'FK' => '209+215+217', + 'FL' => '210+214+218', + 'FM' => '222', 'FN' => '224', 'FO' => '226', 'FQ' => '230', + 'FR' => '232', 'FS' => '234', 'FT' => '236', 'FU' => '238', + 'FV' => '240', 'FW' => '242', 'FX' => '244', 'FY' => '250', + 'FZ' => '252', 'GA' => '254', 'GE' => '262', 'GF' => '264', + 'GG' => '270', 'GP' => '280', 'GU' => '294', + 'GW' => '270+280+294', + 'HD' => '290', 'HH' => '300', 'HI' => '290-300', 'HK' => '306', + 'HL' => '232+280+290', + 'HM' => '264+294+300+306', + 'HN' => '310', 'YY' => '374', 'YZ' => '378', 'YP' => '376'); - $bilanRN=array(); - foreach ($tabBS2BN as $posteRN => $formule) { - if (preg_match('/\+|\-/', $formule)) { - $tabTmp=preg_split('/\+|\-/', $formule, -1, PREG_SPLIT_OFFSET_CAPTURE); - //$bilanRN[$posteRN]=0; - $scalc=''; - foreach ($tabTmp as $i=>$tab) { - if ($i==0) { - $bilanRN[$posteRN]=$bilanRS[$tab[0]]; - $scalc.=$bilanRS[$tab[0]]; - } - else { - $signe=$formule[$tab[1]-1]; - $scalc.=$signe; - if ($signe=='+') $bilanRN[$posteRN]+=$bilanRS[$tab[0]]; - elseif ($signe=='-') $bilanRN[$posteRN]-=$bilanRS[$tab[0]]; - $scalc.=$bilanRS[$tab[0]]; - } - } - $bilanRN[$posteRN]=$bilanRN[$posteRN]; - } - else $bilanRN[$posteRN]=$bilanRS[$formule]; - } - if ($bilanRS['240']<>0) { - $bilanRN['BL']=$bilanRS['050']; - $bilanRN['BM']=$bilanRS['052']; - } else { - $bilanRN['BN']=$bilanRS['050']; - $bilanRN['BO']=$bilanRS['052']; - } + $bilanRN = array(); + foreach ($tabBS2BN as $posteRN => $formule) { + if (preg_match('/\+|\-/', $formule)) { + $tabTmp = + preg_split('/\+|\-/', $formule, -1, PREG_SPLIT_OFFSET_CAPTURE); + //$bilanRN[$posteRN] = 0; + $scalc = ''; + foreach ($tabTmp as $i => $tab) { + if ($i ==0 ) { + $bilanRN[$posteRN] = $bilanRS[$tab[0]]; + $scalc .= $bilanRS[$tab[0]]; + } else { + $signe = $formule[$tab[1] - 1]; + $scalc .= $signe; + if ($signe == '+') { + $bilanRN[$posteRN] += $bilanRS[$tab[0]]; + } else if ($signe == '-') { + $bilanRN[$posteRN] -= $bilanRS[$tab[0]]; + } + $scalc .= $bilanRS[$tab[0]]; + } + } + $bilanRN[$posteRN] = $bilanRN[$posteRN]; + } else { + $bilanRN[$posteRN] = $bilanRS[$formule]; + } + } + if ($bilanRS['240'] != 0) { + $bilanRN['BL'] = $bilanRS['050']; + $bilanRN['BM'] = $bilanRS['052']; + } else { + $bilanRN['BN'] = $bilanRS['050']; + $bilanRN['BO'] = $bilanRS['052']; + } - if ($bilanRS['070']<>0 || $bilanRS['074']<>0 || $bilanRS['052']<>0 || $bilanRS['062']<>0) - $bilanRN['GC']=$bilanRS['256']; - elseif ($bilanRS['070']==0 && $bilanRS['074']==0 && $bilanRS['052']==0 && $bilanRS['062']==0 && $bilanRS['254']<>0) - $bilanRN['GD']=$bilanRS['256']; + if ($bilanRS['070'] != 0 || $bilanRS['074'] != 0 || + $bilanRS['052'] != 0 || $bilanRS['062'] != 0) { + $bilanRN['GC'] = $bilanRS['256']; + } else if ($bilanRS['070'] == 0 && $bilanRS['074'] == 0 && + $bilanRS['052'] == 0 && $bilanRS['062'] == 0 && + $bilanRS['254'] != 0) { + $bilanRN['GD'] = $bilanRS['256']; + } - if ($bilanRS['584']<>0) { - $bilanRN['HB']=$bilanRS['584']; - $bilanRN['HA']=$bilanRS['290']-$bilanRS['584']; - } else - $bilanRN['HA']=$bilanRS['290']; + if ($bilanRS['584'] != 0) { + $bilanRN['HB'] = $bilanRS['584']; + $bilanRN['HA'] = $bilanRS['290'] - $bilanRS['584']; + } else { + $bilanRN['HA'] = $bilanRS['290']; + } - if ($bilanRS['582']<>0) { - $bilanRN['HF']=$bilanRS['582']; - $bilanRN['HE']=$bilanRS['582']-$bilanRS['300']; - } else - $bilanRN['HE']=$bilanRS['300']; + if ($bilanRS['582'] != 0) { + $bilanRN['HF'] = $bilanRS['582']; + $bilanRN['HE'] = $bilanRS['582'] - $bilanRS['300']; + } else { + $bilanRN['HE'] = $bilanRS['300']; + } - return $bilanRN; + return $bilanRN; } +// -------------------------------------------------------------------------- // +// bilanMonnaie +// -------------------------------------------------------------------------- // function bilanMonnaie($value, $unite = '') { - switch($unite) - { - case 'K': - $div = 1000; - break; - case 'M': - $div = 1000*1000; - break; - default: - case '': - $div = 1; - break; - } - if(isset($value) && !empty($value)){ - return number_format($value/$div, 0, '', ' '); - }else{ - return '-'; - } + switch ($unite) { + case 'K': + $div = 1000; + break; + case 'M': + $div = 1000*1000; + break; + default: + case '': + $div = 1; + break; + } + if (empty($value) == false) { + return number_format($value / $div, 0, '', ' '); + } else { + return '-'; + } } +// -------------------------------------------------------------------------- // +// dMontant +// -------------------------------------------------------------------------- // function dMontant(&$tab, $montant, $unite = '') { if ($montant == '' || isset($tab->$montant) == false) { @@ -281,4 +239,3 @@ function liasse2xml(&$val, &$liasse, &$tableTexteBilan) return false; } } - diff --git a/www/pages/giant_rapport.php b/www/pages/giant_rapport.php index 93f033899..db93771cd 100644 --- a/www/pages/giant_rapport.php +++ b/www/pages/giant_rapport.php @@ -1,297 +1,10 @@ '."\n"; - $html .= '  '."\n"; - $html .= ' '.$lib.''."\n"; - - if ($title != '') { - $title = ' title="'.$title.'"'; - } - $html .= ' '.$data.''."\n"; - $html .= ''."\n"; - print $html; -} - -// -------------------------------------------------------------------------- // -// dRow2 -// -------------------------------------------------------------------------- // -function dRow2($lib, $data, $id) -{ - $html = ''."\n"; - $html .= '  '."\n"; - $html .= ' '.$lib .''."\n"; - $html .= ' '.$data.''."\n"; - $html .= ' '.$id .''."\n"; - $html .= ''."\n"; - print $html; -} - -// -------------------------------------------------------------------------- // -// printObj -// -------------------------------------------------------------------------- // -function printObj($obj) -{ - $ret = ''; - foreach ($obj as $val) { - if (is_object($val) == true) { - $ret .= printObj($val); - } else if ($val == 'OldValue' || - $val == 'NewValue') { - $ret .= '('.$val.') '; - } else if ($val != 'eq') { - $ret .= $val.' '; - } - } - return $ret; -} - -// -------------------------------------------------------------------------- // -// cmp -// -------------------------------------------------------------------------- // -function cmp($a, $b) -{ - if ($a->Date->_ == $b->Date->_) { - return 0; - } - return ($a->Date->_ < $b->Date->_) ? 1 : -1; -} - -// -------------------------------------------------------------------------- // -// pdate -// -------------------------------------------------------------------------- // -function pdate($d) -{ - if (isset($d->format) == false) { - if (isset($d->_) == true) { - return $d->_; - } else { - return $d; - } - } - $f = substr($d->format, 0, 1); - $date = ''; - for ($i = 0; $i < strlen($d->format); ++$i) { - if (substr($d->format, $i, 1) != $f) { - $f = substr($d->format, $i, 1); - $date .= ' / '; - } - $date .= substr($d->_, $i, 1); - } - return $date; -} - -// -------------------------------------------------------------------------- // -// arrayInsert -// -------------------------------------------------------------------------- // -function arrayInsert($array, $pos, $value) -{ - return array_merge(array_slice($array, 0 , $pos), - array($value), - array_slice($array, $pos)); -} - -// -------------------------------------------------------------------------- // -// fillAccountItem -// -------------------------------------------------------------------------- // -function fillAccountItem(&$tab, &$num, $item, $year, $level = 0, $desPrec = '') -{ - if (isset($item->AccountItem) == true || - isset($item->GroupTotalAmount) == true) { - if (isset($item->AccountItem) == true) { - foreach ($item->AccountItem as $it) { - if (isset($item->Description->_) == true) { - fillAccountItem($tab, $num, $it, $year, - $level + 1, $desPrec.$item->Description->_); - } else { - fillAccountItem($tab, $num, $it, $year, - $level + 1, $desPrec); - } - } - } - if (isset($item->GroupTotalAmount) == true) { - if (isset($tab[$num]) == true) { - for ($i = $num; $i < count($tab); ++$i) { - if (isset($item->Description->code) == true) { - $code = $item->Description->code; - } else { - $code = $desPrec.$item->Description->_; - } - if ($tab[$i]->cde == $code) { - $num = $i; - $tab[$num]->val[$year] = $item->GroupTotalAmount->_; - return; - } - } - $obj = new StdClass; - $obj->des = $item->Description->_; - $obj->val[$year] = $item->GroupTotalAmount->_; - if (isset($item->Description->code) == true) { - $obj->cde = $item->Description->code; - } else { - $obj->cde = $desPrec.$item->Description->_; - } - $obj->niv = $level; - $tab = arrayInsert($tab, $num, $obj); - } else { - $obj = new StdClass; - $obj->des = $item->Description->_; - $obj->val[$year] = $item->GroupTotalAmount->_; - if (isset($item->Description->code) == true) { - $obj->cde = $item->Description->code; - } else { - $obj->cde = $desPrec.$item->Description->_; - } - $obj->niv = $level; - $tab[$num] = $obj; - } - ++$num; - } - } else { - if (isset($tab[$num]) == true) { - for ($i = 0; $i < count($tab); ++$i) { - if (isset($item->Description->code) == true) { - $code = $item->Description->code; - } else { - $code = $desPrec.$item->Description->_; - } - if ($tab[$i]->cde == $code) { - $num = $i; - $tab[$num]->val[$year] = $item->Value->_; - return; - } - } - $obj = new StdClass; - $obj->des = $item->Description->_; - $obj->val[$year] = $item->Value->_; - if (isset($item->Description->code) == true) { - $obj->cde = $item->Description->code; - } else { - $obj->cde = $desPrec.$item->Description->_; - } - $obj->niv = $level; - $tab = arrayInsert($tab, $num, $obj); - } else { - $obj = new StdClass; - $obj->des = $item->Description->_; - $obj->val[$year] = $item->Value->_; - if (isset($item->Description->code) == true) { - $obj->cde = $item->Description->code; - } else { - $obj->cde = $desPrec.$item->Description->_; - } - $obj->niv = $level; - $tab[$num] = $obj; - } - ++$num; - } -} - -// -------------------------------------------------------------------------- // -// printAccountItem -// -------------------------------------------------------------------------- // -function printAccountItem(&$company, $title) -{ - $tab = array(); - $years = array(); - foreach ($company->AnnualAccounts as $a) { - switch ($title) { - case 'ACTIF': - $account = $a->OriginalAnnualAccounts->BalanceSheet->Assets[0]; - break; - case 'PASSIF': - $account = $a->OriginalAnnualAccounts->BalanceSheet->Liabilities[0]; - break; - default: - $account = $a->OriginalAnnualAccounts->ProfitAndLoss; - } - $num = 0; - $year = substr($a->AccountsDate->_, 0, 4); - $years[] = $year; - fillAccountItem($tab, $num, $account, $year); - } - rsort($years); - print ''. - ''. - $title.''; - foreach ($years as $y) { - print ''.$y.''; - } - $level = 0; - foreach ($tab as $line) { - while ($line->niv < $level) { - print ''; - --$level; - } - $level = $line->niv; - print ''; - print ''; - for ($i = 0; $i < $line->niv; ++$i) { - print ' '; - } - print $line->des; - print ''; - foreach ($years as $y) { - print ''; - if (isset($line->val[$y]) == true) { - print $line->val[$y]; - } - print ''; - } - print ''; - } -} - -// -------------------------------------------------------------------------- // -// printLiensFinanciers -// -------------------------------------------------------------------------- // -function printLiensFinanciers(&$company, $type) -{ - foreach ($company->Associated as $t) { - if ($t->RelationShip == $type) { - $libelle = ''; - if (isset($t->Shares) == true) { - $libelle = $t->Shares->Percentage.' %'; - } - $id = ''; - if (isset($t->Company->CompanyId) == true) { - $id = $t->Company->CompanyId; - } else if (isset($t->Company->CompanyAddress) == true && - isset($t->Company->CompanyAddress->Country) == true) { - $id = '('.$t->Company->CompanyAddress->Country.')'; - } - $name = ''; - if (isset($t->Company->CompanyName) == true) { - foreach ($t->Company->CompanyName as $n) { - $name .= ' '.$n->_; - } - } - dRow2($libelle, $name, $id); - } - } -} - require_once 'dbbootstrap.php'; setDbConn('giantclient'); $r = Doctrine_Query::create() ->from('Rapports') - ->where('OrderId = ?', $commande_id) + ->where('OrderId = ?', $_GET['OrderId']) ->andWhere('User = ?', $_SESSION['tabInfo']['login']) ->fetchOne(); @@ -299,619 +12,5 @@ if ($r == false) { exit; } -// -------------------------------------------------------------------------- // -// Type de rapport -// -------------------------------------------------------------------------- // -print '
'; -switch ($r->DataSetType) { -case 'Full': - print '

RAPPORT COMPLET

'; - break; -case 'Compact': - print '

RAPPORT DE SYNTHESE

'; - break; -case 'CreditRecommendation': - print '

RAPPORT DE SCORE

'; - break; -} -$d = unserialize($r->DataSet); -$c = $d->Company; -print '

SOCIÉTÉ : '; -if (count($c->CompanyName) > 1) { - foreach ($c->CompanyName as $name) { - print '
'.$name; - } -} else if (is_array($c->CompanyName) == true) { - print $c->CompanyName[0]->_; -} else { - print $c->CompanyName->_; -} -print '

'; - -// -------------------------------------------------------------------------- // -// Identite de l'entreprise -// -------------------------------------------------------------------------- // -print '

IDENTITÉ DE L\'ENTREPRISE

'; -print ''; -dRow('Numéro identifiant', $c->CompanyId); -if (isset($c->Vat->VatNumber) == true) { - dRow('Numéro de TVA Intracom.', $c->Vat->VatNumber); -} -if (isset($c->SocialSecurityNumber) == true) { - dRow('Numéro de Securité Sociale', $c->SocialSecurityNumber); -} -if (isset($c->CompanyStatus) == true) { - dRow('Etablissement actif', - ($c->CompanyStatus == 'Active') ? 'Oui' : 'Non'); -} -print '
'; - -// -------------------------------------------------------------------------- // -// Raison sociale et coordonnees -// -------------------------------------------------------------------------- // -print '

Raison sociale & Coordonnées

'; -print ''; -foreach ($c->CompanyName as $name) { - dRow('Raison Sociale', $name->_); -} -if (isset($c->TradeName) == true) { - $libelle = 'Enseigne(s)'; - foreach ($c->TradeName as $t) { - dRow($libelle, $t->_); - $libelle = ''; - } -} -if (isset($c->LegalForm->CountryLegalForm) == true) { - dRow('Forme juridique', - $c->LegalForm->CountryLegalForm->code.' : '. - $c->LegalForm->CountryLegalForm->_); -} -foreach ($c->CompanyAddress as $address) { - dRow('Adresse', - $address->HouseNumber.' '. - $address->Street.' '. - $address->PostCode.' '. - $address->City.' '. - $address->Country); -} -if (isset($c->TelephoneNumber) == true) { - $libelle = 'Téléphone(s)'; - foreach ($c->TelephoneNumber as $t) { - $mobile = (isset($t->isMobile) == true && - $t->isMobile == 1) ? ' (mobile)' : ''; - dRow($libelle, $t->_.$mobile); - $libelle = ''; - } -} -if (isset($c->Telefax) == true) { - dRow('Fax', $c->Telefax); -} -if (isset($c->WebAddress) == true) { - dRow('Site Internet', - ''.$c->WebAddress.''); -} -if (isset($c->EmailAddress) == true) { - dRow('Courriel', - ''. - $c->EmailAddress.''); -} -print '
'; - -// -------------------------------------------------------------------------- // -// Banques -// -------------------------------------------------------------------------- // -if (isset($c->Bank) == true) { - print '

Banques

'; - print ''; - foreach ($c->Bank as $t) { - $libelle = $t->BankName; - if (isset($t->BankIdentifierCode) == true) { - dRow($libelle, 'BIC: '.$t->BankIdentifierCode); - $libelle = ''; - } - if (isset($t->BankAccount) == true) { - foreach ($t->BankAccount as $ac) { - dRow($libelle, $ac->AccountType.': '. $ac->AccountNumber); - $libelle = ''; - } - } - if (isset($t->BankAddress) == true) { - $adresse = ''; - if ( isset($t->BankAddress->HouseNumber) == true) { - $adresse .= $t->BankAddress->HouseNumber.' '; - } - if ( isset($t->BankAddress->Street) == true) { - $adresse .= $t->BankAddress->Street.' '; - } - if ( isset($t->BankAddress->PostCode) == true) { - $adresse .= $t->BankAddress->PostCode.' '; - } - if ( isset($t->BankAddress->City) == true) { - $adresse .= $t->BankAddress->City.' '; - } - if ( isset($t->BankAddress->Country) == true) { - $adresse .= $t->BankAddress->Country.' '; - } - dRow($libelle, $adresse); - } - } - print '
'; -} - -// -------------------------------------------------------------------------- // -// Activite(s) et chiffre d'affaire -// -------------------------------------------------------------------------- // -if (isset($c->Operations->IndustryCode) == true || - isset($c->FinancialSummary) == true || - isset($capital) == true || - isset($c->Employees) == true) { - print '

Activité(s) & Chiffre d\'affaire

'; - print ''; - if (isset($c->Operations->IndustryCode) == true) { - $libelle = 'Activité(s)'; - foreach ($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 = $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 ($c->Employees as $t) { - if (isset($t->Period) == true) { - if (isset($t->Period->StartDate->_) == true && - $t->Period->StartDate->_ > $annee) { - $annee = $t->Period->StartDate->_; - $total = intval($t->TotalStaffEmployed); - } else if (isset($t->Period->EndDate->_) == true && - $t->Period->EndDate->_ > $annee) { - $annee = $t->Period->EndDate->_; - $total = intval($t->TotalStaffEmployed); - } - } else { - $total = intval($t->TotalStaffEmployed); - } - } - 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 '
'; -} - -// -------------------------------------------------------------------------- // -// Annonces legales -// -------------------------------------------------------------------------- // -if (isset($c->Event) == true) { - print '

ANNONCES LÉGALES

'; - print ''; - $tab = $c->Event; - usort($tab, 'cmp'); - foreach ($tab as $t) { - if (isset($t->Value) == true) { - $desc = printObj($t->Value); - if ( isset($t->Description->_) == true) { - $desc = $t->Description->_.' '.$desc; - } - dRow(pdate($t->Date), $desc); - } else if (isset($t->Description->_) == true) { - dRow(pdate($t->Date), $t->Description->_); - } else { - dRow(pdate($t->Date), '('.$t->EventCode.')'); - } - } - print '
'; -} - -// -------------------------------------------------------------------------- // -// Dirigeants -// -------------------------------------------------------------------------- // -if (isset($c->Position) == true) { - print '

DIRIGEANTS

'; - print ''; - foreach ($c->Position as $t) { - if (isset($t->Person) == false) { - continue; - } - $date = ''; - if (isset($t->Period->StartDate) == true) { - $date .= pdate($t->Period->StartDate); - } - $date .= ' - '; - if (isset($t->Period->EndDate) == true) { - $date .= pdate($t->Period->EndDate); - } - $desc = $t->PositionTitle->_.' '.$t->Person->LastName; - if (isset($t->Person->FirstName) == true) { - $desc .= ' '.$t->Person->FirstName; - } - dRow($date, $desc); - } - print '
'; -} - -// -------------------------------------------------------------------------- // -// Employés -// -------------------------------------------------------------------------- // -if (isset($c->Employees) == true) { - print '

EMPLOYÉS

'; - print ''; - foreach ($c->Employees as $t) { - if (isset($t->Period) == true) { - if (isset($t->Period->StartDate) == true) { - dRow(pdate($t->Period->StartDate), - intval($t->TotalStaffEmployed)); - } else if (isset($t->Period->EndDate) == true) { - dRow(pdate($t->Period->EndDate), - intval($t->TotalStaffEmployed)); - } - } else { - dRow('', intval($t->TotalStaffEmployed)); - } - } - print '
'; -} - -// -------------------------------------------------------------------------- // -// Synthese -// -------------------------------------------------------------------------- // -if (isset($c->FinancialSummary) == true) { - print '

Synthèse

'; - print '
'; - print ''; - $tab = $c->FinancialSummary; - print ''; - foreach ($tab as $t) { - print ''; - } - print ''; - foreach (array('Revenue', - 'TotalEquity', - 'ProfitLossBeforeTax', - 'ProfitLoss', - 'WorkingCapital', - 'AuthorizedCapital') as $n) { - print ''; - print ''; - foreach ($tab as $t) { - print ''; - } - print ''; - } - print '
'.substr($t->SummaryDate->_, 0, 4). - '
'; - print $n; - print ''; - if (isset($t->$n) == true) { - $val = $t->$n->_; - if (is_numeric($val) == true) { - print $val * $t->Unit; - } else { - print $val; - } - } - print '
'; - print '
'; -} - -// -------------------------------------------------------------------------- // -// Bilans -// -------------------------------------------------------------------------- // -if (isset($c->AnnualAccounts) == true) { - print '

ÉLÉMENTS FINANCIERS - BILANS

'; - print '
'; - print ''; - printAccountItem($c, 'ACTIF'); - printAccountItem($c, 'PASSIF'); - printAccountItem($c, 'COMPTE DE RÉSULTAT'); - print '
'; - print '
'; -} - -// -------------------------------------------------------------------------- // -// Etablissements -// -------------------------------------------------------------------------- // -if (isset($c->Branch) == true) { - print '

Établissements

'; - print ''; - foreach ($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; - } - foreach ($c->CompanyAddress as $address) { - dRow($libelle, - $address->HouseNumber.' '. - $address->Street.' '. - $address->PostCode.' '. - $address->City.' '. - $address->Country); - } - } - print '
'; -} - -// -------------------------------------------------------------------------- // -// Liens financiers -// -------------------------------------------------------------------------- // -if (isset($c->Associated) == true) { - print '

Liens financiers

'; - print '

Actionnariat

'; - print ''; - printLiensFinanciers($c, 'Shareholder'); - print '
'; - print '

Participations

'; - print ''; - printLiensFinanciers($c, 'Participation'); - print '
'; -} - -// -------------------------------------------------------------------------- // -// Paiements -// -------------------------------------------------------------------------- // -if (isset($c->PaymentBehaviour) == true) { - print '

Paiements

'; - print ''; - $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 '
'; - 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; - if (isset($cat->DueDateExceeds) == true) { - foreach ($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 '

'.$ap->Description->_.'

'; - print ''; - print ''; - print ''; - print ''; - foreach ($tab as $tranche => $valeurs) { - print ''; - } - print ''; - foreach ($ap->Category as $cat) { - $trim = - pdate($cat->Period->StartDate).' - '. - pdate($cat->Period->EndDate); - print ''. - ''. - ''; - foreach ($tab as $tranche => $valeurs) { - if (isset($tab[$tranche][$trim]) == true) { - print ''; - } else { - print ''; - } - } - print ''; - } - print '
QuarterWithin term'.$tranche.'
'.$trim.''.$cat->PercentageWithinTerms.' %'.$tab[$tranche][$trim].' %0 %
'; - } - 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; - if (isset($cat->DueDateExceeds) == true) { - foreach ($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 '

'.$ap->Description->_.'

'; - print ''; - print ''; - print ''; - print ''; - foreach ($tab as $tranche => $valeurs) { - print ''; - } - print ''; - 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 ''. - ''. - ''; - foreach ($tab as $tranche => $valeurs) { - if (isset($tab[$tranche][$amount]) == true) { - print ''; - } else { - print ''; - } - } - print ''; - } - print '
AmountWithin term'.$tranche.'
'.$amount.''.$cat->PercentageWithinTerms.' %'.$tab[$tranche][$amount].' %0 %
'; - } -} - -// -------------------------------------------------------------------------- // -// Score -// -------------------------------------------------------------------------- // -print '

Score

'; -print ''; -if (isset($c->CreditRecommendation->Date) == true) { - dRow('Date', pdate($c->CreditRecommendation->Date)); -} -if (isset($c->CreditRecommendation->RiskClasses) == true) { - foreach ($c->CreditRecommendation->RiskClasses->ProviderRiskClass as $t) { - if (isset($t->Description->_) == true) { - $desc = '    '. - ''; - } else { - $desc = ''; - } - dRow($t->RatingName->_.$desc, $t->RatingValue); - } - $t = $c->CreditRecommendation->RiskClasses->CommonRiskClass; - if (isset($t->Description->_) == true) { - $desc = '    '. - ''; - } else { - $desc = ''; - } - dRow($t->RatingName->_.$desc, $t->RatingValue); -} -foreach ($c->CreditRecommendation as $item) { - dRow('AmountAdvised', - $item->AmountAdvised->_.' '. - $item->AmountAdvised->currency); -} -print '
'; - -// -------------------------------------------------------------------------- // -// Ratios secteur -// -------------------------------------------------------------------------- // -if (isset($c->PeerGroup->FlexibleComparisonItems - ->ComparisonItemsGroup[0]->FlexibleComparisonItem) == true) { - print '

Ratios secteur

'; - print ''; - print ''; - print ''; - foreach ($c->PeerGroup->FlexibleComparisonItems->ComparisonItemsGroup as - $group) { - print ''; - print ''; - } - print ''; - foreach ($c->PeerGroup->FlexibleComparisonItems - ->ComparisonItemsGroup[0]->FlexibleComparisonItem as $i => $item) { - print ''; - print ''; - foreach ($c->PeerGroup->FlexibleComparisonItems->ComparisonItemsGroup as - $group) { - print ''; - print ''; - } - print ''; - } - print '
'; - print ''; - print substr($group->Period->EndDate->_, 0, 4); - print ''; - print 'secteur'; - print '
'; - print $item->ItemName->_; - print ''; - if (isset($group->FlexibleComparisonItem[$i]->SubjectValue)) { - print $group->FlexibleComparisonItem[$i]->SubjectValue; - } - print ''; - if (isset($group->FlexibleComparisonItem[$i]->AverageValue)) { - print $group->FlexibleComparisonItem[$i]->AverageValue; - } - print '
'; -} - -print '
'; +require_once 'giant/rapport-html.php'; ?>