You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kwmobile/application/models/SalesCustomer.php

44 lines
1.1 KiB
PHP

<?php
class SalesCustomer extends CI_Model
{
public $recordID;
public $customerid;
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function getSalesCustomerByRecordIDCustomerID()
{
return $this->db->get_where("salescustomer", array("recordID"=>$this->recordID, "customerid"=>$this->customerid));
}
public function getSalesJoinedSalesCustomerByCustomerID($customerid)
{
$this->db->select('*');
$this->db->from('salescustomer');
$this->db->join('sales', 'salescustomer.recordID=sales.recordID');
$this->db->where('salescustomer.customerid', $customerid);
return $this->db->get();
}
public function addSalesCustomer()
{
$data = array(
"recordID" => $this->recordID,
"customerid" => $this->customerid
);
$success = $this->db->insert("salescustomer", $data);
if($success)
return array("success"=>$success, "data" => $data);
else
return array("success"=>$success, "data" => $this->db->error());
}
}