date));
$year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type_transaction == 'retrait' ;
});
$retraits_data[] = sizeof($retraits_query_mounth);
}
$startDate = (new DateTime('01-'.$months[11].'-'.$years[11]))-> format('Y-m-d H:i:s');
$endDate = date_create_from_format ('m/Y',$months[0].'/'.$years[0])-> format('Y-m-d H:i:s');
$retraits = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date);
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'debit' ;
return $trans->type_transaction == 'retrait' ;
});
/**
** Dépots
**/
$date = date("Y");
$depots_data[] = '';
$depots_data =array();
for ($i = 1; $i <= 12; $i++) {
$depots_query_mounth= array_filter($transactions, function ($trans) use ($i, $months ,$years){
$month = date("m",strtotime($trans->date));
$year = date("Y",strtotime($trans->date));
return $month == $months[$i-1] && $year == $years[$i-1] && $trans->type_transaction == 'depot' ;
});
$depots_data[] = sizeof($depots_query_mounth);
}
$depots = array_filter($transactions, function ($trans) use ($i, $endDate ,$startDate){
$date = strtotime($trans->date);
// return $date >= strtotime($startDate) && $date <= strtotime($endDate) && $trans->type == 'credit' ;
return $trans->type_transaction == 'depot' ;
});
if($transactions!=false){
$transac=sizeof($transactions);
$array_transac = array();
$num = 0;
if ($transac > 0) {
foreach($transactions as $row) {
$num++;
$array_transac[] = $row->type_transaction;
}
$vals_transac = array_count_values($array_transac);
$pieChart = array();
foreach(array_keys($vals_transac) as $paramName) {
$color = dechex(rand(0x000000, 0xFFFFFF));
$trash = array("value" => $vals_transac[$paramName],
"color" => "#".$color,
"highlight" => "#".$color,
"label" => $paramName);
$pieChart[]= $trash;
}
}
}else{
$pieChart = array();
}
$fmt = new NumberFormatter( 'fr_FR', NumberFormatter::DECIMAL );
?>
lang->line('Solde Principal') ?>
lang->line('Solde Commission') ?>
".$this->lang->line('Nom')."
".$this->lang->line('Solde Principal')." |
".$this->lang->line('Solde Commission')." |
".$this->lang->line('DEPOT'). 's'." |
".$this->lang->line('RETRAIT').'s'." | ";
?>
result() as $row) {
$wallet = null;
foreach ($agentWalletInfos->result() as $value) {
if ($value->agent_id == $row->agent_id) {
$wallet = $value;
break;
}
}
$com = 0;
$princ = 0;
if($wallet) {
$com = $wallet->balance_com;
$princ = $wallet->balance_princ;
}
echo "
".$row->lastname." |
".Money::of(round($princ,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR')." |
".Money::of(round($com,2), $this->session->userdata('currency_code'),$context)->formatTo('fr_FR')." | ";
$nb_depots = 0;
$nb_retraits = 0;
foreach($depots as $depot){
if($depot->agent_id == $row->agent_id) {
$nb_depots ++;
}
}
foreach($retraits as $retrait){
if($retrait->agent_id == $row->agent_id) {
$nb_retraits ++;
}
}
echo "".$nb_depots." |
".$nb_retraits." |
";
}
}
?>