pos changes
Showing
... | ... | @@ -13,7 +13,7 @@ class Pos_response_model extends CI_Model { |
return $result; | ||
} | ||
public function get_all_Pos_response($reqId = '',$respId=''){ | ||
public function get_all_Pos_response($reqId = '',$respId='',$type=''){ | ||
$where = ''; | ||
if(isset($reqId) && !empty($reqId)){ | ||
$where .= "PSRSP.req_id=$reqId"; | ||
... | ... | @@ -21,6 +21,9 @@ class Pos_response_model extends CI_Model { |
if(isset($respId) && !empty($respId)){ | ||
$where .= "PSRSP.pos_resp_code='".$respId."'"; | ||
} | ||
if(isset($type) && $type == 3){ | ||
$where .= " AND PSRSP.status='2'"; | ||
} | ||
$sql = $this->db->query("SELECT POS.pos_code,POS.name,POS.phone_no,PSRSP.cost,PSRSP.margin,PSRSP.total,PSRSP.id AS ps_rsp_id,PSRSP.pos_resp_code,PSRSP.status,STNGS.admin_charge,STNGS.VAT FROM pos_response AS PSRSP INNER JOIN pos AS POS ON POS.pos_id = PSRSP.pos_id INNER JOIN settings AS STNGS WHERE $where"); | ||
if(empty($sql)){ | ||
return false; | ||
... | ... | @@ -32,7 +35,9 @@ class Pos_response_model extends CI_Model { |
} | ||
public function updatePosMargin($postData = array()){ | ||
if($this->db->update('pos_response',array('margin'=>$postData['margin'],'total'=>$postData['total']),array('id'=>$postData['respId']))){ | ||
$settings = getSettings(); | ||
$total = ($postData['total'] * $settings['VAT'])/100; | ||
if($this->db->update('pos_response',array('margin'=>$postData['margin'],'total'=>$total),array('id'=>$postData['respId']))){ | ||
return true; | ||
} | ||
} | ||
... | ... | @@ -40,7 +45,19 @@ class Pos_response_model extends CI_Model { |
public function approve_quote($postData = ''){ | ||
$selected = implode(',', $postData['selectedIds']); | ||
if($this->db->query("UPDATE pos_response SET status=2 WHERE id IN($selected)")){ | ||
return true; | ||
$posResp = $this->get_all_Pos_response($postData['req_id'],'',3); | ||
$cust_data = $this->db->query("SELECT CUST.name,CUST.email_id FROM pos_request AS PSREQ INNER JOIN customer AS CUST ON CUST.cust_id = PSREQ.cust_id WHERE PSREQ.id=".$postData['req_id'])->row_array() ; | ||
$to =isset($cust_data['email_id']) && !empty($cust_data['email_id'])?$cust_data['email_id']:''; | ||
$sender_email = "[email protected]"; | ||
$data['name']=$cust_data['name']; | ||
$data['email']=$cust_data['email_id']; | ||
$data['postData']=$posResp; | ||
$mail_head = "Your POS Request Best Offers"; | ||
$mail_status = send_custom_email($sender_email,$mail_head,$to,'Pos Request Details', $this->load->view('template/mail_template/pos_quotes', $data,TRUE),''); | ||
$this->db->update('pos_request',array('status'=>'4'),array('id'=>$postData['req_id'])); | ||
return true; | ||
} | ||
} | ||
... | ... |
Please
register
or
sign in
to comment