get client statistique a year
This commit is contained in:
parent
b1b968a06c
commit
ed4e42f044
@ -2598,8 +2598,6 @@ class PageController extends Controller {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
$exportData = $this->myDb->getExportClientStatData($clientIdsToExport);
|
$exportData = $this->myDb->getExportClientStatData($clientIdsToExport);
|
||||||
var_dump($exportData);
|
|
||||||
die;
|
|
||||||
if(empty($exportData)){
|
if(empty($exportData)){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1923,9 +1923,9 @@ class Bdd {
|
|||||||
produit_devis.id,
|
produit_devis.id,
|
||||||
produit_devis.produit_id,
|
produit_devis.produit_id,
|
||||||
produit_devis.quantite,
|
produit_devis.quantite,
|
||||||
produit_devis.discount
|
produit_devis.discount,
|
||||||
produit.prix_unitaire as produit_price
|
produit.prix_unitaire as produit_price
|
||||||
FROM $this->tableprefix.produit_devis as produit_devis
|
FROM ".$this->tableprefix ."produit_devis as produit_devis
|
||||||
LEFT JOIN ".$this->tableprefix."produit as produit on produit_devis.produit_id = produit.id
|
LEFT JOIN ".$this->tableprefix."produit as produit on produit_devis.produit_id = produit.id
|
||||||
WHERE produit_devis.devis_id = ?;";
|
WHERE produit_devis.devis_id = ?;";
|
||||||
|
|
||||||
|
|||||||
@ -67,18 +67,16 @@ class ExportClientStatisticService {
|
|||||||
|
|
||||||
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
||||||
foreach($exportData as $clientId => $clientData){
|
foreach($exportData as $clientId => $clientData){
|
||||||
foreach($clientData as $data){
|
$clientName = $clientData["client_name"];
|
||||||
$clientName = $data["client_name"];
|
$clientStatPerMonth = $clientData["client_data"];
|
||||||
$clientStatPerMonth = $data["client_data"];
|
$totalPrice = 0;
|
||||||
$totalPrice = 0;
|
if(!empty($clientStatPerMonth)){
|
||||||
if(!empty($clientStatPerMonth)){
|
foreach($clientStatPerMonth as $month => $stat){
|
||||||
foreach($clientStatPerMonth as $month => $stat){
|
$stat["client_name"] = $clientName;
|
||||||
$stat["client_name"] = $clientName;
|
$totalPrice+=$stat["total_price"];
|
||||||
$totalPrice+=$stat["total_price"];
|
$fileContent = $this->populateClientStatDataIntoFileContent($fileContent,$month,$stat);
|
||||||
$fileContent = $this->populateClientStatDataIntoFileContent($fileContent,$month,$stat);
|
|
||||||
}
|
|
||||||
$fileContent = $this->populateTotalPriceIntoFileContent($fileContent,$totalPrice);
|
|
||||||
}
|
}
|
||||||
|
$fileContent = $this->populateTotalPriceIntoFileContent($fileContent,$totalPrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $fileContent;
|
return $fileContent;
|
||||||
@ -96,13 +94,18 @@ class ExportClientStatisticService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function populateClientStatDataIntoFileContent(string $fileContent,$month,array $statPerMonth){
|
private function populateClientStatDataIntoFileContent(string $fileContent,$month,array $statPerMonth){
|
||||||
|
$yearValue = $statPerMonth["year"];
|
||||||
|
$defuntCount = $statPerMonth["defunt_count"];
|
||||||
|
$productCount = $statPerMonth["produit_count"];
|
||||||
|
$totalPrice = $statPerMonth["total_price"];
|
||||||
|
|
||||||
$fileContent = $fileContent.
|
$fileContent = $fileContent.
|
||||||
utf8_decode(html_entity_decode($statPerMonth['client_name'])).';'.
|
utf8_decode(html_entity_decode($statPerMonth['client_name'])).';'.
|
||||||
utf8_decode(html_entity_decode("$month")).';'.
|
utf8_decode(html_entity_decode("$month")).';'.
|
||||||
utf8_decode(html_entity_decode($statPerMonth["year"])).';'.
|
utf8_decode(html_entity_decode("$yearValue")).';'.
|
||||||
utf8_decode(html_entity_decode($statPerMonth["defunt_count"])).';'.
|
utf8_decode(html_entity_decode("$defuntCount")).';'.
|
||||||
utf8_decode(html_entity_decode($statPerMonth["produit_count"])).';'.
|
utf8_decode(html_entity_decode("$productCount")).';'.
|
||||||
utf8_decode(html_entity_decode($statPerMonth["total_price"])).';'."\n";
|
utf8_decode(html_entity_decode("$totalPrice")).';'."\n";
|
||||||
|
|
||||||
return $fileContent;
|
return $fileContent;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user