Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php namespace App\Http\Controllers;
- use Auth;
- use Input;
- use Response;
- use App\Models\Notification;
- use App\Jobs\KHRMSLib;
- use DB;
- use Request;
- use App\Models\User;
- class RecordController extends Controller {
- public function __construct()
- {
- $this->middleware('auth');
- $this->middleware('module_access');
- }
- public function index()
- {
- return view('layout.module.record.index',array());
- }
- public function create()
- {
- //
- }
- public function store()
- {
- $data=array();
- $data['wakka'] = new KHRMSLib();
- $action=Input::get("action");
- $client=Input::get("client");
- $data['wakka']->HRFillNames($client);
- if($action=="show")
- {
- return view('layout.module.record.show',$data);
- }
- if($action=="save")
- {
- return view('layout.module.record.save',$data);
- }
- if($action=="quicksearch")
- {
- return view('layout.module.record.quicksearch',$data);
- }
- if($action=="textsearch")
- {
- return view('layout.module.record.textsearch',$data);
- }
- if($action=="addkey")
- {
- $wakka = new KHRMSLib();
- $varid=Input::get("varid");
- $keys=explode(",",Input::get("keys"));
- $record=$wakka->getPerson($varid);
- if(!empty($keys))foreach($keys as $key)
- {
- $val=Input::get($key);
- $record["peopledata"][$key]=$val;
- }
- $wakka->setPerson($varid,$record);
- return Response::make("");
- }
- if($action=="delaltphone")
- {
- $wakka = new KHRMSLib();
- $varid=Input::get("varid");
- $i=Input::get("i");
- $record=$wakka->getPerson($varid);
- for($k=$i+1;$k<=10;$k++,$i++)
- {
- $record["peopledata"]["altphone$i"]=$record["peopledata"]["altphone$k"];
- $record["peopledata"]["altphone_lbl_$i"]=$record["peopledata"]["altphone_lbl_$k"];
- }
- $record["peopledata"]["altphone10"]="";
- $record["peopledata"]["altphone_lbl_10"]="";
- $wakka->setPerson($varid,$record);
- }
- if($action=="bulkupload")
- {
- return view('layout.module.record.bulkupload',$data);
- }
- if($action=="Appointment")
- {
- $wakka = new KHRMSLib();
- $CustomerName=Input::get("CustomerName");
- $AppntLocation=Input::get("AppntLocation");
- $AppntTime=Input::get("AppntTime");
- $Address=Input::get("Address");
- $AppntDate=Input::get("AppntDate");
- $ContactPerson=Input::get("ContactPerson");
- $Phone=Input::get("Phone");
- $AppntDate=date("d-M-Y",strtotime($AppntDate));
- $h = $AppntTime;
- $hm = $h * 60;
- $ms = $hm * 60;
- $AppntTime=gmdate("g A",$ms);
- $smsapi="http://115.114.132.71/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?userId=idcamps&pass=pacamps1&contenttype=1&from=HEROFC&selfid=true&alert=1&dlrreq=true";
- $MsgContent="Dear $CustomerName, Your appointment is fixed at $AppntLocation. Appointment Date - $AppntDate, Time - $AppntTime. Address: $Address Contact Person - $ContactPerson. In case of any assistence Please give a missed call. $Tollfree";
- $EnMsgContent=urlencode($MsgContent);
- $smsurl=$smsapi."&to=".$Phone."&text=".$EnMsgContent;
- $MessageID=$wakka->get_response($smsurl);
- if($MessageID)
- print $MessageID;
- else
- print "Failed";
- //echo $CustomerName . ' = ' . $AppntLocation . ' = ' . $AppntTime . ' = ' . $Address . ' = ' . $AppntDate . ' = ' . $ContactPerson;
- }
- }
- public function show($id)
- {
- $data=array();
- $data['wakka'] = new KHRMSLib();
- if($id=="bulkupload")
- {
- return view('layout.module.record.bulkupload',$data);
- }
- if($id=="textsearch")
- {
- return view('layout.module.record.textsearch',$data);
- }
- }
- public function edit($id)
- {
- //
- }
- public function update($id)
- {
- //
- }
- public function destroy($id)
- {
- }
- public function dashboard()
- {
- //echo "OK";
- }
- public function churnData()
- {
- $data=array();
- $wakka = new KHRMSLib();
- $useType = array("CRO");
- $ulist = User::whereIn('usertype',$useType)->get();
- $listVal = DB::table('currentqueue_list')->first();
- $holdVal = DB::table('cq_logic')->where('type','=','hold')->where('status','=','Held')->get();
- $rclientlst=$wakka->clientsReadAccess();
- $data['listVal'] = $listVal;
- $data['cntlistVal'] = count($listVal);
- $data['rclientlst'] = $rclientlst;
- $data['holdVal'] = $holdVal;
- $data['ulist'] = $ulist;
- return view('layout.module.record.churn',$data);
- }
- function saveCurrentQueueList()
- {
- $crmCol = Input::get('crmCol');
- $exitListVal = DB::table('currentqueue_list')->first();
- if($exitListVal == "")
- {
- DB::statement("insert into currentqueue_list set updated_at='".date("Y-m-d H:i:s")."', list_value='".$crmCol."'");
- }
- return;
- }
- function delCurrentQueueList()
- {
- DB::statement("TRUNCATE table currentqueue_list");
- }
- public function saveChurnData()
- {
- $empdata = array();
- $updateArr = array();
- $client=Input::get('client');
- $data = $_POST['data'];
- $exitAgent = DB::table('cq_logic')->where('user_agent','=',$client)->where('type','=','churn')->first();
- $dataArr = json_decode($data);
- foreach ($dataArr as $key => $val) {
- if($val != "")
- {
- $updateArr[] = (array)$val;
- }
- }
- $empdata['churn'] = "";
- $empdata['client'] =$client;
- $empdata['peopledata']['status'] ='New';
- $wakka = new KHRMSLib();
- $wakka->setPerson($updateArr, $empdata);
- if($exitAgent)
- {
- DB::update("update cq_logic set updated_at='".date("Y-m-d H:i:s")."', data='".$data."' where type='churn' and user_agent='".$client."'");
- }
- else
- {
- DB::statement("insert into cq_logic set created_at='".date("Y-m-d H:i:s")."', updated_at='".date("Y-m-d H:i:s")."', type='churn', user_agent='".$client."', data='".$data."'");
- }
- return ;
- }
- public function getFields()
- {
- $client = Input::get('client');
- $optionsstr=array();
- $optionsstr[]="cluster";
- $optionsstr[]="Branch_Code";
- $optionsstr[]="MOB";
- $optionsstr[]="dialer_status";
- return $optionsstr;
- }
- public function getCampFields()
- {
- $campField = Input::get('camp_field');
- if($campField == "cluster")
- $campField="State";
- $optionsstr=array();
- $optionsstr = DB::table('records')->groupBy($campField)->get();
- return $optionsstr;
- }
- public function holdData()
- {
- $camp = Input::get('client');
- $campField = Input::get('field');
- $campFieldVal = Input::get('fieldVal');
- //For Temp
- if($campField == "cluster")
- {
- $campField = "State";
- }
- $optionsstr=array();
- $dialerStatusArr=array("","No contact");
- DB::table('records')->where('client',$camp)->where($campField, $campFieldVal)->whereIn('dialer_status',$dialerStatusArr)->update(['passportstatus'=>'Hold']);
- $existAgent = DB::table('cq_logic')->where('type','=','hold')->where('user_agent','=',$camp)->where('field','=',$campField)->where('field_value','=',$campFieldVal)->where('status','=','Held')->first();
- if($existAgent)
- {
- DB::update("update cq_logic set updated_at='".date("Y-m-d H:i:s")."' where user_agent='".$camp."'");
- }
- else
- {
- DB::statement("insert into cq_logic set created_at='".date("Y-m-d H:i:s")."', updated_at='".date("Y-m-d H:i:s")."', type='hold', user_agent='".$camp."', field='".$campField."', field_value='".$campFieldVal."',status='Held'");
- }
- return;
- }
- public function relData()
- {
- $camp = Input::get('client');
- $campField = Input::get('field');
- $campFieldVal = Input::get('fieldVal');
- $optionsstr=array();
- $dialerStatusArr=array("","No contact");
- DB::table('records')->where('client',$camp)->where($campField, $campFieldVal)->whereIn('dialer_status',$dialerStatusArr)->update(['passportstatus'=>'Unhold']);
- $existAgent = DB::table('cq_logic')->where('type','=','hold')->where('user_agent','=',$camp)->where('field','=',$campField)->where('field_value','=',$campFieldVal)->where('status','=','Held')->first();
- if($existAgent)
- {
- DB::update("update cq_logic set updated_at='".date("Y-m-d H:i:s")."', status='Released' where user_agent='".$camp."' and field='".$campField."' and field_value='".$campFieldVal."'");
- }
- return;
- }
- }
Add Comment
Please, Sign In to add comment