issue #0001758: change dateT to Zend_Date

This commit is contained in:
Arman KYOKCHAN 2013-10-28 12:15:22 +00:00
parent 2529350998
commit 6e895d9503
10 changed files with 37 additions and 43 deletions

View File

@ -4,7 +4,6 @@ require_once 'Giant/WSgiant.php';
require_once 'Giant/Controllers.lib.php';
require_once 'Giant/RequestDatabase.lib.php';
require_once 'Giant/Functions.lib.php';
require_once 'common/dates.php';
class GiantController extends Zend_Controller_Action
{
@ -142,7 +141,6 @@ class GiantController extends Zend_Controller_Action
$this->view->reportType = $this->getRequest()->getParam('Type');
$this->view->report = $fiche;
$this->view->Type = $this->getRequest()->getParam('Type');
$this->view->dateFunction = new WDate();
$this->view->assign('exportObjet', $creditrecommendation);
}
@ -177,7 +175,6 @@ class GiantController extends Zend_Controller_Action
$this->view->reportType = $this->getRequest()->getParam('Type');
$this->view->report = $fiche;
$this->view->Type = $this->getRequest()->getParam('Type');
$this->view->dateFunction = new WDate();
$this->view->assign('exportObjet', $compact);
}
@ -214,7 +211,6 @@ class GiantController extends Zend_Controller_Action
$this->view->reportType = $this->getRequest()->getParam('Type');
$this->view->report = $fiche;
$this->view->Type = $this->getRequest()->getParam('Type');
$this->view->dateFunction = new WDate();
$this->view->assign('exportObjet', $full);
}

View File

@ -1,7 +1,7 @@
<div id="center">
<h2>1. Informations d'entreprise générales</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/InformationEntreprise.phtml', null, array('report' => $this->report, 'carte' => $this->carte, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/InformationEntreprise.phtml', null, array('report' => $this->report, 'carte' => $this->carte)); ?>
</div>
<h2>2. Avis de crédit</h2>
<div id="break">
@ -13,6 +13,6 @@
</div>
<h2>7. Dirigeants</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/Dirigeant.phtml', null, array('report' => $this->report, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/Dirigeant.phtml', null, array('report' => $this->report)); ?>
</div>
</div>

View File

@ -1,7 +1,7 @@
<div id="center">
<h2>1. Informations d'entreprise générales</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/InformationEntreprise.phtml', null, array('report' => $this->report, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/InformationEntreprise.phtml', null, array('report' => $this->report)); ?>
</div>
<a name="6"></a>
<h2>2. Avis de crédit</h2>
@ -10,7 +10,7 @@
</div>
<h2>3. Compte Annuels</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/ComptesAnnuels.phtml', null, array('report' => $this->report, 'Type' => $this->Type, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/ComptesAnnuels.phtml', null, array('report' => $this->report, 'Type' => $this->Type)); ?>
</div>
<h2>4. Position financiére</h2>
<div id="break">
@ -18,7 +18,7 @@
</div>
<h2>5. Comportement de paiement</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/ComportementDePaiement.phtml', null, array('report' => $this->report, 'Type' => $this->Type, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/ComportementDePaiement.phtml', null, array('report' => $this->report, 'Type' => $this->Type)); ?>
</div>
<h2>6. Structure de l'entreprise</h2>
<div id="break">
@ -26,7 +26,7 @@
</div>
<h2>7. Dirigeants</h2>
<div id="break">
<?php echo $this->partial('giant/partials/rapports/Dirigeant.phtml', null, array('report' => $this->report, 'dateFunction' => $this->dateFunction)); ?>
<?php echo $this->partial('giant/partials/rapports/Dirigeant.phtml', null, array('report' => $this->report)); ?>
</div>
<h2>8. Comparaison avec valeurs similaires</h2>
<div id="break">

View File

@ -18,9 +18,10 @@
<?php foreach($this->report->ComportementPaiement as $dates => $valeurs):?>
<?(strlen($dates)==12)?$len=6:$len=8;preg_match('/(\d{'.$len.'})(\d{'.$len.'})/', $dates,$matches);$s = $matches[1];$e = $matches[2];?>
<?php $date = explode(':', $dates);?>
<?php $date1 = new Zend_Date($s,yyyymmdd);$date2 = new Zend_Date($e,yyyymmdd);?>
<tr>
<td class="head">
<a><?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $s);?> - <?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $e);?></a>
<a><?php echo $date1->toString('dd/mm/yyyy');?> - <?php echo $date2->toString('dd/mm/yyyy');?></a>
</td>
<?php $i=0;foreach($valeurs as $valeur): $i++; ?>
<td class="right"><?php echo $valeur;?> %</td>

View File

@ -8,7 +8,8 @@
<a class="tooltip tooltipFont">Date de clôture</a>
</td>
<?php foreach($this->report->AnnualAccounts as $AnnualAccounts):$i++?>
<td class="right"><?php echo (empty($AnnualAccounts->AccountsDate->_))?'NC':$this->dateFunction->dateT('Ymd', 'd/m/Y', $AnnualAccounts->AccountsDate->_);?></td>
<?php $date = new Zend_Date($AnnualAccounts->AccountsDate->_,yyyymmdd);?>
<td class="right"><?php echo (empty($AnnualAccounts->AccountsDate->_))?'NC':$date->toString('dd/mm/yyyy');?></td>
<?php endforeach; ?>
</tr>
<tr >
@ -39,7 +40,8 @@
<th align="center">
</th>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
<th align="right" class="date"><?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $AnnualAccounts->AccountsDate->_); ?></th>
<?php $date = new Zend_Date($AnnualAccounts->AccountsDate->_,yyyymmdd);?>
<th align="right" class="date"><?php echo $date->toString('dd/mm/yyyy'); ?></th>
<?php endforeach; ?>
<th>&nbsp;</th>
</tr>
@ -83,7 +85,8 @@
<th align="center">
</th>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
<th align="right" class="date"><?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $AnnualAccounts->AccountsDate->_); ?></th>
<?php $date = new Zend_Date($AnnualAccounts->AccountsDate->_,yyyymmdd);?>
<th align="right" class="date"><?php echo $date->toString('dd/mm/yyyy'); ?></th>
<?php endforeach; ?>
<th>&nbsp;</th>
@ -128,7 +131,8 @@
<th align="center">
</th>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
<th align="right" class="date"><?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $AnnualAccounts->AccountsDate->_); ?></th>
<?php $date = new Zend_Date($AnnualAccounts->AccountsDate->_,yyyymmdd);?>
<th align="right" class="date"><?php echo $date->toString('dd/mm/yyyy'); ?></th>
<?php endforeach; ?>
<th>&nbsp;</th>
@ -174,7 +178,8 @@
<th align="center">
</th>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
<th align="right" class="date"><?php echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $AnnualAccounts->AccountsDate->_); ?></th>
<?php $date = new Zend_Date($AnnualAccounts->AccountsDate->_,yyyymmdd);?>
<th align="right" class="date"><?php echo $date->toString('dd/mm/yyyy'); ?></th>
<?php endforeach; ?>
<th>&nbsp;</th>

View File

@ -6,15 +6,18 @@
<?php foreach($this->report->Dirigeant as $Dirigeants):?>
<?php foreach($Dirigeants as $date => $Dirigeant):?>
<tr>
<td style="padding:2px;color:#2599E7"><b><?php if(!empty($Dirigeant[0]->date[0]) || !empty($Dirigeant[0]->date[1])){echo(!empty($Dirigeant[0]->date[0]))?$this->dateFunction->dateT('Ymd', 'd/m/Y', $Dirigeant[0]->date[0]):'NC';echo' - ';
echo(!empty($Dirigeant[0]->date[1]))?$this->dateFunction->dateT('Ymd', 'd/m/Y', $Dirigeant[0]->date[1]):'NC';}else{echo 'NC';}?></b></td>
<td style="padding:2px;color:#2599E7"><b><?php if(!empty($Dirigeant[0]->date[0]) || !empty($Dirigeant[0]->date[1])){
$date1 = new Zend_Date($Dirigeant[0]->date[0],yyyymmdd);$date2 = new Zend_Date($Dirigeant[0]->date[1],yyyymmdd);
echo(!empty($Dirigeant[0]->date[0]))?$date1->toString('dd/mm/yyyy'):'NC';echo' - ';
echo(!empty($Dirigeant[0]->date[1]))?$date2->toString('dd/mm/yyyy'):'NC';}else{echo 'NC';}?></b></td>
</tr>
<?php $i=0;?>
<?php foreach($Dirigeant as $dir):$i++;?>
<tr>
<td class="line" style="font-size:12px;padding:5px;">
<?php echo $dir->FirstName.' '.$dir->LastName.'
<br /><b>Né(e) le:</b> '.((!empty($dir->DateOfBirth->_))?$this->dateFunction->dateT('Ymd', 'd/m/Y', $dir->DateOfBirth->_):'NC').
<?php $date3 = new Zend_Date($dir->DateOfBirth->_,yyyymmdd);
echo $dir->FirstName.' '.$dir->LastName.'
<br /><b>Né(e) le:</b> '.((!empty($dir->DateOfBirth->_))?$date3->toString('dd/mm/yyyy'):'NC').
' <br /><b>Domicilié(e) à :</b>'.(($dir->PersonalAddress->HouseNumber!=0)?$dir->PersonalAddress->HouseNumber:'').
' '.$dir->PersonalAddress->Street.
' '.(($dir->PersonalAddress->PostCode!=0)?$dir->PersonalAddress->PostCode:'NC').

View File

@ -122,7 +122,8 @@
<tr>
<?php foreach($this->report->Employees as $year => $employees): ?>
<tr class="<?php echo ($val)? 'red':'green'; ?>">
<td class="left"><?php if(strlen($year)==4)echo $year; else echo $this->dateFunction->dateT('Ymd', 'd/m/Y', $year);?></td>
<?$date = new Zend_Date($year,yyyymmdd);?>
<td class="left"><?php if(strlen($year)==4)echo $year; else echo $date->toString('dd/mm/yyyy');?></td>
<td class="right"><?php echo $employees['TotalStaffEmployed'];?></td>
<td class="right"><?php echo $employees['FulltimeEquivalent'];?></td>
</tr>

View File

@ -1,6 +1,5 @@
<div class="paragraph">
<?php if(isset($this->report->FinancialSummary)):?>
<? $dateFunction = new WDate();?>
<a name="11"></a>
<span class="title">Informations Capital</span><br />
<?php if(isset($this->report->PositionFinanciere)):?>
@ -10,7 +9,8 @@
<th align="center">
</th>
<?php $i = 0; foreach($this->report->PositionFinanciereDate as $date => $val):$i++?>
<th align="right" class="date"><?php echo $dateFunction->dateT('Ymd', 'd/m/Y', $date);?></th>
<?$date1 = new Zend_Date($date,yyyymmdd);?>
<th align="right" class="date"><?php echo $date1->toString('dd/mm/yyyy');?></th>
<?php endforeach; ?>
</tr>
</thead>

View File

@ -20,11 +20,10 @@ Class GiantFunction
public function setDate($date, $format)
{
$wdate = new WDate();
switch($format) {
case 'YYYYMMDD':
$formatIn = 'Ymd';
$date = $wdate->dateT($formatIn, 'd/m/Y', $date);
$wdate = new Zend_Date($date,yyyymmdd);
$date = $wdate->toString('dd/mm/yyyy');
return ($date);
case 'YYYY':
return ($date);
@ -170,12 +169,11 @@ Class GiantFunction
public function divCommande($listeCommandes, &$total)
{
$i = 1;
$date = new WDate();
$liste .= '<b>Liste de vos commandes :</b><br /><br /><ul>';
foreach($listeCommandes as $commande) {
$total = $total + $commande['price'];
$liste .= '<li>';
$liste .= $i++.'- '. GiantFunction::getFlag($commande['pays']).' '.$date->dateT('Y-m-d', 'd/m/Y', $commande['date']).' '.$commande['typeReport'].' '.$commande['price'].' euros';
$liste .= $i++.'- '. GiantFunction::getFlag($commande['pays']).' '.$commande['date'].' '.$commande['typeReport'].' '.$commande['price'].' euros';
$liste .= '</li>';
}
$liste .= '</ul>';

View File

@ -34,14 +34,11 @@ Class AvisDeCredit
public function formatDate()
{
$date = new WDate();
$function = new GiantFunction();
for($i = 0; $i < count($this->report->DataSet->Company->CreditRecommendation); $i++) {
if (isset($this->report->DataSet->Company->CreditRecommendation[$i]->Date->_)) {
$this->report->DataSet->Company->CreditRecommendation[$i]->Date->_ =
$date->dateT($function->getFormatDate($this->report->DataSet->Company->CreditRecommendation[$i]->Date->format),
'd/m/Y',
$this->report->DataSet->Company->CreditRecommendation[$i]->Date->_);
$date = new Zend_Date($this->report->DataSet->Company->CreditRecommendation[$i]->Date->_,yyyymmdd);
$this->report->DataSet->Company->CreditRecommendation[$i]->Date->_ = $date->toString('dd/mm/yyyy');
}
}
}
@ -201,7 +198,6 @@ class ComparaisonValeurs
public function generateStructureRatio($type)
{
$i = 0;
$date = new WDate();
foreach($this->report->DataSet->Company->PeerGroup as $PeerGroup) {
switch($type) {
case 'FlexibleComparisonItems':
@ -210,13 +206,14 @@ class ComparaisonValeurs
foreach($ComparisonItemsGroup->FlexibleComparisonItem as $key=>$FlexibleComparisonItem) {
$name = str_replace(' ', '_', str_replace('\'', '', $FlexibleComparisonItem->ItemName->_));
$this->report->DataSet->Company->ComparaisonValeurs[$key]['name'] = $name;
$date = new Zend_Date($ComparisonItemsGroup->Period->EndDate->_,yyyymmdd);
if(!isset($this->report->DataSet->Company->ComparaisonValeurs[$key]['date'])) {
$this->report->DataSet->Company->ComparaisonValeurs[$key]['date'] = $date->dateT('Ymd', 'd/m/Y', $ComparisonItemsGroup->Period->EndDate->_);}
$this->report->DataSet->Company->ComparaisonValeurs[$key]['date'] = $date->toString('dd/mm/yyyy');}
if(!isset($this->report->DataSet->Company->ComparaisonValeurs[$key]['current'])){
$this->report->DataSet->Company->ComparaisonValeurs[$key]['current'] = $FlexibleComparisonItem->SubjectValue;}
if(!isset($this->report->DataSet->Company->ComparaisonValeurs[$key]['entreprise'])){
$this->report->DataSet->Company->ComparaisonValeurs[$key]['entreprise'] = $FlexibleComparisonItem->AverageValue;}
if($date->dateT('Ymd', 'd/m/Y', $ComparisonItemsGroup->Period->EndDate->_) != $this->report->DataSet->Company->ComparaisonValeurs[$key]['date']){
if($date->toString('dd/mm/yyyy') != $this->report->DataSet->Company->ComparaisonValeurs[$key]['date']){
$this->report->DataSet->Company->ComparaisonValeurs[$key]['old'][$ComparisonItemsGroup->Period->EndDate->_][] = $FlexibleComparisonItem;}}}
break;
case 'AmountAdvisedComparison':
@ -278,7 +275,6 @@ class ComportementPaiement
public function generateStructure()
{
$date = new WDate();
if(isset($this->report->DataSet->Company->PaymentBehaviour)) {
foreach($this->report->DataSet->Company->PaymentBehaviour as $PaymentBehaviour) {
if(isset($PaymentBehaviour->AnalysisByPeriod->Category)) {
@ -594,14 +590,9 @@ class ComptesAnnuels
public function formatDate($report)
{
//$date = new WDate();
//$function = new GiantFunction();
for ($i = 0; $i < count($this->report->DataSet->Company->AnnualAccounts); $i++) {
if(isset($this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->_)) {
$this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->_=(int)$this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->_;
/*$this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->_ = $date->dateT(
$function->getFormatDate($this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->format), 'd/m/Y',
$this->report->DataSet->Company->AnnualAccounts[$i]->AccountsDate->_);*/
}
}
}
@ -624,7 +615,6 @@ class Dirigeant {
public function generateStructure()
{
$date = new WDate();
foreach($this->report->DataSet->Company->Position as $Position) {
$Position->Person->date = array($Position->Period->StartDate->_,$Position->Period->EndDate->_);
$this->report->DataSet->Company->Dirigeant[$Position->PositionTitle->code][(int)$Position->Period->StartDate->_][] = $Position->Person;