39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
[viewBag]
|
|
==
|
|
<?php
|
|
function onStart (){
|
|
$no = $this->no;
|
|
$year = $this->year;
|
|
$prodId = $this->prodId;
|
|
|
|
$allAmount = $this->all_amount;
|
|
|
|
|
|
$amountCalc = Romanah\Gokbakja\Models\PivotProduction::where('product_id', $prodId)
|
|
->whereMonth('created_at', $no)
|
|
->whereYear('created_at', $year)
|
|
->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;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
?>
|
|
==
|
|
<td style="text-align: center;">
|
|
{% if pivot_calc > 0 %}
|
|
{{pivot_calc|number_format}} kg <br>
|
|
<font style="font-size: 12px;color: gray;">
|
|
{{percentageCalc|number_format(2)}} %
|
|
</font>
|
|
{% endif %}
|
|
</td>
|