Correction et test
This commit is contained in:
parent
e0eacb08d7
commit
d4fdab888f
@ -430,19 +430,18 @@ class Metier_Partenaires_MBilans
|
||||
|
||||
$clotureDate = DateTime::createFromFormat('d/m/Y', $millesime);
|
||||
$clotureDateSql = $clotureDate->format('Ymd');
|
||||
|
||||
$fields = "dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert";
|
||||
$where = "siren=:siren AND typeBilan=:typeBilan AND dateExercice=:clotureDate";
|
||||
if ($accesPartenaire) {
|
||||
// On ne veut pas de bilans "Téléchargés" directement sur Internet
|
||||
$strSansBilansWeb = ' AND partenaire<>7 ';
|
||||
} else {
|
||||
$strSansBilansWeb = '';
|
||||
$where.= " AND partenaire!=7";
|
||||
}
|
||||
|
||||
// --- Selection du premier bilan
|
||||
try {
|
||||
$bilanSql = "SELECT dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert
|
||||
FROM jo.bilans WHERE siren=:siren AND typeBilan=:typeBilan AND dateExercice=:clotureDate $strSansBilansWeb
|
||||
LIMIT 0,1";
|
||||
$bilanStmt = $this->conn->prepare($bilanpreviousSql);
|
||||
$bilanSql = "SELECT $fields FROM jo.bilans WHERE $where LIMIT 0,1";
|
||||
$bilanStmt = $this->conn->prepare($bilanSql);
|
||||
$bilanStmt->bindValue('siren', $this->siren);
|
||||
$bilanStmt->bindValue('typeBilan', $typeBilan);
|
||||
$bilanStmt->bindValue('clotureDate', $clotureDateSql);
|
||||
@ -686,10 +685,10 @@ class Metier_Partenaires_MBilans
|
||||
$cloturePreDateSql = $cloturePreDate->format('Ym');
|
||||
// --- Recherche des infos du bilan précédent
|
||||
try {
|
||||
$bilanpreSql = "SELECT dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes
|
||||
FROM jo.bilans WHERE siren=:siren AND typeBilan=:typeBilan AND dateExercice BETWEEN :clotureDateBegin AND :clotureDateEnd
|
||||
ORDER BY dateExercice DESC LIMIT 0,1";
|
||||
$bilanpreStmt = $this->conn->prepare($bilanpreviousSql);
|
||||
$fields = "dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes";
|
||||
$where = "siren=:siren AND typeBilan=:typeBilan AND dateExercice BETWEEN :clotureDateBegin AND :clotureDateEnd";
|
||||
$bilanpreSql = "SELECT $fields FROM jo.bilans WHERE $where ORDER BY dateExercice DESC LIMIT 0,1";
|
||||
$bilanpreStmt = $this->conn->prepare($bilanpreSql);
|
||||
$bilanpreStmt->bindValue('siren', $this->siren);
|
||||
$bilanpreStmt->bindValue('typeBilan', $typeBilan);
|
||||
$bilanpreStmt->bindValue('clotureDateBegin', $cloturePreDateSql.'01');
|
||||
|
Loading…
Reference in New Issue
Block a user