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

39 lines
1.1 KiB
HTML
Raw Normal View History

2023-09-19 19:52:14 +00:00
[viewBag]
==
<?php
function onStart (){
$no = $this->no;
$year = $this->year;
$prodId = $this->prodId;
2023-10-11 22:11:21 +00:00
$allAmount = $this->all_amount;
$amountCalc = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
2023-09-19 19:52:14 +00:00
->whereMonth('created_at', $no)
->whereYear('created_at', $year)
2023-10-11 22:11:21 +00:00
->orderBy('id', 'DESC')
->first();
if ($amountCalc != null){
$this["pivot_calc"] = (float) ($amountCalc->amount_percentage / 100) * (float) $allAmount;
$this["percentageCalc"] = (float) $amountCalc->amount_percentage;
}else{
$this["pivot_calc"] = 0;
}
2023-09-19 19:52:14 +00:00
}
?>
==
<td style="text-align: center;">
2023-10-11 22:11:21 +00:00
{% if pivot_calc > 0 %}
{{pivot_calc|number_format}} kg <br>
<font style="font-size: 12px;color: gray;">
{{percentageCalc|number_format(2)}} %
</font>
{% endif %}
2023-09-19 19:52:14 +00:00
</td>