179 lines
12 KiB
PHP
179 lines
12 KiB
PHP
<?php
|
|
require_once ('Giant/ChromePhp.php');
|
|
require_once ('Giant/WSgiant.php');
|
|
require_once ('Giant/Search.lib.php');
|
|
require_once ('Scores/RechercheHistorique.php');
|
|
require_once ('Giant/CreditData.lib.php');
|
|
require_once ('Giant/Controller/RechercheController.php');
|
|
require_once ('Scores/Utilisateur.php');
|
|
require_once ('Giant/Functions.php');
|
|
require_once ('Giant/Controller/GiantController.php');
|
|
require_once ('Giant/Controller/IdentiteController.php');
|
|
require_once ('common/dates.php');
|
|
require_once ('Giant/Commandes.php');
|
|
require_once ('Giant/Rapports.php');
|
|
require_once('Graphique/Graphique.lib.php');
|
|
|
|
class GiantController extends Zend_Controller_Action
|
|
{
|
|
|
|
protected $TestIndication = true;
|
|
|
|
public function init()
|
|
{
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
|
|
$this->view->debug = false;
|
|
}
|
|
|
|
public function searchAction()
|
|
{
|
|
$user = new Utilisateur();
|
|
$params = $this->getRequest()->getParams();
|
|
$search = new GiantRechercheController($params['pays'], $this->TestIndication);
|
|
$result = $search->Liste($params, $this->getRequest()->getParam('page'));
|
|
$this->view->label = $search->getObjet()->getLabelDesc();
|
|
$this->view->labelResults = $search->getObjet()->getLabelResults;
|
|
$this->view->pays = $params['pays'];
|
|
$this->view->currentPage = $search->getObjet()->getCurrentPage();
|
|
$this->view->userMaxResult = $user->getNbRep();
|
|
$this->view->resultats = $result;
|
|
$this->view->page = $this->getRequest()->getParam('page');
|
|
$this->view->referer = $search->getObjet()->getQuery();
|
|
$this->view->lienReferer = $search->getQueryLink($params);
|
|
if($this->view->debug)
|
|
$this->view->soap = $search->soapG;
|
|
}
|
|
|
|
public function identiteAction()
|
|
{
|
|
$rechercheParams = new RechercheHistorique();
|
|
if (count($rechercheParams->liste()) > 0)
|
|
{
|
|
$recherche = $rechercheParams->item(0);
|
|
$type = $recherche['type'];
|
|
$params = $recherche['params'];
|
|
}
|
|
$Commande = new Commandes();
|
|
$Utilisateur = new Utilisateur();
|
|
$listeCommandes = $Commande->getCommandesByLogin($Utilisateur->getLogin());
|
|
$total = 0;
|
|
$liste = GiantFunction::divCommande($listeCommandes, $total);
|
|
$ListeRapport = new GiantRechercheController($params['pays'], $this->TestIndication);
|
|
$result = $ListeRapport->ListeRapport($this->getRequest()->getParam('CompanyId'));
|
|
$this->view->total = $total;
|
|
$this->view->listeCommandes = $liste;
|
|
$this->view->modification = (isset($result->MonitoringOptions))?($ListeRapport->getModification($result->MonitoringOptions->MonitoringOption[0])):null;
|
|
$this->view->description = $ListeRapport->getDescription();
|
|
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
|
|
$this->view->listeRapport = $result;
|
|
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
|
|
$this->view->raisonSociale = $this->getRequest()->getParam('raisonSociale');
|
|
$this->view->CompanyRegisterNumber = $this->getRequest()->getParam('CompanyRegisterNumber');
|
|
$this->view->Pays = $this->getRequest()->getParam('Pays');
|
|
$this->view->Adresse = explode(':', $this->getRequest()->getParam('Adresse'));
|
|
if($this->view->debug)
|
|
$this->view->soap = $ListeRapport->soapG;
|
|
}
|
|
|
|
public function commandesAction()
|
|
{
|
|
$Utilisateur = new Utilisateur();
|
|
$Commande = new Commandes();
|
|
$Rapport = new Rapports($this->getRequest()->getParam('Pays'), $this->TestIndication);
|
|
$CommandeP = new stdClass();
|
|
|
|
$id = $Rapport->getRapportExist($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type'));
|
|
if(empty($id)) {
|
|
$rapport = new GiantRechercheController($this->getRequest()->getParam('Pays'), $this->TestIndication);
|
|
$result = $rapport->GetRapport($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type'));
|
|
$result = base64_encode(serialize($result));
|
|
$id = $Rapport->setReport($this->getRequest()->getParam('CompanyId'),
|
|
$this->getRequest()->getParam('Type'),
|
|
$this->getRequest()->getParam('Pays'),
|
|
$result);
|
|
}
|
|
$CommandeP->login = $Utilisateur->getLogin();
|
|
$CommandeP->date = date("Y-m-d");
|
|
$CommandeP->typeReport = GiantFunction::getTypeReport($this->getRequest()->getParam('Type'));
|
|
$CommandeP->price = 150;
|
|
$CommandeP->rapportId = 1;
|
|
$CommandeP->pays = strtolower($this->getRequest()->getParam('Pays'));
|
|
|
|
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->rapportId, $CommandeP->typeReport, $CommandeP->pays)) {
|
|
$Commande->setCommandes($CommandeP);
|
|
}
|
|
$this->_forward('rapport', 'giant', null, array('idRapport' => $id));
|
|
}
|
|
|
|
public function rapportAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$result = unserialize(base64_decode($request->getParam('idRapport')));
|
|
$identiteController = new GiantIdentiteController($result);
|
|
$graphique = new Graphique('/cache/imgcache/');
|
|
$identiteController->ficheAction();
|
|
$fiche = $identiteController->getObjet('fiche');
|
|
|
|
$giantConstroller = new GiantControllerLib();
|
|
$fiche = $giantConstroller->getInformationGenerale($result);
|
|
$result = $giantConstroller->getAvisDeCredit($result);
|
|
$result = $giantConstroller->getComptesAnnuels($result);
|
|
|
|
$parametres = new stdClass();
|
|
$actifLabel = array('FixedAssets', 'TotalIntangibleAssets', 'TotalFinancialAssets', 'RawMaterialsAndSupplies', 'Inventories', 'CashBankSecurities', 'OtherCurrentAssets');
|
|
$actifDatas = array(
|
|
$result->DataSet->Company->Assets->FixedAssets[key($result->DataSet->Company->Assets->FixedAssets)],
|
|
$result->DataSet->Company->Assets->TotalIntangibleAssets[key($result->DataSet->Company->Assets->TotalIntangibleAssets)],
|
|
$result->DataSet->Company->Assets->TotalFinancialAssets[key($result->DataSet->Company->Assets->TotalFinancialAssets)],
|
|
$result->DataSet->Company->Assets->RawMaterialsAndSupplies[key($result->DataSet->Company->Assets->RawMaterialsAndSupplies)],
|
|
$result->DataSet->Company->Assets->Inventories[key($result->DataSet->Company->Assets->Inventories)],
|
|
$result->DataSet->Company->Assets->CashBankSecurities[key($result->DataSet->Company->Assets->CashBankSecurities)],
|
|
$result->DataSet->Company->Assets->OtherCurrentAssets[key($result->DataSet->Company->Assets->OtherCurrentAssets)]
|
|
);
|
|
|
|
$passifLabel = array('EquityCapital', 'SurplusEquity', 'ProfitAndLossAccount', 'LongTermDeferredTaxes', 'AccumulatedDepreciation', 'OtherLongTermLiabilities',
|
|
'TotalLongTermLiabilities', 'TradeCreditors', 'DueToBanks', 'ShortTermLiabilities', 'Provisions', 'OtherShortTermLiabilities', 'TotalShortTermLiabilities');
|
|
$passifDatas = array(
|
|
$result->DataSet->Company->Liabilities->EquityCapital[key($result->DataSet->Company->Liabilities->EquityCapital)],
|
|
$result->DataSet->Company->Liabilities->SurplusEquity[key($result->DataSet->Company->Liabilities->SurplusEquity)],
|
|
$result->DataSet->Company->Liabilities->ProfitAndLossAccount[key($result->DataSet->Company->Liabilities->ProfitAndLossAccount)],
|
|
$result->DataSet->Company->Liabilities->LongTermDeferredTaxes[key($result->DataSet->Company->Liabilities->LongTermDeferredTaxes)],
|
|
$result->DataSet->Company->Liabilities->AccumulatedDepreciation[key($result->DataSet->Company->Liabilities->AccumulatedDepreciation)],
|
|
$result->DataSet->Company->Liabilities->OtherLongTermLiabilities[key($result->DataSet->Company->Liabilities->OtherLongTermLiabilities)],
|
|
$result->DataSet->Company->Liabilities->TotalLongTermLiabilities[key($result->DataSet->Company->Liabilities->TotalLongTermLiabilities)],
|
|
$result->DataSet->Company->Liabilities->TradeCreditors[key($result->DataSet->Company->Liabilities->TradeCreditors)],
|
|
$result->DataSet->Company->Liabilities->DueToBanks[key($result->DataSet->Company->Liabilities->DueToBanks)],
|
|
$result->DataSet->Company->Liabilities->ShortTermLiabilities[key($result->DataSet->Company->Liabilities->ShortTermLiabilities)],
|
|
$result->DataSet->Company->Liabilities->Provisions[key($result->DataSet->Company->Liabilities->Provisions)],
|
|
$result->DataSet->Company->Liabilities->OtherShortTermLiabilities[key($result->DataSet->Company->Liabilities->OtherShortTermLiabilities)],
|
|
$result->DataSet->Company->Liabilities->TotalShortTermLiabilities[key($result->DataSet->Company->Liabilities->TotalShortTermLiabilities)]
|
|
);
|
|
|
|
$profitandlossLabel = array('NetSales', 'NetIncomeLossOfTheYear', 'GrossProfit', 'OperatingResult', 'ResultsOfOrdinaryOperations', 'NetProfitBeforeTaxes',
|
|
'FinancialCharges', 'Depreciation', 'Purchases', 'WagesAndSalaries', 'FinancialIncome', 'Tax', 'ExtraordinaryItems');
|
|
$profitandlossDatas = array(
|
|
$result->DataSet->Company->ProfitAndLoss->NetSales[key($result->DataSet->Company->ProfitAndLoss->NetSales)],
|
|
$result->DataSet->Company->ProfitAndLoss->NetIncomeLossOfTheYear[key($result->DataSet->Company->ProfitAndLoss->NetIncomeLossOfTheYear)],
|
|
$result->DataSet->Company->ProfitAndLoss->GrossProfit[key($result->DataSet->Company->ProfitAndLoss->GrossProfit)],
|
|
$result->DataSet->Company->ProfitAndLoss->OperatingResult[key($result->DataSet->Company->ProfitAndLoss->OperatingResult)],
|
|
$result->DataSet->Company->ProfitAndLoss->ResultsOfOrdinaryOperations[key($result->DataSet->Company->ProfitAndLoss->ResultsOfOrdinaryOperations)],
|
|
$result->DataSet->Company->ProfitAndLoss->NetProfitBeforeTaxes[key($result->DataSet->Company->ProfitAndLoss->NetProfitBeforeTaxes)],
|
|
$result->DataSet->Company->ProfitAndLoss->FinancialCharges[key($result->DataSet->Company->ProfitAndLoss->FinancialCharges)],
|
|
$result->DataSet->Company->ProfitAndLoss->Depreciation[key($result->DataSet->Company->ProfitAndLoss->Depreciation)],
|
|
$result->DataSet->Company->ProfitAndLoss->Purchases[key($result->DataSet->Company->ProfitAndLoss->Purchases)],
|
|
$result->DataSet->Company->ProfitAndLoss->WagesAndSalaries[key($result->DataSet->Company->ProfitAndLoss->WagesAndSalaries)],
|
|
$result->DataSet->Company->ProfitAndLoss->FinancialIncome[key($result->DataSet->Company->ProfitAndLoss->FinancialIncome)],
|
|
$result->DataSet->Company->ProfitAndLoss->Tax[key($result->DataSet->Company->ProfitAndLoss->Tax)],
|
|
$result->DataSet->Company->ProfitAndLoss->ExtraordinaryItems[key($result->DataSet->Company->ProfitAndLoss->ExtraordinaryItems)],
|
|
|
|
);
|
|
|
|
$giantConstroller->createBilanGraphique('actifs', $actifDatas, $actifLabel);
|
|
$giantConstroller->createBilanGraphique('passifs', $passifDatas, $passifLabel, 590, 310);
|
|
$giantConstroller->createBilanGraphique('profitandloss', $profitandlossDatas, $profitandlossLabel, 590, 310);
|
|
//$this->view->report = $result;
|
|
$this->view->reportType = $this->getRequest()->getParam('Type');
|
|
$this->view->fiche = $fiche;
|
|
}
|
|
} |