<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class DailyBankNoteResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'id'              => $this->id,
            'currency_id'     => $this->currency_id,
            'created_by'      => $this->createdBy->name??'',
            'created_at'      => $this->created_at,
            'date_banknote'   => $this->date_banknote,
            'total_add_kh'    => ($this->qty_100000_add*100000)+($this->qty_50000_add*50000)+($this->qty_30000_add*30000)+($this->qty_20000_add*20000)+($this->qty_15000_add*15000)+($this->qty_10000_add*10000)+($this->qty_5000_add*5000)+($this->qty_2000_add*2000)+($this->qty_1000_add*1000)+($this->qty_500_add*500)+($this->qty_200_add*200)+($this->qty_100_add*100),
            'total_sub_kh'    => ($this->qty_100000_sub*100000)+($this->qty_50000_sub*50000)+($this->qty_30000_sub*30000)+($this->qty_20000_sub*20000)+($this->qty_15000_sub*15000)+($this->qty_10000_sub*10000)+($this->qty_5000_sub*5000)+($this->qty_2000_sub*2000)+($this->qty_1000_sub*1000)+($this->qty_500_sub*500)+($this->qty_200_sub*200)+($this->qty_100_sub*100),

            'total_add_dolla' => ($this->qty_100_dollar_add*100)+($this->qty_50_dollar_add*50)+($this->qty_20_dollar_add*20)+($this->qty_10_dollar_add*10)+($this->qty_5_dollar_add*5)+($this->qty_1_dollar_add*1),
            'total_sub_dolla' => ($this->qty_100_dollar_sub*100)+($this->qty_50_dollar_sub*50)+($this->qty_20_dollar_sub*20)+($this->qty_10_dollar_sub*10)+($this->qty_5_dollar_sub*5)+($this->qty_1_dollar_sub*1),
        ];
    }
}