RRG : Nouvelles règles

This commit is contained in:
Michael RICOIS 2015-04-23 15:36:12 +00:00
parent c7f838a90f
commit 248a3c39d4

View File

@ -245,30 +245,47 @@ if ( count($resultItem) == 0 ) {
$DateCreaEn = $tabIdentite['DateCreaEn'];
}
// --- Correction pour l'envoi des dates
if ( !empty($DateCreaEn) ) {
if (substr($DateCreaEn, -2) * 1 == 0) {
$DateCreaEn = substr($DateCreaEn,0,6).'01';
}
}
// --- Gestion des bilans
$today = new Zend_Date();
if ( !empty($tabIdentite['bilanDate']) ) {
$compare = $today->sub($tabIdentite['bilanDate'], 'yyMMdd');
if ( $compare->toValue(Zend_Date::DAY) < 800 ) {
if ( $compare->toValue(Zend_Date::MONTH) < 37 ) {
$BilanDateCloture = substr($tabIdentite['bilanDate'],6,2).substr($tabIdentite['bilanDate'],4,2).substr($tabIdentite['bilanDate'],0,4);
$BilanCA = $tabIdentite['bilanFL'];
}
}
// --- Estimation du CA bilan
if (empty($BilanCA)) {
//@todo : vérifier pour l'estimé
if ( !empty($tabIdentite['bilanAnnee']) ) {
$BilanDateCloture = '3112'.$tabIdentite['bilanAnnee'];
$BilanCA = $tabIdentite['bilanFLestime'];
}
}
// --- Correction pour l'envoi des dates
if ( !empty($DateCreaEn) ) {
if (substr($DateCreaEn, -2) * 1 == 0) {
$DateCreaEn = substr($DateCreaEn,0,6).'01';
}
if (empty($BilanCA) && !empty($tabIdentite['bilanAnnee'])) {
$dateCreaRecente = new Zend_Date();
$dateCreaRecente->subYear(2)->setMonth(1)->setDay(1);
$dateClotureEstime = new Zend_Date();
$dateClotureEstime->setMonth(12)->setDay(31);
// --- Condition RRG
if ( $tabIdentite['Eff'] > 0
|| substr($tabIdentite['FJ'],0,1) == 1 && $tabIdentite['Eff'] < 1
|| !empty($tabIdentite['NafEnt']) && strlen($tabIdentite['NafEnt']) == 5 && $tabIdentite['NafEnt'] != '0000Z' ) {
// --- Création récente
if ( $dateCreaRecente->compareDate($DateCreaEn, 'yyMMdd') == 1 ) {
$BilanDateCloture = '3112'.date('Y');
$BilanCA = $tabIdentite['bilanFLestime'];
}
// --- Date cloture estimée < Date de création
elseif ( $dateClotureEstime->compare($DateCreaEn, 'yyMMdd') == -1) {
$BilanDateCloture = '3112'.$tabIdentite['bilanAnnee'];
$BilanCA = $tabIdentite['bilanFLestime'];
}
}
}
// Récupération du libellé d'information de paiement