<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class Invoice
 * 
 * @property string $inv_no
 * @property string|null $hire_purchaseID
 * @property int|null $cus_id
 * @property float $tot_inv_price
 * @property float $tot_discount
 * @property float $sub_total
 * @property float|null $hire_p_advance
 * @property string|null $pay_stat
 * @property Carbon $added_date
 * @property Carbon $added_time
 * @property string $delivery_no
 * @property int $added_by
 * @property string $cmp_id
 * @property string|null $inv_type
 * @property string|null $status
 * @property string|null $dis
 * @property string|null $voucherNo
 * @property float|null $paid
 * @property string $invoice_status
 * @property string|null $order_id
 * @property int|null $loyalty_member_id
 * @property string|null $approveStatus
 * @property int|null $print_count
 * @property int|null $IsvatInvoice
 * @property float|null $vat_percentage
 * @property float|null $other_charge
 * @property float|null $total_weight
 * 
 * @property Customer|null $customer
 *
 * @package App\Models
 */
class Invoice extends Model
{
	protected $table = 'invoice';
	protected $primaryKey = 'inv_no';
	public $incrementing = false;
	public $timestamps = false;

	protected $casts = [
		'cus_id' => 'int',
		'tot_inv_price' => 'float',
		'tot_discount' => 'float',
		'sub_total' => 'float',
		'hire_p_advance' => 'float',
		'added_date' => 'datetime',
		'added_time' => 'datetime',
		'added_by' => 'int',
		'paid' => 'float',
		'loyalty_member_id' => 'int',
		'print_count' => 'int',
		'IsvatInvoice' => 'int',
		'vat_percentage' => 'float',
		'other_charge' => 'float',
		'total_weight' => 'float'
	];

	protected $fillable = [
		'hire_purchaseID',
		'cus_id',
		'tot_inv_price',
		'tot_discount',
		'sub_total',
		'hire_p_advance',
		'pay_stat',
		'added_date',
		'added_time',
		'delivery_no',
		'added_by',
		'cmp_id',
		'inv_type',
		'status',
		'dis',
		'voucherNo',
		'paid',
		'invoice_status',
		'order_id',
		'loyalty_member_id',
		'approveStatus',
		'print_count',
		'IsvatInvoice',
		'vat_percentage',
		'other_charge',
		'total_weight'
	];

	public function customer()
	{
		return $this->belongsTo(Customer::class, 'cus_id');
	}
}
