<?php

class PrintModel extends CI_Model {

	public function getAllBill()
	{
		return $this->db->order_by("bill_id", "DESC")->get_where("bill_details");
	}

	public function setPrintData($post)
	{
		$data = [
			"bill_party" => !empty(trim($post["partyName"])) ? $post["partyName"] : "-",
			"bill_rsl_no" => !empty(trim($post["rslNumber"])) ? $post["rslNumber"] : "-",
			"bill_vehicle_no" => !empty(trim($post["vNumber"])) ? $post["vNumber"] : "-",
			"bill_gross" => !empty(trim($post["gross"])) ? $post["gross"] : "-",
			"bill_kg_date1" => !empty(trim($post["date1"])) ? $post["date1"] : "-",
			"bill_time1" => !empty(trim($post["time1"])) ? $post["time1"] : "-",
			"bill_tare" => !empty(trim($post["tare"])) ? $post["tare"] : "-",
			"bill_kg_date2" => !empty(trim($post["date2"])) ? $post["date2"] : "-",
			"bill_time2" => !empty(trim($post["time2"])) ? $post["time2"] : "-",
			"bill_nett" => !empty(trim($post["nett"])) ? $post["nett"] : "-",
		];

		return $this->db->insert("bill_details", $data);
	}
}