wugg 2 years ago
parent
commit
ecd4700979
1 changed files with 16 additions and 16 deletions
  1. 16 16
      app/command/reportTips.php

+ 16 - 16
app/command/reportTips.php

@@ -47,26 +47,26 @@ class reportTips extends Command
         foreach ($tips as $key=>$value){
 			$t=[];
 			$t['p']=$value['department'];
-			$t['thtotal']=$month_total[$key]??0 - $month_thtotal[$key]??0;
-			$t['mtotal']=$month_total[$key]??0 ;
-			$t['mthfee']=$month_thtotal[$key]??0;
-			$t['wtotal']=$week_total[$key]??0;
-			$t['wthfee']= $week_thtotal[$key]??0;
-			$t['dtotal']=$day_total[$key]??0;
-			$t['thfee']= $day_thtotal[$key]??0;
-			$t['tips']= $value['total_tips']??0;
+			$t['thtotal']=sprintf( "%.2f",$month_total[$key]??0 - $month_thtotal[$key]??0);
+			$t['mtotal']=sprintf( "%.2f",$month_total[$key]??0 );
+			$t['mthfee']=sprintf( "%.2f",$month_thtotal[$key]??0);
+			$t['wtotal']=sprintf( "%.2f",$week_total[$key]??0);
+			$t['wthfee']= sprintf( "%.2f",$week_thtotal[$key]??0);
+			$t['dtotal']=sprintf( "%.2f",$day_total[$key]??0);
+			$t['thfee']= sprintf( "%.2f",$day_thtotal[$key]??0);
+			$t['tips']= sprintf( "%.2f",$value['total_tips']??0);
 			$t["rate"]=number_format( $t['mtotal']/$value['total_tips']*100,2);
 			$t["thrate"]=number_format( $t['thtotal']/$value['total_tips']*100,2);
 			$data[]=$t;
         }
-        $temp['thtotal'] = array_sum(array_column($data,'thtotal'));
-        $temp['mtotal'] = array_sum(array_column($data,'mtotal'));
-        $temp['mthfee'] = array_sum(array_column($data,'mthfee'));
-        $temp['wtotal'] = array_sum(array_column($data,'wtotal'));
-        $temp['wthfee'] = array_sum(array_column($data,'wthfee'));
-        $temp['dtotal'] = array_sum(array_column($data,'dtotal'));
-        $temp['thfee'] = array_sum(array_column($data,'thfee'));
-        $temp['tips'] = array_sum(array_column($data,'tips'));
+        $temp['thtotal'] = sprintf( "%.2f",array_sum(array_column($data,'thtotal')));
+        $temp['mtotal'] = sprintf( "%.2f",array_sum(array_column($data,'mtotal')));
+        $temp['mthfee'] = sprintf( "%.2f",array_sum(array_column($data,'mthfee')));
+        $temp['wtotal'] = sprintf( "%.2f",array_sum(array_column($data,'wtotal')));
+        $temp['wthfee'] = sprintf( "%.2f",array_sum(array_column($data,'wthfee')));
+        $temp['dtotal'] = sprintf( "%.2f",array_sum(array_column($data,'dtotal')));
+        $temp['thfee'] = sprintf( "%.2f",array_sum(array_column($data,'thfee')));
+        $temp['tips'] = sprintf( "%.2f",array_sum(array_column($data,'tips')));
         $temp["rate"]=number_format( $temp['mtotal']/$temp['tips']*100,2);
 		$temp["thrate"]=number_format( $temp['thtotal']/$temp['tips']*100,2);