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

50 lines
1.2 KiB
HTML

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