fe1c4e2d by Prashant Gupta

New repo of HDFC

0 parents
Showing 1000 changed files with 4999 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";
No preview for this file type
No preview for this file type
No preview for this file type
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 echo "\n".date('Y-m-d H:i:s')."\n";
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_id="08";
47 $calllog_report = "calllog_report_".date("d_m_Y");
48
49 $conn = array(
50 'driver' => 'mysql',
51 'host' => '10.3.177.14',
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
64 DB::connection("conn")->getDatabaseName();
65
66
67 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
68
69 $maxids=$maxid[0]->maxid;
70
71 $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))."'"));
72
73 $userarr=array();
74 foreach($alist as $aline)
75 {
76 $setstrarr=array();
77
78
79 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
80 if($aline->crm_id>0)
81 {
82 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
83 if(isset($user[0]))
84 {
85 $record_id=$user[0]->id;
86 $clientcode=$user[0]->clientcode;
87 $currentstatus=$user[0]->currentstatus;
88 $legalstatus=$user[0]->legalstatus;
89 }
90 }
91 $tpostdata=json_decode($aline->data,true);
92 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
93 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
94 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
95
96 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
97 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
98 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
99 $globalid=$server_id.$record_id;
100 $setstrarr[]="server='$server_id'";
101 $setstrarr[]="record_id='$record_id'";
102 $setstrarr[]="crmcall_id='$aline->id'";
103 $setstrarr[]="globalid='$globalid'";
104 $setstrarr[]="start='$fulldate'";
105 $setstrarr[]="length='$length'";
106 $setstrarr[]="user='$username'";
107 $setstrarr[]="name='$dispname'";
108 $setstrarr[]="dispo='$aline->userstatus'";
109 $setstrarr[]="subdispo='$aline->usersubstatus'";
110 $setstrarr[]="callback='$aline->usercallback'";
111
112 $setstrarr[]="number='$aline->number'";
113 $setstrarr[]="clientcode='$clientcode'";
114 $setstrarr[]="currentstatus='$currentstatus'";
115 $setstrarr[]="legalstatus='$legalstatus'";
116 $setstrarr[]="client='$aline->client'";
117 $setstrarr[]="department='$aline->department'";
118 $setstrarr[]="state='$aline->state'";
119 $setstrarr[]="hsource='$aline->hsource'";
120
121 $setstrarr[]="type='$aline->type'";
122 $setstrarr[]="status='$aline->status'";
123 $setstrarr[]="statuscode='$aline->statuscode'";
124 $setstrarr[]="statusstr='$aline->substatus'";
125 $setstrarr[]="dialline='$aline->dialline_id'";
126 $setstrarr[]="did='$aline->did'";
127 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
128 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
129 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
130 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
131 $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
132 $setstrarr[]="userdata='$aline->userdata'";
133
134 $setstr=implode(",",$setstrarr);
135 DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
136 }
137
138 }
139 }
140
141
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 $sipids=Sipid::where("status","=","1")->get();
49 foreach($sipids as $tsip)
50 {
51 $newqueue=new Kqueue();
52 $newqueue->sipNotify($tsip,"adminCommand","user","logout","");
53 }
54
55 Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
56 Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
57
58 $serverarray=explode(",",Config::get("app.asterisk_slaves"));
59 foreach($serverarray as $server)
60 {
61 $sparts=explode(":",$server);
62
63 Sipid::where("id",">=",$sparts[1])->where("id","<=",$sparts[2])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
64 Dialline::where("id",">=",$sparts[3])->where("id","<=",$sparts[4])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
65
66 $newqueue=new Kqueue();
67 $newqueue->astCommand($sparts[0],"channel request hangup all");
68 }
69
70 User::where('presence','>','0')->update(['presence'=>0]);
71 Session::truncate();
72
73 return "";
74 }
75 }
76
77
78
79
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 $logdate=strtotime('-7 day');
49
50 CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
51 }
52 }
53
54
55
56
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 'Start';
49
50 DB::insert(DB::raw("insert into crmcalls_archive select * from crmcalls where id>(select max(id) from crmcalls_archive)"));
51
52 echo 'End';
53 }
54 }
55
56
57
58
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 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 echo "\n".date('Y-m-d')."\n";
45
46 $wakka = new KHRMSLib();
47
48 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
49 $kformlib->gthis=$wakka;
50
51 $themehome=$wakka->GetThemePath('/');
52 $updatetime=time();
53
54 $clientlst=$wakka->GetBBBUserData("clientslist");
55
56 $isadmin=$wakka->IsAdmin();
57 $username=$wakka->GetUserName();
58 $triggers=Input::get("triggers");
59 $tmpstr=explode(",",$kformlib->HRFiledsStr);
60
61 $success="";$message="";$successcnt=0;$duplicatecount=0;
62
63
64 $conn = array(
65 'driver' => 'mysql',
66 'host' => '10.3.177.14',
67 'database' => env('DB_DATABASE', 'kstych_flexydial'),
68 'username' => env('DB_USERNAME', 'root'),
69 'password' => env('DB_PASSWORD', 'yb9738z'),
70 'charset' => 'utf8',
71 'collation' => 'utf8_unicode_ci',
72 'prefix' => '',
73 'options' => array(
74 PDO::ATTR_TIMEOUT => 5,
75 ),
76 );
77 Config::set("database.connections.conn", $conn);
78
79 DB::connection("conn")->getDatabaseName();
80
81 // $excelarray = DB::table('bz_record_upload_uat')->select('*')->get();
82
83 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat limit 1"));
84 $excelarray = (array)$excelarray;
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestrow = count($excelarray);
88 echo $highestColumn;
89 $flag = 0;
90 $editflag=0;
91
92 for($i=0;$i<=$highestrow;$i++)
93 {
94 if($excelarray[$i]["id"]!="")
95 {
96 if($excelarray[$i]["id"]=="CREATE")
97 {
98 $excelarray[$i]["id"]=$wakka->Query("insert into","","records_demo",array('created'=>date('Y-m-d H:i:s')));
99 }
100 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
101
102 if($wakka->getCount("records_demo","id='".$excelarray[$i]["id"]."'")==1)
103 {
104 $empdata=$wakka->getPersonServer($excelarray[$i]["id"]);
105 $ppldata=$empdata["peopledata"];
106 $createdlog=$empdata['modifylog'];
107 $fdirty=$empdata['dirty'];
108
109 $createdlog[$updatetime]=$username."::";
110 $createdlog["updated"]=$updatetime;
111
112 $newdata=$ppldata;
113 foreach($excelarray[$i] as $key => $value)
114 {
115 if($value!="")
116 {
117 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
118 {
119 $value=str_replace("'"," ",$value);
120 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
121
122 $fdirty[$key]=1;
123
124 $newdata[$key]=$value;
125 }
126 }
127 }
128 $empdata["peopledata"]=$newdata;
129 $empdata['modifylog']=$createdlog;
130 $empdata['dirty']=$fdirty;
131
132 $wakka->setPersonServer($excelarray[$i]["id"],$empdata);
133 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
134
135 }
136 }
137
138 }
139 mysqli_close($conn);
140
141 }
142 }
143
144
145
146
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 0,20000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
218 }
219 }
220 //DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat` where SERVER_IP='10.3.179.121'"));
221
222 DB::connection("conn")->disconnect();
223 }
224 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 20001,40000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
112 {
113 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
114 $ppldata=$empdata["peopledata"];
115 $createdlog=$empdata['modifylog'];
116 $fdirty=$empdata['dirty'];
117
118 $createdlog[$updatetime]=$username."::";
119 $createdlog["updated"]=$updatetime;
120
121 $newdata=$ppldata;
122 foreach($excelarray[$i] as $key => $value)
123 {
124 if($value!="")
125 {
126 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
127 {
128 $value=str_replace("'"," ",$value);
129 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
130
131 $fdirty[$key]=1;
132
133 $newdata[$key]=$value;
134 }
135 }
136 }
137
138 /*Start - Changes need to be done*/
139
140 if($excelarray[$i]["status"]==null)
141 {
142 $empdata['status'] = "rom";
143 }
144
145 if($excelarray[$i]["dialer_status"]==null)
146 {
147 $empdata['dialer_status'] = "rom";
148 }
149
150 if($excelarray[$i]["dialer_substatus"]==null)
151 {
152 $empdata['dialer_substatus'] = "rom";
153 }
154
155 /*End - Changes need to be done*/
156
157 $empdata["peopledata"]=$newdata;
158 $empdata['modifylog']=$createdlog;
159 $empdata['dirty']=$fdirty;
160
161 $wakka->setPerson($excelarray[$i]["id"],$empdata);
162 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
163 $successArr[] = $excelarray[$i];
164
165 }
166 else
167 {
168 $reason = "";
169
170 $reason .= "Record ID is not on local server,";
171
172 $excelarray[$i]['server_ip'] =$server_ip;
173 $excelarray[$i]['location'] =$location;
174
175 if($excelarray[$i]["clientcode"]!="")
176 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
177 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
178
179 $excelarray[$i]['Reason'] = $reason;
180
181 $failureArr[] = $excelarray[$i];
182
183 }
184 }
185 else
186 {
187
188 $reason = "";
189
190 if($excelarray[$i]["id"]=="")
191 $reason .= "Column ID is blank,";
192
193 $excelarray[$i]['server_ip'] =$server_ip;
194 $excelarray[$i]['location'] =$location;
195
196 if($excelarray[$i]["clientcode"]!="")
197 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
198
199 $excelarray[$i]['Reason'] = $reason;
200
201 $failureArr[] = $excelarray[$i];
202
203 }
204
205 }
206 if(!empty($successArr)){
207 foreach($successArr as $succes)
208 {
209 $setSuccess=array();
210
211 $setSuccess[] = "server_ip='$server_ip'";
212 $setSuccess[] = "location='$location'";
213 $setSuccess[] = "record_id='".$succes['id']."'";
214 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
215 $setSuccess[] = "modified='".$succes['modified']."'";
216
217 $setSuccess = implode(",",$setSuccess);
218
219 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
220 }
221 }
222 if(!empty($failureArr)){
223 foreach($failureArr as $failur)
224 {
225 $setFailure=array();
226
227 $setFailure[] = "server_ip='$server_ip'";
228 $setFailure[] = "location='$location'";
229 $setFailure[] = "cust_id='".$failur['clientcode']."'";
230 $setFailure[] = "record_id='".$failur['record_id']."'";
231 $setFailure[] = "reason='".$failur['Reason']."'";
232
233 $setFailure = implode(",",$setFailure);
234
235 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
236 }
237 }
238
239 DB::connection("conn")->disconnect();
240 }
241 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 40001,60000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
218 }
219 }
220
221 DB::connection("conn")->disconnect();
222 }
223 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 60001,80000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
218 }
219 }
220
221 DB::connection("conn")->disconnect();
222 }
223 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 80001,100000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
218 }
219 }
220
221 DB::connection("conn")->disconnect();
222 }
223 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 100001,120000"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
218 }
219 }
220 // DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat` where SERVER_IP='10.3.179.121'"));
221
222 DB::connection("conn")->disconnect();
223 }
224 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='10.3.179.121' order by auto_id asc limit 0,200"));
83
84 $server_ip='10.3.179.121';
85 $location='Mumbai';
86 $conn='';
87
88 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
89
90 foreach($excelarray as $key => $array){
91 $excelarray[$key] = (array)$array;
92 }
93
94 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_daily'"));
95 $highestColumn = $highestColumn[0]->cnt;
96
97 $highestrow = count($excelarray);
98
99 $flag = 0;
100 $editflag=0;
101
102 for($i=0;$i<=$highestrow;$i++)
103 {
104 if($excelarray[$i]["id"]!="")
105 {
106 if($excelarray[$i]["id"]=="CREATE")
107 {
108 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
109 }
110 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
111
112 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
113 {
114 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
115 $ppldata=$empdata["peopledata"];
116 $createdlog=$empdata['modifylog'];
117 $fdirty=$empdata['dirty'];
118
119 $createdlog[$updatetime]=$username."::";
120 $createdlog["updated"]=$updatetime;
121
122 $newdata=$ppldata;
123 foreach($excelarray[$i] as $key => $value)
124 {
125 if($value!="")
126 {
127 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
128 {
129 $value=str_replace("'"," ",$value);
130 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
131
132 $fdirty[$key]=1;
133
134 $newdata[$key]=$value;
135 }
136 }
137 }
138
139 /*Start - Changes need to be done*/
140
141 if($excelarray[$i]["status"]==null)
142 {
143 $empdata['status'] = "rom";
144 }
145
146 if($excelarray[$i]["dialer_status"]==null)
147 {
148 $empdata['dialer_status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_substatus"]==null)
152 {
153 $empdata['dialer_substatus'] = "rom";
154 }
155
156 /*End - Changes need to be done*/
157
158 $empdata["peopledata"]=$newdata;
159 $empdata['modifylog']=$createdlog;
160 $empdata['dirty']=$fdirty;
161
162 $wakka->setPerson($excelarray[$i]["id"],$empdata);
163 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
164 $successArr[] = $excelarray[$i];
165
166 }
167 }
168 else
169 {
170 $reason = "";
171
172 if($excelarray[$i]["id"]=="")
173 $reason .= "Column ID is blank,";
174
175 $excelarray[$i]['server_ip'] =$server_ip;
176 $excelarray[$i]['location'] =$location;
177
178 if($excelarray[$i]["clientcode"]!="")
179 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
180
181 $excelarray[$i]['Reason'] = $reason;
182
183 $failureArr[] = $excelarray[$i];
184 }
185
186 }
187
188 if(!empty($successArr)){
189 foreach($successArr as $succes)
190 {
191 $setSuccess=array();
192
193 $setSuccess[] = "server_ip='$server_ip'";
194 $setSuccess[] = "location='$location'";
195 $setSuccess[] = "record_id='".$succes['id']."'";
196 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
197 $setSuccess[] = "modified='".$succes['modified']."'";
198
199 $setSuccess = implode(",",$setSuccess);
200
201 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
202 }
203 }
204
205 if(!empty($failureArr)){
206 foreach($failureArr as $failur)
207 {
208 $setFailure=array();
209
210 $setFailure[] = "server_ip='$server_ip'";
211 $setFailure[] = "location='$location'";
212 $setFailure[] = "cust_id='".$failur['clientcode']."'";
213 $setFailure[] = "reason='".$failur['Reason']."'";
214
215 $setFailure = implode(",",$setFailure);
216
217 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure_daily set $setFailure"));
218 }
219 }
220 DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='10.3.179.121'"));
221
222 DB::connection("conn")->disconnect();
223
224
225 }
226 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 0,20000"));
83
84 foreach($excelarray as $key => $array){
85 $excelarray[$key] = (array)$array;
86 }
87
88 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
89 $highestColumn = $highestColumn[0]->cnt;
90
91 $highestrow = count($excelarray);
92
93 $flag = 0;
94 $editflag=0;
95
96 for($i=0;$i<=$highestrow;$i++)
97 {
98 if($excelarray[$i]["id"]!="")
99 {
100 if($excelarray[$i]["id"]=="CREATE")
101 {
102 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
103 }
104 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
105
106 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
107 {
108 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
109 $ppldata=$empdata["peopledata"];
110 $createdlog=$empdata['modifylog'];
111 $fdirty=$empdata['dirty'];
112
113 $createdlog[$updatetime]=$username."::";
114 $createdlog["updated"]=$updatetime;
115
116 $newdata=$ppldata;
117 foreach($excelarray[$i] as $key => $value)
118 {
119 if($value!="")
120 {
121 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
122 {
123 $value=str_replace("'"," ",$value);
124 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
125
126 $fdirty[$key]=1;
127
128 $newdata[$key]=$value;
129 }
130 }
131 }
132
133 /*Start - Changes need to be done*/
134
135 if($excelarray[$i]["status"]==null)
136 {
137 $empdata['status'] = "rom";
138 }
139
140 if($excelarray[$i]["dialer_status"]==null)
141 {
142 $empdata['dialer_status'] = "rom";
143 }
144
145 if($excelarray[$i]["dialer_substatus"]==null)
146 {
147 $empdata['dialer_substatus'] = "rom";
148 }
149
150 /*End - Changes need to be done*/
151
152 $empdata["peopledata"]=$newdata;
153 $empdata['modifylog']=$createdlog;
154 $empdata['dirty']=$fdirty;
155
156 $wakka->setPerson($excelarray[$i]["id"],$empdata);
157 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
158 $successArr[] = $excelarray[$i];
159
160 }
161 }
162 else
163 {
164 $reason = "";
165
166 if($excelarray[$i]["id"]=="")
167 $reason .= "Column ID is blank,";
168
169 $excelarray[$i]['server_ip'] =$server_ip;
170 $excelarray[$i]['location'] =$location;
171
172 if($excelarray[$i]["clientcode"]!="")
173 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
174
175 $excelarray[$i]['Reason'] = $reason;
176
177 $failureArr[] = $excelarray[$i];
178 }
179
180 }
181
182 if(!empty($successArr)){
183 foreach($successArr as $succes)
184 {
185 $setSuccess=array();
186
187 $setSuccess[] = "server_ip='$server_ip'";
188 $setSuccess[] = "location='$location'";
189 $setSuccess[] = "record_id='".$succes['id']."'";
190 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
191 $setSuccess[] = "modified='".$succes['modified']."'";
192
193 $setSuccess = implode(",",$setSuccess);
194
195 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
196 }
197 }
198
199 if(!empty($failureArr)){
200 foreach($failureArr as $failur)
201 {
202 $setFailure=array();
203
204 $setFailure[] = "server_ip='$server_ip'";
205 $setFailure[] = "location='$location'";
206 $setFailure[] = "cust_id='".$failur['clientcode']."'";
207 $setFailure[] = "reason='".$failur['Reason']."'";
208
209 $setFailure = implode(",",$setFailure);
210
211 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
212 }
213 }
214
215 DB::connection("conn")->disconnect();
216
217
218 }
219 }
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 $wakka = new KHRMSLib();
48
49 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
50 $kformlib->gthis=$wakka;
51
52 $themehome=$wakka->GetThemePath('/');
53 $updatetime=time();
54
55 $clientlst=$wakka->GetBBBUserData("clientslist");
56
57 $isadmin=$wakka->IsAdmin();
58 $username=$wakka->GetUserName();
59 $triggers=Input::get("triggers");
60 $tmpstr=explode(",",$kformlib->HRFiledsStr);
61
62 $success="";$message="";$successcnt=0;$duplicatecount=0;
63
64
65 $conn = array(
66 'driver' => 'mysql',
67 'host' => '10.3.177.14',
68 'database' => env('DB_DATABASE', 'kstych_flexydial'),
69 'username' => env('DB_USERNAME', 'root'),
70 'password' => env('DB_PASSWORD', 'yb9738z'),
71 'charset' => 'utf8',
72 'collation' => 'utf8_unicode_ci',
73 'prefix' => '',
74 'options' => array(
75 PDO::ATTR_TIMEOUT => 5,
76 ),
77 );
78 Config::set("database.connections.conn", $conn);
79
80 DB::connection("conn")->getDatabaseName();
81
82 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_080117 where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 0,20000"));
83
84 foreach($excelarray as $key => $array){
85 $excelarray[$key] = (array)$array;
86 }
87
88 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat_080117'"));
89 $highestColumn = $highestColumn[0]->cnt;
90
91 $highestrow = count($excelarray);
92
93 $flag = 0;
94 $editflag=0;
95
96 for($i=0;$i<=$highestrow;$i++)
97 {
98 if($excelarray[$i]["id"]!="")
99 {
100 if($excelarray[$i]["id"]=="CREATE")
101 {
102 $excelarray[$i]["id"]=$wakka->Query("insert into","","records_demo",array('created'=>date('Y-m-d H:i:s')));
103 }
104 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
105
106 if($wakka->getCount("records_demo","id='".$excelarray[$i]["id"]."'")==1)
107 {
108 $empdata=$wakka->getPersonServer($excelarray[$i]["id"]);
109 $ppldata=$empdata["peopledata"];
110 $createdlog=$empdata['modifylog'];
111 $fdirty=$empdata['dirty'];
112
113 $createdlog[$updatetime]=$username."::";
114 $createdlog["updated"]=$updatetime;
115
116 $newdata=$ppldata;
117 foreach($excelarray[$i] as $key => $value)
118 {
119 if($value!="")
120 {
121 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
122 {
123 $value=str_replace("'"," ",$value);
124 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
125
126 $fdirty[$key]=1;
127
128 $newdata[$key]=$value;
129 }
130 }
131 }
132
133 /*Start - Changes need to be done*/
134
135 if($excelarray[$i]["status"]==null)
136 {
137 $newdata['status'] = "";
138 }
139
140 if($excelarray[$i]["dialer_status"]==null)
141 {
142 $newdata['dialer_status'] = "";
143 }
144
145 if($excelarray[$i]["dialer_substatus"]==null)
146 {
147 $newdata['dialer_substatus'] = "";
148 }
149
150 /*End - Changes need to be done*/
151
152 $empdata["peopledata"]=$newdata;
153 $empdata['modifylog']=$createdlog;
154 $empdata['dirty']=$fdirty;
155
156 $wakka->setPersonServer($excelarray[$i]["id"],$empdata);
157 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
158 $successArr[] = $excelarray[$i];
159
160 }
161 }
162 else
163 {
164 $reason = "";
165
166 if($excelarray[$i]["id"]=="")
167 $reason .= "Column ID is blank,";
168
169 $excelarray[$i]['server_ip'] = $server_ip;
170 $excelarray[$i]['location'] = $location;
171
172 if($excelarray[$i]["clientcode"]!="")
173 $excelarray[$i]['cust_id'] = $excelarray[$i]["clientcode"];
174
175 $excelarray[$i]['Reason'] = $reason;
176
177 $failureArr[] = $excelarray[$i];
178 }
179
180 }
181
182 if(!empty($successArr)){
183 foreach($successArr as $succes)
184 {
185 $setSuccess=array();
186
187 $setSuccess[] = "server_ip='$server_ip'";
188 $setSuccess[] = "location='$location'";
189 $setSuccess[] = "record_id='".$succes['id']."'";
190 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
191 $setSuccess[] = "modified='".$succes['modified']."'";
192
193 $setSuccess = implode(",",$setSuccess);
194
195 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
196 }
197 }
198
199 if(!empty($failureArr)){
200 foreach($failureArr as $failur)
201 {
202 $setFailure=array();
203
204 $setFailure[] = "server_ip='$server_ip'";
205 $setFailure[] = "location='$location'";
206 $setFailure[] = "cust_id='".$failur['clientcode']."'";
207 $setFailure[] = "reason='".$failur['Reason']."'";
208
209 $setFailure = implode(",",$setFailure);
210
211 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
212 }
213 }
214
215 DB::connection("conn")->disconnect();
216
217
218 }
219 }
...\ No newline at end of file ...\ No newline at end of file
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 questionnaire_details extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'questionnaire_details';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'questionnaire_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
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_id="08";
47 $questionaire = "questionaire_details_".date("d_m_Y");
48 //$questionaire = "questionaire_details_23_06_2017";
49
50 $conn = array(
51 'driver' => 'mysql',
52 'host' => '10.3.177.14',
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
66 if(DB::connection("conn")->getDatabaseName())
67 {
68
69 echo ",".$server_id;
70
71 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(question_id) as maxid from $questionaire where server='$server_id'"));
72
73 $maxids=$maxid[0]->maxid;
74
75
76 $qlist=DB::select(DB::raw("SELECT * from questionaire_details where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
77
78 $userarr=array();
79 foreach($qlist as $qline)
80 {
81
82 $setstrarr=array();
83
84 $crtdate=date("Y-m-d H:i:s",strtotime($qline->created_at)+330*60);
85 $update=date("Y-m-d H:i:s",strtotime($qline->updated_at)+330*60);
86
87 $qtime=date("Y-m-d H:i:s",strtotime($qline->question_time)+330*60);
88
89 $setstrarr[]="server='$server_id'";
90 $setstrarr[]="question_id='$qline->id'";
91 $setstrarr[]="created_at='$crtdate'";
92 $setstrarr[]="updated_at='$update'";
93 $setstrarr[]="user_id='$qline->user_id'";
94 $setstrarr[]="cust_id='$qline->cust_id'";
95 $setstrarr[]="call_id='$qline->call_id'";
96 $setstrarr[]="name='$qline->name'";
97 $setstrarr[]="number='$qline->number'";
98 $setstrarr[]="question_time='$qtime'";
99
100 $setstrarr[]="question='$qline->question'";
101 $setstrarr[]="primary_question='$qline->primary_question'";
102 $setstrarr[]="primary_response='$qline->primary_response'";
103 $setstrarr[]="primary_text='$qline->primary_text'";
104 $setstrarr[]="followup1_question='$qline->followup1_question'";
105 $setstrarr[]="followup1_response='$qline->followup1_response'";
106 $setstrarr[]="followup1_text='$qline->followup1_text'";
107 $setstrarr[]="followup2_question='$qline->followup2_question'";
108 $setstrarr[]="followup2_response='$qline->followup2_response'";
109 $setstrarr[]="followup2_text='$qline->followup2_text'";
110 $setstrarr[]="followup3_question='$qline->followup3_question'";
111 $setstrarr[]="followup3_response='$qline->followup3_response'";
112 $setstrarr[]="followup3_text='$qline->followup3_text'";
113 $setstrarr[]="followup4_question='$qline->followup4_question'";
114 $setstrarr[]="followup4_response='$qline->followup4_response'";
115 $setstrarr[]="followup4_text='$qline->followup4_text'";
116 $setstrarr[]="followup5_question='$qline->followup5_question'";
117 $setstrarr[]="followup5_response='$qline->followup5_response'";
118 $setstrarr[]="followup5_text='$qline->followup5_text'";
119 $setstrarr[]="followup6_question='$qline->followup6_question'";
120 $setstrarr[]="followup6_response='$qline->followup6_response'";
121 $setstrarr[]="followup6_text='$qline->followup6_text'";
122 $setstrarr[]="followup7_question='$qline->followup7_question'";
123 $setstrarr[]="followup7_response='$qline->followup7_response'";
124 $setstrarr[]="followup7_text='$qline->followup7_text'";
125
126 $setstr=implode(",",$setstrarr);
127 DB::connection("conn")->insert(DB::raw("insert into ".$questionaire." set $setstr"));
128
129 }
130 DB::connection("conn")->disconnect();
131
132 }
133
134 }
135
136
137 }
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
42
43 //$slist=DB::connection("conn")->select(DB::raw("select * from server_details where type='COP' and id='1'"));
44
45 //$slist=DB::select(DB::raw("select * from server_details where type='COP' and id>'27' and id!='54'"));
46
47 $server_ip='10.3.179.121';
48 $location='mumbai';
49 $conn='';
50
51 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
52
53 $conn = array(
54 'driver' => 'mysql',
55 'host' => '10.3.177.14',
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
69 if(DB::connection("conn")->getDatabaseName())
70 {
71
72 echo ",".$server_ip;
73
74 $qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`"));
75
76
77 $datainser='';
78 foreach($qlist as $qline)
79 {
80
81 $record_id=$qline->id;
82 $clientcode=$qline->clientcode;
83 $client=$qline->client;
84 $status=$qline->status;
85 $clientinternalid=$qline->clientinternalid;
86 $mobile=$qline->mobile;
87 $priority=$qline->priority;
88 $modified=$qline->modified;
89 $question=$qline->question;
90 $firstname=$qline->firstname;
91
92
93 DB::connection("conn")->insert(DB::raw("insert into records_details_server_1 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'"));
94
95
96 }
97 DB::connection("conn")->disconnect();
98
99 }
100 }
101
102 }
103
104
105
106
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 $wakka = new KHRMSLib();
46
47 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
48 $kformlib->gthis=$wakka;
49
50 $themehome=$wakka->GetThemePath('/');
51 $updatetime=time();
52
53 $clientlst=$wakka->GetBBBUserData("clientslist");
54
55 $isadmin=$wakka->IsAdmin();
56 $username=$wakka->GetUserName();
57 $triggers=Input::get("triggers");
58 $tmpstr=explode(",",$kformlib->HRFiledsStr);
59
60 $success="";$message="";$successcnt=0;$duplicatecount=0;
61
62
63 $conn = array(
64 'driver' => 'mysql',
65 'host' => '10.3.177.14',
66 'database' => env('DB_DATABASE', 'kstych_flexydial'),
67 'username' => env('DB_USERNAME', 'root'),
68 'password' => env('DB_PASSWORD', 'yb9738z'),
69 'charset' => 'utf8',
70 'collation' => 'utf8_unicode_ci',
71 'prefix' => '',
72 'options' => array(
73 PDO::ATTR_TIMEOUT => 5,
74 ),
75 );
76 Config::set("database.connections.conn", $conn);
77
78 DB::connection("conn")->getDatabaseName();
79
80 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and client='G4015' order by auto_id asc limit 0,20000"));
81
82 foreach($excelarray as $key => $array){
83 $excelarray[$key] = (array)$array;
84 }
85
86 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
87 $highestColumn = $highestColumn[0]->cnt;
88
89 $highestrow = count($excelarray);
90
91 $flag = 0;
92 $editflag=0;
93
94 for($i=0;$i<=$highestrow;$i++)
95 {
96 if($excelarray[$i]["id"]!="")
97 {
98 if($excelarray[$i]["id"]=="CREATE")
99 {
100 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
101 }
102 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
103
104 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
105 {
106 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
107 $ppldata=$empdata["peopledata"];
108 $createdlog=$empdata['modifylog'];
109 $fdirty=$empdata['dirty'];
110
111 $createdlog[$updatetime]=$username."::";
112 $createdlog["updated"]=$updatetime;
113
114 $newdata=$ppldata;
115 foreach($excelarray[$i] as $key => $value)
116 {
117 if($value!="")
118 {
119 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
120 {
121 $value=str_replace("'"," ",$value);
122 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
123
124 $fdirty[$key]=1;
125
126 $newdata[$key]=$value;
127 }
128 }
129 }
130 $empdata["peopledata"]=$newdata;
131 $empdata['modifylog']=$createdlog;
132 $empdata['dirty']=$fdirty;
133
134 $wakka->setPerson($excelarray[$i]["id"],$empdata);
135 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
136
137 }
138 }
139
140 }
141 mysqli_close($conn);
142
143
144 }
145 }
146
147
148
149
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 echo "\n".date('Y-m-d H:i:s')."\n";
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $central_ip=env('central_ip');
47 $server_ip=env('app_ip');
48 $calllog_report = "calllog_report_".date("d_m_Y");
49
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")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
79
80 $userarr=array();
81 foreach($alist as $aline)
82 {
83 $setstrarr=array();
84
85
86 $clientcode="";$currentstatus="";$legalstatus="";$record_id="";
87 if($aline->crm_id>0)
88 {
89 $user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
90 if(isset($user[0]))
91 {
92 $record_id=$user[0]->id;
93 $clientcode=$user[0]->clientcode;
94 $currentstatus=$user[0]->currentstatus;
95 $legalstatus=$user[0]->legalstatus;
96 }
97 }
98 $tpostdata=json_decode($aline->data,true);
99 $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
100 $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
101 $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
102
103 if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
104 $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
105 $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
106 $globalid=$server_id.$record_id;
107 $setstrarr[]="server='$server_id'";
108 $setstrarr[]="record_id='$record_id'";
109 $setstrarr[]="crmcall_id='$aline->id'";
110 $setstrarr[]="globalid='$globalid'";
111 $setstrarr[]="start='$fulldate'";
112 $setstrarr[]="length='$length'";
113 $setstrarr[]="user='$username'";
114 $setstrarr[]="name='$dispname'";
115 $setstrarr[]="dispo='$aline->userstatus'";
116 $setstrarr[]="subdispo='$aline->usersubstatus'";
117 $setstrarr[]="callback='$aline->usercallback'";
118
119 $setstrarr[]="number='$aline->number'";
120 $setstrarr[]="clientcode='$clientcode'";
121 $setstrarr[]="currentstatus='$currentstatus'";
122 $setstrarr[]="legalstatus='$legalstatus'";
123 $setstrarr[]="client='$aline->client'";
124 $setstrarr[]="department='$aline->department'";
125 $setstrarr[]="state='$aline->state'";
126 $setstrarr[]="hsource='$aline->hsource'";
127
128 $setstrarr[]="type='$aline->type'";
129 $setstrarr[]="status='$aline->status'";
130 $setstrarr[]="statuscode='$aline->statuscode'";
131 $setstrarr[]="statusstr='$aline->substatus'";
132 $setstrarr[]="dialline='$aline->dialline_id'";
133 $setstrarr[]="did='$aline->did'";
134 $setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
135 $setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
136 $setstrarr[]="talksec='".round($talktime/1000,2)."'";
137 $setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
138 $setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
139 $setstrarr[]="userdata='$aline->userdata'";
140
141 $setstr=implode(",",$setstrarr);
142 DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
143 }
144
145 }
146 }
147
148
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 $sipids=Sipid::where("status","=","1")->get();
49 foreach($sipids as $tsip)
50 {
51 $newqueue=new Kqueue();
52 $newqueue->sipNotify($tsip,"adminCommand","user","logout","");
53 }
54
55 Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
56 Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
57
58 $serverarray=explode(",",Config::get("app.asterisk_slaves"));
59 foreach($serverarray as $server)
60 {
61 $sparts=explode(":",$server);
62
63 Sipid::where("id",">=",$sparts[1])->where("id","<=",$sparts[2])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
64 Dialline::where("id",">=",$sparts[3])->where("id","<=",$sparts[4])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
65
66 $newqueue=new Kqueue();
67 $newqueue->astCommand($sparts[0],"channel request hangup all");
68 }
69
70 User::where('presence','>','0')->update(['presence'=>0]);
71 Session::truncate();
72
73 return "";
74 }
75 }
76
77
78
79
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 $logdate=strtotime('-7 day');
49
50 CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
51 }
52 }
53
54
55
56
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 'Start';
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"));
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_data extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'Userlog_data';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'Userlog_data';
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 foreach($rowdata AS $key=>$value) {
131 if($key != 1)
132 $key_value .= "`$key` = '$value', ";
133 }
134
135 $startTime=$aline->startdate." ".$aline->starttime;
136 $endTime=$aline->enddate." ".$aline->endtime;
137
138 $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."'"));
139
140 $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
141 $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
142 $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
143 $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
144 $tt_prog=0;$tt_man=0;$tt_inb=0;
145
146 if($crmCalls!=null){
147 foreach($crmCalls as $crmCall){
148 $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
149 $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
150 $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
151 $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
152
153 if($crmCall->type == 'Progressive')
154 {
155 $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
156 $progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
157 $progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
158 $progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
159 }
160
161 if($crmCall->type == 'Manual')
162 {
163 $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
164 $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
165 $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
166 $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
167 }
168
169 if($crmCall->type == 'Inbound')
170 {
171 $inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
172 $inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
173 $inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
174 $inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
175 }
176 }
177 }
178
179 $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
180 $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
181 $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
182
183 $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
184
185 $key_value .= "`tt_prog` = '$tt_prog', ";
186 $key_value .= "`tt_man` = '$tt_man', ";
187 $key_value .= "`tt_inb` = '$tt_inb', ";
188
189 $key_value .= "`ts_Wait` = '$ts_Wait', ";
190 $key_value .= "`ts_Call` = '$ts_Call', ";
191 $key_value .= "`ts_Talk` = '$ts_Talk', ";
192 $key_value .= "`ts_Dispo` = '$ts_Dispo', ";
193 $key_value .= "`progts_Wait` = '$progTs_Wait', ";
194 $key_value .= "`progts_Call` = '$progTs_Call', ";
195 $key_value .= "`progts_Talk` = '$progTs_Talk', ";
196 $key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
197 $key_value .= "`mants_Wait` = '$manTs_Wait', ";
198 $key_value .= "`mants_Call` = '$manTs_Call', ";
199 $key_value .= "`mants_Talk` = '$manTs_Talk', ";
200 $key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
201 $key_value .= "`incts_Wait` = '$inbTs_Wait', ";
202 $key_value .= "`incts_Call` = '$inbTs_Call', ";
203 $key_value .= "`incts_Talk` = '$inbTs_Talk', ";
204 $key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
205 $key_value .= "`prod_tos` = '$prod_TOS', ";
206
207
208
209 $key_value = substr($key_value, 0, -2);
210
211 $userlogsTable = "userlogs_".date("d_m_Y",$logdate);
212 DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
213
214 }
215
216 }
217 }
218 }
219 }
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_data extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'Userlog_data';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'Userlog_data';
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
45 $server_ip='10.3.179.121';
46 $server_id='08';
47
48 $conn = array(
49 'driver' => 'mysql',
50 'host' => '10.3.177.14',
51 'database' => env('DB_DATABASE', 'kstych_flexydial'),
52 'username' => env('DB_USERNAME', 'root'),
53 'password' => env('DB_PASSWORD', ''),
54 'charset' => 'utf8',
55 'collation' => 'utf8_unicode_ci',
56 'prefix' => '',
57 'options' => array(
58 PDO::ATTR_TIMEOUT => 5,
59 ),
60 );
61 Config::set("database.connections.conn", $conn);
62
63 $i=0;
64
65
66 $ulist=DB::select(DB::raw("select * from users WHERE 1"));
67 foreach($ulist as $uline) {
68 $users[$uline->id] = $uline->username;
69 }
70 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)."'"))){
71
72
73 foreach($alist as $aline) {
74 $i++;
75 $global_id = $server_id . $i;
76 $rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
77 'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
78 'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$aline->enddate,'endtime'=>$aline->endtime,
79 'durationsec'=>$aline->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'=>''
80 );
81
82 $data=json_decode($aline->data,true);
83 foreach($data as $sipid=>$sdata)
84 {
85 $prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
86 if(isset($sdata['states']))
87 {
88 $previous="login";
89 foreach($sdata['states'] as $fts=>$states)
90 {
91 if($states[0] != 1)
92 {
93 $rowdata[$previous] +=round(($fts-$prets)/1000,2);
94
95 $previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
96 $prets=$fts;
97 }
98
99 }
100 $rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
101 }
102 }
103 $rowdata["login"] = $aline->durationsec;
104
105 $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'];
106
107
108 $key_value = '';
109 foreach($rowdata AS $key=>$value) {
110 if($key != 1)
111 $key_value .= "`$key` = '$value', ";
112 }
113
114 $startTime=$aline->startdate." ".$aline->starttime;
115 $endTime=$aline->enddate." ".$aline->endtime;
116
117 $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."'"));
118
119 $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
120 $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
121 $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
122 $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
123 $tt_prog=0;$tt_man=0;$tt_inb=0;
124
125 if($crmCalls!=null){
126 foreach($crmCalls as $crmCall){
127 $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
128 $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
129 $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
130 $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
131
132 if($crmCall->type == 'Progressive')
133 {
134 $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
135 $progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
136 $progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
137 $progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
138 }
139
140 if($crmCall->type == 'Manual')
141 {
142 $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
143 $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
144 $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
145 $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
146 }
147
148 if($crmCall->type == 'Inbound')
149 {
150 $inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
151 $inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
152 $inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
153 $inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
154 }
155 }
156 }
157
158 $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
159 $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
160 $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
161
162 $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
163
164 $key_value .= "`tt_prog` = '$tt_prog', ";
165 $key_value .= "`tt_man` = '$tt_man', ";
166 $key_value .= "`tt_inb` = '$tt_inb', ";
167
168 $key_value .= "`ts_Wait` = '$ts_Wait', ";
169 $key_value .= "`ts_Call` = '$ts_Call', ";
170 $key_value .= "`ts_Talk` = '$ts_Talk', ";
171 $key_value .= "`ts_Dispo` = '$ts_Dispo', ";
172 $key_value .= "`progts_Wait` = '$progTs_Wait', ";
173 $key_value .= "`progts_Call` = '$progTs_Call', ";
174 $key_value .= "`progts_Talk` = '$progTs_Talk', ";
175 $key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
176 $key_value .= "`mants_Wait` = '$manTs_Wait', ";
177 $key_value .= "`mants_Call` = '$manTs_Call', ";
178 $key_value .= "`mants_Talk` = '$manTs_Talk', ";
179 $key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
180 $key_value .= "`incts_Wait` = '$inbTs_Wait', ";
181 $key_value .= "`incts_Call` = '$inbTs_Call', ";
182 $key_value .= "`incts_Talk` = '$inbTs_Talk', ";
183 $key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
184 $key_value .= "`prod_tos` = '$prod_TOS', ";
185
186
187
188 $key_value = substr($key_value, 0, -2);
189
190 $userlogsTable = "userlogs_".date("d_m_Y",$logdate);
191 DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
192
193 }
194
195 }
196 }
197 }
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 "1";
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 $wakka = new KHRMSLib();
53
54 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
55 $kformlib->gthis=$wakka;
56
57 $themehome=$wakka->GetThemePath('/');
58 $updatetime=time();
59
60 $clientlst=$wakka->GetBBBUserData("clientslist");
61
62 $isadmin=$wakka->IsAdmin();
63 $username=$wakka->GetUserName();
64 $triggers=Input::get("triggers");
65 $tmpstr=explode(",",$kformlib->HRFiledsStr);
66
67 $success="";$message="";$successcnt=0;$duplicatecount=0;
68
69
70 $conn = array(
71 'driver' => 'mysql',
72 'host' => $central_ip,
73 'database' => env('DB_DATABASE', 'kstych_flexydial'),
74 'username' => env('DB_USERNAME', 'root'),
75 'password' => env('DB_PASSWORD', 'yb9738z'),
76 'charset' => 'utf8',
77 'collation' => 'utf8_unicode_ci',
78 'prefix' => '',
79 'options' => array(
80 PDO::ATTR_TIMEOUT => 5,
81 ),
82 );
83 Config::set("database.connections.conn", $conn);
84
85 DB::connection("conn")->getDatabaseName();
86
87 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
88 $location=$serverclist[0]->location;
89 echo $central_ip;
90 echo $location;
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 0,20000"));
92 $conn='';
93
94 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
95
96 foreach($excelarray as $key => $array){
97 $excelarray[$key] = (array)$array;
98 }
99
100 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
101 $highestColumn = $highestColumn[0]->cnt;
102
103 $highestrow = count($excelarray);
104
105 $flag = 0;
106 $editflag=0;
107
108 for($i=0;$i<$highestrow;$i++)
109 {
110 if($excelarray[$i]["id"]!="")
111 {
112 if($excelarray[$i]["id"]=="CREATE")
113 {
114 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
115 }
116 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
117 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
118 {
119 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
120 $ppldata=$empdata["peopledata"];
121 $createdlog=$empdata['modifylog'];
122 $fdirty=$empdata['dirty'];
123
124 $createdlog[$updatetime]=$username."::";
125 $createdlog["updated"]=$updatetime;
126
127 $newdata=$ppldata;
128 foreach($excelarray[$i] as $key => $value)
129 {
130 if($value!="")
131 {
132 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
133 {
134 $value=str_replace("'"," ",$value);
135 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
136
137 $fdirty[$key]=1;
138
139 $newdata[$key]=$value;
140 }
141 }
142 }
143
144 /*Start - Changes need to be done*/
145
146 if($excelarray[$i]["status"]==null)
147 {
148 $empdata['status'] = "rom";
149 }
150
151 if($excelarray[$i]["dialer_status"]==null)
152 {
153 $empdata['dialer_status'] = "rom";
154 }
155
156 if($excelarray[$i]["dialer_substatus"]==null)
157 {
158 $empdata['dialer_substatus'] = "rom";
159 }
160
161 /*End - Changes need to be done*/
162
163 $empdata["peopledata"]=$newdata;
164 $empdata['modifylog']=$createdlog;
165 $empdata['dirty']=$fdirty;
166
167 $wakka->setPerson($excelarray[$i]["id"],$empdata);
168 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
169 $successArr[] = $excelarray[$i];
170
171 }
172 else
173 {
174 $reason = "";
175
176 $reason .= "Record ID is not on local server,";
177
178 $excelarray[$i]['server_ip'] =$server_ip;
179 $excelarray[$i]['location'] =$location;
180
181 if($excelarray[$i]["clientcode"]!="")
182 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
183 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
184
185 $excelarray[$i]['Reason'] = $reason;
186
187 $failureArr[] = $excelarray[$i];
188
189 }
190 }
191 else
192 {
193
194 $reason = "";
195
196 if($excelarray[$i]["id"]=="")
197 $reason .= "Column ID is blank,";
198
199 $excelarray[$i]['server_ip'] =$server_ip;
200 $excelarray[$i]['location'] =$location;
201
202 if($excelarray[$i]["clientcode"]!="")
203 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
204
205 $excelarray[$i]['Reason'] = $reason;
206
207 $failureArr[] = $excelarray[$i];
208
209 }
210
211 }
212 if(!empty($successArr)){
213 foreach($successArr as $succes)
214 {
215 $setSuccess=array();
216
217 $setSuccess[] = "server_ip='$server_ip'";
218 $setSuccess[] = "location='$location'";
219 $setSuccess[] = "record_id='".$succes['id']."'";
220 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
221 $setSuccess[] = "modified='".$succes['modified']."'";
222
223 $setSuccess = implode(",",$setSuccess);
224
225 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
226 }
227 }
228 if(!empty($failureArr)){
229 foreach($failureArr as $failur)
230 {
231 $setFailure=array();
232
233 $setFailure[] = "server_ip='$server_ip'";
234 $setFailure[] = "location='$location'";
235 $setFailure[] = "cust_id='".$failur['clientcode']."'";
236 $setFailure[] = "record_id='".$failur['record_id']."'";
237 $setFailure[] = "reason='".$failur['Reason']."'";
238
239 $setFailure = implode(",",$setFailure);
240
241 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
242 }
243 }
244
245 DB::connection("conn")->disconnect();
246 }
247 }
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 }
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.
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
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!