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-12-20 20:59:14 +00:00
|
|
|
->whereMonth('date', $this["month"])
|
|
|
|
|
->whereYear('date', $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
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
==
|
2023-12-20 20:59:14 +00:00
|
|
|
<div class="col">
|
|
|
|
|
<span class="badge badge-soft-info" style="font-size: 14px;">
|
|
|
|
|
|
|
|
|
|
{{product_code}}: {{pivot_calc|number_format}} kg
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|