5088d28e by G Manojkumar

VRM new Application

0 parents
Showing 1000 changed files with 4964 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 ../custom/.env
...\ No newline at end of file ...\ No newline at end of file
1 * text=auto
2 *.css linguist-vendored
3 *.less linguist-vendored
1 #!/bin/bash
2
3 export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
4
5
6 echo asterisk -rx "sip show channels";
1 The difference between this server and other servers is KPAMIListen.php Please make sure updating this file.
2
3 Version No. 1.14v
4 Changes: agent time report updated, commented if condition.
5 Date: 03/09/2018
6
7 Version No. 1.13v
8 Changes: hangup beep, footer.blade.php, dialer.js changed and hangup beep added to assets/sounds/
9 Date: 11/08/2018 Only on Mumbai servers
10
11 Version No. 1.12v
12 Changes: followup for new disposition, DialerController.php and dialer.js is changed.
13 Date: 11/08/2018
14
15 Version No. 1.11v
16 Changes: Master report download, Changes main.blade.php, Added two libraries lib, php, KHRMS.php, XLSX library.
17 Date: 08/08/2018
18
19 Version No. 1.10v
20 Changes: Username for inbounddrop and Userbusy for SIP/GATEWAY , Changes KPAMIListen.php
21 Date: 02/08/2018
22
23 Version No. 1.9v
24 Changes: Call log report supervisor, and Date range in call report.
25 Date: 30/07/2018
26
27 Version No. 1.8v
28 Changes: HDFC Mogo, Changes 1.extension.conf, 2.DialerController.php, 3.mogo tune in moh location.
29 Date 20/07/2018
30
31 Version No. 1.7V
32 Changes: Live report reload button issue, commented one line of code in Livereport.blade.php
33 Date: 19/07/2018
34
35 Versio No. 1.6V
36 Changes: call forward, KPAMIListen, .env and extension.conf file updated
37 Date: 14/07/2018
38
39 Version No. 1.5V
40 Changes: Birthday calls for progressive mode, DialerController.php is updated
41 Date: 13/07/2018
42
43 Version No. 1.4V
44 Changes: To Blank diallines, DailyLogout.php is updated.
45 Date: 6/07/2018
46
47 Version No. 1.3v
48 Changes: Bulkupload
49 Date: 5/07/2018
50
51 Version NO. 1.2v
52 Changes: To remove multiple circles in dialer, dialer.js is updated.
53 Date: 4/07/2018
54
55 Version No. 1.1v
56 Changes: To remove Inbound Portfolio issue, KPAMIListen updated.
57 Date: 18/06/2018
58
59
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkserverupload_data extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkserverupload_data';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkserverupload_data';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "2";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_150918 where SERVER_IP='$server_ip'"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_150918'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["clientcode"]!="")
113 {
114 /*if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else*/
119 $excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
120 //$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
121 if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
122 {
123 //$empdata=$wakka->getPerson($excelarray[$i]["id"]);
124 $empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
125 $ppldata=$empdata["peopledata"];
126 $createdlog=$empdata['modifylog'];
127 $fdirty=$empdata['dirty'];
128
129 $createdlog[$updatetime]=$username."::";
130 $createdlog["updated"]=$updatetime;
131
132 $newdata=$ppldata;
133 foreach($excelarray[$i] as $key => $value)
134 {
135 if($value!="")
136 {
137 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
138 {
139 $value=str_replace("'"," ",$value);
140 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
141
142 $fdirty[$key]=1;
143
144 $newdata[$key]=$value;
145 }
146 }
147 }
148
149 /*Start - Changes need to be done*/
150
151 if($excelarray[$i]["status"]==null)
152 {
153 $empdata['status'] = "rom";
154 }
155
156 if($excelarray[$i]["dialer_status"]==null)
157 {
158 $empdata['dialer_status'] = "rom";
159 }
160
161 if($excelarray[$i]["dialer_substatus"]==null)
162 {
163 $empdata['dialer_substatus'] = "rom";
164 }
165
166 /*End - Changes need to be done*/
167
168 $empdata["peopledata"]=$newdata;
169 $empdata['modifylog']=$createdlog;
170 $empdata['dirty']=$fdirty;
171
172 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
173 $wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
174 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
175 $successArr[] = $excelarray[$i];
176
177 }
178 else
179 {
180 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
181 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
182 $ppldata=$empdata["peopledata"];
183 $createdlog=$empdata['modifylog'];
184 $fdirty=$empdata['dirty'];
185
186
187 $createdlog[$updatetime]=$username."::";
188 $createdlog["updated"]=$updatetime;
189
190 $newdata=$ppldata;
191 foreach($excelarray[$i] as $key => $value)
192 {
193 if($value!="")
194 {
195 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
196 {
197 $value=str_replace("'"," ",$value);
198 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
199
200 $fdirty[$key]=1;
201
202 $newdata[$key]=$value;
203 }
204 }
205 }
206 $empdata["peopledata"]=$newdata;
207 $empdata['modifylog']=$createdlog;
208 $empdata['dirty']=$fdirty;
209
210 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
211 $wakka->setPerson($excelarray[$i]["id"],$empdata);
212
213 $reason = "";
214
215 $reason .= "Record ID is not on local server,";
216
217 $excelarray[$i]['server_ip'] =$server_ip;
218 $excelarray[$i]['location'] =$location;
219
220 if($excelarray[$i]["clientcode"]!="")
221 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
222 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
223
224 $excelarray[$i]['Reason'] = $reason;
225
226 $failureArr[] = $excelarray[$i];
227
228 }
229 }
230 else
231 {
232
233 $reason = "";
234
235 if($excelarray[$i]["id"]=="")
236 $reason .= "Column ID is blank,";
237
238 $excelarray[$i]['server_ip'] =$server_ip;
239 $excelarray[$i]['location'] =$location;
240
241 if($excelarray[$i]["clientcode"]!="")
242 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
243
244 $excelarray[$i]['Reason'] = $reason;
245
246 $failureArr[] = $excelarray[$i];
247
248 }
249
250 }
251 /*if(!empty($successArr)){
252 foreach($successArr as $succes)
253 {
254 $setSuccess=array();
255
256 $setSuccess[] = "server_ip='$server_ip'";
257 $setSuccess[] = "location='$location'";
258 $setSuccess[] = "record_id='".$succes['id']."'";
259 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
260 $setSuccess[] = "modified='".$succes['modified']."'";
261
262 $setSuccess = implode(",",$setSuccess);
263
264 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
265 }
266 }
267 if(!empty($failureArr)){
268 foreach($failureArr as $failur)
269 {
270 $setFailure=array();
271
272 $setFailure[] = "server_ip='$server_ip'";
273 $setFailure[] = "location='$location'";
274 $setFailure[] = "cust_id='".$failur['clientcode']."'";
275 $setFailure[] = "record_id='".$failur['record_id']."'";
276 $setFailure[] = "reason='".$failur['Reason']."'";
277
278 $setFailure = implode(",",$setFailure);
279
280 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
281 }
282 }*/
283
284 DB::connection("conn")->disconnect();
285 }
286 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "2";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_1 where SERVER_IP='$server_ip'"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_1'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["clientcode"]!="")
113 {
114 /*if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else*/
119 $excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
120 //$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
121 if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
122 {
123 //$empdata=$wakka->getPerson($excelarray[$i]["id"]);
124 $empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
125 $excelarray[$i]["other_information"]='2018-10-09_1';
126 $ppldata=$empdata["peopledata"];
127 $createdlog=$empdata['modifylog'];
128 $fdirty=$empdata['dirty'];
129
130 $createdlog[$updatetime]=$username."::";
131 $createdlog["updated"]=$updatetime;
132
133 $newdata=$ppldata;
134 foreach($excelarray[$i] as $key => $value)
135 {
136 if($value!="")
137 {
138 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
139 {
140 $value=str_replace("'"," ",$value);
141 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
142
143 $fdirty[$key]=1;
144
145 $newdata[$key]=$value;
146 }
147 }
148 }
149
150 /*Start - Changes need to be done*/
151
152 if($excelarray[$i]["status"]==null)
153 {
154 $empdata['status'] = "rom";
155 }
156
157 if($excelarray[$i]["dialer_status"]==null)
158 {
159 $empdata['dialer_status'] = "rom";
160 }
161
162 if($excelarray[$i]["dialer_substatus"]==null)
163 {
164 $empdata['dialer_substatus'] = "rom";
165 }
166
167 /*End - Changes need to be done*/
168
169 $empdata["peopledata"]=$newdata;
170 $empdata['modifylog']=$createdlog;
171 $empdata['dirty']=$fdirty;
172
173 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
174 $wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
175 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
176 $successArr[] = $excelarray[$i];
177
178 }
179 else
180 {
181 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
182 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
183 $ppldata=$empdata["peopledata"];
184 $createdlog=$empdata['modifylog'];
185 $fdirty=$empdata['dirty'];
186
187
188 $createdlog[$updatetime]=$username."::";
189 $createdlog["updated"]=$updatetime;
190
191 $newdata=$ppldata;
192 foreach($excelarray[$i] as $key => $value)
193 {
194 if($value!="")
195 {
196 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
197 {
198 $value=str_replace("'"," ",$value);
199 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
200
201 $fdirty[$key]=1;
202
203 $newdata[$key]=$value;
204 }
205 }
206 }
207 $empdata["peopledata"]=$newdata;
208 $empdata['modifylog']=$createdlog;
209 $empdata['dirty']=$fdirty;
210
211 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
212 $wakka->setPerson($excelarray[$i]["id"],$empdata);
213
214 $reason = "";
215
216 $reason .= "Record ID is not on local server,";
217
218 $excelarray[$i]['server_ip'] =$server_ip;
219 $excelarray[$i]['location'] =$location;
220
221 if($excelarray[$i]["clientcode"]!="")
222 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
223 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
224
225 $excelarray[$i]['Reason'] = $reason;
226
227 $failureArr[] = $excelarray[$i];
228
229 }
230 }
231 else
232 {
233
234 $reason = "";
235
236 if($excelarray[$i]["id"]=="")
237 $reason .= "Column ID is blank,";
238
239 $excelarray[$i]['server_ip'] =$server_ip;
240 $excelarray[$i]['location'] =$location;
241
242 if($excelarray[$i]["clientcode"]!="")
243 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
244
245 $excelarray[$i]['Reason'] = $reason;
246
247 $failureArr[] = $excelarray[$i];
248
249 }
250
251 }
252 echo "\n"."Updated data partial upload end"."\n";
253 /*if(!empty($successArr)){
254 foreach($successArr as $succes)
255 {
256 $setSuccess=array();
257
258 $setSuccess[] = "server_ip='$server_ip'";
259 $setSuccess[] = "location='$location'";
260 $setSuccess[] = "record_id='".$succes['id']."'";
261 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
262 $setSuccess[] = "modified='".$succes['modified']."'";
263
264 $setSuccess = implode(",",$setSuccess);
265
266 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_09102018_1_success set $setSuccess"));
267 }
268 }
269 if(!empty($failureArr)){
270 foreach($failureArr as $failur)
271 {
272 $setFailure=array();
273
274 $setFailure[] = "server_ip='$server_ip'";
275 $setFailure[] = "location='$location'";
276 $setFailure[] = "cust_id='".$failur['clientcode']."'";
277 $setFailure[] = "record_id='".$failur['record_id']."'";
278 $setFailure[] = "reason='".$failur['Reason']."'";
279
280 $setFailure = implode(",",$setFailure);
281
282 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
283 }
284 }*/
285
286 DB::connection("conn")->disconnect();
287 }
288 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class BirthdayDate extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'BirthdayDate';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'BirthdayDate';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $birthday="%".date('-m-d')."%";
50 $wakka = new KHRMSLib();
51
52 $dobarray=DB::select(DB::raw("select peopledata from records where `DOB` like '$birthday'"));
53
54 foreach($dobarray as $dobarr)
55 {
56 $dobarray = unserialize($dobarr->peopledata);
57 $dobarray['priority']='11';
58 $preppldata['peopledata'] = $dobarray;
59 $query=$wakka->setPerson($dobarray['id'],$preppldata);
60 }
61 }
62 }
63
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class Calllogupdate extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'Calllogupdate';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task for CreportEight';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 $date=date('F_Y');
42 echo "\n".date('Y-m-d H:i:s')."\n";
43
44 $logdate=strtotime('0 day');
45
46 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
47 $central_ip=env('central_ip');
48 $server_ip=env('app_ip');
49 $calllog_report = "calllog_report_".$date;
50 $conn = array(
51 'driver' => 'mysql',
52 'host' => $central_ip,
53 'database' => env('DB_DATABASE', 'kstych_flexydial'),
54 'username' => env('DB_USERNAME', 'root'),
55 'password' => env('DB_PASSWORD', ''),
56 'charset' => 'utf8',
57 'collation' => 'utf8_unicode_ci',
58 'prefix' => '',
59 'options' => array(
60 PDO::ATTR_TIMEOUT => 5,
61 ),
62 );
63 Config::set("database.connections.conn", $conn);
64
65 DB::connection("conn")->getDatabaseName();
66
67 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
68 $server_id=$serverclist[0]->id;
69 if($server_id<10){
70 $server_id="0".$server_id;
71 }
72
73
74
75
76 $alistupdate=DB::select(DB::raw("SELECT * from crmcalls where call_flag='Z' and created_at <= '".date("Y-m-d H:i:s",$logdate-(05*60))."'"));
77 foreach ($alistupdate as $aline) {
78 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
79 if($aline->crm_id>0)
80 {
81 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
82 if(isset($user[0]))
83 {
84 $record_id=$user[0]->id;
85 $clientcode=$user[0]->clientcode;
86 $currentstatus=$user[0]->currentstatus;
87 $legalstatus=$user[0]->legalstatus;
88 }
89 }
90 $tpostdata=json_decode($aline->data,true);
91 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
92 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
93 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
94
95 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
96 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
97 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
98 $globalid=$server_id.$record_id;
99 $server = $server_id;
100 $record_id = $record_id;
101 $crmcall_id = $aline->id;
102 $globalid = $globalid;
103 $created_at = $aline->created_at;
104 $start = $fulldate;
105 $length = $length;
106 $user = $username;
107 $name = $dispname;
108 $dispo = $aline->userstatus;
109 $subdispo = $aline->usersubstatus;
110 $callback = $aline->usercallback;
111 $number = $aline->number;
112 $clientcode = $clientcode;
113 $currentstatus = $currentstatus;
114 $legalstatus = $legalstatus;
115 $client = $aline->client;
116 $department = $aline->department;
117 $state = $aline->state;
118 $hsource = $aline->hsource;
119 $type = $aline->type;
120 $status = $aline->status;
121 $statuscode = $aline->statuscode;
122 $statusstr = $aline->substatus;
123 $dialline = $aline->dialline_id;
124 $did = $aline->did;
125 $waitsec = round($aline->waitSec/1000,2);
126 $callsec = round($aline->callSec/1000,2);
127 $talksec = round($talktime/1000,2);
128 $disposec = round($aline->dispoSec/1000,2);
129 $remarks = str_replace("'","",$aline->userremarks);
130 $userdata = $aline->userdata;
131 $attempt = $aline->attempt;
132 $priority = $aline->priority;
133 $question = $aline->question;
134
135
136 DB::connection("conn")->update(DB::raw("UPDATE $calllog_report set server='$server', record_id='$record_id', crmcall_id='$crmcall_id', globalid='$globalid', created_at='$created_at', start='$start', length='$length', user='$user', name='$name', dispo='$dispo', subdispo='$subdispo', callback='$callback', number='$number', clientcode='$clientcode', currentstatus='$currentstatus', legalstatus='$legalstatus', client='$client', department='$department', state='$state', hsource='$hsource', type='$type', status='$status', statuscode='$statuscode', statusstr='$statusstr', dialline='$dialline', did='$did', waitsec='$waitsec', callsec='$callsec', talksec='$talksec', disposec='$disposec', remarks='$remarks', userdata='$userdata', attempt='$attempt', priority='$priority', question='$question' where server= '$server_id' and crmcall_id= '$crmcall_id'"));
137
138 DB::update(DB::raw("UPDATE crmcalls set call_flag='C' where id=$crmcall_id"));
139
140
141 }
142
143 echo "\n".date('Y-m-d H:i:s')."\n";
144 DB::connection("conn")->disconnect();
145 }
146
147 }
148
149
150
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class CreportEight extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'CreportEight';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task for CreportEight';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 $date=date('F_Y');
42 echo "\n".date('Y-m-d H:i:s')."\n";
43
44 $logdate=strtotime('0 day');
45
46 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
47 $central_ip=env('central_ip');
48 $server_ip=env('app_ip');
49 $calllog_report = "calllog_report_".$date;
50 $conn = array(
51 'driver' => 'mysql',
52 'host' => $central_ip,
53 'database' => env('DB_DATABASE', 'kstych_flexydial'),
54 'username' => env('DB_USERNAME', 'root'),
55 'password' => env('DB_PASSWORD', ''),
56 'charset' => 'utf8',
57 'collation' => 'utf8_unicode_ci',
58 'prefix' => '',
59 'options' => array(
60 PDO::ATTR_TIMEOUT => 5,
61 ),
62 );
63 Config::set("database.connections.conn", $conn);
64
65 DB::connection("conn")->getDatabaseName();
66
67 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
68 $server_id=$serverclist[0]->id;
69 if($server_id<10){
70 $server_id="0".$server_id;
71 }
72
73
74 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
75
76 $maxids=$maxid[0]->maxid;
77
78 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
79 $alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids'"));
80 $countnumber=count($alist);
81 $finalnumber=$countnumber/50;
82 $finalnumber=floor($finalnumber);
83 $datainser='';
84 $iii=1;
85 $kkk=1;
86 $shortinsert="";
87 $userarr=array();
88 foreach($alist as $aline)
89 {
90 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
91 if($aline->crm_id>0)
92 {
93 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
94 if(isset($user[0]))
95 {
96 $record_id=$user[0]->id;
97 $clientcode=$user[0]->clientcode;
98 $currentstatus=$user[0]->currentstatus;
99 $legalstatus=$user[0]->legalstatus;
100 }
101 }
102 $tpostdata=json_decode($aline->data,true);
103 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
104 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
105 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
106
107 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
108 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
109 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
110 $globalid=$server_id.$record_id;
111 $server = $server_id;
112 $record_id = $record_id;
113 $crmcall_id = $aline->id;
114 $globalid = $globalid;
115 $created_at = $aline->created_at;
116 $start = $fulldate;
117 $length = $length;
118 $user = $username;
119 $name = $dispname;
120 $dispo = $aline->userstatus;
121 $subdispo = $aline->usersubstatus;
122 $callback = $aline->usercallback;
123 $number = $aline->number;
124 $clientcode = $clientcode;
125 $currentstatus = $currentstatus;
126 $legalstatus = $legalstatus;
127 $client = $aline->client;
128 $department = $aline->department;
129 $state = $aline->state;
130 $hsource = $aline->hsource;
131 $type = $aline->type;
132 $status = $aline->status;
133 $statuscode = $aline->statuscode;
134 $statusstr = $aline->substatus;
135 $dialline = $aline->dialline_id;
136 $did = $aline->did;
137 $waitsec = round($aline->waitSec/1000,2);
138 $callsec = round($aline->callSec/1000,2);
139 $talksec = round($talktime/1000,2);
140 $disposec = round($aline->dispoSec/1000,2);
141 $remarks = str_replace("'","",$aline->userremarks);
142 $userdata = $aline->userdata;
143 $attempt = $aline->attempt;
144 $priority = $aline->priority;
145 $question = $aline->question;
146
147
148
149 $shortinsert.="('$server', '$record_id', '$crmcall_id', '$globalid','$created_at', '$start', '$length', '$user', '$name', '$dispo', '$subdispo', '$callback', '$number', '$clientcode', '$currentstatus', '$legalstatus', '$client', '$department', '$state', '$hsource', '$type', '$status', '$statuscode', '$statusstr', '$dialline', '$did', '$waitsec', '$callsec', '$talksec', '$disposec', '$remarks', '$userdata', '$attempt', '$priority', '$question'),";
150
151 if($kkk<=$finalnumber){
152 if($iii%50==0){
153
154 $shortinsert=substr($shortinsert,0,-1);
155 DB::connection("conn")->insert(DB::raw("INSERT INTO $calllog_report (`server`, `record_id`, `crmcall_id`, `globalid`, `created_at`, `start`, `length`, `user`, `name`, `dispo`, `subdispo`, `callback`, `number`, `clientcode`, `currentstatus`, `legalstatus`, `client`, `department`, `state`, `hsource`, `type`, `status`, `statuscode`, `statusstr`, `dialline`, `did`, `waitsec`, `callsec`, `talksec`, `disposec`, `remarks`, `userdata`, `attempt`, `priority`, `question`) VALUES $shortinsert"));
156 $kkk++;
157 }
158 }else{
159 DB::connection("conn")->insert(DB::raw("INSERT INTO $calllog_report set server='$server', record_id='$record_id', crmcall_id='$crmcall_id', globalid='$globalid', created_at='$created_at', start='$start', length='$length', user='$user', name='$name', dispo='$dispo', subdispo='$subdispo', callback='$callback', number='$number', clientcode='$clientcode', currentstatus='$currentstatus', legalstatus='$legalstatus', client='$client', department='$department', state='$state', hsource='$hsource', type='$type', status='$status', statuscode='$statuscode', statusstr='$statusstr', dialline='$dialline', did='$did', waitsec='$waitsec', callsec='$callsec', talksec='$talksec', disposec='$disposec', remarks='$remarks', userdata='$userdata', attempt='$attempt', priority='$priority', question='$question'"));
160
161 }
162 if($iii%50==0){
163 $shortinsert="";
164 }
165 $iii++;
166
167 //$update=DB::connection("conn")->select(DB::raw("SELECT crmcall_id as updateid from $calllog_report where server='$server_id' and `state` IN ('DialBegin','DialEnd')"));
168 //echo $update;
169 DB::update(DB::raw("UPDATE crmcalls set call_flag='C' where id=$crmcall_id"));
170 }
171 echo "\n".date('Y-m-d H:i:s')."\n";
172 DB::connection("conn")->disconnect();
173 }
174
175 }
176
177
178
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class CreportNine extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'CreportNine';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task for CreportNine';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 $date=date('F_Y');
42 echo "\n".date('Y-m-d H:i:s')."\n";
43
44 $logdate=strtotime('0 day');
45
46 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
47 $central_ip=env('central_ip');
48 $server_ip=env('app_ip');
49 $d='01';
50 $startdate=date('Y-m-')."$d";
51 $calllog_report = "calllog_report_".$date;
52 // $calllog_report = "calllog_report_February_2018";
53 $conn = array(
54 'driver' => 'mysql',
55 'host' => $central_ip,
56 'database' => env('DB_DATABASE', 'kstych_flexydial'),
57 'username' => env('DB_USERNAME', 'root'),
58 'password' => env('DB_PASSWORD', ''),
59 'charset' => 'utf8',
60 'collation' => 'utf8_unicode_ci',
61 'prefix' => '',
62 'options' => array(
63 PDO::ATTR_TIMEOUT => 5,
64 ),
65 );
66 Config::set("database.connections.conn", $conn);
67
68 DB::connection("conn")->getDatabaseName();
69
70 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
71 $server_id=$serverclist[0]->id;
72 if($server_id<10){
73 $server_id="0".$server_id;
74 }
75
76
77 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
78
79 $maxids=$maxid[0]->maxid;
80
81 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
82 $alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids'"));
83 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
84
85
86 $userarr=array();
87 foreach($alist as $aline)
88 {
89 $setstrarr=array();
90
91
92 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
93 if($aline->crm_id>0)
94 {
95 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
96 if(isset($user[0]))
97 {
98 $record_id=$user[0]->id;
99 $clientcode=$user[0]->clientcode;
100 $currentstatus=$user[0]->currentstatus;
101 $legalstatus=$user[0]->legalstatus;
102 }
103 }
104 $tpostdata=json_decode($aline->data,true);
105 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
106 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
107 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
108
109 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
110 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
111 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
112 $globalid=$server_id.$record_id;
113 $setstrarr[]="server='$server_id'";
114 $setstrarr[]="record_id='$record_id'";
115 $setstrarr[]="crmcall_id='$aline->id'";
116 $setstrarr[]="globalid='$globalid'";
117 $setstrarr[]="created_at='$aline->created_at'";
118 $setstrarr[]="start='$fulldate'";
119 $setstrarr[]="length='$length'";
120 $setstrarr[]="user='$username'";
121 $setstrarr[]="name='$dispname'";
122 $setstrarr[]="dispo='$aline->userstatus'";
123 $setstrarr[]="subdispo='$aline->usersubstatus'";
124 $setstrarr[]="callback='$aline->usercallback'";
125
126 $setstrarr[]="number='$aline->number'";
127 $setstrarr[]="clientcode='$clientcode'";
128 $setstrarr[]="currentstatus='$currentstatus'";
129 $setstrarr[]="legalstatus='$legalstatus'";
130 $setstrarr[]="client='$aline->client'";
131 $setstrarr[]="department='$aline->department'";
132 $setstrarr[]="state='$aline->state'";
133 $setstrarr[]="hsource='$aline->hsource'";
134
135 $setstrarr[]="type='$aline->type'";
136 $setstrarr[]="status='$aline->status'";
137 $setstrarr[]="statuscode='$aline->statuscode'";
138 $setstrarr[]="statusstr='$aline->substatus'";
139 $setstrarr[]="dialline='$aline->dialline_id'";
140 $setstrarr[]="did='$aline->did'";
141 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
142 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
143 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
144 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
145 $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
146 $setstrarr[]="userdata='$aline->userdata'";
147 $setstrarr[]="attempt='$aline->attempt'";
148 $setstrarr[]="priority='$aline->priority'";
149 $setstrarr[]="question='$aline->question'";
150
151 $setstr=implode(",",$setstrarr);
152 DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
153 }
154 DB::connection("conn")->disconnect();
155
156 }
157 }
158
159
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class CreportTen extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'CreportTen';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task for CreportTen';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 $date=date('F_Y');
42 echo "\n".date('Y-m-d H:i:s')."\n";
43
44 $logdate=strtotime('0 day');
45
46 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
47 $central_ip=env('central_ip');
48 $server_ip=env('app_ip');
49 //$calllog_report = "calllog_report_".date("d_m_Y");
50 $calllog_report = "calllog_report_test";
51 $conn = array(
52 'driver' => 'mysql',
53 'host' => $central_ip,
54 'database' => env('DB_DATABASE', 'kstych_flexydial'),
55 'username' => env('DB_USERNAME', 'root'),
56 'password' => env('DB_PASSWORD', ''),
57 'charset' => 'utf8',
58 'collation' => 'utf8_unicode_ci',
59 'prefix' => '',
60 'options' => array(
61 PDO::ATTR_TIMEOUT => 5,
62 ),
63 );
64 Config::set("database.connections.conn", $conn);
65
66 DB::connection("conn")->getDatabaseName();
67
68 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
69 $server_id=$serverclist[0]->id;
70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73
74
75 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
76
77 $maxids=$maxid[0]->maxid;
78 echo "Maxid".$maxids;
79
80 //$alist=DB::select(DB::raw("SELECT * from crmcalls_archive where created_at>'2018-06-01' and created_at<'2018-07-01'"));
81 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
82
83 $alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
84
85 $userarr=array();
86 foreach($alist as $aline)
87 {
88 $setstrarr=array();
89
90
91 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
92 if($aline->crm_id>0)
93 {
94 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
95 if(isset($user[0]))
96 {
97 $record_id=$user[0]->id;
98 $clientcode=$user[0]->clientcode;
99 $currentstatus=$user[0]->currentstatus;
100 $legalstatus=$user[0]->legalstatus;
101 }
102 }
103 $tpostdata=json_decode($aline->data,true);
104 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
105 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
106 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
107
108 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
109 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
110 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
111 $globalid=$server_id.$record_id;
112 $setstrarr[]="server='$server_id'";
113 $setstrarr[]="record_id='$record_id'";
114 $setstrarr[]="crmcall_id='$aline->id'";
115 $setstrarr[]="globalid='$globalid'";
116 $setstrarr[]="created_at='$aline->created_at'";
117 $setstrarr[]="start='$fulldate'";
118 $setstrarr[]="length='$length'";
119 $setstrarr[]="user='$username'";
120 $setstrarr[]="name='$dispname'";
121 $setstrarr[]="dispo='$aline->userstatus'";
122 $setstrarr[]="subdispo='$aline->usersubstatus'";
123 $setstrarr[]="callback='$aline->usercallback'";
124
125 $setstrarr[]="number='$aline->number'";
126 $setstrarr[]="clientcode='$clientcode'";
127 $setstrarr[]="currentstatus='$currentstatus'";
128 $setstrarr[]="legalstatus='$legalstatus'";
129 $setstrarr[]="client='$aline->client'";
130 $setstrarr[]="department='$aline->department'";
131 $setstrarr[]="state='$aline->state'";
132 $setstrarr[]="hsource='$aline->hsource'";
133
134 $setstrarr[]="type='$aline->type'";
135 $setstrarr[]="status='$aline->status'";
136 $setstrarr[]="statuscode='$aline->statuscode'";
137 $setstrarr[]="statusstr='$aline->substatus'";
138 $setstrarr[]="dialline='$aline->dialline_id'";
139 $setstrarr[]="did='$aline->did'";
140 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
141 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
142 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
143 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
144 $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
145 $setstrarr[]="userdata='$aline->userdata'";
146 $setstrarr[]="attempt='$aline->attempt'";
147 $setstrarr[]="priority='$aline->priority'";
148 $setstrarr[]="question='$aline->question'";
149
150 $setstr=implode(",",$setstrarr);
151 DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
152 //DB::connection("conn")->update(DB::raw("UPDATE ".$calllog_report." as ca INNER JOIN crmcalls as c on ca.crmcall_id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question"));
153 }
154 echo "AfterUploadingData=".date('Y-m-d H:i:s');
155 }
156 }
157
158
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class DailyLogout extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'DailyLogout';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'DailyLogout';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48
49 Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','updated_at'=>'0000-00-00 00:00:00']);
50 Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','updated_at'=>'0000-00-00 00:00:00']);
51
52 User::where('presence','>','0')->update(['presence'=>0]);
53 Session::truncate();
54
55 return "";
56 }
57 }
58
59
60
61
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class DeleteCrmcalls extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'DeleteCrmcalls';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Delete data from CRMCalls before 7 days';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 echo "\n".date('Y-m-d H:i:s')."\n";
49
50 $logdate=strtotime('-7 day');
51
52 CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
53 }
54 }
55
56
57
58
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 use App\Models\Sipid;
19 use App\Models\Kqueue;
20 use App\Models\Dialline;
21 use App\Models\Session;
22
23 use Illuminate\Database\Schema\Blueprint;
24
25 class InsertCrmArchive extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'InsertCrmArchive';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'Insert updated data into crmcalls_archive from crmcalls';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 echo "\n".date('Y-m-d H:i:s')."\n";
49
50 DB::insert(DB::raw("insert into crmcalls_archive select * from crmcalls where id>(select max(id) from crmcalls_archive)"));
51
52 DB::update(DB::raw("UPDATE crmcalls_archive as ca INNER JOIN crmcalls as c on ca.id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question"));
53
54 echo 'End';
55 }
56 }
57
58
59
60
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAMIListen;
6
7 class KstychARP extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychARP';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'ARP Broadcast';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30
31 }
32
33 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class KstychDaily extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'KstychDaily';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->update(array('postdata'=>'','queries'=>''));
42 Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->delete();
43
44
45
46 if(env('app_ip')=="10.3.177.14")
47 {
48
49 if(!Schema::hasTable('calllog_report'))
50 {
51 Schema::create('calllog_report', function(Blueprint $table)
52 {
53 $table->string('server', 100);
54 $table->dateTime('start');
55 $table->integer('length');
56 $table->string('user',100);
57 $table->string('name',100);
58 $table->string('dispo', 200);
59 $table->string('subdispo', 200);
60 $table->dateTime('callback');
61 $table->string('number', 100);
62 $table->string('clientcode', 100);
63 $table->string('currentstatus', 100);
64 $table->string('legalstatus', 100);
65 $table->string('client', 200);
66 $table->string('department', 200);
67 $table->string('state', 50);
68 $table->string('hsource', 100);
69 $table->string('type', 50);
70 $table->string('statuscode', 20);
71 $table->string('status', 100);
72 $table->string('statusstr', 100);
73 $table->integer('dialline');
74 $table->string('did', 50);
75 $table->bigInteger('waitsec');
76 $table->bigInteger('callsec');
77 $table->bigInteger('talksec');
78 $table->bigInteger('disposec');
79 $table->string('remarks', 500);
80 $table->string('userdata',1000);
81 });
82 }
83
84
85 $offline=array();
86 $arr=Config::get("app.hdfcnodes");
87 $logdate=strtotime('-1 day');
88
89
90 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
91
92
93
94 $ii=1;$ci=0;
95 foreach($arr as $server=>$serverline)
96 {
97 $ci++;
98 $conn = array(
99 'driver' => 'mysql',
100 'host' => $server,
101 'database' => env('DB_DATABASE', 'kstych_flexydial'),
102 'username' => env('DB_USERNAME', 'root'),
103 'password' => env('DB_PASSWORD', ''),
104 'charset' => 'utf8',
105 'collation' => 'utf8_unicode_ci',
106 'prefix' => '',
107 'options' => array(
108 PDO::ATTR_TIMEOUT => 5,
109 ),
110 );
111 Config::set("database.connections.conn$ci", $conn);
112
113 try
114 {
115 DB::connection("conn$ci")->getDatabaseName();
116
117
118 $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->get();
119 $userarr=array();
120 foreach($alist as $aline)
121 {
122 $setstrarr=array();
123
124
125 $clientcode="";$currentstatus="";$legalstatus="";
126 if($aline->crm_id>0)
127 {
128 $user=DB::connection("conn$ci")->select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
129 if(isset($user[0]))
130 {
131 $clientcode=$user[0]->clientcode;
132 $currentstatus=$user[0]->currentstatus;
133 $legalstatus=$user[0]->legalstatus;
134 }
135 }
136 $tpostdata=json_decode($aline->data,true);
137 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
138 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
139 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
140
141 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id);
142 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
143 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
144
145 $setstrarr[]="server='$server'";
146 $setstrarr[]="start='$fulldate'";
147 $setstrarr[]="length='$length'";
148 $setstrarr[]="user='$username'";
149 $setstrarr[]="name='$dispname'";
150 $setstrarr[]="dispo='$aline->userstatus'";
151 $setstrarr[]="subdispo='$aline->usersubstatus'";
152 $setstrarr[]="callback='$aline->usercallback'";
153
154 $setstrarr[]="number='$aline->number'";
155 $setstrarr[]="clientcode='$clientcode'";
156 $setstrarr[]="currentstatus='$currentstatus'";
157 $setstrarr[]="legalstatus='$legalstatus'";
158 $setstrarr[]="client='$aline->client'";
159 $setstrarr[]="department='$aline->department'";
160 $setstrarr[]="state='$aline->state'";
161 $setstrarr[]="hsource='$aline->hsource'";
162
163 $setstrarr[]="type='$aline->type'";
164 $setstrarr[]="status='$aline->status'";
165 $setstrarr[]="statuscode='$aline->statuscode'";
166 $setstrarr[]="statusstr='$aline->substatus'";
167 $setstrarr[]="dialline='$aline->dialline_id'";
168 $setstrarr[]="did='$aline->did'";
169 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
170 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
171 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
172 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
173 $setstrarr[]="remarks='$aline->userremarks'";
174 $setstrarr[]="userdata='$aline->userdata'";
175
176 $setstr=implode(",",$setstrarr);
177 DB::insert(DB::raw("insert into calllog_report set $setstr"));
178 }
179
180 }
181 catch(Exception $e)
182 {
183 $offline[]=$server;
184 }
185 }
186
187 }
188
189
190
191 }
192
193 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAGIListen;
6
7 class KstychPAGI extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychPAGI';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'Daemon to Listen to Asterisk';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30 $agi = \PAGI\Client\Impl\ClientImpl::getInstance();
31 $kpagi = new KPAGIListen(array('pagiClient' => $agi));
32 $kpagi->init();
33 $kpagi->run();
34 }
35
36 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4
5 use App\Jobs\KPAMIListen;
6
7 class KstychPAMI extends Command {
8
9 /**
10 * The console command name.
11 *
12 * @var string
13 */
14 protected $signature = 'KstychPAMI {serverip=127.0.0.1}';
15
16 /**
17 * The console command description.
18 *
19 * @var string
20 */
21 protected $description = 'Daemon to Listen to Asterisk';
22
23 /**
24 * Execute the console command.
25 *
26 * @return mixed
27 */
28 public function handle()
29 {
30 $listener = new KPAMIListen($this->argument('serverip'));$listener->run();
31 }
32
33 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use DB;
5 use Config;
6
7 use App\Models\User;
8 use App\Models\Accesslog;
9
10 use App\Models\CRMCall;
11 use Schema;
12 use PDO;
13
14 use Illuminate\Database\Schema\Blueprint;
15
16 class Userlog_datavalidation extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'Userlog_datavalidation';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'Userlog_datavalidation';
31
32 /**
33 * Execute the console command.
34 *
35 * @return mixed
36 */
37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d')."\n";
41
42 $logdate=strtotime('-1 day');
43 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
44 $server_ip=env('app_ip');
45 $central_ip=env('central_ip');
46
47 $conn = array(
48 'driver' => 'mysql',
49 'host' => $central_ip,
50 'database' => env('DB_DATABASE', 'kstych_flexydial'),
51 'username' => env('DB_USERNAME', 'root'),
52 'password' => env('DB_PASSWORD', ''),
53 'charset' => 'utf8',
54 'collation' => 'utf8_unicode_ci',
55 'prefix' => '',
56 'options' => array(
57 PDO::ATTR_TIMEOUT => 5,
58 ),
59 );
60 Config::set("database.connections.conn", $conn);
61 if(DB::connection("conn")->getDatabaseName())
62 {
63 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
64 $server_id=$serverclist[0]->id;
65 if($server_id<10){
66 $server_id="0".$server_id;
67 }
68
69
70 $i=0;
71
72
73 $ulist=DB::select(DB::raw("select * from users WHERE 1"));
74 foreach($ulist as $uline) {
75 $users[$uline->id] = $uline->username;
76 }
77 if($alist=DB::select(DB::raw("select * from userlogs WHERE created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"))){
78
79
80 foreach($alist as $aline) {
81 $i++;
82 $global_id = $server_id . $i;
83 if($aline->enddate=='0000-00-00'|| $aline->endtime=='00:00:00' || $aline->durationsec=='0')
84 {
85 $enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at));
86 $enddate=explode(" ",$enddatetime)[0];
87 $endtime=explode(" ",$enddatetime)[1];
88 $durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime));
89 }
90 else
91 {
92 $enddate=$aline->enddate;
93 $endtime=$aline->endtime;
94 $durationsec=$aline->durationsec;
95 }
96
97 $rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
98 'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
99 'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime,
100 'durationsec'=>$durationsec,'data'=>$aline->data,'group'=>$aline->group,'login'=>'','dialnext'=>'','dialnext-agentbriefing'=>'','dialnext-downtime'=>'','dialnext-floorannouncements'=>'','dialnext-incoming'=>'','dialnext-lunchbreak'=>'','dialnext-manual'=>'','dialnext-notready'=>'','dialnext-qualityfeedback'=>'','dialnext-teabreak'=>'','dialnext-teammeeting'=>'','dialnext-utilitybreak'=>'','manual'=>'','manual-agentbriefing'=>'','manual-agentbriefing'=>'','manual-downtime'=>'','manual-floorannouncements'=>'','manual-incoming'=>'','manual-lunchbreak'=>'','manual-manual'=>'','manual-notready'=>'','manual-qualityfeedback'=>'','manual-teabreak'=>'','manual-teammeeting'=>'','manual-utilitybreak'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','paused-wrapup'=>'','progressive'=>'','progressive-agentbriefing'=>'','progressive-agentbriefing'=>'','progressive-downtime'=>'','progressive-floorannouncements'=>'','progressive-incoming'=>'','progressive-lunchbreak'=>'','progressive-manual'=>'','progressive-notready'=>'','progressive-qualityfeedback'=>'','progressive-teabreak'=>'','progressive-teammeeting'=>'','progressive-utilitybreak'=>'','ready-incoming'=>''
101 );
102
103 $data=json_decode($aline->data,true);
104 foreach($data as $sipid=>$sdata)
105 {
106 $prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
107 if(isset($sdata['states']))
108 {
109 $previous="login";
110 foreach($sdata['states'] as $fts=>$states)
111 {
112 if($states[0] != 1)
113 {
114 $rowdata[$previous] +=round(($fts-$prets)/1000,2);
115
116 $previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
117 $prets=$fts;
118 }
119
120 }
121 $rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
122 }
123 }
124 $rowdata["login"] = $aline->durationsec;
125
126 $rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak'];
127
128
129 $key_value = '';
130
131
132 $startTime=$aline->startdate." ".$aline->starttime;
133 $endTime=$aline->enddate." ".$aline->endtime;
134
135 $crmCalls=DB::select(DB::raw("select user_id,type,ts_Wait,ts_Call,ts_Talk,ts_Recstart,ts_Recend,ts_Dispo,ts_Close from crmcalls WHERE updated_at>='".$startTime."' and updated_at<'".$endTime."' and user_id='".$aline->user_id."'"));
136
137 $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
138 $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
139 $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
140 $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
141 $tt_prog=0;$tt_man=0;$tt_inb=0;
142
143 if($crmCalls!=null){
144 foreach($crmCalls as $crmCall){
145 $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
146 $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
147 $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
148 $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
149
150 if($crmCall->type == 'Progressive')
151 {
152 $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
153 $progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
154 $progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
155 $progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
156 }
157
158 if($crmCall->type == 'Manual')
159 {
160 $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
161 $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
162 $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
163 $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
164 }
165
166 if($crmCall->type == 'Inbound')
167 {
168 $inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
169 $inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
170 $inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
171 $inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
172 }
173 }
174 }
175
176 $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
177 $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
178 $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
179
180 $total_idealtime=$rowdata["login"]-($rowdata['not-ready']+$tt_prog+$tt_man+$tt_inb);
181
182 echo "notready time-----idle----".$total_idealtime;
183
184 foreach($rowdata AS $key=>$value) {
185 if($key != 1)
186 $key_value .= "`$key` = '$value', ";
187 }
188 $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
189
190 $key_value .= "`tt_prog` = '$tt_prog', ";
191 $key_value .= "`tt_man` = '$tt_man', ";
192 $key_value .= "`tt_inb` = '$tt_inb', ";
193
194 $key_value .= "`ts_Wait` = '$ts_Wait', ";
195 $key_value .= "`ts_Call` = '$ts_Call', ";
196 $key_value .= "`ts_Talk` = '$ts_Talk', ";
197 $key_value .= "`ts_Dispo` = '$ts_Dispo', ";
198 $key_value .= "`progts_Wait` = '$progTs_Wait', ";
199 $key_value .= "`progts_Call` = '$progTs_Call', ";
200 $key_value .= "`progts_Talk` = '$progTs_Talk', ";
201 $key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
202 $key_value .= "`mants_Wait` = '$manTs_Wait', ";
203 $key_value .= "`mants_Call` = '$manTs_Call', ";
204 $key_value .= "`mants_Talk` = '$manTs_Talk', ";
205 $key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
206 $key_value .= "`incts_Wait` = '$inbTs_Wait', ";
207 $key_value .= "`incts_Call` = '$inbTs_Call', ";
208 $key_value .= "`incts_Talk` = '$inbTs_Talk', ";
209 $key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
210 $key_value .= "`prod_tos` = '$prod_TOS', ";
211 $key_value .= "`totalidealtime` = '$total_idealtime', ";
212
213
214
215 $key_value = substr($key_value, 0, -2);
216
217 //$userlogsTable = "userlogs_".date("d_m_Y",$logdate);
218 $userlogsTable = "userlogs_datavalid";
219 DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
220
221 }
222
223 }
224 }
225 }
226 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use DB;
5 use Config;
6
7 use App\Models\User;
8 use App\Models\Accesslog;
9
10 use App\Models\CRMCall;
11 use Schema;
12 use PDO;
13
14 use Illuminate\Database\Schema\Blueprint;
15
16 class dailyupload_calllog extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'dailyupload_calllog';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'dailyupload_calllog';
31
32 /**
33 * Execute the console command.
34 *
35 * @return mixed
36 */
37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41 $logdate=strtotime('0 day');
42
43 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
44 $server_ip=env('app_ip');
45 $central_ip=env('central_ip');
46 $calllog_report = "calllog_report_".date("d_m_Y",$logdate);
47 $created_at=date("Y-m-d H:i:s");
48
49 $conn = array(
50 'driver' => 'mysql',
51 'host' => $central_ip,
52 'database' => env('DB_DATABASE', 'kstych_flexydial'),
53 'username' => env('DB_USERNAME', 'root'),
54 'password' => env('DB_PASSWORD', ''),
55 'charset' => 'utf8',
56 'collation' => 'utf8_unicode_ci',
57 'prefix' => '',
58 'options' => array(
59 PDO::ATTR_TIMEOUT => 5,
60 ),
61 );
62 Config::set("database.connections.conn", $conn);
63 if(DB::connection("conn")->getDatabaseName())
64 {
65
66 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
67 $server_id=$serverclist[0]->id;
68 if($server_id<10){
69 $server_id="0".$server_id;
70 }
71
72 $clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server"));
73 $caar=[];
74 foreach($clist as $cline)
75 {
76 $caar[$cline->server]= $cline->cnt;
77
78
79 }
80 $mlist=DB::select(DB::raw("select count(*) as countrecord from crmcalls where created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"));
81
82 $location_cont='0';
83 $central_cont='0';
84
85 $location_cont=$mlist[0]->countrecord;
86 if(array_key_exists($server_id,$caar)){
87 $central_cont=$caar[$server_id];
88 }else{
89 $central_cont=0;
90
91 }
92 $dif=($central_cont)-($mlist[0]->countrecord);
93
94 if($dif==0){
95
96 $result="Y";
97
98 DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
99
100 }else{
101
102 $result="N";
103 DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
104
105 }
106
107 DB::connection("conn")->disconnect();
108
109 }
110
111 }
112
113
114 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use DB;
5 use Config;
6
7 use App\Models\User;
8 use App\Models\Accesslog;
9
10 use App\Models\CRMCall;
11 use Schema;
12 use PDO;
13
14 use Illuminate\Database\Schema\Blueprint;
15
16 class records_details extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'records_details';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'records_details';
31
32 /**
33 * Execute the console command.
34 *
35 * @return mixed
36 */
37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d')."\n";
41 $server_ip=env('app_ip');
42 $central_ip=env('central_ip');
43 $conn='';
44 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
45
46 $conn = array(
47 'driver' => 'mysql',
48 'host' => $central_ip,
49 'database' => env('DB_DATABASE', 'kstych_flexydial'),
50 'username' => env('DB_USERNAME', 'root'),
51 'password' => env('DB_PASSWORD', ''),
52 'charset' => 'utf8',
53 'collation' => 'utf8_unicode_ci',
54 'prefix' => '',
55 'options' => array(
56 PDO::ATTR_TIMEOUT => 5,
57 ),
58 );
59 Config::set("database.connections.conn", $conn);
60
61
62 if(DB::connection("conn")->getDatabaseName())
63 {
64 $serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
65 $server_id=$serverclist[0]->id;
66 if($server_id<10){
67 $server_id="0".$server_id;
68 }
69 $location=$serverclist[0]->location;
70
71 echo ",".$server_ip;
72
73 $qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`"));
74 $datainser='';
75 foreach($qlist as $qline)
76 {
77
78 $record_id=$qline->id;
79 $clientcode=$qline->clientcode;
80 $client=$qline->client;
81 $status=$qline->status;
82 $clientinternalid=$qline->clientinternalid;
83 $mobile=$qline->mobile;
84 $priority=$qline->priority;
85 $modified=$qline->modified;
86 $question=$qline->question;
87 $firstname=$qline->firstname;
88
89
90 DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'"));
91
92
93 }
94 DB::connection("conn")->disconnect();
95
96 }
97 }
98
99 }
100
101
102
103
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "4";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 0,20000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_1 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_1';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_1';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "2";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 20001,40000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_2 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_2';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_2';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "3";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 40001,60000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_3 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_3';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_3';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "4";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 60001,80000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_4 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_4';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_4';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "5";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
88 $location=$serverclist[0]->location;
89
90
91 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 80001,100000"));
92
93 $conn='';
94
95 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
96
97 foreach($excelarray as $key => $array){
98 $excelarray[$key] = (array)$array;
99 }
100
101 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
102 $highestColumn = $highestColumn[0]->cnt;
103
104 $highestrow = count($excelarray);
105
106 $flag = 0;
107 $editflag=0;
108
109 for($i=0;$i<$highestrow;$i++)
110 {
111 if($excelarray[$i]["id"]!="")
112 {
113 if($excelarray[$i]["id"]=="CREATE")
114 {
115 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
116 }
117 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
118 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
119 {
120 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
121 $ppldata=$empdata["peopledata"];
122 $createdlog=$empdata['modifylog'];
123 $fdirty=$empdata['dirty'];
124
125 $createdlog[$updatetime]=$username."::";
126 $createdlog["updated"]=$updatetime;
127
128 $newdata=$ppldata;
129 foreach($excelarray[$i] as $key => $value)
130 {
131 if($value!="")
132 {
133 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
134 {
135 $value=str_replace("'"," ",$value);
136 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
137
138 $fdirty[$key]=1;
139
140 $newdata[$key]=$value;
141 }
142 }
143 }
144
145 /*Start - Changes need to be done*/
146
147 if($excelarray[$i]["status"]==null)
148 {
149 $empdata['status'] = "rom";
150 }
151
152 if($excelarray[$i]["dialer_status"]==null)
153 {
154 $empdata['dialer_status'] = "rom";
155 }
156
157 if($excelarray[$i]["dialer_substatus"]==null)
158 {
159 $empdata['dialer_substatus'] = "rom";
160 }
161
162 /*End - Changes need to be done*/
163
164 $empdata["peopledata"]=$newdata;
165 $empdata['modifylog']=$createdlog;
166 $empdata['dirty']=$fdirty;
167
168 $wakka->setPerson($excelarray[$i]["id"],$empdata);
169 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
170 $successArr[] = $excelarray[$i];
171
172 }
173 else
174 {
175 $reason = "";
176
177 $reason .= "Record ID is not on local server,";
178
179 $excelarray[$i]['server_ip'] =$server_ip;
180 $excelarray[$i]['location'] =$location;
181
182 if($excelarray[$i]["clientcode"]!="")
183 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
184 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
185
186 $excelarray[$i]['Reason'] = $reason;
187
188 $failureArr[] = $excelarray[$i];
189
190 }
191 }
192 else
193 {
194
195 $reason = "";
196
197 if($excelarray[$i]["id"]=="")
198 $reason .= "Column ID is blank,";
199
200 $excelarray[$i]['server_ip'] =$server_ip;
201 $excelarray[$i]['location'] =$location;
202
203 if($excelarray[$i]["clientcode"]!="")
204 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
205
206 $excelarray[$i]['Reason'] = $reason;
207
208 $failureArr[] = $excelarray[$i];
209
210 }
211
212 }
213 if(!empty($successArr)){
214 foreach($successArr as $succes)
215 {
216 $setSuccess=array();
217
218 $setSuccess[] = "server_ip='$server_ip'";
219 $setSuccess[] = "location='$location'";
220 $setSuccess[] = "record_id='".$succes['id']."'";
221 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
222 $setSuccess[] = "modified='".$succes['modified']."'";
223
224 $setSuccess = implode(",",$setSuccess);
225
226 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
227 }
228 }
229 if(!empty($failureArr)){
230 foreach($failureArr as $failur)
231 {
232 $setFailure=array();
233
234 $setFailure[] = "server_ip='$server_ip'";
235 $setFailure[] = "location='$location'";
236 $setFailure[] = "cust_id='".$failur['clientcode']."'";
237 $setFailure[] = "record_id='".$failur['record_id']."'";
238 $setFailure[] = "reason='".$failur['Reason']."'";
239
240 $setFailure = implode(",",$setFailure);
241
242 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
243 }
244 }
245
246 DB::connection("conn")->disconnect();
247 }
248 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_5 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_5';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_5';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "6";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 100001,120000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_6 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_6';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_6';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "6";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 120001,140000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_daily extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_daily';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_daily';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "1";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49
50 $server_ip=env('app_ip');
51 $central_ip=env('central_ip');
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90 echo $central_ip;
91 echo $location;
92
93
94 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='$server_ip'"));
95
96 $conn='';
97
98 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
99
100 foreach($excelarray as $key => $array){
101 $excelarray[$key] = (array)$array;
102 }
103
104 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
105 $highestColumn = $highestColumn[0]->cnt;
106
107 $highestrow = count($excelarray);
108
109 $flag = 0;
110 $editflag=0;
111
112 for($i=0;$i<$highestrow;$i++)
113 {
114 if($excelarray[$i]["id"]!="")
115 {
116 if($excelarray[$i]["id"]=="CREATE")
117 {
118 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
119 }
120 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
121 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
122 {
123 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
124 $ppldata=$empdata["peopledata"];
125 $createdlog=$empdata['modifylog'];
126 $fdirty=$empdata['dirty'];
127
128 $createdlog[$updatetime]=$username."::";
129 $createdlog["updated"]=$updatetime;
130
131 $newdata=$ppldata;
132 foreach($excelarray[$i] as $key => $value)
133 {
134 if($value!="")
135 {
136 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
137 {
138 $value=str_replace("'"," ",$value);
139 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
140
141 $fdirty[$key]=1;
142
143 $newdata[$key]=$value;
144 }
145 }
146 }
147
148 /*Start - Changes need to be done*/
149
150 if($excelarray[$i]["status"]==null)
151 {
152 $empdata['status'] = "rom";
153 }
154
155 if($excelarray[$i]["dialer_status"]==null)
156 {
157 $empdata['dialer_status'] = "rom";
158 }
159
160 if($excelarray[$i]["dialer_substatus"]==null)
161 {
162 $empdata['dialer_substatus'] = "rom";
163 }
164
165 /*End - Changes need to be done*/
166
167 $empdata["peopledata"]=$newdata;
168 $empdata['modifylog']=$createdlog;
169 $empdata['dirty']=$fdirty;
170
171 $wakka->setPerson($excelarray[$i]["id"],$empdata);
172 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
173 $successArr[] = $excelarray[$i];
174
175 }
176 else
177 {
178 $reason = "";
179
180 $reason .= "Record ID is not on local server,";
181
182 $excelarray[$i]['server_ip'] =$server_ip;
183 $excelarray[$i]['location'] =$location;
184
185 if($excelarray[$i]["clientcode"]!="")
186 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
187 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
188
189 $excelarray[$i]['Reason'] = $reason;
190
191 $failureArr[] = $excelarray[$i];
192
193 }
194 }
195 else
196 {
197
198 $reason = "";
199
200 if($excelarray[$i]["id"]=="")
201 $reason .= "Column ID is blank,";
202
203 $excelarray[$i]['server_ip'] =$server_ip;
204 $excelarray[$i]['location'] =$location;
205
206 if($excelarray[$i]["clientcode"]!="")
207 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
208
209 $excelarray[$i]['Reason'] = $reason;
210
211 $failureArr[] = $excelarray[$i];
212
213 }
214
215 }
216 if(!empty($successArr)){
217 foreach($successArr as $succes)
218 {
219 $setSuccess=array();
220
221 $setSuccess[] = "server_ip='$server_ip'";
222 $setSuccess[] = "location='$location'";
223 $setSuccess[] = "record_id='".$succes['id']."'";
224 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
225 $setSuccess[] = "modified='".$succes['modified']."'";
226
227 $setSuccess = implode(",",$setSuccess);
228
229 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
230
231 DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='$server_ip' and id='".$succes['id']."'"));
232 }
233 }
234 if(!empty($failureArr)){
235 foreach($failureArr as $failur)
236 {
237 $setFailure=array();
238
239 $setFailure[] = "server_ip='$server_ip'";
240 $setFailure[] = "location='$location'";
241 $setFailure[] = "cust_id='".$failur['clientcode']."'";
242 $setFailure[] = "record_id='".$failur['record_id']."'";
243 $setFailure[] = "reason='".$failur['Reason']."'";
244
245 $setFailure = implode(",",$setFailure);
246
247 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure_daily set $setFailure"));
248 }
249 }
250
251 //DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='10.3.179.121'"));
252
253 DB::connection("conn")->disconnect();
254
255
256 }
257 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_data3 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_data3';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_data3';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "3";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_3 where SERVER_IP='$server_ip'"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_3'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $excelarray[$i]["other_information"]='2018-10-09_3';
123 $ppldata=$empdata["peopledata"];
124 $createdlog=$empdata['modifylog'];
125 $fdirty=$empdata['dirty'];
126
127 $createdlog[$updatetime]=$username."::";
128 $createdlog["updated"]=$updatetime;
129
130 $newdata=$ppldata;
131 foreach($excelarray[$i] as $key => $value)
132 {
133 if($value!="")
134 {
135 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
136 {
137 $value=str_replace("'"," ",$value);
138 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
139
140 $fdirty[$key]=1;
141
142 $newdata[$key]=$value;
143 }
144 }
145 }
146
147 /*Start - Changes need to be done*/
148
149 if($excelarray[$i]["status"]==null)
150 {
151 $empdata['status'] = "rom";
152 }
153
154 if($excelarray[$i]["dialer_status"]==null)
155 {
156 $empdata['dialer_status'] = "rom";
157 }
158
159 if($excelarray[$i]["dialer_substatus"]==null)
160 {
161 $empdata['dialer_substatus'] = "rom";
162 }
163
164 /*End - Changes need to be done*/
165
166 $empdata["peopledata"]=$newdata;
167 $empdata['modifylog']=$createdlog;
168 $empdata['dirty']=$fdirty;
169
170 $wakka->setPerson($excelarray[$i]["id"],$empdata);
171 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
172 $successArr[] = $excelarray[$i];
173
174 }
175 else
176 {
177 $reason = "";
178
179 $reason .= "Record ID is not on local server,";
180
181 $excelarray[$i]['server_ip'] =$server_ip;
182 $excelarray[$i]['location'] =$location;
183
184 if($excelarray[$i]["clientcode"]!="")
185 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
186 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
187
188 $excelarray[$i]['Reason'] = $reason;
189
190 $failureArr[] = $excelarray[$i];
191
192 }
193 }
194 else
195 {
196
197 $reason = "";
198
199 if($excelarray[$i]["id"]=="")
200 $reason .= "Column ID is blank,";
201
202 $excelarray[$i]['server_ip'] =$server_ip;
203 $excelarray[$i]['location'] =$location;
204
205 if($excelarray[$i]["clientcode"]!="")
206 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
207
208 $excelarray[$i]['Reason'] = $reason;
209
210 $failureArr[] = $excelarray[$i];
211
212 }
213
214 }
215 echo "\n"."Updated data partial upload end"."\n";
216 /*if(!empty($successArr)){
217 foreach($successArr as $succes)
218 {
219 $setSuccess=array();
220
221 $setSuccess[] = "server_ip='$server_ip'";
222 $setSuccess[] = "location='$location'";
223 $setSuccess[] = "record_id='".$succes['id']."'";
224 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
225 $setSuccess[] = "modified='".$succes['modified']."'";
226
227 $setSuccess = implode(",",$setSuccess);
228
229 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
230 }
231 }
232 if(!empty($failureArr)){
233 foreach($failureArr as $failur)
234 {
235 $setFailure=array();
236
237 $setFailure[] = "server_ip='$server_ip'";
238 $setFailure[] = "location='$location'";
239 $setFailure[] = "cust_id='".$failur['clientcode']."'";
240 $setFailure[] = "record_id='".$failur['record_id']."'";
241 $setFailure[] = "reason='".$failur['Reason']."'";
242
243 $setFailure = implode(",",$setFailure);
244
245 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
246 }
247 }*/
248
249 DB::connection("conn")->disconnect();
250 }
251 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkserverupload_data extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkserverupload_data';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkserverupload_data';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "2";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_09102018_2 where SERVER_IP='$server_ip'"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_09102018_2'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["clientcode"]!="")
113 {
114 /*if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else*/
119 $excelarray[$i]["clientcode"]=intval($excelarray[$i]["clientcode"]);
120 //$excelarray[$i]["client"]=$excelarray[$i]["rm_code"];
121 if($wakka->getCount("records","clientcode='".$excelarray[$i]["clientcode"]."'")==1)
122 {
123 //$empdata=$wakka->getPerson($excelarray[$i]["id"]);
124 $empdata=$wakka->getPersonServer($excelarray[$i]["clientcode"]);
125 $excelarray[$i]["other_information"]='2018-10-09';
126 $ppldata=$empdata["peopledata"];
127 $createdlog=$empdata['modifylog'];
128 $fdirty=$empdata['dirty'];
129
130 $createdlog[$updatetime]=$username."::";
131 $createdlog["updated"]=$updatetime;
132
133 $newdata=$ppldata;
134 foreach($excelarray[$i] as $key => $value)
135 {
136 if($value!="")
137 {
138 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
139 {
140 $value=str_replace("'"," ",$value);
141 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
142
143 $fdirty[$key]=1;
144
145 $newdata[$key]=$value;
146 }
147 }
148 }
149
150 /*Start - Changes need to be done*/
151
152 if($excelarray[$i]["status"]==null)
153 {
154 $empdata['status'] = "rom";
155 }
156
157 if($excelarray[$i]["dialer_status"]==null)
158 {
159 $empdata['dialer_status'] = "rom";
160 }
161
162 if($excelarray[$i]["dialer_substatus"]==null)
163 {
164 $empdata['dialer_substatus'] = "rom";
165 }
166
167 /*End - Changes need to be done*/
168
169 $empdata["peopledata"]=$newdata;
170 $empdata['modifylog']=$createdlog;
171 $empdata['dirty']=$fdirty;
172
173 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
174 $wakka->setPersonServer($excelarray[$i]["clientcode"],$empdata);
175 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
176 $successArr[] = $excelarray[$i];
177
178 }
179 else
180 {
181 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
182 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
183 $ppldata=$empdata["peopledata"];
184 $createdlog=$empdata['modifylog'];
185 $fdirty=$empdata['dirty'];
186
187
188 $createdlog[$updatetime]=$username."::";
189 $createdlog["updated"]=$updatetime;
190
191 $newdata=$ppldata;
192 foreach($excelarray[$i] as $key => $value)
193 {
194 if($value!="")
195 {
196 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
197 {
198 $value=str_replace("'"," ",$value);
199 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
200
201 $fdirty[$key]=1;
202
203 $newdata[$key]=$value;
204 }
205 }
206 }
207 $empdata["peopledata"]=$newdata;
208 $empdata['modifylog']=$createdlog;
209 $empdata['dirty']=$fdirty;
210
211 //$wakka->setPerson($excelarray[$i]["id"],$empdata);
212 $wakka->setPerson($excelarray[$i]["id"],$empdata);
213
214 $reason = "";
215
216 $reason .= "Record ID is not on local server,";
217
218 $excelarray[$i]['server_ip'] =$server_ip;
219 $excelarray[$i]['location'] =$location;
220
221 if($excelarray[$i]["clientcode"]!="")
222 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
223 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
224
225 $excelarray[$i]['Reason'] = $reason;
226
227 $failureArr[] = $excelarray[$i];
228
229 }
230 }
231 else
232 {
233
234 $reason = "";
235
236 if($excelarray[$i]["id"]=="")
237 $reason .= "Column ID is blank,";
238
239 $excelarray[$i]['server_ip'] =$server_ip;
240 $excelarray[$i]['location'] =$location;
241
242 if($excelarray[$i]["clientcode"]!="")
243 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
244
245 $excelarray[$i]['Reason'] = $reason;
246
247 $failureArr[] = $excelarray[$i];
248
249 }
250
251 }
252 echo "\n"."Updated data partial upload end"."\n";
253 /*if(!empty($successArr)){
254 foreach($successArr as $succes)
255 {
256 $setSuccess=array();
257
258 $setSuccess[] = "server_ip='$server_ip'";
259 $setSuccess[] = "location='$location'";
260 $setSuccess[] = "record_id='".$succes['id']."'";
261 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
262 $setSuccess[] = "modified='".$succes['modified']."'";
263
264 $setSuccess = implode(",",$setSuccess);
265
266 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
267 }
268 }
269 if(!empty($failureArr)){
270 foreach($failureArr as $failur)
271 {
272 $setFailure=array();
273
274 $setFailure[] = "server_ip='$server_ip'";
275 $setFailure[] = "location='$location'";
276 $setFailure[] = "cust_id='".$failur['clientcode']."'";
277 $setFailure[] = "record_id='".$failur['record_id']."'";
278 $setFailure[] = "reason='".$failur['Reason']."'";
279
280 $setFailure = implode(",",$setFailure);
281
282 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
283 }
284 }*/
285
286 DB::connection("conn")->disconnect();
287 }
288 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14
15 use Illuminate\Database\Schema\Blueprint;
16
17 class calllog extends Command {
18
19 /**
20 * The console command name.
21 *
22 * @var string
23 */
24 protected $signature = 'calllog';
25
26 /**
27 * The console command description.
28 *
29 * @var string
30 */
31 protected $description = 'App Main Daily Task for calllog';
32
33 /**
34 * Execute the console command.
35 *
36 * @return mixed
37 */
38 public function handle()
39 {
40 $nowts=time();
41 $date=date('F_Y');
42 echo "\n".date('Y-m-d H:i:s')."\n";
43
44 $logdate=strtotime('0 day');
45
46 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
47 $central_ip=env('central_ip');
48 $server_ip=env('app_ip');
49 $calllog_report = "calllog_report_".$date;
50
51 $conn = array(
52 'driver' => 'mysql',
53 'host' => $central_ip,
54 'database' => env('DB_DATABASE', 'kstych_flexydial'),
55 'username' => env('DB_USERNAME', 'root'),
56 'password' => env('DB_PASSWORD', ''),
57 'charset' => 'utf8',
58 'collation' => 'utf8_unicode_ci',
59 'prefix' => '',
60 'options' => array(
61 PDO::ATTR_TIMEOUT => 5,
62 ),
63 );
64 Config::set("database.connections.conn", $conn);
65
66 DB::connection("conn")->getDatabaseName();
67
68 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
69 $server_id=$serverclist[0]->id;
70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73
74
75 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
76
77 $maxids=$maxid[0]->maxid;
78
79 $alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
80
81 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
82
83 //$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
84
85 $userarr=array();
86 foreach($alist as $aline)
87 {
88 $setstrarr=array();
89
90
91 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
92 if($aline->crm_id>0)
93 {
94 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
95 if(isset($user[0]))
96 {
97 $record_id=$user[0]->id;
98 $clientcode=$user[0]->clientcode;
99 $currentstatus=$user[0]->currentstatus;
100 $legalstatus=$user[0]->legalstatus;
101 }
102 }
103 $tpostdata=json_decode($aline->data,true);
104 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
105 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
106 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
107
108 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
109 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
110 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
111 $globalid=$server_id.$record_id;
112 $setstrarr[]="server='$server_id'";
113 $setstrarr[]="record_id='$record_id'";
114 $setstrarr[]="crmcall_id='$aline->id'";
115 $countid=DB::connection("conn")->select(DB::raw("SELECT count(crmcall_id) as countid from $calllog_report where server='$server_id' and crmcall_id='$aline->id'"));
116 $countids=$countid[0]->countid;
117 if($countids>0){continue;}
118 $setstrarr[]="globalid='$globalid'";
119 $setstrarr[]="start='$fulldate'";
120 $setstrarr[]="length='$length'";
121 $setstrarr[]="user='$username'";
122 $setstrarr[]="name='$dispname'";
123 $setstrarr[]="dispo='$aline->userstatus'";
124 $setstrarr[]="subdispo='$aline->usersubstatus'";
125 $setstrarr[]="callback='$aline->usercallback'";
126
127 $setstrarr[]="number='$aline->number'";
128 $setstrarr[]="clientcode='$clientcode'";
129 $setstrarr[]="currentstatus='$currentstatus'";
130 $setstrarr[]="legalstatus='$legalstatus'";
131 $setstrarr[]="client='$aline->client'";
132 $setstrarr[]="department='$aline->department'";
133 $setstrarr[]="state='$aline->state'";
134 $setstrarr[]="hsource='$aline->hsource'";
135
136 $setstrarr[]="type='$aline->type'";
137 $setstrarr[]="status='$aline->status'";
138 $setstrarr[]="statuscode='$aline->statuscode'";
139 $setstrarr[]="statusstr='$aline->substatus'";
140 $setstrarr[]="dialline='$aline->dialline_id'";
141 $setstrarr[]="did='$aline->did'";
142 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
143 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
144 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
145 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
146 $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
147 $setstrarr[]="userdata='$aline->userdata'";
148 $setstrarr[]="attempt='$aline->attempt'";
149
150 $setstr=implode(",",$setstrarr);
151 DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
152 }
153
154 }
155 }
156
157
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!