[viewBag]
==
<?php
function onStart (){
    $year = $this->param("year");
    $prodId = $this->prodId;
    $currentDate = Carbon\Carbon::now();

    $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('date', $this["month"])
                    ->whereYear('date', $currentDate->year)
                    ->sum("amount_calc");


        if ($amountCalc != null){
            $this["pivot_calc"] = (float) ($amountCalc);

        }else{
            $this["pivot_calc"] = 0;
        }

    }

}
?>
==
<div class="col">
<span class="badge badge-soft-info" style="font-size: 14px;">

    {{product_code}}: {{pivot_calc|number_format}} kg

</span>
</div>

