File: /home/cafsindia/allyindian_com/backend/application/models/Refund_collection_model.php
<?php
class Refund_collection_model extends CI_Model{
public function get_packages(){
$this->db->from('package');
$this->db->where('status',1);
return $this->db->get()->result_array();
}
public function get_banks(){
$this->db->from('banks');
$this->db->where('status',1);
return $this->db->get()->result_array();
}
public function get_pending_amt($search_by,$search_text,$package){
$this->db->select('orderid,bookorderid,sblttweb_cancelorder.custid,custfname,custlname,cancelorder.pnrno,custmobile,nopass,orderdate,doj,refundamt,refundpaytype,orderdate as cancel_date');
$this->db->from('cancelorder');
$this->db->join('customers', 'customers.custid = cancelorder.custid');
if($search_by === "1"){
$this->db->where('pnrno', $search_text);
}else
if($search_by === "2"){
$this->db->where('bookorderid', $search_text);
}else
if($search_by === "3"){
$this->db->where('packid', $package);
}
$this->db->where('cancelorder.refundstatus',0);
//$this->db->where('cancelorder.refundamt >',0); AS Discussed with Raghu Removed by BSK on 07th Dec 2018
$this->db->group_by('orderid');
return $this->db->get()->result_array();
}
public function get_update_refund($cancelid){
$this->db->select('*,orderid,sblttweb_cancelorder.ticketamt as ticketamt,sblttweb_cancelorder.cancelfee,sblttweb_cancelorder.cancelamt,sblttweb_cancelorder.refundamt,sblttweb_cancelorder.cashpaid,sblttweb_cancelorder.pnrno as pnrno,bookorderid,count(*) as pass_count');
$this->db->from('cancelorder');
$this->db->where('orderid', $cancelid);
//$this->db->group_by('bookorderid');
return $this->db->get()->result_array();
}
public function refund_update($custid,$insert_data,$refund_amt){
$cancel_id = $insert_data['orderid'];
$update_data = array('refundstatus' => 1);
if($cancel_id){
$this->db->from('sblttweb_payment');
$this->db->where('orderid', $cancel_id);
$result = $this->db->get()->num_rows();
if($result === 0){
if($this->db->insert('sblttweb_payment',$insert_data)){
$payment_id = $this->db->insert_id();
}
$this->db->where('orderid',$cancel_id);
$update = $this->db->update('cancelorder',$update_data);
if($update){
return $payment_id;
}else{
return False;
}
}else{
return False;
}
}
}
public function get_refund_details($payment_id){
$this->db->from('payment');
$this->db->join('customers', 'customers.custid = payment.custid');
$this->db->where('paymentid', $payment_id);
return $this->db->get()->result_array();
}
}
?>