diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 8d27100..30b2b8c 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -2615,7 +2615,7 @@ class Bdd return $data; } - private function getThanatoDevisListByDate($thanatoId, $date) + private function getThanatoDevisListByDateSave($thanatoId, $date) { $dateFormatted = $date->format('Y-m-d'); $sql = "SELECT @@ -2656,6 +2656,42 @@ class Bdd return $devisList; } + private function getThanatoDevisListByDate($thanatoId, $date) + { + $dateFormatted = $date->format('Y-m-d'); + $sql = "SELECT + devis.id, + devis.date, + devis.mentions, + devis.num as calendar_uuid, + devis.id_defunt as id_defunt, + devis.id_lieu as id_lieu, + devis.id_client as id_client, + devis.id_thanato as id_thanato, + thanato.nom as nom_thanato, + thanato.prenom as prenom_thanato, + defunt.nom as nom_defunt, + lieu.nom as nom_lieu, + lieu.latitude as lieu_latitude, + lieu.longitude as lieu_longitude, + client.nom as nom_client, + client.entreprise as client_entreprise, + client.adresse as client_adresse + FROM ".$this->tableprefix."devis as devis + LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id + LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id + LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id + LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id + WHERE devis.date = ? AND + devis.id_thanato = ? + ORDER BY devis.date ASC;"; + $devisList = $this->execSQLNoJsonReturn( + $sql, + [$dateFormatted,$thanatoId] + ); + return $devisList; + } + public function getThanatoById($thanatoId) { $sql = "SELECT id, nom, prenom,fk_user_uuid FROM ".$this->tableprefix."thanato WHERE id = ? LIMIT 1;"; diff --git a/gestion/lib/Service/ExportThanatoStatisticService.php b/gestion/lib/Service/ExportThanatoStatisticService.php index 7d98a5f..e0907cb 100644 --- a/gestion/lib/Service/ExportThanatoStatisticService.php +++ b/gestion/lib/Service/ExportThanatoStatisticService.php @@ -34,149 +34,158 @@ use OCA\Gestion\Constants\BddConstant; use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Constants\AbsenceTypeConstant; -class ExportThanatoStatisticService { - /** @var Bdd */ - private $gestionBdd; +class ExportThanatoStatisticService +{ + /** @var Bdd */ + private $gestionBdd; - /** @var LoggerInterface */ - private $logger; + /** @var LoggerInterface */ + private $logger; - /** @var IRootFolder */ - private $rootFolder; + /** @var IRootFolder */ + private $rootFolder; - private $geoService; + private $geoService; - public function __construct( - Bdd $gestionBdd, - LoggerInterface $logger, - IRootFolder $rootFolder, - GeoService $geoService) { - $this->geoService = $geoService; - $this->rootFolder = $rootFolder; - $this->logger = $logger; - $this->gestionBdd = $gestionBdd; - } + public function __construct( + Bdd $gestionBdd, + LoggerInterface $logger, + IRootFolder $rootFolder, + GeoService $geoService + ) { + $this->geoService = $geoService; + $this->rootFolder = $rootFolder; + $this->logger = $logger; + $this->gestionBdd = $gestionBdd; + } - private function getFilename($thanatoName,$thanatoLastName,$month,$year){ - $filename = "$year-$month-"; - $filename .= $thanatoName . '-' . $thanatoLastName; - $filename = str_replace(' ','-', $filename); - $filename = str_replace(' ','-', $filename); + private function getFilename($thanatoName, $thanatoLastName, $month, $year) + { + $filename = "$year-$month-"; + $filename .= $thanatoName . '-' . $thanatoLastName; + $filename = str_replace(' ', '-', $filename); + $filename = str_replace(' ', '-', $filename); return $filename; - } + } - private function exportThanatoStatistic($thanatoId,$month,$year,$idNextcloud){ - $thanato = $this->gestionBdd->getThanatoById($thanatoId); - if($thanato == null){ - return null; - } - $exportData = $this->gestionBdd->getExportThanatoStatisticData($thanatoId,$month,$year); - if(empty($exportData)){ - return null; - } - $defaultConfig = json_decode($this->gestionBdd->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); - $racineFolder = html_entity_decode($defaultConfig[0]->path).'/'; - $thanatoFolder = $racineFolder.'STATISTIQUES/THANATOS/'; - $fileHeader = $this->getExportThanatoFileHeader(); - $fileContent = $this->populateExportDataIntoFileContent($exportData,$fileHeader); - $storage = $this->rootFolder->getUserFolder($idNextcloud); - try{ - $storage->newFolder($thanatoFolder); - } - catch(\OCP\Files\NotPermittedException $e) { - - } - $filename = $this->getFilename($thanato["nom"],$thanato["prenom"],$month,$year); - $fileNamePath = $thanatoFolder."STAT-THANATO-" . $filename . '.csv'; - $storage->newFile($fileNamePath); - $file = $storage->get($fileNamePath); - $file->putContent($fileContent); - return $fileNamePath; - } + private function exportThanatoStatistic($thanatoId, $month, $year, $idNextcloud) + { + $thanato = $this->gestionBdd->getThanatoById($thanatoId); + if($thanato == null) { + return null; + } + $exportData = $this->gestionBdd->getExportThanatoStatisticData($thanatoId, $month, $year); + if(empty($exportData)) { + return null; + } + $defaultConfig = json_decode($this->gestionBdd->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD)); + $racineFolder = html_entity_decode($defaultConfig[0]->path).'/'; + $thanatoFolder = $racineFolder.'STATISTIQUES/THANATOS/'; + $fileHeader = $this->getExportThanatoFileHeader(); + $fileContent = $this->populateExportDataIntoFileContent($exportData, $fileHeader); + $storage = $this->rootFolder->getUserFolder($idNextcloud); + try { + $storage->newFolder($thanatoFolder); + } catch(\OCP\Files\NotPermittedException $e) { - public function exportThanatosListStatistic(array $thanatoIds,$month,$year,$idNextcloud){ - $filenames = []; - foreach($thanatoIds as $thanatoId){ - $filename = $this->exportThanatoStatistic($thanatoId,$month,$year,$idNextcloud); - if($filename != null){ - $filenames[] = $filename; - } - } - return $filenames; - } + } + $filename = $this->getFilename($thanato["nom"], $thanato["prenom"], $month, $year); + $fileNamePath = $thanatoFolder."STAT-THANATO-" . $filename . '.csv'; + $storage->newFile($fileNamePath); + $file = $storage->get($fileNamePath); + $file->putContent($fileContent); + return $fileNamePath; + } - public function getExportThanatoFileHeader(): string{ - $fileHeader = - 'FACTURE'.';'. - 'THANATOPRACTEUR'.';'. - 'DATE'.';'. - 'HEURE DE DEBUT'.';'. - 'HEURE DE FIN'.';'. - 'SOINS'.';'. - 'JOUR/FERIE'.';'. - 'CONGE'.';'. - 'REPOS'.';'. - 'MALADIE'.';'. - 'NOM ET PRENOM'.';'. - 'LIEU'.';'. - 'POMPES FUNEBRES'.';'. - 'ADRESSE'.';'. - 'DISTANCE TOTALE KM'.';'. - 'HEURES TOTAL DE SOIN'.';'. - 'HEURES TOTAL DE CONGE'.';'. - 'HEURES TOTAL DE REPOS'.';'. - 'HEURES TOTAL DE MALADIE'.';'. - 'HEURES TOTAL DE TRAVAIL'.';'. - 'HEURES TOTAL DE PARCOURS ENTRE DEVIS'.';'. - 'NOMBRE DE SOINS ET TOILETTES'.';'. - "\n"; - return $fileHeader; - } + public function exportThanatosListStatistic(array $thanatoIds, $month, $year, $idNextcloud) + { + $filenames = []; + foreach($thanatoIds as $thanatoId) { + $filename = $this->exportThanatoStatistic($thanatoId, $month, $year, $idNextcloud); + if($filename != null) { + $filenames[] = $filename; + } + } + return $filenames; + } - private function populateNoDevisDataInADay(string $fileContent,$leave){ - $startTimeValue = ""; - $endTimeValue = ""; - $leaveValue = "Non"; - if($leave["onLeave"]){ - $startTimeValue = $leave["startTime"]; - $endTimeValue = $leave["endTime"]; - if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE){ - $leaveValue = "Oui"; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){ - $diseaseValue = "Oui"; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){ - $restValue = "Oui"; - } - } - $fileContent = $fileContent. - ''.';'. - FileExportHelpers::FormatTextForExport($leave['thanatoName']).';'. - $leave['date'].';'. - $startTimeValue.';'. - $endTimeValue.';'. - ''.';'. - DateHelpers::getPublicHolidayText($leave['isPublicHoliday']).';'. - $leaveValue.';'. - $restValue.';'. - $diseaseValue.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'."\n"; - return $fileContent; - } + public function getExportThanatoFileHeader(): string + { + $fileHeader = + 'DEVIS'.';'. + 'THANATOPRACTEUR'.';'. + 'DATE'.';'. + 'HEURE DE DEBUT'.';'. + 'HEURE DE FIN'.';'. + 'SOINS'.';'. + 'JOUR/FERIE'.';'. + 'CONGE'.';'. + 'REPOS'.';'. + 'MALADIE'.';'. + 'NOM ET PRENOM'.';'. + 'LIEU'.';'. + 'POMPES FUNEBRES'.';'. + 'ADRESSE'.';'. + 'DISTANCE TOTALE KM'.';'. + 'HEURES TOTAL DE SOIN'.';'. + 'HEURES TOTAL DE CONGE'.';'. + 'HEURES TOTAL DE REPOS'.';'. + 'HEURES TOTAL DE MALADIE'.';'. + 'HEURES TOTAL DE TRAVAIL'.';'. + 'HEURES TOTAL DE PARCOURS ENTRE DEVIS'.';'. + 'NOMBRE DE SOINS ET TOILETTES'.';'. + "\n"; + return $fileHeader; + } - public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{ + private function populateNoDevisDataInADay(string $fileContent, $leave) + { + $startTimeValue = ""; + $endTimeValue = ""; + $leaveValue = "Non"; + $restValue = "Non"; // AJOUTER CETTE LIGNE + $diseaseValue = "Non"; // AJOUTER CETTE LIGNE + if($leave["onLeave"]) { + $startTimeValue = $leave["startTime"]; + $endTimeValue = $leave["endTime"]; + if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) { + $leaveValue = "Oui"; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) { + $diseaseValue = "Oui"; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) { + $restValue = "Oui"; + } + } + $fileContent = $fileContent. + ''.';'. + FileExportHelpers::FormatTextForExport($leave['thanatoName']).';'. + $leave['date'].';'. + $startTimeValue.';'. + $endTimeValue.';'. + ''.';'. + DateHelpers::getPublicHolidayText($leave['isPublicHoliday']).';'. + $leaveValue.';'. + $restValue.';'. + $diseaseValue.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'."\n"; + return $fileContent; + } + + public function populateExportDataIntoFileContent(array $exportData, string $fileContent): string + { $g_totalDistance = 0; $g_totalDevisHours = 0; @@ -185,81 +194,81 @@ class ExportThanatoStatisticService { $g_totalTravelingHoursBetweenDevisLocation = 0; $g_totalDiseaseHours = 0; $g_totalRestHours = 0; - $g_totalDevisCount = 0; + $g_totalDevisCount = 0; - foreach($exportData as $devisDate => $devisData){ - $totalDevisHours = 0; - $totalWorkedHours = 8; - $totalLeaveHours = 0; - $totalDiseaseHours = 0; - $totalRestHours = 0; - $totalDistance = 0; - $totalDevisCount = 0; - $totalTravelingHoursBetweenDevisLocation = 0; - $hasDevisInTheCurrentDate = $devisData['hasDevis']; - if($hasDevisInTheCurrentDate === false){ - $leaves = $devisData["leaves"]; - foreach($leaves as $leave){ - $fileContent = $this->populateNoDevisDataInADay($fileContent,$leave); - if($leave["onLeave"]){ - $totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"]; - if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE ){ - $totalLeaveHours += $totalLeaveHoursInsideWorkingHours; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){ - $totalRestHours += $totalLeaveHoursInsideWorkingHours; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){ - $totalDiseaseHours += $totalLeaveHoursInsideWorkingHours; - } - } - } - $totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours; - $totalWorkedHours -= $totalAbsenceHours; - } - else{ - $totalDevisCount += count($devisData["devisId"]); - $routeLines = $this->gestionBdd->getRouteLinesByDevisIdList($devisData["devisId"]); - $totalDistanceAndTotalTravelingHoursBetweenDevis = $this->geoService->getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines($routeLines); - $totalDistance = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalDistance"]; - $totalTravelingHoursBetweenDevisLocation = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalTravelingHours"]; - $devisList = $devisData["devis"]; - $leaves = $devisData["leaves"]; - if(!empty($devisList)){ - foreach($devisList as $devis){ - $fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent,$devis); - $totalDevisHours += $devis["totalHours"]; - } - } - foreach($leaves as $leave){ - $fileContent = $this->populateNoDevisDataInADay($fileContent,$leave); - if($leave["onLeave"]){ - $totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"]; - if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE){ - $totalLeaveHours += $totalLeaveHoursInsideWorkingHours; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){ - $totalRestHours += $totalLeaveHoursInsideWorkingHours; - } - if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){ - $totalDiseaseHours += $totalLeaveHoursInsideWorkingHours; - } - } - } - $totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours; - $totalWorkedHours -= $totalAbsenceHours; - } + foreach($exportData as $devisDate => $devisData) { + $totalDevisHours = 0; + $totalWorkedHours = 8; + $totalLeaveHours = 0; + $totalDiseaseHours = 0; + $totalRestHours = 0; + $totalDistance = 0; + $totalDevisCount = 0; + $totalTravelingHoursBetweenDevisLocation = 0; + $hasDevisInTheCurrentDate = $devisData['hasDevis']; + if($hasDevisInTheCurrentDate === false) { + $leaves = $devisData["leaves"]; + foreach($leaves as $leave) { + $fileContent = $this->populateNoDevisDataInADay($fileContent, $leave); + if($leave["onLeave"]) { + $totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"]; + if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) { + $totalLeaveHours += $totalLeaveHoursInsideWorkingHours; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) { + $totalRestHours += $totalLeaveHoursInsideWorkingHours; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) { + $totalDiseaseHours += $totalLeaveHoursInsideWorkingHours; + } + } + } + $totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours; + $totalWorkedHours -= $totalAbsenceHours; + } else { + $totalDevisCount += count($devisData["devisId"]); + $routeLines = $this->gestionBdd->getRouteLinesByDevisIdList($devisData["devisId"]); + $totalDistanceAndTotalTravelingHoursBetweenDevis = $this->geoService->getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines($routeLines); + $totalDistance = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalDistance"]; + $totalTravelingHoursBetweenDevisLocation = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalTravelingHours"]; + $devisList = $devisData["devis"]; + $leaves = $devisData["leaves"]; + if(!empty($devisList)) { + foreach($devisList as $devis) { + $fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent, $devis); + $totalDevisHours += $devis["totalHours"]; + } + } + foreach($leaves as $leave) { + $fileContent = $this->populateNoDevisDataInADay($fileContent, $leave); + if($leave["onLeave"]) { + $totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"]; + if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) { + $totalLeaveHours += $totalLeaveHoursInsideWorkingHours; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) { + $totalRestHours += $totalLeaveHoursInsideWorkingHours; + } + if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) { + $totalDiseaseHours += $totalLeaveHoursInsideWorkingHours; + } + } + } + $totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours; + $totalWorkedHours -= $totalAbsenceHours; + } - $fileContent = $this->populateLastRecapForTheLine( - $fileContent, - $totalDistance, - $totalDevisHours, - $totalWorkedHours, - $totalLeaveHours, - $totalTravelingHoursBetweenDevisLocation, - $totalDiseaseHours, - $totalRestHours,$totalDevisCount - ); + $fileContent = $this->populateLastRecapForTheLine( + $fileContent, + $totalDistance, + $totalDevisHours, + $totalWorkedHours, + $totalLeaveHours, + $totalTravelingHoursBetweenDevisLocation, + $totalDiseaseHours, + $totalRestHours, + $totalDevisCount + ); $g_totalDistance += $totalDistance; $g_totalDevisHours += $totalDevisHours; @@ -268,8 +277,8 @@ class ExportThanatoStatisticService { $g_totalTravelingHoursBetweenDevisLocation += $totalTravelingHoursBetweenDevisLocation; $g_totalDiseaseHours += $totalDiseaseHours; $g_totalRestHours += $totalRestHours; - $g_totalDevisCount += $totalDevisCount; - } + $g_totalDevisCount += $totalDevisCount; + } $fileContent = $this->populateLastRecapForTheLine( $fileContent, @@ -279,77 +288,112 @@ class ExportThanatoStatisticService { $g_totalLeaveHours, $g_totalTravelingHoursBetweenDevisLocation, $g_totalDiseaseHours, - $g_totalRestHours,$g_totalDevisCount + $g_totalRestHours, + $g_totalDevisCount ); - return $fileContent; - } + return $fileContent; + } - private function populateLastRecapForTheLine(string $fileContent,$distance,$totalDevisHours,$totalWorkedHours,$totalLeaveHours,$totalTravelingHours ,$totalDiseaseHours = 0,$totalRestHours = 0,$totalDevisCount = 0){ - $fileContent = $fileContent. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - "$distance".';'. - "$totalDevisHours".';'. - "$totalLeaveHours".';'. - "$totalRestHours".';'. - "$totalDiseaseHours".';'. - "$totalWorkedHours".';'. - "$totalTravelingHours".';'. - "$totalDevisCount"."\n"; - return $fileContent; - } + private function populateLastRecapForTheLine(string $fileContent, $distance, $totalDevisHours, $totalWorkedHours, $totalLeaveHours, $totalTravelingHours, $totalDiseaseHours = 0, $totalRestHours = 0, $totalDevisCount = 0) + { + $fileContent = $fileContent. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + "$distance".';'. + "$totalDevisHours".';'. + "$totalLeaveHours".';'. + "$totalRestHours".';'. + "$totalDiseaseHours".';'. + "$totalWorkedHours".';'. + "$totalTravelingHours".';'. + "$totalDevisCount"."\n"; + return $fileContent; + } - private function getFormatDevisProduitsAsString($devisProduits){ - $result = ''; - foreach ($devisProduits as $produit) { - $result .= $produit['produit_reference'] . '-' . $produit['produit_description'] . '--'; - } - // Remove the trailing "--" at the end - $result = rtrim($result, '-'); - return $result; - } + private function getFormatDevisProduitsAsString($devisProduits) + { + $result = ''; + foreach ($devisProduits as $produit) { + $result .= $produit['produit_reference'] . '-' . $produit['produit_description'] . '--'; + } + // Remove the trailing "--" at the end + $result = rtrim($result, '-'); + return $result; + } - private function populateDevisDataIntoThanatoExportFileContent(string $fileContent,array $devis){ - $produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]); - $factureNum = $devis["facture_num"] ?? $devis["facture_on_group_num"] ?? ""; - $fileContent = $fileContent. - FileExportHelpers::FormatTextForExport($factureNum).';'. - FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanatho']).';'. - FileExportHelpers::FormatTextForExport($devis["date"]).';'. - FileExportHelpers::FormatTextForExport($devis["startTime"]).';'. - FileExportHelpers::FormatTextForExport($devis["endTime"]).';'. - FileExportHelpers::FormatTextForExport($produitAsString).';'. - FileExportHelpers::FormatTextForExport($devis["dayType"]).';'. - FileExportHelpers::FormatTextForExport('Non').';'. - ''.';'. - ''.';'. - FileExportHelpers::FormatTextForExport($devis["nom_defunt"]).';'. - FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'. - FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'. - FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? ""). - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'. - ''.';'."\n"; - - return $fileContent; + private function populateDevisDataIntoThanatoExportFileContentSave(string $fileContent, array $devis) + { + $produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]); + $factureNum = $devis["facture_num"] ?? $devis["facture_on_group_num"] ?? ""; + $fileContent = $fileContent. + FileExportHelpers::FormatTextForExport($factureNum).';'. + FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanatho']).';'. + FileExportHelpers::FormatTextForExport($devis["date"]).';'. + FileExportHelpers::FormatTextForExport($devis["startTime"]).';'. + FileExportHelpers::FormatTextForExport($devis["endTime"]).';'. + FileExportHelpers::FormatTextForExport($produitAsString).';'. + FileExportHelpers::FormatTextForExport($devis["dayType"]).';'. + FileExportHelpers::FormatTextForExport('Non').';'. + ''.';'. + ''.';'. + FileExportHelpers::FormatTextForExport($devis["nom_defunt"]).';'. + FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'. + FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'. + FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? ""). + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'."\n"; - } + return $fileContent; + + } + + private function populateDevisDataIntoThanatoExportFileContent(string $fileContent, array $devis) + { + $produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]); + $devisNum = (string)$devis["calendar_uuid"]; + $fileContent = $fileContent. + FileExportHelpers::FormatTextForExport($devisNum).';'. + FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanato']).';'. + FileExportHelpers::FormatTextForExport($devis["date"]).';'. + FileExportHelpers::FormatTextForExport($devis["startTime"]).';'. + FileExportHelpers::FormatTextForExport($devis["endTime"]).';'. + FileExportHelpers::FormatTextForExport($produitAsString).';'. + FileExportHelpers::FormatTextForExport($devis["dayType"]).';'. + FileExportHelpers::FormatTextForExport('Non').';'. + ''.';'. + ''.';'. + FileExportHelpers::FormatTextForExport($devis["nom_defunt"]).';'. + FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'. + FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'. + FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? ""). + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'. + ''.';'."\n"; + + return $fileContent; + } }