<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class M_sales extends CI_Model {

	function get_all_sales_quotation1(){
	    $query = $this->db->get($this->table);
        return $query->result();
		
		// $result = array();
		// $row = array();
		// $result['total'] =1;
		
		// $row[] = array(
			// 'SalesQuotationDate'=> '21-07-2014',
			// 'SalesQuotationNo'=> 'IST/0614SO-075',
			// 'SalesQuotationOrderByNo'=> 'BGR00112',
			// 'SalesQuotationOrderBy'=> 'ADI',
			// 'SalesQuotationStatus'=> 'Queue',
			// 'SalesQuotationDiscount'=> '0',
			// 'SalesQuotationTax'=> '0',
			// 'SalesQuotationFeight'=> '0',
			// 'SalesQuotationInvoiceAmount'=> '25000',
			// 'SalesQuotationDescription'=> 'Update Stok'
		// );
		
		// $result=array_merge($result,array('rows'=>$row));
		// return json_encode($result);
	}
	
	function get_all_sales_quotation(){
        $this->db->select('
			at_salesquotation.SQuoNumber,
		');
		$this->db->from('at_salesquotation');
		$this->db->join('at_squodetail', 'at_squodetail.EmployeeCode = tbl_user.EmployeeCode', 'inner');
		$this->db->join('am_employee', 'am_employee.DepartmentCode = am_employee.DepartmentCode', 'inner');
		$this->db->join('am_customer', 'am_customer.JobTitleCode = am_employee.JobTitleCode', 'inner');
		$this->db->join('am_itemprice', 'am_itemprice.CompanyCode = am_department.CompanyCode', 'inner');
		$this->db->join('at_inventories', 'at_inventories.CompanyCode = am_company.CompanyCode', 'inner');
		$this->db->join('at_inventdetail', 'at_inventdetail.CompanyCode = am_company.CompanyCode', 'inner');
		$this->db->where('tbl_user.EmployeeCode', $id);
		$query = $this->db->get();
        return $query->result();
    }
	
	function get_detail_sq(){
	    $result = array();
		$row = array();
		$result['total'] =1;
		
		$row[] = array(
			'SalesQuotationDescription'=> 'ANDESIT GREY Q-S3',
			'SalesQuotationQty'=> '1',
			'SalesQuotationUnit'=> 'M2',
			'SalesQuotationUnitPrice'=> '20000',
			'SalesQuotationDiscount'=> '',
			'SalesQuotationAmount'=> '20000',
			'SalesQuotationItem'=> 'K00009',
			'SalesQuotationTax'=> '0',
			'SalesQuotationDepartment'=> '',
			'SalesQuotationProceeded'=> '0',
			'SalesQuotationClosed'=> ''
		);
		
		$result=array_merge($result,array('rows'=>$row));
		return json_encode($result);
		
	}
}

/* End of file m_sales_quotation.php */
/* Location: ./application/models/m_sales_quotation.php */