RecordController.php
4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php namespace App\Http\Controllers;
use Auth;
use Input;
use Response;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use DB;
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();
$listVal = DB::table('currentqueue_list')->get();
$rclientlst=$wakka->clientsReadAccess();
$data['listVal'] = $listVal;
$data['cntlistVal'] = count($listVal);
$data['rclientlst'] = $rclientlst;
return view('layout.module.record.churn',$data);
}
public function saveChurnData()
{
$user_agent=Input::get('agent');
$data = $_POST['data'];
$exitAgent = DB::table('cq_logic')->where('user_agent','=',$user_agent)->first();
if($exitAgent)
{
DB::update("update cq_logic set updated_at='".date("Y-m-d H:i:s")."', data='".$data."' where user_agent='".$user_agent."'");
}
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")."', user_agent='".$user_agent."', data='".$data."'");
}
return ;
}
}