refactor: update SQL order by clause and enhance export functionality for return_to_siege data
This commit is contained in:
parent
49904e63da
commit
bc73730190
@ -226,7 +226,7 @@ class Bdd {
|
|||||||
LEFT JOIN ".$this->tableprefix."client as client_devis on devis.id_client = client_devis.id
|
LEFT JOIN ".$this->tableprefix."client as client_devis on devis.id_client = client_devis.id
|
||||||
LEFT JOIN ".$this->tableprefix."client as client on ligne_trajet.id_client = client.id
|
LEFT JOIN ".$this->tableprefix."client as client on ligne_trajet.id_client = client.id
|
||||||
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||||
WHERE ligne_trajet.id_trajet = ? ORDER BY ligne_trajet.rang ASC;";
|
WHERE ligne_trajet.id_trajet = ? ORDER BY ligne_trajet.date ASC , ligne_trajet.rang ASC;";
|
||||||
return $this->execSQL($sql, array($numtrajet));
|
return $this->execSQL($sql, array($numtrajet));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,7 +1292,7 @@ class Bdd {
|
|||||||
$this->insertTrajet($devis->id_thanato, $date_devis_split[1], $date_devis_split[0], $idNextcloud);
|
$this->insertTrajet($devis->id_thanato, $date_devis_split[1], $date_devis_split[0], $idNextcloud);
|
||||||
$trajet = json_decode($this->getOneTrajet_byThanatoMonthYear($devis->id_thanato, $date_devis_split[1], $date_devis_split[0]))[0];
|
$trajet = json_decode($this->getOneTrajet_byThanatoMonthYear($devis->id_thanato, $date_devis_split[1], $date_devis_split[0]))[0];
|
||||||
}
|
}
|
||||||
$devis->return_to_siege =true ;
|
|
||||||
|
|
||||||
$this->insertTrajetdetails_byDevis($trajet->id, $devis, $idNextcloud);
|
$this->insertTrajetdetails_byDevis($trajet->id, $devis, $idNextcloud);
|
||||||
if($devis->return_to_siege){
|
if($devis->return_to_siege){
|
||||||
@ -2139,7 +2139,9 @@ class Bdd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$devisComment,$calendarUuid = self::DEFAULT_CALENDAR_UUID_FOR_DEVIS,$date = null,$idNextcloud = "admin" , $returnToSiege = false){
|
public function insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId,$devisComment,$calendarUuid = self::DEFAULT_CALENDAR_UUID_FOR_DEVIS,$date = null,$idNextcloud = "admin" , $returnToSiege = false){
|
||||||
|
|
||||||
|
$returnToSiege = $returnToSiege ? 1 : 0;
|
||||||
|
|
||||||
if($date == null){
|
if($date == null){
|
||||||
$dateTime = new Datetime();
|
$dateTime = new Datetime();
|
||||||
$date = $dateTime->format('Y-m-d');
|
$date = $dateTime->format('Y-m-d');
|
||||||
@ -2267,6 +2269,7 @@ class Bdd {
|
|||||||
devis.id_lieu as id_lieu,
|
devis.id_lieu as id_lieu,
|
||||||
devis.id_client as id_client,
|
devis.id_client as id_client,
|
||||||
devis.id_thanato as id_thanato,
|
devis.id_thanato as id_thanato,
|
||||||
|
devis.return_to_siege as return_to_siege,
|
||||||
thanato.nom as nom_thanato,
|
thanato.nom as nom_thanato,
|
||||||
thanato.prenom as prenom_thanato,
|
thanato.prenom as prenom_thanato,
|
||||||
thanato.fk_thanato_type_key as fk_thanato_type_key,
|
thanato.fk_thanato_type_key as fk_thanato_type_key,
|
||||||
@ -3554,6 +3557,7 @@ COMMENTAIRES: ".$comment;
|
|||||||
devis.id_lieu as id_lieu,
|
devis.id_lieu as id_lieu,
|
||||||
devis.id_client as id_client,
|
devis.id_client as id_client,
|
||||||
devis.id_thanato as id_thanato,
|
devis.id_thanato as id_thanato,
|
||||||
|
devis.return_to_siege as return_to_siege,
|
||||||
thanato.nom as nom_thanato,
|
thanato.nom as nom_thanato,
|
||||||
thanato.prenom as prenom_thanato,
|
thanato.prenom as prenom_thanato,
|
||||||
defunt.nom as nom_defunt,
|
defunt.nom as nom_defunt,
|
||||||
|
|||||||
@ -176,6 +176,33 @@ class ExportThanatoStatisticService {
|
|||||||
return $fileContent;
|
return $fileContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function populateReturnToSiegeDataInToFileContent(string $fileContent , $devis){
|
||||||
|
$fileContent = $fileContent.
|
||||||
|
''.';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanatho']).';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["date"]).';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
FileExportHelpers::FormatTextForExport('H2F').';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
"0.5H".';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'."\n";
|
||||||
|
|
||||||
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
||||||
foreach($exportData as $devisDate => $devisData){
|
foreach($exportData as $devisDate => $devisData){
|
||||||
$totalDevisHours = 0;
|
$totalDevisHours = 0;
|
||||||
@ -216,6 +243,10 @@ class ExportThanatoStatisticService {
|
|||||||
if(!empty($devisList)){
|
if(!empty($devisList)){
|
||||||
foreach($devisList as $devis){
|
foreach($devisList as $devis){
|
||||||
$fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent,$devis);
|
$fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent,$devis);
|
||||||
|
if ($devis['return_to_siege']) {
|
||||||
|
$fileContent = $this->populateReturnToSiegeDataInToFileContent($fileContent , $devis);
|
||||||
|
}
|
||||||
|
|
||||||
$totalDevisHours += $devis["totalHours"];
|
$totalDevisHours += $devis["totalHours"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user