Commit b1d01c53 by Jansa Jose

pos changes

parent 58475234
......@@ -8,7 +8,7 @@ class Pos_booking extends CI_Controller {
date_default_timezone_set("Asia/Kolkata");
$this->load->model('Pos_booking_model');
$this->load->helper('generals_helper');
if(!$this->session->userdata('logged_in')) {
if(!$this->session->userdata('logged_pos')) {
redirect(base_url());
}
......@@ -31,65 +31,12 @@ class Pos_booking extends CI_Controller {
$this->load->view('template',$template);
}
public function getPos_bookingData(){
$resArr = array('status'=>0);
if(!isset($_POST)||empty($_POST)||!isset($_POST['Pos_booking_id'])||empty($_POST['Pos_booking_id']) ||
!is_numeric($Pos_booking_id = $_POST['Pos_booking_id'])){
echo json_encode($resArr);exit;
}
$view_all = (isset($_POST['view_all']) && !empty($_POST['view_all']))?$_POST['view_all']:'';
//$view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:0;
$mechData = $this->Pos_booking_model->getPos_bookingData($Pos_booking_id,$view_all);
//echo json_encode($mechData);exit;
if(empty($mechData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $mechData;
echo json_encode($resArr);exit;
}
function changeStatus($Pos_booking_id = '',$status ='1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'danger');
if(empty($Pos_booking_id) || !is_numeric($Pos_booking_id = decode_param($Pos_booking_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Pos_booking'));
}
$status = $this->Pos_booking_model->changeStatus($Pos_booking_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Pos_booking'));
}
public function check_email_availability() {
$email=$this->input->post('email');
$result = $this->Pos_booking_model->email_availability_check($email);
echo json_encode($result);
}
public function get_all_Pos_booking() {
$data = $_GET;
//print_r($data);exit;
$col = $data['order'][0]['column'];
$col_type = $data['order'][0]['dir'];
$columns = array("pos_booking.id","pos.name","customer.name");
$columns = array("pos_booking.book_id","customer.name","customer.phone_no","pos_parts.unique_name","pos.name","pos.phone_no","customer_address.name","customer_address.phone_no","customer_address.house_no","customer_address.area","customer_address.country","customer_address.district","customer_address.city");
$value['order_by'] = $columns[$col];
$value['order_type'] = $col_type;
$value['search'] = $data['search']['value'];
......@@ -98,77 +45,82 @@ public function get_all_Pos_booking() {
$value['where'] = '';
if(!empty($value['search'])) {
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
}
$prod_list = $this->Pos_booking_model->get_all_Pos_booking($value);
//print_r($prod_list);exit;
$book_list = $this->Pos_booking_model->get_all_Pos_booking($value);
$all_list = $this->Pos_booking_model->get_all_Pos_booking();
$recordsTotal = count($all_list);
$filtered = count($all_list);
if($value['where']!='') {
$value['length'] = '-1';
$all_list = $this->Pos_booking_model->get_all_Pos_booking($value);
$filtered = count($all_list);
}
$data = array();
foreach ($prod_list as $r) {
$action = "<a class='btn btn-info btn-sm view_wish' onclick='getPos_bookingDetails(".$r->cust_id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
$action .= " <a class='btn btn-info btn-sm' href='".base_url()."Pos_booking/editPos_bookings/".encode_param($r->cust_id)."'>
<i class='fa fa-pencil'></i>Edit
</a>";
$action .= " <a class='btn btn-sm btn-danger' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/2' ."'
onClick='return doconfirm()'>
<i class='fa fa-fw fa-trash'></i>Delete
</a>";
if($r->status == 1){
$action .= " <a class='btn btn-sm btn-success' style='background-color:#ac2925' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/0' ."'>
<i class='fa fa-cog'></i> De-activate
</a>";
} else {
$action .= " <a class='btn btn-sm btn-success' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/1' ."'>
<i class='fa fa-cog'></i> Activate
</a>";
}
$action1='';
array_push($data, array(
$r->cust_id,
$r->book_id,
$r->customer_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->customer_phone),
$r->pos_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->pos_phone),
$r->pos_name,
$r->cost,
$r->est_delivery,
$action1
));
}
foreach ($book_list as $r) {
$action = $status = '';
$action .= "<a class='btn btn-info btn-sm view_wish' onclick='getBookDetails(".$r->id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
if($r->status == 2){
$status = "<button type='button' class='btn btn-primary'>Order Packed</button>";
} else if ($r->status == 3) {
$status = "<button type='button' class='btn btn-success'>Order Delivered</button>";
} else if ($r->status == 4) {
$status = "<button type='button' class='btn btn-success'>Completed</button>";
} else if ($r->status == 0) {
$status = "<button type='button' class='btn btn-danger'>Cancelled</button>";
} else if ($r->status == 1) {
$status = "<button type='button' class='btn btn-secondary'>New Booking</button>";
}
array_push($data, array(
$r->cust_id,
$r->book_id,
$r->customer_name,
$r->customer_phone,
$r->cost,
(isset($r->est_delivery) && !empty($r->est_delivery))?$r->est_delivery:'--',
$status,
$action
));
}
echo json_encode(array('recordsFiltered' => $filtered, 'recordsTotal' => $recordsTotal, 'data' => $data));
}
public function getbookDetails(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['bookId'])||empty($_POST['bookId'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_booking_model->getbookdetails($_POST['bookId']);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $posData;
echo json_encode($resArr);exit;
}
public function changeOrderStatus(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['bookingId'])||empty($_POST['bookingId']) || !isset($_POST['status'])||empty($_POST['status']) || !isset($_POST['expected_date'])||empty($_POST['expected_date'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_booking_model->changeOrderStatus($_POST);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
echo json_encode($resArr);exit;
}
......
......@@ -86,8 +86,7 @@ public function get_all_Pos_request() {
$col = $data['order'][0]['column'];
$col_type = $data['order'][0]['dir'];
$columns = array("pos_request.id","pos_request.sub_services","pos_request.Pos_name","pos_request.booking_date");
$columns = array("pos_request.posReq_id","customer_address.name","customer_address.phone_no","pos_parts.unique_name","customer_address.house_no","customer_address.area","customer_address.country","customer_address.district","customer_address.city","customer.name","customer.phone_no");
$value['order_by'] = $columns[$col];
$value['order_type'] = $col_type;
......@@ -120,32 +119,33 @@ public function get_all_Pos_request() {
}
$data = array();
foreach ($prod_list as $r) {
$assign_dt2 = $assign_dtl = $status = '';
if($r->status == 1){
$status = "<button type='button' class='btn btn-primary'>Requested</button>";
} else if ($r->status == 2) {
$status = "<button type='button' class='btn btn-info'>Assigned</button>";
$status = "<button type='button' class='btn btn-info'>Assigned to POS</button>";
} else if ($r->status == 3) {
$status = "<button type='button' class='btn btn-warning'>Respond</button>";
$status = "<button type='button' class='btn btn-warning'>Accepted</button>";
} else if ($r->status == 4) {
$status = "<button type='button' class='btn'>Quote Send</button>";
} else if ($r->status == 5) {
$status = "<button type='button' class='btn btn-success'>Approved</button>";
$status = "<button type='button' class='btn btn-success'>Response From Pos</button>";
}else if ($r->status == 0) {
$status = "<button type='button' class='btn btn-danger'>Cancelled</button>";
}
}
$action = "<a class='btn btn-info btn-sm view_wish' onclick='getPos_requestDetails(".$r->id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
$assign_dtl = '';
$assign_dtl = "<a class='btn btn-info btn-sm' href='".base_url()."Pos_request/pos_assign/".encode_param($r->posReq_id)."'><i class='fa fa-pencil'></i>Assign</a>";
$assign_dt2 = '';
if($r->status == 2) {
if($r->status == 5 || $r->status == 4) {
$assign_dt2.= "<a class='btn btn-info btn-sm' href='".base_url()."Pos_response/responce/".encode_param($r->posReq_id)."'><i class='fa fa-pencil'></i>Responses</a>";
}
array_push($data, array(
$r->cust_id,
$r->posReq_id,
$r->customer_name,
$r->customer_phone,
$r->unique_name,
......@@ -190,6 +190,7 @@ public function pos_assign($request_id=''){
$template['requestData'] = $this->Pos_request_model->getPosData('',decode_param($request_id));
$template['posData'] = $this->Pos_request_model->getPosDetails(decode_param($request_id));
$template['assign_pos'] = $this->Pos_request_model->getAssignPos(decode_param($request_id));
//pr($template);
$this->load->view('template',$template);
}
......
......@@ -58,7 +58,7 @@ class Pos_response extends CI_Controller {
public function approve_quote(){
$respArr =array('status'=>'error');
$data = $_POST;
if(!isset($_POST['selectedIds']) || empty($_POST['selectedIds'])){
if(!isset($_POST['selectedIds']) || empty($_POST['selectedIds']) || !isset($_POST['req_id']) || empty($_POST['req_id'])){
echo json_encode($respArr);exit;
}
$requestData = $this->Pos_response_model->approve_quote($_POST);
......
<?php class Pos_booking_model extends CI_Model {
public function _consruct(){
parent::_construct();
}
public function getPos_bookingData($Pos_booking_id='',$view=''){
$cond = (!empty($view))?" USR.user_type IN ($view) ":" USR.status != '2' ";
$cond .= (!empty($Pos_booking_id))?" AND CUST.cust_id='$Pos_booking_id' ":"";
$query = "SELECT CUST.*,USR.status,USR.password
FROM pos_booking AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE $cond AND USR.user_type='1' Order by id DESC";
$Pos_bookingData = $this->db->query($query);
if($query->num_rows()>0)
{
return (empty($Pos_booking_id))?$Pos_bookingData->result():$Pos_bookingData->row();
}
return 0;
}
function changeStatus($Pos_booking_id = '', $status = '0'){
if(empty($Pos_booking_id)){
return 0;
}
$status = $this->db->update('users',array('status'=>$status),array('profile_id'=>$Pos_booking_id,'user_type'=>'1'));
//echo $this->db->last_query();exit;
return $status;
}
function email_availability_check($email)
{
if($email!=''){
$query = "SELECT * FROM pos_booking AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE USR.status!='2' AND CUST.cust_id!='".$Pos_booking_id."' AND
USR.username='".$email."'";
$query=$this->db->query($query,array($email));
if($query->num_rows()>0)
{
return $query->row_array();
} else
{
return false;
}
}
return false;
public function _consruct(){
parent::_construct();
}
function get_all_Pos_booking($filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
if(!empty($filter['where'])){
$this->db->where($filter['where']);
}
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$this->db->where('pos_booking.status!=','2');
function get_all_Pos_booking($filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
if(!empty($filter['where'])){
$this->db->where($filter['where']);
}
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$this->db->order_by('pos_booking.id','desc');
$this->db->select("pos_booking.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,pos.name as pos_name,pos.phone_no as pos_phone");
$this->db->select("pos_booking.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,pos.name as pos_name,pos.phone_no as pos_phone,customer_address.name,customer_address.phone_no,customer_address.house_no,customer_address.area,customer_address.country,customer_address.district,customer_address.city,pos_response.req_id");
$this->db->from('pos_booking');
$this->db->join('pos','pos.pos_id = pos_booking.pos_id');
$this->db->join('customer', 'customer.cust_id = pos_booking.cust_id');
$this->db->join('customer_address', 'customer_address.ID = pos_booking.address');
$this->db->join('pos_response', 'pos_response.id = pos_booking.resp_id');
$this->db->join("pos_parts","find_in_set(pos_parts.id,pos_response.pos_parts)<> 0","left",false);
$this->db->join("pos_parts","pos_parts.id=pos_response.pos_parts");
//$this->db->where("pos_booking.pos_id",$this->session->userdata('pos_id'));
$this->db->group_by('pos_booking.id');
$res = $this->db->get();
return $res->result();
$res = $this->db->get();
return $res->result();
}
public function getbookdetails($bookingId){
$this->db->select("pos_booking.*,customer_address.name,customer_address.phone_no,customer_address.house_no,customer_address.area,customer_address.country,customer_address.district,customer_address.city,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,vehicle_model.make,vehicle_model.model,vehicle_model.year,vehicle_model.vehicle_name,vehicle_model.mileage,vehicle_model.vehicle_image,pos_request.posReq_id,pos_response.cost,pos_response.margin,pos_response.total");
$this->db->from('pos_booking');
$this->db->join('pos_response', 'pos_response.id = pos_booking.resp_id');
$this->db->join("pos_parts","pos_parts.id=pos_response.pos_parts");
$this->db->join("pos_request","pos_request.id=pos_response.req_id");
$this->db->join('customer', 'customer.cust_id = pos_booking.cust_id');
$this->db->join('customer_address', 'customer_address.id = pos_booking.address');
$this->db->join('vehicle_model', 'vehicle_model.id = pos_request.vehicle_id');
$this->db->where('pos_booking.id',$bookingId);
$res = $this->db->get()->row();
$settings = getSettings();
$res->VAT = $settings['VAT'];
return $res;
}
public function changeOrderStatus($postData = array()){
if($this->db->update('pos_booking',array('est_delivery'=>$postData['expected_date'],'status'=>$postData['status']),array('id'=>$postData['bookingId']))){
return true;
}
}
}
?>
\ No newline at end of file
......@@ -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;
}
}
......
......@@ -51,6 +51,7 @@
<thead>
<tr>
<th>No</th>
<th>Pos Request Code</th>
<th>Customer Name</th>
<th>Phone</th>
<th>Product Name</th>
......
......@@ -104,7 +104,7 @@
<!-- PAGE-INDEX-ENDS -->
<!-- PAGE-CONTENT-STARTS -->
<?php $setting = getSettings();?>
<div class="content">
<div class="animated fadeIn">
<div class="row">
......@@ -166,6 +166,8 @@
<th>Pos Name</th>
<th>Phone Number</th>
<th>Cost</th>
<th>Margin</th>
<th>VAT</th>
<th>Total</th>
<th>Edit</th>
<th>Select</th>
......@@ -179,6 +181,8 @@
<td><?= $value['name'] ?></td>
<td><?= $value['phone_no'] ?></td>
<td><?= $value['cost'] ?></td>
<td><?php echo (isset($value['margin']) && !empty($value['margin']))? $value['margin']: '--' ?></td>
<td><?= $setting['VAT'] ?></td>
<td><?= $value['total'] ?></td>
<td>
<?php
......@@ -198,7 +202,7 @@
</tbody>
<?php } } ?>
<td colspan="8">
<td colspan="10">
<button type="button" class="btn btn-primary" id="send_quote" data-dismiss="modal" style="float: right;">Send Quote</button>
</a>
</td>
......@@ -223,10 +227,11 @@
$("input[type=checkbox]:checked").each ( function() {
selectedValues.push($(this).val());
});
if(selectedValues == ''){
var req_id = jQuery('[id="req_id"]').val();
if(selectedValues == '' || req_id == ''){
return false;
}
var post_data = {"selectedIds": selectedValues};
var post_data = {"selectedIds": selectedValues,"req_id":req_id};
$.ajax({
type: "POST",
url: '<?php echo base_url('Pos_response/approve_quote'); ?>',
......@@ -257,7 +262,7 @@ function changeMargins(reqCode,respCode){
}
var resp_data = jQuery.parseJSON(resp);
if(resp_data['status'] == '0'){
if(resp_data['status'] == 'error'){
remModalLoader();
jQuery('[id="modal_content"]').htnl('Something went wrong, Please try again later...!');
return false;
......@@ -369,7 +374,7 @@ function changeMargins(reqCode,respCode){
'<div class="col-md-5">'+
'<input class="marginTop10" placeholder="Margin" id="margin" type="number" name="margin">'+
'<input class="marginTop10" id="respCode" value="'+resp_data['posDetails'].ps_rsp_id+'" type="hidden">'+
'<input class="marginTop10" id="total" value="'+resp_data['posDetails'].total+'" type="hidden">'+
'<input class="marginTop10" id="cost" value="'+resp_data['posDetails'].cost+'" type="hidden">'+
'</div>'+
'<div class="col-md-3">'+
'<button type="button" style="height: 25px;font-size: 13px;padding-bottom: 22px;" onclick="submitCustQuote(event);" class="btn btn-primary">Submit</button>'+
......@@ -397,19 +402,19 @@ function submitCustQuote(e){
var margin = jQuery('[id="margin"]').val();
var respCode = jQuery('[id="respCode"]').val();
var total = jQuery('[id="total"]').val();
var cost = jQuery('[id="cost"]').val();
if((margin != '' && respCode == '') || (margin == '' && respCode != '')){
if(margin == ''){
jQuery('[id="margin"]').addClass('errInput');
}
if(respCode == '' || total == ''){
if(respCode == '' || cost == ''){
remModalLoader();
jQuery('[id="modal_content"]').html('Something went wrong, please try again later...!');
}
return false;
}
var subTotal = parseInt(total) + parseInt(margin);
var subTotal = parseInt(cost) + parseInt(margin);
jQuery.ajax({
url : base_url+"Pos_response/insertCustomMargin",
......
<!DOCTYPE html>
<html>
<head>
<title>ALLO</title>
<style>
.pin_container{
background: #a8a8a84a;
border:1px dashed #e7e7e7;
padding:10px;
margin-top:20px;
}
.pin_container_1{
background: #a8a8a8;
border:1px dashed #e7e7e7;
padding:10px;
margin-top:20px;
}
</style>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" style="border-collapse: collapse; background-color: #e8e8e8;border-collapse: collapse;margin: 0;padding: 0;">
<tbody style="border: 1px solid #00000017;border-radius: 95px;">
<tr>
<td align="center" valign="top" style="padding: 0 10px;">
<table cellpadding="0" cellspacing="0" border="0" align="center" width="100%" style="border-collapse: collapse; font-family:'Roboto',sans-serif;font-size: 32px;font-weight: bold;color: #3392ea; max-width: 600px;">
<tbody>
<tr>
<!-- <td align="left" style="padding: 18px 0 7px 5px;"><a href="" style="color: #689c35;text-decoration: none;" target="_blank" rel="noopener"> <span style="color: #555555;text-decoration: none; font-size=12px"><img src="<?php echo base_url();?>user_assets/images/al-hissan--logo.png" max-height="65px" alt="xxxxx"> </span> </a></td> -->
</tr>
</tbody>
</table>
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; background-color: #ffffff; border-collapse: collapse;width: 100%;max-width: 600px; border-radius: 8px;">
<tbody>
<tr>
<td align="center" style="padding: 0px; text-align: center;">
<table cellpadding="0" cellspacing="0" width="100%" align="center" style="border-collapse: collapse;">
<tbody>
<tr>
<td align="left" style="padding: 25px;">
<h3 style="margin: 0; text-align: center; padding: 0 0 10px; font-weight: normal; font-weight: normal; font-size: 26px; color: #bb4825; line-height: 32px; font-family:'Roboto',sans-serif; "> <strong>Hi <?php echo ($name);?></strong>, Offers For You.</h3>
<h2 style="color: #555555; font-weight: bold; margin: 0; padding: 0 0 10px; line-height: 25px; font-size: 15px; font-family:'Roboto',sans-serif; border-bottom: 1px dashed #ccc; " align="center"></h2>
<div style="border-bottom: 1px dashed #ccc; padding: 10px 0; line-height: 160%; font-size: 15px;">
<div style="color: #555555; line-height: 160%;font-family:'Roboto',sans-serif;">
<center>
<div class="pin_container_1">
Following Your Request, We are Pleased to send you our Best Offers
</div>
</center>
</div>
</div>
<div style="border-bottom: 1px dashed #ccc; padding: 10px 0; line-height: 160%; font-size: 15px;">
<div style="color: #555555; line-height: 160%;font-family:'Roboto',sans-serif;">
<center>
<h3 style="color: midnightblue;">
<strong> POS DETAILS</strong>
</h3>
<div class="pin_container">
<table cellpadding="10" cellspacing="5" width="100%" border="0" style="border-collapse: collapse;">
<thead>
<tr>
<th>Pos Code</th>
<th>Pos Name</th>
<th>Phone Number</th>
<th>Cost</th>
<th>Margin</th>
<th>Total</th>
</tr>
</thead>
<?php foreach ($postData as $key => $value) { ?>
<tbody>
<tr>
<td><?= $value['pos_code'] ?></td>
<td><?= $value['name'] ?></td>
<td><?= $value['phone_no'] ?></td>
<td><?= $value['cost'] ?></td>
<td><?= $value['margin'] ?></td>
<td><?= $value['total'] ?></td>
<tr>
</tbody>
<?php } ?>
</table>
</div>
</center><br>
</div>
</div>
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="border-collapse: collapse;">
<tbody>
<tr>
<td align="center" style="padding: 25px 0;">
<p style="color: #555555; font-size: 16px; line-height: 140%; margin: 0; padding: 0;">
<span style="font-size: 14px;font-family:'Roboto',sans-serif;">If you got any questions for us, drop us a not at <a href="http://www.xxxx.co.uk/" style="text-decoration: none; color: #3392ea;" target="_blank" rel="noopener">http://www.xxxx.co.uk/</a> or call us on (123) 456-7890 . </span>
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; max-width: 600px;" align="center">
<tbody>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
......@@ -2561,3 +2561,4 @@ footer.site-footer {
pointer-events: none;
opacity: 0.7;
}
......@@ -48,7 +48,7 @@ public function __construct() {
);
$this->session->set_userdata('logged_pos',$sess_array);
$this->session->set_userdata('admin',$result->role);
$this->session->set_userdata('id',$result->id);
$this->session->set_userdata('pos_id',$result->profile_id);
return true;
} else {
......
......@@ -31,65 +31,12 @@ class Pos_booking extends CI_Controller {
$this->load->view('template',$template);
}
public function getPos_bookingData(){
$resArr = array('status'=>0);
if(!isset($_POST)||empty($_POST)||!isset($_POST['Pos_booking_id'])||empty($_POST['Pos_booking_id']) ||
!is_numeric($Pos_booking_id = $_POST['Pos_booking_id'])){
echo json_encode($resArr);exit;
}
$view_all = (isset($_POST['view_all']) && !empty($_POST['view_all']))?$_POST['view_all']:'';
//$view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:0;
$mechData = $this->Pos_booking_model->getPos_bookingData($Pos_booking_id,$view_all);
//echo json_encode($mechData);exit;
if(empty($mechData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $mechData;
echo json_encode($resArr);exit;
}
function changeStatus($Pos_booking_id = '',$status ='1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'danger');
if(empty($Pos_booking_id) || !is_numeric($Pos_booking_id = decode_param($Pos_booking_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Pos_booking'));
}
$status = $this->Pos_booking_model->changeStatus($Pos_booking_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Pos_booking'));
}
public function check_email_availability() {
$email=$this->input->post('email');
$result = $this->Pos_booking_model->email_availability_check($email);
echo json_encode($result);
}
public function get_all_Pos_booking() {
$data = $_GET;
//print_r($data);exit;
$col = $data['order'][0]['column'];
$col_type = $data['order'][0]['dir'];
$columns = array("pos_booking.id","pos.name","customer.name");
$columns = array("pos_booking.book_id","customer.name","customer.phone_no","pos_parts.unique_name","pos.name","pos.phone_no","customer_address.name","customer_address.phone_no","customer_address.house_no","customer_address.area","customer_address.country","customer_address.district","customer_address.city");
$value['order_by'] = $columns[$col];
$value['order_type'] = $col_type;
$value['search'] = $data['search']['value'];
......@@ -98,77 +45,88 @@ public function get_all_Pos_booking() {
$value['where'] = '';
if(!empty($value['search'])) {
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
}
$prod_list = $this->Pos_booking_model->get_all_Pos_booking($value);
//print_r($prod_list);exit;
$book_list = $this->Pos_booking_model->get_all_Pos_booking($value);
$all_list = $this->Pos_booking_model->get_all_Pos_booking();
$recordsTotal = count($all_list);
$filtered = count($all_list);
if($value['where']!='') {
$value['length'] = '-1';
$all_list = $this->Pos_booking_model->get_all_Pos_booking($value);
$filtered = count($all_list);
}
$data = array();
foreach ($prod_list as $r) {
$action = "<a class='btn btn-info btn-sm view_wish' onclick='getPos_bookingDetails(".$r->cust_id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
$action .= " <a class='btn btn-info btn-sm' href='".base_url()."Pos_booking/editPos_bookings/".encode_param($r->cust_id)."'>
<i class='fa fa-pencil'></i>Edit
</a>";
$action .= " <a class='btn btn-sm btn-danger' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/2' ."'
onClick='return doconfirm()'>
<i class='fa fa-fw fa-trash'></i>Delete
</a>";
if($r->status == 1){
$action .= " <a class='btn btn-sm btn-success' style='background-color:#ac2925' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/0' ."'>
<i class='fa fa-cog'></i> De-activate
</a>";
} else {
$action .= " <a class='btn btn-sm btn-success' href='".base_url()."Pos_booking/changeStatus/".encode_param($r->cust_id).'/1' ."'>
<i class='fa fa-cog'></i> Activate
</a>";
}
$action1='';
array_push($data, array(
$r->cust_id,
$r->book_id,
$r->customer_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->customer_phone),
$r->pos_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->pos_phone),
$r->pos_name,
$r->cost,
$r->est_delivery,
$action1
));
}
foreach ($book_list as $r) {
$action = $status = '';
$action .= "<a class='btn btn-info btn-sm view_wish' onclick='getBookDetails(".$r->id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
if($r->status == '1' || $r->status == '2'){
$action .= '<a class="btn btn-sm btn-success"
onclick="ChangeStatus('.$r->id.','.$r->status.',\''.$r->est_delivery.'\')">
<i class="fa fa-cog"></i>ChangeStatus
</a>';
}
if($r->status == 2){
$status = "<button type='button' class='btn btn-primary'>Order Packed</button>";
} else if ($r->status == 3) {
$status = "<button type='button' class='btn btn-success'>Order Delivered</button>";
} else if ($r->status == 4) {
$status = "<button type='button' class='btn btn-success'>Completed</button>";
} else if ($r->status == 0) {
$status = "<button type='button' class='btn btn-danger'>Cancelled</button>";
} else if ($r->status == 1) {
$status = "<button type='button' class='btn btn-secondary'>New Booking</button>";
}
array_push($data, array(
$r->cust_id,
$r->book_id,
$r->customer_name,
$r->customer_phone,
$r->cost,
(isset($r->est_delivery) && !empty($r->est_delivery))?$r->est_delivery:'--',
$status,
$action
));
}
echo json_encode(array('recordsFiltered' => $filtered, 'recordsTotal' => $recordsTotal, 'data' => $data));
}
public function getbookDetails(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['bookId'])||empty($_POST['bookId'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_booking_model->getbookdetails($_POST['bookId']);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $posData;
echo json_encode($resArr);exit;
}
public function changeOrderStatus(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['bookingId'])||empty($_POST['bookingId']) || !isset($_POST['status'])||empty($_POST['status']) || !isset($_POST['expected_date'])||empty($_POST['expected_date'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_booking_model->changeOrderStatus($_POST);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
echo json_encode($resArr);exit;
}
......
......@@ -13,8 +13,6 @@ class Pos_request extends CI_Controller {
}
}
public function index(){
$template['page'] = 'Pos_request/list';
......@@ -30,7 +28,7 @@ class Pos_request extends CI_Controller {
}
public function getPos_requestData(){
$resArr = array('status'=>0);
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['Pos_request_id'])||empty($_POST['Pos_request_id']) ||
!is_numeric($Pos_request_id = $_POST['Pos_request_id'])){
echo json_encode($resArr);exit;
......@@ -81,92 +79,115 @@ public function check_email_availability() {
public function get_all_Pos_request() {
$data = $_GET;
//print_r($data);exit;
$pos_id = $this->session->userdata('pos_id');
$col = $data['order'][0]['column'];
$col_type = $data['order'][0]['dir'];
$columns = array("pos_request.id","pos_request.sub_services","pos_request.Pos_name","pos_request.booking_date");
$columns = array("pos_request.posReq_id","customer.name","customer.phone_no","pos_parts.unique_name");
$value['order_by'] = $columns[$col];
$value['order_type'] = $col_type;
$value['search'] = $data['search']['value'];
$value['start'] = $data['start'];
$value['length'] = $data['length'];
$value['where'] = '';
if(!empty($value['search'])) {
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$prod_list = $this->Pos_request_model->get_all_Pos_request($value);
//print_r($prod_list);exit;
$all_list = $this->Pos_request_model->get_all_Pos_request();
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
}
$prod_list = $this->Pos_request_model->get_all_Pos_request($pos_id,$value);
$all_list = $this->Pos_request_model->get_all_Pos_request($pos_id,'');
$recordsTotal = count($all_list);
$filtered = count($all_list);
if($value['where']!='') {
$value['length'] = '-1';
$all_list = $this->Pos_request_model->get_all_Pos_request($value);
$all_list = $this->Pos_request_model->get_all_Pos_request($pos_id,$value);
$filtered = count($all_list);
}
$data = array();
foreach ($prod_list as $r) {
$action = $status = '';
$action .= "<a class='btn btn-info btn-sm view_wish' onclick='getPos_requestDetails(".$r->id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
if($r->status == 2){
$action .= " <a class='btn btn-sm btn-success' onclick='sendQuote(".$r->id.",".$r->part_ids.")'><i class='fa fa-cog'></i> Quote</a>";
$status = "<button type='button' class='btn btn-primary'>New Request</button>";
} else if ($r->status == 3) {
$status = "<button type='button' class='btn btn-success'>Accepted</button>";
} else if ($r->status == 4) {
$status = "<button type='button' class='btn btn-info'>Quote Send to User</button>";
} else if ($r->status == 0) {
$status = "<button type='button' class='btn btn-danger'>Cancelled</button>";
} else if ($r->status == 5) {
$status = "<button type='button' class='btn btn-secondary'>Quote Send to Admin</button>";
}
if($r->status == 5 || $r->status == 4){
$action .= " <a class='btn btn-sm btn-success' onclick='quoteDetails(".$r->id.")'><i class='fa fa-cog'></i> Quote Details</a>";
}
array_push($data, array(
$r->id,
$r->posReq_id,
$r->customer_name,
$r->customer_phone,
$r->unique_name,
$status,
$action
));
}
echo json_encode(array('recordsFiltered' => $filtered, 'recordsTotal' => $recordsTotal, 'data' => $data));
}
$action = "<a class='btn btn-info btn-sm view_wish' onclick='getPos_requestDetails(".$r->cust_id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
$action .= " <a class='btn btn-info btn-sm' href='".base_url()."Pos_request/editPos_requests/".encode_param($r->cust_id)."'>
<i class='fa fa-pencil'></i>Edit
</a>";
$action .= " <a class='btn btn-sm btn-danger' href='".base_url()."Pos_request/changeStatus/".encode_param($r->cust_id).'/2' ."'
onClick='return doconfirm()'>
<i class='fa fa-fw fa-trash'></i>Delete
</a>";
if($r->status == 1){
$action .= " <a class='btn btn-sm btn-success' style='background-color:#ac2925' href='".base_url()."Pos_request/changeStatus/".encode_param($r->cust_id).'/0' ."'>
<i class='fa fa-cog'></i> De-activate
</a>";
} else {
$action .= " <a class='btn btn-sm btn-success' href='".base_url()."Pos_request/changeStatus/".encode_param($r->cust_id).'/1' ."'>
<i class='fa fa-cog'></i> Activate
</a>";
}
$action1='';
array_push($data, array(
$r->cust_id,
$r->customer_name,
$r->customer_phone,
$r->unique_name,
$r->pos_name,
$r->address,
$action1
));
}
echo json_encode(array('recordsFiltered' => $filtered, 'recordsTotal' => $recordsTotal, 'data' => $data));
}
public function getPosData($request_id = ''){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['request_id'])||empty($_POST['request_id']) ||
!is_numeric($request_id = $_POST['request_id'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_request_model->getPosData($request_id);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $posData;
echo json_encode($resArr);exit;
}
public function getPosDetails(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['requestId'])||empty($_POST['requestId'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_request_model->getPosData($_POST['requestId']);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $posData;
echo json_encode($resArr);exit;
}
public function getSendQuoteDetails(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['requestId'])||empty($_POST['requestId'])){
echo json_encode($resArr);exit;
}
$quoteDetails = $this->Pos_request_model->getSendQuoteDetails($_POST['requestId']);
if(empty($quoteDetails)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $quoteDetails;
echo json_encode($resArr);exit;
}
......
......@@ -15,162 +15,17 @@ class Pos_response extends CI_Controller {
}
public function index(){
$template['page'] = 'Pos_response/list';
$template['menu'] = 'POS Response Management';
$template['smenu'] = 'View POS Responses';
$template['pTitle'] = "View POS Responses";
$template['pDescription'] = "View and Manage POS Responses";
$template['page_head'] = "POS Response Management";
$template['datatable'] = 1;
//$template['Pos_response_data'] = $this->Pos_response_model->getPos_responseData();
$this->load->view('template',$template);
}
public function getPos_responseData(){
$resArr = array('status'=>0);
if(!isset($_POST)||empty($_POST)||!isset($_POST['Pos_response_id'])||empty($_POST['Pos_response_id']) ||
!is_numeric($Pos_response_id = $_POST['Pos_response_id'])){
echo json_encode($resArr);exit;
}
$view_all = (isset($_POST['view_all']) && !empty($_POST['view_all']))?$_POST['view_all']:'';
//$view_all = (isset($_POST['view_all']) && $_POST['view_all'] == 1)?1:0;
$mechData = $this->Pos_response_model->getPos_responseData($Pos_response_id,$view_all);
//echo json_encode($mechData);exit;
if(empty($mechData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
$resArr['data'] = $mechData;
echo json_encode($resArr);exit;
}
function changeStatus($Pos_response_id = '',$status ='1'){
$flashMsg = array('message'=>'Something went wrong, please try again..!','class'=>'danger');
if(empty($Pos_response_id) || !is_numeric($Pos_response_id = decode_param($Pos_response_id))){
$this->session->set_flashdata('message',$flashMsg);
redirect(base_url('Pos_response'));
}
$status = $this->Pos_response_model->changeStatus($Pos_response_id,$status);
if(!$status){
$this->session->set_flashdata('message',$flashMsg);
}
redirect(base_url('Pos_response'));
}
public function check_email_availability() {
$email=$this->input->post('email');
$result = $this->Pos_response_model->email_availability_check($email);
echo json_encode($result);
}
public function get_all_Pos_response() {
$data = $_GET;
//print_r($data);exit;
$col = $data['order'][0]['column'];
$col_type = $data['order'][0]['dir'];
$columns = array("pos_request.id","pos_request.sub_services","pos_request.Pos_name","pos_request.booking_date");
$value['order_by'] = $columns[$col];
$value['order_type'] = $col_type;
$value['search'] = $data['search']['value'];
$value['start'] = $data['start'];
$value['length'] = $data['length'];
$value['where'] = '';
if(!empty($value['search'])) {
$where = array();
foreach($columns as $c) {
$where_data[] = $c." like '%".$value['search']."%' ";
}
$where = implode(" OR ", $where_data);
$where = "(".$where.")";
$value['where'] = $where;
}
$prod_list = $this->Pos_response_model->get_all_Pos_response($value);
//print_r($prod_list);exit;
$all_list = $this->Pos_response_model->get_all_Pos_response();
$recordsTotal = count($all_list);
$filtered = count($all_list);
if($value['where']!='') {
$value['length'] = '-1';
$all_list = $this->Pos_response_model->get_all_Pos_response($value);
$filtered = count($all_list);
public function SendCustomQuote(){
$resArr = array('status'=>"error");
if(!isset($_POST)||empty($_POST)||!isset($_POST['amount'])||empty($_POST['amount'])||!isset($_POST['reqId'])||empty($_POST['reqId'])||!isset($_POST['partId'])||empty($_POST['partId'])){
echo json_encode($resArr);exit;
}
$posData = $this->Pos_response_model->insertCustomQuote($_POST);
if(empty($posData)){
echo json_encode($resArr);exit;
}
$resArr['status'] = 1;
echo json_encode($resArr);exit;
}
$data = array();
foreach ($prod_list as $r) {
$action = "<a class='btn btn-info btn-sm view_wish' onclick='getPos_responseDetails(".$r->id.")'><i class='fa fa-fw fa-eye'></i>View</a>";
$action .= " <a class='btn btn-info btn-sm' href='".base_url()."Pos_response/editPos_responses/".encode_param($r->id)."'>
<i class='fa fa-pencil'></i>Edit
</a>";
$action .= " <a class='btn btn-sm btn-danger' href='".base_url()."Pos_response/changeStatus/".encode_param($r->id).'/2' ."'
onClick='return doconfirm()'>
<i class='fa fa-fw fa-trash'></i>Delete
</a>";
if($r->status == 1){
$action .= " <a class='btn btn-sm btn-success' style='background-color:#ac2925' href='".base_url()."Pos_response/changeStatus/".encode_param($r->id).'/0' ."'>
<i class='fa fa-cog'></i> De-activate
</a>";
} else {
$action .= " <a class='btn btn-sm btn-success' href='".base_url()."Pos_response/changeStatus/".encode_param($r->id).'/1' ."'>
<i class='fa fa-cog'></i> Activate
</a>";
}
$action1='';
array_push($data, array(
$r->id,
$r->pos_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->pos_phone),
$r->customer_name.'</br>'.'<b>'.'Phone:'.'</b>'. ($r->customer_phone),
$r->pos_name,
$r->cost,
$action1
));
}
echo json_encode(array('recordsFiltered' => $filtered, 'recordsTotal' => $recordsTotal, 'data' => $data));
}
}
?>
\ No newline at end of file
......@@ -3,63 +3,6 @@
parent::_construct();
}
public function getPos_bookingData($Pos_booking_id='',$view=''){
$cond = (!empty($view))?" USR.user_type IN ($view) ":" USR.status != '2' ";
$cond .= (!empty($Pos_booking_id))?" AND CUST.cust_id='$Pos_booking_id' ":"";
$query = "SELECT CUST.*,USR.status,USR.password
FROM pos_booking AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE $cond AND USR.user_type='1' Order by id DESC";
$Pos_bookingData = $this->db->query($query);
if($query->num_rows()>0)
{
return (empty($Pos_booking_id))?$Pos_bookingData->result():$Pos_bookingData->row();
}
return 0;
}
function changeStatus($Pos_booking_id = '', $status = '0'){
if(empty($Pos_booking_id)){
return 0;
}
$status = $this->db->update('users',array('status'=>$status),array('profile_id'=>$Pos_booking_id,'user_type'=>'1'));
//echo $this->db->last_query();exit;
return $status;
}
function email_availability_check($email)
{
if($email!=''){
$query = "SELECT * FROM pos_booking AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE USR.status!='2' AND CUST.cust_id!='".$Pos_booking_id."' AND
USR.username='".$email."'";
$query=$this->db->query($query,array($email));
if($query->num_rows()>0)
{
return $query->row_array();
} else
{
return false;
}
}
return false;
}
function get_all_Pos_booking($filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
......@@ -69,23 +12,39 @@ if($email!=''){
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$this->db->where('pos_booking.status!=','2');
$this->db->order_by('pos_booking.id','desc');
$this->db->select("pos_booking.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,pos.name as pos_name,pos.phone_no as pos_phone");
$this->db->select("pos_booking.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,pos.name as pos_name,pos.phone_no as pos_phone,customer_address.name,customer_address.phone_no,customer_address.house_no,customer_address.area,customer_address.country,customer_address.district,customer_address.city,pos_response.req_id");
$this->db->from('pos_booking');
$this->db->join('pos','pos.pos_id = pos_booking.pos_id');
$this->db->join('customer', 'customer.cust_id = pos_booking.cust_id');
$this->db->join('customer_address', 'customer_address.ID = pos_booking.address');
$this->db->join('pos_response', 'pos_response.id = pos_booking.resp_id');
$this->db->join("pos_parts","find_in_set(pos_parts.id,pos_response.pos_parts)<> 0","left",false);
$this->db->join("pos_parts","pos_parts.id=pos_response.pos_parts");
$this->db->where("pos_booking.pos_id",$this->session->userdata('pos_id'));
$this->db->group_by('pos_booking.id');
$res = $this->db->get();
return $res->result();
}
public function getbookdetails($bookingId){
$this->db->select("pos_booking.*,customer_address.name,customer_address.phone_no,customer_address.house_no,customer_address.area,customer_address.country,customer_address.district,customer_address.city,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,vehicle_model.make,vehicle_model.model,vehicle_model.year,vehicle_model.vehicle_name,vehicle_model.mileage,vehicle_model.vehicle_image,pos_request.posReq_id");
$this->db->from('pos_booking');
$this->db->join('pos_response', 'pos_response.id = pos_booking.resp_id');
$this->db->join("pos_parts","pos_parts.id=pos_response.pos_parts");
$this->db->join("pos_request","pos_request.id=pos_response.req_id");
$this->db->join('customer', 'customer.cust_id = pos_booking.cust_id');
$this->db->join('customer_address', 'customer_address.id = pos_booking.address');
$this->db->join('vehicle_model', 'vehicle_model.id = pos_request.vehicle_id');
$this->db->where('pos_booking.id',$bookingId);
$res = $this->db->get();
return $res->row();
}
public function changeOrderStatus($postData = array()){
if($this->db->update('pos_booking',array('est_delivery'=>$postData['expected_date'],'status'=>$postData['status']),array('id'=>$postData['bookingId']))){
return true;
}
}
}
?>
\ No newline at end of file
......@@ -62,29 +62,54 @@ if($email!=''){
return false;
}
function get_all_Pos_request($filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
if(!empty($filter['where'])){
$this->db->where($filter['where']);
}
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$this->db->where('pos_request.status!=','2');
$this->db->order_by('pos_request.id','desc');
$this->db->select("pos_request.*,customer.name as customer_name,customer.phone_no as customer_phone,GROUP_CONCAT(DISTINCT(pos_parts.unique_name)) AS unique_name,GROUP_CONCAT(DISTINCT(pos.name)) AS pos_name");
$this->db->from('pos_request');
$this->db->join('customer', 'customer.cust_id = pos_request.cust_id');
$this->db->join("pos_parts","find_in_set(pos_parts.id,pos_request.part_ids)<> 0","left",false);
$this->db->join("pos","find_in_set(pos.pos_id,pos_request.pos_ids)<> 0","left",false);
$this->db->group_by('pos_request.id');
$res = $this->db->get();
return $res->result();
function get_all_Pos_request($pos_id='',$filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
if(!empty($filter['where'])){
$this->db->where($filter['where']);
}
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$where = '';
$where .= "find_in_set('".$pos_id."',pos_request.pos_ids) AND pos_request.status IN ('2','4','5')";
$this->db->order_by('pos_request.id','desc');
$this->db->select("pos_request.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name");
$this->db->from('pos_request');
$this->db->join('customer', 'customer.cust_id = pos_request.cust_id');
$this->db->join("pos_parts","pos_parts.id=pos_request.part_ids");
$this->db->where($where);
$this->db->group_by('pos_request.id');
$res = $this->db->get();
return $res->result();
}
public function getPosData($reqId =''){
$this->db->select("pos_request.*,customer_address.name,customer_address.phone_no,customer_address.house_no,customer_address.area,customer_address.country,customer_address.district,customer_address.city,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,GROUP_CONCAT(DISTINCT(pos.name)) AS pos_name,vehicle_model.make,vehicle_model.model,vehicle_model.year,vehicle_model.vehicle_name,vehicle_model.mileage,vehicle_model.vehicle_image");
$this->db->from('pos_request');
$this->db->join('customer', 'customer.cust_id = pos_request.cust_id','left');
$this->db->join('customer_address', 'customer_address.id = pos_request.address','left');
$this->db->join('vehicle_model', 'vehicle_model.id = pos_request.vehicle_id','left');
$this->db->join("pos_parts","pos_parts.id=pos_request.part_ids","left",false);
$this->db->join("pos","find_in_set(pos.pos_id,pos_request.pos_ids)<> 0","left",false);
$this->db->where('pos_request.id',$reqId);
$res = $this->db->get();
return $res->row();
}
public function getSendQuoteDetails($reqId){
$this->db->select("pos_response.*,customer.name as customer_name,pos_parts.unique_name,customer_address.phone_no,customer_address.area,pos_request.posReq_id,vehicle_model.make,vehicle_model.model,vehicle_model.year,vehicle_model.vehicle_name,vehicle_model.mileage,vehicle_model.vehicle_image");
$this->db->from('pos_response');
$this->db->join('pos_request','pos_request.id = pos_response.req_id');
$this->db->join('customer', 'customer.cust_id = pos_request.cust_id');
$this->db->join('vehicle_model', 'vehicle_model.id = pos_request.vehicle_id','left');
$this->db->join('customer_address', 'customer_address.ID = pos_request.address');
$this->db->join("pos_parts","pos_parts.id=pos_response.pos_parts");
$this->db->where("pos_response.pos_id",$this->session->userdata('pos_id'));
$this->db->where("pos_response.req_id",$reqId);
$res = $this->db->get();
return $res->row();
}
}
......
......@@ -4,89 +4,23 @@ class Pos_response_model extends CI_Model {
parent::_construct();
}
public function getPos_responseData($Pos_response_id='',$view=''){
$cond = (!empty($view))?" USR.user_type IN ($view) ":" USR.status != '2' ";
$cond .= (!empty($Pos_response_id))?" AND CUST.cust_id='$Pos_response_id' ":"";
$sql = "SELECT CUST.*,USR.status,USR.password
FROM Pos_response AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE $cond AND USR.user_type='1' Order by id DESC";
$Pos_responseData = $this->db->query($sql);
//echo $this->db->last_query();exit;
if(isset($Pos_responseData)){
return (empty($Pos_response_id))?$Pos_responseData->result():$Pos_responseData->row();
}
return 0;
}
function changeStatus($Pos_response_id = '', $status = '0'){
if(empty($Pos_response_id)){
return 0;
}
$status = $this->db->update('users',array('status'=>$status),array('profile_id'=>$Pos_response_id,'user_type'=>'1'));
//echo $this->db->last_query();exit;
return $status;
}
function email_availability_check($email)
{
if($email!=''){
$query = "SELECT * FROM Pos_response AS CUST
INNER JOIN users AS USR ON (USR.profile_id=CUST.cust_id)
WHERE USR.status!='2' AND CUST.cust_id!='".$Pos_response_id."' AND
USR.username='".$email."'";
$query=$this->db->query($query,array($email));
if($query->num_rows()>0)
{
return $query->row_array();
} else
{
return false;
public function insertCustomQuote($postData =array()){
$squence = str_pad(rand(1111,9999),4,0,STR_PAD_LEFT);
$insertArray = array(
'pos_resp_code'=>'PSRESP'.date('ymd').$squence,
'req_id'=>$postData['reqId'],
'pos_id'=>$this->session->userdata('pos_id'),
'cost'=>$postData['amount'],
'total'=>$postData['amount'],
'pos_parts'=>$postData['partId'],
'status'=>1
);
if($this->db->insert('pos_response',$insertArray)){
if($this->db->update('pos_request',array('status'=>5),array('id'=>$postData['reqId']))){
return 1;
}
}
}
return false;
}
function get_all_Pos_response($filter=null) {
if($filter){
$this->db->order_by($filter['order_by'], $filter['order_type']);
if(!empty($filter['where'])){
$this->db->where($filter['where']);
}
if($filter['length']!=-1)
$this->db->limit($filter['length'],$filter['start']);
}
$this->db->where('pos_response.status!=','2');
$this->db->order_by('pos_response.id','desc');
$this->db->select("pos_response.*,customer.name as customer_name,customer.phone_no as customer_phone,pos_parts.unique_name,pos.name as pos_name,pos.phone_no as pos_phone");
$this->db->from('pos_response');
$this->db->join('pos_request', 'pos_request.id = pos_response.req_id');
$this->db->join('pos', 'pos.pos_id = pos_response.pos_id');
$this->db->join('customer', 'customer.cust_id = pos_request.cust_id');
$this->db->join("pos_parts","find_in_set(pos_parts.id,pos_request.part_ids)<> 0","left",false);
$this->db->group_by('pos_response.id');
$res = $this->db->get();
return $res->result();
}
}
?>
\ No newline at end of file
......@@ -20,15 +20,6 @@
</ul>
</li>
<li class="menu-item-has-children dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="menu-icon fa fa-check-circle-o"></i>Pos Response</a>
<ul class="sub-menu children dropdown-menu">
<li><i class="fa fa-tasks"></i><a href="<?php echo base_url('Pos_response'); ?>">List</a></li>
</ul>
</li>
<li class="menu-item-has-children dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="menu-icon fa fa-book"></i>Pos Booking</a>
<ul class="sub-menu children dropdown-menu">
......
......@@ -2550,4 +2550,12 @@ footer.site-footer {
.modal-content{
border-radius: 0px !important;
}
\ No newline at end of file
}
.errInput{
border: 1px solid red !important;
}
.textCenterAlign {
text-align:center;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment