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