g_sto/themes/gokbakja/partials/report/product-month-row.htm

50 lines
1.2 KiB
HTML
Raw Normal View History

2023-09-19 19:52:14 +00:00
[viewBag]
==
<?php
function onStart (){
$year = $this->param("year");
$prodId = $this->prodId;
2023-11-19 19:59:08 +00:00
$currentDate = Carbon\Carbon::now();
2023-09-19 19:52:14 +00:00
2023-10-11 22:11:21 +00:00
$allAmount = $this->all_amount;
2023-09-19 19:52:14 +00:00
if($year){
2023-10-19 21:07:33 +00:00
$amountCalc = Romanah\Gokbakja\Models\ProductionCalculate::where('product_id', $prodId)
->whereMonth('date', $this["month"])
->whereYear('date', $year)
->sum("amount_calc");
2023-10-11 22:11:21 +00:00
if ($amountCalc != null){
2023-10-19 21:07:33 +00:00
$this["pivot_calc"] = (float) ($amountCalc);
2023-10-11 22:11:21 +00:00
}else{
$this["pivot_calc"] = 0;
}
2023-09-19 19:52:14 +00:00
}else{
2023-10-19 21:07:33 +00:00
$amountCalc = Romanah\Gokbakja\Models\ProductionCalculate::where('product_id', $prodId)
2023-10-11 22:11:21 +00:00
->whereMonth('created_at', $this["month"])
->whereYear('created_at', $currentDate->year)
2023-10-19 21:07:33 +00:00
->sum("amount_calc");
2023-10-11 22:11:21 +00:00
if ($amountCalc != null){
2023-10-19 21:07:33 +00:00
$this["pivot_calc"] = (float) ($amountCalc);
2023-10-11 22:11:21 +00:00
}else{
$this["pivot_calc"] = 0;
}
2023-09-19 19:52:14 +00:00
}
}
?>
==
<td style="text-align: center;">
<span class="badge badge-soft-info"
2023-10-11 22:11:21 +00:00
style="font-size: 14px;">{{pivot_calc|number_format}} kg</span>
2023-09-19 19:52:14 +00:00
</td>