09693dac by Prashant Jadhav

Merge branch 'master' of http://54.197.18.130/yashwant/hdfc

2 parents 15185d0b d4ce65dc
Showing 1000 changed files with 730 additions and 4150 deletions

Too many changes to show.

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

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 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_3 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_3';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_3';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "4";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 60001,80000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_4 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_4';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_4';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "5";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
88 $location=$serverclist[0]->location;
89
90
91 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 80001,100000"));
92
93 $conn='';
94
95 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
96
97 foreach($excelarray as $key => $array){
98 $excelarray[$key] = (array)$array;
99 }
100
101 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
102 $highestColumn = $highestColumn[0]->cnt;
103
104 $highestrow = count($excelarray);
105
106 $flag = 0;
107 $editflag=0;
108
109 for($i=0;$i<$highestrow;$i++)
110 {
111 if($excelarray[$i]["id"]!="")
112 {
113 if($excelarray[$i]["id"]=="CREATE")
114 {
115 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
116 }
117 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
118 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
119 {
120 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
121 $ppldata=$empdata["peopledata"];
122 $createdlog=$empdata['modifylog'];
123 $fdirty=$empdata['dirty'];
124
125 $createdlog[$updatetime]=$username."::";
126 $createdlog["updated"]=$updatetime;
127
128 $newdata=$ppldata;
129 foreach($excelarray[$i] as $key => $value)
130 {
131 if($value!="")
132 {
133 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
134 {
135 $value=str_replace("'"," ",$value);
136 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
137
138 $fdirty[$key]=1;
139
140 $newdata[$key]=$value;
141 }
142 }
143 }
144
145 /*Start - Changes need to be done*/
146
147 if($excelarray[$i]["status"]==null)
148 {
149 $empdata['status'] = "rom";
150 }
151
152 if($excelarray[$i]["dialer_status"]==null)
153 {
154 $empdata['dialer_status'] = "rom";
155 }
156
157 if($excelarray[$i]["dialer_substatus"]==null)
158 {
159 $empdata['dialer_substatus'] = "rom";
160 }
161
162 /*End - Changes need to be done*/
163
164 $empdata["peopledata"]=$newdata;
165 $empdata['modifylog']=$createdlog;
166 $empdata['dirty']=$fdirty;
167
168 $wakka->setPerson($excelarray[$i]["id"],$empdata);
169 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
170 $successArr[] = $excelarray[$i];
171
172 }
173 else
174 {
175 $reason = "";
176
177 $reason .= "Record ID is not on local server,";
178
179 $excelarray[$i]['server_ip'] =$server_ip;
180 $excelarray[$i]['location'] =$location;
181
182 if($excelarray[$i]["clientcode"]!="")
183 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
184 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
185
186 $excelarray[$i]['Reason'] = $reason;
187
188 $failureArr[] = $excelarray[$i];
189
190 }
191 }
192 else
193 {
194
195 $reason = "";
196
197 if($excelarray[$i]["id"]=="")
198 $reason .= "Column ID is blank,";
199
200 $excelarray[$i]['server_ip'] =$server_ip;
201 $excelarray[$i]['location'] =$location;
202
203 if($excelarray[$i]["clientcode"]!="")
204 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
205
206 $excelarray[$i]['Reason'] = $reason;
207
208 $failureArr[] = $excelarray[$i];
209
210 }
211
212 }
213 if(!empty($successArr)){
214 foreach($successArr as $succes)
215 {
216 $setSuccess=array();
217
218 $setSuccess[] = "server_ip='$server_ip'";
219 $setSuccess[] = "location='$location'";
220 $setSuccess[] = "record_id='".$succes['id']."'";
221 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
222 $setSuccess[] = "modified='".$succes['modified']."'";
223
224 $setSuccess = implode(",",$setSuccess);
225
226 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
227 }
228 }
229 if(!empty($failureArr)){
230 foreach($failureArr as $failur)
231 {
232 $setFailure=array();
233
234 $setFailure[] = "server_ip='$server_ip'";
235 $setFailure[] = "location='$location'";
236 $setFailure[] = "cust_id='".$failur['clientcode']."'";
237 $setFailure[] = "record_id='".$failur['record_id']."'";
238 $setFailure[] = "reason='".$failur['Reason']."'";
239
240 $setFailure = implode(",",$setFailure);
241
242 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
243 }
244 }
245
246 DB::connection("conn")->disconnect();
247 }
248 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_5 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_5';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_5';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "6";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 100001,120000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_6 extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_6';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_6';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "6";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49 $server_ip=env('app_ip');
50 $central_ip=env('central_ip');
51
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90
91
92 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='$server_ip' order by auto_id asc limit 120001,140000"));
93
94 $conn='';
95
96 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
97
98 foreach($excelarray as $key => $array){
99 $excelarray[$key] = (array)$array;
100 }
101
102 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
103 $highestColumn = $highestColumn[0]->cnt;
104
105 $highestrow = count($excelarray);
106
107 $flag = 0;
108 $editflag=0;
109
110 for($i=0;$i<$highestrow;$i++)
111 {
112 if($excelarray[$i]["id"]!="")
113 {
114 if($excelarray[$i]["id"]=="CREATE")
115 {
116 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
117 }
118 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
119 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
120 {
121 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
122 $ppldata=$empdata["peopledata"];
123 $createdlog=$empdata['modifylog'];
124 $fdirty=$empdata['dirty'];
125
126 $createdlog[$updatetime]=$username."::";
127 $createdlog["updated"]=$updatetime;
128
129 $newdata=$ppldata;
130 foreach($excelarray[$i] as $key => $value)
131 {
132 if($value!="")
133 {
134 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
135 {
136 $value=str_replace("'"," ",$value);
137 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
138
139 $fdirty[$key]=1;
140
141 $newdata[$key]=$value;
142 }
143 }
144 }
145
146 /*Start - Changes need to be done*/
147
148 if($excelarray[$i]["status"]==null)
149 {
150 $empdata['status'] = "rom";
151 }
152
153 if($excelarray[$i]["dialer_status"]==null)
154 {
155 $empdata['dialer_status'] = "rom";
156 }
157
158 if($excelarray[$i]["dialer_substatus"]==null)
159 {
160 $empdata['dialer_substatus'] = "rom";
161 }
162
163 /*End - Changes need to be done*/
164
165 $empdata["peopledata"]=$newdata;
166 $empdata['modifylog']=$createdlog;
167 $empdata['dirty']=$fdirty;
168
169 $wakka->setPerson($excelarray[$i]["id"],$empdata);
170 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
171 $successArr[] = $excelarray[$i];
172
173 }
174 else
175 {
176 $reason = "";
177
178 $reason .= "Record ID is not on local server,";
179
180 $excelarray[$i]['server_ip'] =$server_ip;
181 $excelarray[$i]['location'] =$location;
182
183 if($excelarray[$i]["clientcode"]!="")
184 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
185 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
186
187 $excelarray[$i]['Reason'] = $reason;
188
189 $failureArr[] = $excelarray[$i];
190
191 }
192 }
193 else
194 {
195
196 $reason = "";
197
198 if($excelarray[$i]["id"]=="")
199 $reason .= "Column ID is blank,";
200
201 $excelarray[$i]['server_ip'] =$server_ip;
202 $excelarray[$i]['location'] =$location;
203
204 if($excelarray[$i]["clientcode"]!="")
205 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
206
207 $excelarray[$i]['Reason'] = $reason;
208
209 $failureArr[] = $excelarray[$i];
210
211 }
212
213 }
214 if(!empty($successArr)){
215 foreach($successArr as $succes)
216 {
217 $setSuccess=array();
218
219 $setSuccess[] = "server_ip='$server_ip'";
220 $setSuccess[] = "location='$location'";
221 $setSuccess[] = "record_id='".$succes['id']."'";
222 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
223 $setSuccess[] = "modified='".$succes['modified']."'";
224
225 $setSuccess = implode(",",$setSuccess);
226
227 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
228 }
229 }
230 if(!empty($failureArr)){
231 foreach($failureArr as $failur)
232 {
233 $setFailure=array();
234
235 $setFailure[] = "server_ip='$server_ip'";
236 $setFailure[] = "location='$location'";
237 $setFailure[] = "cust_id='".$failur['clientcode']."'";
238 $setFailure[] = "record_id='".$failur['record_id']."'";
239 $setFailure[] = "reason='".$failur['Reason']."'";
240
241 $setFailure = implode(",",$setFailure);
242
243 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
244 }
245 }
246
247 DB::connection("conn")->disconnect();
248 }
249 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18
19 use Illuminate\Database\Schema\Blueprint;
20
21 class bulkServerUpload_daily extends Command {
22
23 /**
24 * The console command name.
25 *
26 * @var string
27 */
28 protected $signature = 'bulkServerUpload_daily';
29
30 /**
31 * The console command description.
32 *
33 * @var string
34 */
35 protected $description = 'bulkServerUpload_daily';
36
37 /**
38 * Execute the console command.
39 *
40 * @return mixed
41 */
42 public function handle()
43 {
44
45 //echo "\n".date('Y-m-d')."\n";
46
47 echo "1";
48 echo "\n".date('Y-m-d H:i:s')."\n";
49
50 $server_ip=env('app_ip');
51 $central_ip=env('central_ip');
52
53 $wakka = new KHRMSLib();
54
55 $kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
56 $kformlib->gthis=$wakka;
57
58 $themehome=$wakka->GetThemePath('/');
59 $updatetime=time();
60
61 $clientlst=$wakka->GetBBBUserData("clientslist");
62
63 $isadmin=$wakka->IsAdmin();
64 $username=$wakka->GetUserName();
65 $triggers=Input::get("triggers");
66 $tmpstr=explode(",",$kformlib->HRFiledsStr);
67
68 $success="";$message="";$successcnt=0;$duplicatecount=0;
69
70
71 $conn = array(
72 'driver' => 'mysql',
73 'host' => $central_ip,
74 'database' => env('DB_DATABASE', 'kstych_flexydial'),
75 'username' => env('DB_USERNAME', 'root'),
76 'password' => env('DB_PASSWORD', 'yb9738z'),
77 'charset' => 'utf8',
78 'collation' => 'utf8_unicode_ci',
79 'prefix' => '',
80 'options' => array(
81 PDO::ATTR_TIMEOUT => 5,
82 ),
83 );
84 Config::set("database.connections.conn", $conn);
85
86 DB::connection("conn")->getDatabaseName();
87
88 $serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
89 $location=$serverclist[0]->location;
90 echo $central_ip;
91 echo $location;
92
93
94 $excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_daily where SERVER_IP='$server_ip' order by auto_id asc limit 0,200"));
95
96 $conn='';
97
98 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
99
100 foreach($excelarray as $key => $array){
101 $excelarray[$key] = (array)$array;
102 }
103
104 $highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
105 $highestColumn = $highestColumn[0]->cnt;
106
107 $highestrow = count($excelarray);
108
109 $flag = 0;
110 $editflag=0;
111
112 for($i=0;$i<$highestrow;$i++)
113 {
114 if($excelarray[$i]["id"]!="")
115 {
116 if($excelarray[$i]["id"]=="CREATE")
117 {
118 $excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
119 }
120 else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
121 if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
122 {
123 $empdata=$wakka->getPerson($excelarray[$i]["id"]);
124 $ppldata=$empdata["peopledata"];
125 $createdlog=$empdata['modifylog'];
126 $fdirty=$empdata['dirty'];
127
128 $createdlog[$updatetime]=$username."::";
129 $createdlog["updated"]=$updatetime;
130
131 $newdata=$ppldata;
132 foreach($excelarray[$i] as $key => $value)
133 {
134 if($value!="")
135 {
136 if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
137 {
138 $value=str_replace("'"," ",$value);
139 if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
140
141 $fdirty[$key]=1;
142
143 $newdata[$key]=$value;
144 }
145 }
146 }
147
148 /*Start - Changes need to be done*/
149
150 if($excelarray[$i]["status"]==null)
151 {
152 $empdata['status'] = "rom";
153 }
154
155 if($excelarray[$i]["dialer_status"]==null)
156 {
157 $empdata['dialer_status'] = "rom";
158 }
159
160 if($excelarray[$i]["dialer_substatus"]==null)
161 {
162 $empdata['dialer_substatus'] = "rom";
163 }
164
165 /*End - Changes need to be done*/
166
167 $empdata["peopledata"]=$newdata;
168 $empdata['modifylog']=$createdlog;
169 $empdata['dirty']=$fdirty;
170
171 $wakka->setPerson($excelarray[$i]["id"],$empdata);
172 $excelarray[$i]['modified']=date('Y-m-d H:i:s');
173 $successArr[] = $excelarray[$i];
174
175 }
176 else
177 {
178 $reason = "";
179
180 $reason .= "Record ID is not on local server,";
181
182 $excelarray[$i]['server_ip'] =$server_ip;
183 $excelarray[$i]['location'] =$location;
184
185 if($excelarray[$i]["clientcode"]!="")
186 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
187 $excelarray[$i]['record_id'] = $excelarray[$i]["id"];
188
189 $excelarray[$i]['Reason'] = $reason;
190
191 $failureArr[] = $excelarray[$i];
192
193 }
194 }
195 else
196 {
197
198 $reason = "";
199
200 if($excelarray[$i]["id"]=="")
201 $reason .= "Column ID is blank,";
202
203 $excelarray[$i]['server_ip'] =$server_ip;
204 $excelarray[$i]['location'] =$location;
205
206 if($excelarray[$i]["clientcode"]!="")
207 $excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
208
209 $excelarray[$i]['Reason'] = $reason;
210
211 $failureArr[] = $excelarray[$i];
212
213 }
214
215 }
216 if(!empty($successArr)){
217 foreach($successArr as $succes)
218 {
219 $setSuccess=array();
220
221 $setSuccess[] = "server_ip='$server_ip'";
222 $setSuccess[] = "location='$location'";
223 $setSuccess[] = "record_id='".$succes['id']."'";
224 $setSuccess[] = "cust_id='".$succes['clientcode']."'";
225 $setSuccess[] = "modified='".$succes['modified']."'";
226
227 $setSuccess = implode(",",$setSuccess);
228
229 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
230
231 DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='$server_ip' and id='".$succes['id']."'"));
232 }
233 }
234 if(!empty($failureArr)){
235 foreach($failureArr as $failur)
236 {
237 $setFailure=array();
238
239 $setFailure[] = "server_ip='$server_ip'";
240 $setFailure[] = "location='$location'";
241 $setFailure[] = "cust_id='".$failur['clientcode']."'";
242 $setFailure[] = "record_id='".$failur['record_id']."'";
243 $setFailure[] = "reason='".$failur['Reason']."'";
244
245 $setFailure = implode(",",$setFailure);
246
247 DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure_daily set $setFailure"));
248 }
249 }
250
251 //DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='10.3.179.121'"));
252
253 DB::connection("conn")->disconnect();
254
255
256 }
257 }
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use 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 recording_reconcilation extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'recording_reconcilation';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'recording_reconcilation';
31
32 /**
33 * Execute the console command.
34 *
35 * @return mixed
36 */
37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41
42 $logdate=strtotime(date('Y-m-d')." 00:00:00");
43 //$logdate=strtotime("-1 days"." 00:00:00");
44 $logtodate=strtotime(date('Y-m-d')." 23:59:59");
45 //$logtodate=strtotime("-1 days"." 23:59:59");
46 $server_ip=env('app_ip');
47 $central_ip=env('central_ip');
48
49 $reporthead=array("id","server_ip","call_id","call_start_date","call_start_time","call_duration","DNIS","ANI","call_direction","cti_var1","cti_var2","cti_var4","transfer_status","recording_filename");
50
51 $ftp_server="10.3.177.14";
52 $ftp_user_name="buzzworks";
53 $ftp_user_pass="0per@ti0n@1";
54 $conn_id = ftp_connect($ftp_server);
55
56 // login with username and password
57 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
58
59
60 $conn = array(
61 'driver' => 'mysql',
62 'host' => $central_ip,
63 'database' => env('DB_DATABASE', 'kstych_flexydial'),
64 'username' => env('DB_USERNAME', 'root'),
65 'password' => env('DB_PASSWORD', ''),
66 'charset' => 'utf8',
67 'collation' => 'utf8_unicode_ci',
68 'prefix' => '',
69 'options' => array(
70 PDO::ATTR_TIMEOUT => 5,
71 ),
72 );
73 Config::set("database.connections.conn", $conn);
74
75
76 if(DB::connection("conn")->getDatabaseName())
77 {
78 //check maximum id saved in the table
79 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(call_id) as maxid from recording_reconcilation where server_ip='$server_ip'"));
80 if($maxid)$maxids=$maxid[0]->maxid;
81
82 echo "\n"."maxids---".$maxids."\n";
83 echo "\n".date("Y-m-d H:i:s",$logdate)."\n";
84 echo "\n".date("Y-m-d H:i:s",$logtodate)."\n";
85
86 //query for calllog and recording
87 /*$qlist=DB::table('crmcalls')->select('*')->where('id','>','$maxid')->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logtodate))->get();*/
88 $qlist=DB::table('crmcalls')->select('*')->where('id','=','1079409')->get();
89
90 //create csv file
91 $ii=1;
92 $fileName = 'recording_Excel_'.date("Y-m-d",$logdate);
93 $fileName=storage_path().'/recording_excel/'.$fileName .'.csv';
94 $filesave = fopen($fileName, 'w');
95 fputcsv($filesave, $reporthead);
96
97 $userdatavalue="";
98 foreach ($qlist as $qline)
99 {
100
101 $fulldate=date("Y-m-d H:i:s",strtotime($qline->created_at)+330*60);
102 //$talktime=$qline->talkSec+$qline->recstartSec+$qline->recendSec;
103 //$length=round(($qline->waitSec+$qline->callSec+$talktime+$qline->dispoSec)/1000,2);
104 $length=round(($qline->talkSec+$qline->recstartSec+$qline->recendSec)/1000,2);
105 echo "\n"."startdate--".explode(" ",$fulldate)[0]."\n";
106 echo "\n"."starttime--".explode(" ",$fulldate)[1]."\n";
107 echo "\n"."call duration--". $length."\n";
108 $userdatavalue="";
109
110 $userdata=json_decode($qline->userdata,true);
111
112 //print_r(array_values($userdata));
113 if($userdata)
114 {
115 if(array_values($userdata)!=""||array_values($userdata)!=null)
116 {
117 $userdatavalue=implode(",",array_values($userdata));
118 }
119 else
120 {
121 $userdatavalue="";
122 }
123 }
124
125
126
127
128
129
130 $setstrarr=array();
131 $setstrarr[]="server_ip='$server_ip'";
132 $setstrarr[]="call_id='$qline->id'";
133 $setstrarr[]="call_start_date='".explode(" ",$fulldate)[0]."'";
134 $setstrarr[]="call_start_time='".explode(" ",$fulldate)[1]."'";
135 $setstrarr[]="call_duration='$length'";
136 $setstrarr[]="DNIS='$qline->did'";
137 $setstrarr[]="ANI='$qline->number'";
138 $setstrarr[]="call_direction='$qline->type'";
139 $setstrarr[]="cti_var1='$userdatavalue'";
140 $setstrarr[]="cti_var2='$qline->client'";
141 $setstrarr[]="cti_var4='$qline->crm_id'";
142
143
144 //send recording file to server
145 $file = storage_path()."/app/drec/2017-09/".$qline->id.".gsm";//tobe uploaded
146 //$remote_file = "/home/buzzworks/recording_test";
147 $remote_file = "recording_test/".$server_ip."_".$qline->id.".wav";
148 /*$out='wav';
149
150 header("Content-type: audio/x-$out");
151 header("Content-disposition: attachment; filename=\"".basename($file).".$out\"");
152 $descriptorspec = array(0 => array("pipe", "r"),1 => array("pipe", "w"),2 => array("pipe", "w"));
153 $process = proc_open( "/usr/bin/sox $file /tmp/".basename($file).".$out", $descriptorspec, $pipes );
154 while( stream_get_contents( $pipes[1] ));
155 header("Content-length: ".filesize("/tmp/".basename($file).".$out"));
156 readfile("/tmp/".basename($file).".$out");unlink("/tmp/".basename($file).".$out");
157 fclose( $pipes[1] );
158 fclose( $pipes[2] );*/
159
160 // set up basic connection
161
162
163 if($login_result)
164 {
165 echo "Successfully connect";
166 if (file_exists($file))
167 {
168 echo "The file $file exists";
169 if(ftp_put($conn_id, $remote_file, $file, FTP_BINARY))
170 {
171 echo "successfully uploaded $file\n";
172 $setstrarr[]="transfer_status='success'";
173 $setstrarr[]="recording_filename='$remote_file'";
174 $success_fail="success";
175
176 $setstr=implode(",",$setstrarr);
177 DB::connection("conn")->insert(DB::raw("insert into recording_reconcilation set $setstr"));
178 $data=array($ii++,$server_ip,$qline->id,explode(" ",$fulldate)[0],explode(" ",$fulldate)[1],$length,$qline->did,$qline->number,$qline->type,$userdatavalue,$qline->client,$qline->crm_id,$success_fail,$remote_file);
179
180
181 fputcsv($filesave, $data);
182 }
183 else
184 {
185 echo "There was a problem while uploading $file\n";
186 $setstrarr[]="transfer_status='fail'";
187 $success_fail="fail";
188 }
189 }
190 else
191 {
192
193 echo "The file $file does not exist";
194 $setstrarr[]="transfer_status='file does not exist'";
195 $success_fail="file does not exist";
196 }
197 }
198 else
199 {
200 echo "not connect to server";
201 }
202 // close the connection
203 }
204
205 echo "file save\n";
206 fclose($filesave);
207 ftp_close($conn_id);
208
209 //send csv file to ftp server
210 $conn_id_csv = ftp_connect($ftp_server);
211 $remote_filecsv = "recording_excel/".$server_ip."_".date("Y-m-d",$logdate).".csv";
212 $login_result_csv = ftp_login($conn_id_csv, $ftp_user_name, $ftp_user_pass);
213
214 if($login_result_csv)
215 {
216 if (file_exists($fileName))
217 {
218 echo "The file $fileName exists\n";
219 if(ftp_put($conn_id_csv, $remote_filecsv, $fileName, FTP_BINARY))
220 {
221 echo "successfully uploaded $fileName\n";
222 }
223 else
224 {
225 echo "There was a problem while uploading $fileName\n";
226 }
227 }
228 else
229 {
230 echo "The file $fileName does not exist";
231 }
232 }
233 else
234 {
235 echo "not connect to server";
236 }
237
238
239 ftp_close($conn_id_csv);
240 DB::connection("conn")->disconnect();
241 }
242 }
243 }
244
245 ?>
246
247
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 use DB;
5 use Config;
6
7 use App\Models\User;
8 use App\Models\Accesslog;
9
10 use App\Models\CRMCall;
11 use Schema;
12 use PDO;
13
14 use Illuminate\Database\Schema\Blueprint;
15
16 class records_details extends Command {
17
18 /**
19 * The console command name.
20 *
21 * @var string
22 */
23 protected $signature = 'records_details';
24
25 /**
26 * The console command description.
27 *
28 * @var string
29 */
30 protected $description = 'records_details';
31
32 /**
33 * Execute the console command.
34 *
35 * @return mixed
36 */
37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d')."\n";
41 $server_ip=env('app_ip');
42 $central_ip=env('central_ip');
43 $conn='';
44 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
45
46 $conn = array(
47 'driver' => 'mysql',
48 'host' => $central_ip,
49 'database' => env('DB_DATABASE', 'kstych_flexydial'),
50 'username' => env('DB_USERNAME', 'root'),
51 'password' => env('DB_PASSWORD', ''),
52 'charset' => 'utf8',
53 'collation' => 'utf8_unicode_ci',
54 'prefix' => '',
55 'options' => array(
56 PDO::ATTR_TIMEOUT => 5,
57 ),
58 );
59 Config::set("database.connections.conn", $conn);
60
61
62 if(DB::connection("conn")->getDatabaseName())
63 {
64 $serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
65 $server_id=$serverclist[0]->id;
66 if($server_id<10){
67 $server_id="0".$server_id;
68 }
69 $location=$serverclist[0]->location;
70
71 echo ",".$server_ip;
72
73 $qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`"));
74 $datainser='';
75 foreach($qlist as $qline)
76 {
77
78 $record_id=$qline->id;
79 $clientcode=$qline->clientcode;
80 $client=$qline->client;
81 $status=$qline->status;
82 $clientinternalid=$qline->clientinternalid;
83 $mobile=$qline->mobile;
84 $priority=$qline->priority;
85 $modified=$qline->modified;
86 $question=$qline->question;
87 $firstname=$qline->firstname;
88
89
90 DB::connection("conn")->insert(DB::raw("insert into records_details set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'"));
91
92
93 }
94 DB::connection("conn")->disconnect();
95
96 }
97 }
98
99 }
100
101
102
103
1 <?php namespace App\Console\Commands;
2
3 use Illuminate\Console\Command;
4 //use Mail;
5 use DB;
6 use Config;
7
8 use App\Models\User;
9 use App\Models\Accesslog;
10
11 use App\Models\CRMCall;
12 use Schema;
13 use PDO;
14 use App\Models\Notification;
15 use App\Jobs\KHRMSLib;
16
17 use Input;
18 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 relationship_data extends Command {
26
27 /**
28 * The console command name.
29 *
30 * @var string
31 */
32 protected $signature = 'relationship_data';
33
34 /**
35 * The console command description.
36 *
37 * @var string
38 */
39 protected $description = 'relationship_data';
40
41 /**
42 * Execute the console command.
43 *
44 * @return mixed
45 */
46 public function handle()
47 {
48 echo 'Start';
49
50 $local_data=DB::select(DB::raw("SELECT mvalue FROM `hrms_masters` where mid='1'"));
51 $local_data_value=$local_data[0]->mvalue;
52
53 echo "Hrms core data----".$local_data_value;
54
55 if(is_array($local_data_value)) $core_data_value= array_map(__METHOD__, $local_data_value);
56
57 if(!empty($local_data_value) && is_string($local_data_value)) {
58 $core_data_value = str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $local_data_value);
59
60 echo "core data value replace".$core_data_value;
61 }
62
63
64
65 DB::update(DB::raw("UPDATE hrms_masters_demo SET mvalue='$core_data_value' WHERE mid='1'"));
66
67 echo 'End';
68 }
69 }
70
71
72
73
1 <?php namespace App\Console;
2
3 use Illuminate\Console\Scheduling\Schedule;
4 use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
5
6 class Kernel extends ConsoleKernel
7 {
8
9 /**
10 * The Artisan commands provided by your application.
11 *
12 * @var array
13 */
14 protected $commands = [
15 'App\Console\Commands\KstychDaily',
16 'App\Console\Commands\KstychPAMI',
17 'App\Console\Commands\KstychPAGI',
18 'App\Console\Commands\DailyLogout',
19 'App\Console\Commands\bulkServerUpload',
20 'App\Console\Commands\bulkServerUpload_1',
21 'App\Console\Commands\bulkServerUpload_2',
22 'App\Console\Commands\bulkServerUpload_3',
23 'App\Console\Commands\bulkServerUpload_4',
24 //'App\Console\Commands\bulkServerUpload_5',
25 'App\Console\Commands\bulkServerUpload_daily',
26 'App\Console\Commands\InsertCrmArchive',
27 'App\Console\Commands\DeleteCrmcalls',
28 'App\Console\Commands\records_details',
29 'App\Console\Commands\CreportEight',
30 'App\Console\Commands\questionnaire_details',
31 'App\Console\Commands\Userlog_data',
32 'App\Console\Commands\lead_form_details',
33 'App\Console\Commands\full_remark_details',
34 'App\Console\Commands\recording_reconcilation',
35 'App\Console\Commands\dailyupload_calllog',
36 'App\Console\Commands\dailyupload_questionaire',
37 'App\Console\Commands\relationship_data',
38 ];
39
40 /**
41 * Define the application's command schedule.
42 *
43 * @param \Illuminate\Console\Scheduling\Schedule $schedule
44 * @return void
45 */
46 protected function schedule(Schedule $schedule)
47 {
48 $schedule->command('KstychDaily')->daily()->withoutOverlapping();
49 //$schedule->command('bulkServerUpload')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
50
51
52 $schedule->command('Userlog_data')->dailyAt('01:10')->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping();
53
54 $schedule->command('bulkServerUpload')->dailyAt('14:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
55 $schedule->command('bulkServerUpload_1')->dailyAt('16:18')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
56 $schedule->command('bulkServerUpload_2')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
57 $schedule->command('bulkServerUpload_3')->dailyAt('19:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
58 $schedule->command('bulkServerUpload_4')->dailyAt('20:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
59 //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkServerUpload_daily.txt")->withoutOverlapping();
60 //$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
61
62 $schedule->command('bulkServerUpload_daily')->dailyAt('05:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
63 $schedule->command('bulkServerUpload_daily')->dailyAt('07:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
64 $schedule->command('bulkServerUpload_daily')->dailyAt('09:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
65 $schedule->command('bulkServerUpload_daily')->dailyAt('11:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
66 $schedule->command('bulkServerUpload_daily')->dailyAt('13:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
67
68 $schedule->command('dailyupload_questionaire')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailyupload_questionaire.txt")->withoutOverlapping();
69 $schedule->command('CreportEight')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping();
70
71
72 //$schedule->command('CreportEight')->hourly()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping();
73 $schedule->command('questionnaire_details')->hourly()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping();
74
75 $schedule->command('InsertCrmArchive')->hourly()->withoutOverlapping();
76 $schedule->command('DeleteCrmcalls')->hourly()->withoutOverlapping();
77
78 $schedule->command('DailyLogout')->dailyAt('14:30')->withoutOverlapping();
79
80 $schedule->command('lead_form_details')->everyTenMinutes()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping();
81 $schedule->command('records_details')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping();
82 //$schedule->command('recording_reconcilation')->everyMinute()->appendOutputTo(storage_path()."/reason/recording_reconcilation.txt")->withoutOverlapping();
83
84 //$schedule->command('lead_form_details')->everyMinute()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping();
85
86 $schedule->command('dailyupload_calllog')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailycalllog_records.txt")->withoutOverlapping();
87
88 //$schedule->command('records_details')->everyMinute()->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping();
89 $schedule->command('full_remark_details')->hourly()->appendOutputTo(storage_path()."/reason/full_remark_details.txt")->withoutOverlapping();
90 //$schedule->command('questionnaire_details')->everyMinute()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping();
91
92 //$schedule->command('relationship_data')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_data.txt")->withoutOverlapping();
93
94 }
95
96 }
1 <?php namespace App\Console\Commands; 1 <?php namespace App\Console\Commands;
2 2
3 use Illuminate\Console\Command; 3 use Illuminate\Console\Command;
4 use DB;
5 use Config;
6 4
7 use App\Models\User; 5 use DB;
8 use App\Models\Accesslog; 6 use App\Models\ComplaintCategory;
7 use App\Models\ComplaintResolclassUnit;
8 use App\Models\ComplaintSubCategory;
9 9
10 use App\Models\CRMCall; 10 use Config;
11 use Schema; 11 use Schema;
12 use PDO; 12 use PDO;
13 13
14 use Illuminate\Database\Schema\Blueprint; 14 use Illuminate\Database\Schema\Blueprint;
15 15
16 class dailyupload_questionaire extends Command { 16 class complaint_data extends Command {
17 17
18 /** 18 /**
19 * The console command name. 19 * The console command name.
20 * 20 *
21 * @var string 21 * @var string
22 */ 22 */
23 protected $signature = 'dailyupload_questionaire'; 23 protected $signature = 'complaint_data';
24 24
25 /** 25 /**
26 * The console command description. 26 * The console command description.
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = 'dailyupload_questionaire'; 30 protected $description = 'complaint_data';
31 31
32 /** 32 /**
33 * Execute the console command. 33 * Execute the console command.
34 * 34 *
35 * @return mixed 35 * @return mixed
36 */ 36 */
37 public function handle() 37 public function handle()
38 { 38 {
39 $nowts=time(); 39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_ip=env('app_ip');
47 $central_ip=env('central_ip');
48 $questionaire_details = "questionaire_details_".date("d_m_Y",$logdate);
49 $created_at=date("Y-m-d H:i:s");
50
51 $conn = array(
52 'driver' => 'mysql',
53 'host' => $central_ip,
54 'database' => env('DB_DATABASE', 'kstych_flexydial'),
55 'username' => env('DB_USERNAME', 'root'),
56 'password' => env('DB_PASSWORD', ''),
57 'charset' => 'utf8',
58 'collation' => 'utf8_unicode_ci',
59 'prefix' => '',
60 'options' => array(
61 PDO::ATTR_TIMEOUT => 5,
62 ),
63 );
64 Config::set("database.connections.conn", $conn);
65
66
67 if(DB::connection("conn")->getDatabaseName())
68 {
69
70 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
71 $server_id=$serverclist[0]->id;
72 if($server_id<10){
73 $server_id="0".$server_id;
74 }
75 40
41 echo date('Y-m-d H:i:s')."\n";
42
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
61 Config::set("database.connections.conn", $conn);
76 62
77 $clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $questionaire_details group by server")); 63 if(DB::connection("conn")->getDatabaseName())
78 64 {
79 $caar=[];
80 foreach($clist as $cline)
81 {
82 $caar[$cline->server]= $cline->cnt;
83 }
84
85 $mlist=DB::select(DB::raw("select count(*) as countrecord from questionaire_details where created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"));
86
87 $location_cont='0';
88 $central_cont='0';
89
90 $location_cont=$mlist[0]->countrecord;
91 if(array_key_exists($server_id,$caar)){
92 $central_cont=$caar[$server_id];
93 }else{
94 $central_cont=0;
95 65
96 } 66 DB::table('complaint_category')->truncate();
97 $dif=($mlist[0]->countrecord)-($central_cont); 67 DB::table('complaint_resol_class_unit')->truncate();
68 DB::table('complaint_sub_category')->truncate();
98 69
99 if($dif<=1 && $dif>=-1){ 70 $complaintdataList = DB::connection("conn")->select(DB::raw("SELECT * FROM complaint_category"));
100 71
101 $result="Y"; 72 $complaintData = 0; $newCategory = 0; $newSubCategory = 0; $newComplaintResolClassUnit = 0;
102 73
103 DB::connection("conn")->insert(DB::raw("insert into dailyupload_questionaire set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'")); 74 foreach ($complaintdataList as $list) {
75 $category = ComplaintCategory::where('category','=',$list->category)->first();
104 76
105 }else{ 77 if(count($category)){
106 78 $categoryId = $category->id;
107 $result="N"; 79
108 DB::connection("conn")->insert(DB::raw("insert into dailyupload_questionaire set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'")); 80 }else{
81 $addCategory = ComplaintCategory::create(['category'=>$list->category]);
82 $categoryId = $addCategory->id;
83 $newCategory++;
84 }
85
86
87 $complaintResolClassUnit = ComplaintResolclassUnit::where('resolve_class_unit','=',$list->resolve_class_unit)->first();
88
89 if(count($complaintResolClassUnit)){
90 $complaintResolClassUnitId = $complaintResolClassUnit->id;
91 }else{
92 $addComplaintResolClassUnit = ComplaintResolclassUnit::create(['resolve_class_unit'=>$list->resolve_class_unit]);
93 $complaintResolClassUnitId = $addComplaintResolClassUnit->id;
94 $newComplaintResolClassUnit++;
95 }
96
97 $subCategory = ComplaintSubCategory::where('resolve_class_unit_id','=',$complaintResolClassUnitId)->where('category_id','=',$categoryId)->where('sub_category','=',$list->sub_category)->first();
98
99 if(count($subCategory)){
100 $subCategoryId = $subCategory->id;
101
102 }else{
103 $addSubCategory = ComplaintSubCategory::create(['sub_category'=>$list->sub_category,'resolve_class_unit_id'=>$complaintResolClassUnitId,'category_id'=>$categoryId]);
104 $subCategoryId = $addSubCategory->id;
105 $newSubCategory++;
106 }
107
108 $complaintData++;
109 }
110 DB::connection("conn")->disconnect();
109 111
110 }
111
112 DB::connection("conn")->disconnect();
113
114 } 112 }
115 113
116 } 114 }
117
118 115
119 } 116 }
......
...@@ -13,132 +13,127 @@ use PDO; ...@@ -13,132 +13,127 @@ use PDO;
13 13
14 use Illuminate\Database\Schema\Blueprint; 14 use Illuminate\Database\Schema\Blueprint;
15 15
16 class questionnaire_details extends Command { 16 class complaint_details extends Command {
17 17
18 /** 18 /**
19 * The console command name. 19 * The console command name.
20 * 20 *
21 * @var string 21 * @var string
22 */ 22 */
23 protected $signature = 'questionnaire_details'; 23 protected $signature = 'complaint_details';
24 24
25 /** 25 /**
26 * The console command description. 26 * The console command description.
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = 'questionnaire_details'; 30 protected $description = 'complaint_details';
31 31
32 /** 32 /**
33 * Execute the console command. 33 * Execute the console command.
34 * 34 *
35 * @return mixed 35 * @return mixed
36 */ 36 */
37 public function handle() 37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_ip=env('app_ip');
47 $lead_form = "lead_form_details";
48 $central_ip=env('central_ip');
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
66 if(DB::connection("conn")->getDatabaseName())
38 { 67 {
39 $nowts=time(); 68 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
40 echo "\n".date('Y-m-d')."\n"; 69 $server_id=$serverclist[0]->id;
41 70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
42 73
43 $logdate=strtotime('0 day'); 74 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(complaint_id) as maxid from complaint_details where server='$server_id'"));
44 75
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array(); 76 $maxids=$maxid[0]->maxid;
46 $questionaire = "questionaire_details_".date("d_m_Y");
47 $server_ip=env('app_ip');
48 $central_ip=env('central_ip');
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
66 if(DB::connection("conn")->getDatabaseName())
67 {
68 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
69 $server_id=$serverclist[0]->id;
70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73
74 echo ",".$server_id;
75 77
76 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(question_id) as maxid from $questionaire where server='$server_id'")); 78 $qlist=DB::select(DB::raw("SELECT * from complaint_details where id>$maxids"));
77 79 $userarr=array();
78 $maxids=$maxid[0]->maxid; 80 foreach($qlist as $qline)
79 81 {
80 82
81 //$qlist=DB::select(DB::raw("SELECT * from questionaire_details where id>'$maxids'")); 83 $setstrarr=array();
82 84
83 $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))."'")); 85 $setstrarr[]="complaint_id='$qline->id'";
84 86 $setstrarr[]="upload_date='$qline->upload_date'";
85 $userarr=array(); 87 $setstrarr[]="call_id='$qline->call_id'";
86 foreach($qlist as $qline) 88 $setstrarr[]="cust_band='$qline->cust_band'";
87 { 89 $setstrarr[]="cust_type='$qline->cust_type'";
88 90 $setstrarr[]="source_of_info='$qline->source_of_info'";
89 $setstrarr=array(); 91 $setstrarr[]="service_type='$qline->service_type'";
90 92 $setstrarr[]="priority='$qline->priority'";
91 $crtdate=date("Y-m-d H:i:s",strtotime($qline->created_at)+330*60); 93 $setstrarr[]="category='$qline->category'";
92 $update=date("Y-m-d H:i:s",strtotime($qline->updated_at)+330*60); 94 $setstrarr[]="sub_category='$qline->sub_category'";
93 95 $setstrarr[]="resolving_branch='$qline->resolving_branch'";
94 $qtime=date("Y-m-d H:i:s",strtotime($qline->question_time)+330*60); 96 $setstrarr[]="cust_city='$qline->cust_city'";
95 97 $setstrarr[]="acknowledge='$qline->acknowledge'";
96 $setstrarr[]="server='$server_id'"; 98 $setstrarr[]="resolve_class_unit='$qline->resolve_class_unit'";
97 $setstrarr[]="question_id='$qline->id'"; 99 $setstrarr[]="rbb='$qline->rbb'";
98 $setstrarr[]="created_at='$crtdate'"; 100 $setstrarr[]="non_rrb='$qline->non_rrb'";
99 $setstrarr[]="updated_at='$update'"; 101 $setstrarr[]="complainant_name='$qline->complainant_name'";
100 $setstrarr[]="user_id='$qline->user_id'"; 102 $setstrarr[]="existing_customer='$qline->existing_customer'";
101 $setstrarr[]="cust_id='$qline->cust_id'"; 103 $setstrarr[]="cust_id='$qline->cust_id'";
102 $setstrarr[]="call_id='$qline->call_id'"; 104 $setstrarr[]="shadow_cust_id='$qline->shadow_cust_id'";
103 $setstrarr[]="name='$qline->name'"; 105 $setstrarr[]="casa_number='$qline->casa_number'";
104 $setstrarr[]="number='$qline->number'"; 106 $setstrarr[]="docket_number='$qline->docket_number'";
105 $setstrarr[]="question_time='$qtime'"; 107 $setstrarr[]="cust_mobile='$qline->cust_mobile'";
106 108 $setstrarr[]="contact_number='$qline->contact_number'";
107 $setstrarr[]="question='$qline->question'"; 109 $setstrarr[]="email='$qline->email'";
108 $setstrarr[]="primary_question='$qline->primary_question'"; 110 $setstrarr[]="case_reference='$qline->case_reference'";
109 $setstrarr[]="primary_response='$qline->primary_response'"; 111 $setstrarr[]="logging_branch_name='$qline->logging_branch_name'";
110 $setstrarr[]="primary_text='$qline->primary_text'"; 112 $setstrarr[]="logging_class_unit='$qline->logging_class_unit'";
111 $setstrarr[]="followup1_question='$qline->followup1_question'"; 113 $setstrarr[]="nature_of_complaint='$qline->nature_of_complaint'";
112 $setstrarr[]="followup1_response='$qline->followup1_response'"; 114 $setstrarr[]="detailed_suggestion='$qline->detailed_suggestion'";
113 $setstrarr[]="followup1_text='$qline->followup1_text'"; 115 $setstrarr[]="additional_info='$qline->additional_info'";
114 $setstrarr[]="followup2_question='$qline->followup2_question'"; 116 $setstrarr[]="cust_name_on_card='$qline->cust_name_on_card'";
115 $setstrarr[]="followup2_response='$qline->followup2_response'"; 117 if($qline->card_number==''){
116 $setstrarr[]="followup2_text='$qline->followup2_text'"; 118 $setstrarr[]="card_number='' ";
117 $setstrarr[]="followup3_question='$qline->followup3_question'"; 119 }else{
118 $setstrarr[]="followup3_response='$qline->followup3_response'"; 120 $setstrarr[]="card_number='".substr($qline->card_number,0,6).'******'.substr($qline->card_number,-4,4)."'";
119 $setstrarr[]="followup3_text='$qline->followup3_text'"; 121 }
120 $setstrarr[]="followup4_question='$qline->followup4_question'"; 122 $setstrarr[]="aan='$qline->aan'";
121 $setstrarr[]="followup4_response='$qline->followup4_response'"; 123 $setstrarr[]="logging_branch_code='$qline->logging_branch_code'";
122 $setstrarr[]="followup4_text='$qline->followup4_text'"; 124 $setstrarr[]="resolving_branch_code='$qline->resolving_branch_code'";
123 $setstrarr[]="followup5_question='$qline->followup5_question'"; 125 $setstrarr[]="status='$qline->status'";
124 $setstrarr[]="followup5_response='$qline->followup5_response'"; 126 $setstrarr[]="server='$server_id'";
125 $setstrarr[]="followup5_text='$qline->followup5_text'"; 127
126 $setstrarr[]="followup6_question='$qline->followup6_question'"; 128 $setstr=implode(",",$setstrarr);
127 $setstrarr[]="followup6_response='$qline->followup6_response'"; 129 DB::connection("conn")->insert(DB::raw("insert into complaint_details set $setstr"));
128 $setstrarr[]="followup6_text='$qline->followup6_text'"; 130
129 $setstrarr[]="followup7_question='$qline->followup7_question'";
130 $setstrarr[]="followup7_response='$qline->followup7_response'";
131 $setstrarr[]="followup7_text='$qline->followup7_text'";
132
133 $setstr=implode(",",$setstrarr);
134 DB::connection("conn")->insert(DB::raw("insert into ".$questionaire." set $setstr"));
135
136 }
137 DB::connection("conn")->disconnect();
138
139 } 131 }
140 132 DB::connection("conn")->disconnect();
141 } 133
142 134 }
135
136 }
137
143 138
144 } 139 }
......
...@@ -13,92 +13,95 @@ use PDO; ...@@ -13,92 +13,95 @@ use PDO;
13 13
14 use Illuminate\Database\Schema\Blueprint; 14 use Illuminate\Database\Schema\Blueprint;
15 15
16 class full_remark_details extends Command { 16 class complaint_fields extends Command {
17 17
18 /** 18 /**
19 * The console command name. 19 * The console command name.
20 * 20 *
21 * @var string 21 * @var string
22 */ 22 */
23 protected $signature = 'full_remark_details'; 23 protected $signature = 'complaint_fields';
24 24
25 /** 25 /**
26 * The console command description. 26 * The console command description.
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = 'full_remark_details'; 30 protected $description = 'complaint_fields';
31 31
32 /** 32 /**
33 * Execute the console command. 33 * Execute the console command.
34 * 34 *
35 * @return mixed 35 * @return mixed
36 */ 36 */
37 public function handle() 37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_ip=env('app_ip');
47 $lead_form = "lead_form_details";
48 $central_ip=env('central_ip');
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
66 if(DB::connection("conn")->getDatabaseName())
38 { 67 {
39 $nowts=time(); 68 DB::table('complaint_fields')->truncate();
40 echo "\n".date('Y-m-d H:i:s')."\n"; 69
41 70 $qlist=DB::connection("conn")->select(DB::raw("SELECT * from complaint_fields"));
42 71 $userarr=array();
43 $logdate=strtotime('0 day'); 72 foreach($qlist as $qline)
44 73 {
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array(); 74
46 $server_ip=env('app_ip'); 75 $setstrarr=array();
47 $full_remark = "full_remark_details"; 76
48 $central_ip=env('central_ip'); 77 $setstrarr[]="cust_band='$qline->cust_band'";
49 78 $setstrarr[]="cust_type='$qline->cust_type'";
50 $conn = array( 79 $setstrarr[]="source_of_info='$qline->source_of_info'";
51 'driver' => 'mysql', 80 $setstrarr[]="service_type='$qline->service_type'";
52 'host' => $central_ip, 81 $setstrarr[]="priority='$qline->priority'";
53 'database' => env('DB_DATABASE', 'kstych_flexydial'), 82 $setstrarr[]="category='$qline->category'";
54 'username' => env('DB_USERNAME', 'root'), 83 $setstrarr[]="sub_category='$qline->sub_category'";
55 'password' => env('DB_PASSWORD', ''), 84 $setstrarr[]="resolving_branch='$qline->resolving_branch'";
56 'charset' => 'utf8', 85 $setstrarr[]="cust_city='$qline->cust_city'";
57 'collation' => 'utf8_unicode_ci', 86 $setstrarr[]="acknowledge='$qline->acknowledge'";
58 'prefix' => '', 87 $setstrarr[]="resolve_class_unit='$qline->resolve_class_unit'";
59 'options' => array( 88 $setstrarr[]="rbb='$qline->rbb'";
60 PDO::ATTR_TIMEOUT => 5, 89 $setstrarr[]="non_rbb='$qline->non_rbb'";
61 ), 90 $setstrarr[]="logging_branch_name='$qline->logging_branch_name'";
62 ); 91 $setstrarr[]="logging_branch_code='$qline->logging_branch_code'";
63 Config::set("database.connections.conn", $conn); 92 $setstrarr[]="resolving_branch_code='$qline->resolving_branch_code'";
64 93 $setstrarr[]="resolving_branch_w_code='$qline->resolving_branch_w_code'";
65 94 $setstrarr[]="logging_branch_w_code='$qline->logging_branch_w_code'";
66 if(DB::connection("conn")->getDatabaseName())
67 {
68 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
69 $server_id=$serverclist[0]->id;
70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73
74 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(full_remark_id) as maxid from $full_remark where server_id='$server_id'"));
75
76 $maxids=$maxid[0]->maxid;
77
78 //$qlist=DB::select(DB::raw("SELECT * from full_remark"));
79 $qlist=DB::select(DB::raw("SELECT * from full_remark where id>'$maxids' and created_at>'".date("Y-m-d")."' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
80
81 $userarr=array();
82 foreach($qlist as $qline)
83 {
84 95
85 $setstrarr=array(); 96 $setstr=implode(",",$setstrarr);
97 DB::insert(DB::raw("insert into complaint_fields set $setstr"));
86 98
87 $setstrarr[]="server_id='$server_id'";
88 $setstrarr[]="full_remark_id='$qline->id'";
89 $setstrarr[]="call_id='$qline->call_id'";
90 $setstrarr[]="fullremark='$qline->fullremark'";
91 $setstrarr[]="created_at='$qline->created_at'";
92
93 $setstr=implode(",",$setstrarr);
94 DB::connection("conn")->insert(DB::raw("insert into ".$full_remark." set $setstr"));
95
96 }
97 DB::connection("conn")->disconnect();
98
99 } 99 }
100 100 DB::connection("conn")->disconnect();
101 } 101
102 102 }
103
104 }
105
103 106
104 } 107 }
......
...@@ -13,102 +13,131 @@ use PDO; ...@@ -13,102 +13,131 @@ use PDO;
13 13
14 use Illuminate\Database\Schema\Blueprint; 14 use Illuminate\Database\Schema\Blueprint;
15 15
16 class dailyupload_calllog extends Command { 16 class leadform_products extends Command {
17 17
18 /** 18 /**
19 * The console command name. 19 * The console command name.
20 * 20 *
21 * @var string 21 * @var string
22 */ 22 */
23 protected $signature = 'dailyupload_calllog'; 23 protected $signature = 'leadform_products';
24 24
25 /** 25 /**
26 * The console command description. 26 * The console command description.
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = 'dailyupload_calllog'; 30 protected $description = 'leadform_products';
31 31
32 /** 32 /**
33 * Execute the console command. 33 * Execute the console command.
34 * 34 *
35 * @return mixed 35 * @return mixed
36 */ 36 */
37 public function handle() 37 public function handle()
38 { 38 {
39 $nowts=time(); 39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n"; 40 echo "\n".date('Y-m-d H:i:s')."\n";
41 $logdate=strtotime('0 day');
42
43 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
44 $server_ip=env('app_ip');
45 $central_ip=env('central_ip');
46 $calllog_report = "calllog_report_".date("d_m_Y",$logdate);
47 $created_at=date("Y-m-d H:i:s");
48
49 $conn = array(
50 'driver' => 'mysql',
51 'host' => $central_ip,
52 'database' => env('DB_DATABASE', 'kstych_flexydial'),
53 'username' => env('DB_USERNAME', 'root'),
54 'password' => env('DB_PASSWORD', ''),
55 'charset' => 'utf8',
56 'collation' => 'utf8_unicode_ci',
57 'prefix' => '',
58 'options' => array(
59 PDO::ATTR_TIMEOUT => 5,
60 ),
61 );
62 Config::set("database.connections.conn", $conn);
63 if(DB::connection("conn")->getDatabaseName())
64 {
65
66 $serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
67 $server_id=$serverclist[0]->id;
68 if($server_id<10){
69 $server_id="0".$server_id;
70 }
71
72 $clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server"));
73 $caar=[];
74 foreach($clist as $cline)
75 {
76 $caar[$cline->server]= $cline->cnt;
77
78
79 }
80 $mlist=DB::select(DB::raw("select count(*) as countrecord from crmcalls where created_at>'".date("Y-m-d",$logdate)."' and created_at<'".date("Y-m-d",$logdate+24*60*60)."'"));
81
82 $location_cont='0';
83 $central_cont='0';
84
85 $location_cont=$mlist[0]->countrecord;
86 if(array_key_exists($server_id,$caar)){
87 $central_cont=$caar[$server_id];
88 }else{
89 $central_cont=0;
90
91 }
92 $dif=($mlist[0]->countrecord)-($central_cont);
93
94 if($dif<=5 && $dif>=-5){
95
96 $result="Y";
97
98 DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
99
100 }else{
101
102 $result="N";
103 DB::connection("conn")->insert(DB::raw("insert into dailyupload_calllog_records set created_at='$created_at',server_id='$server_id',server_ip='$server_ip',central_count='$central_cont',location_count='$location_cont',difference='$dif',result='$result'"));
104
105 }
106 41
107 DB::connection("conn")->disconnect(); 42
108 43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_ip=env('app_ip');
47 $lead_form = "lead_form_details";
48 $central_ip=env('central_ip');
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
66 if(DB::connection("conn")->getDatabaseName())
67 {
68 DB::table('leadform_products')->truncate();
69
70 $qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_PRODUCT_MASTER"));
71 $userarr=array();
72 foreach($qlist as $qline)
73 {
74
75 $setstrarr=array();
76
77 $setstrarr[]="products='$qline->PRODUCT_NAME'";
78
79 $setstr=implode(",",$setstrarr);
80 DB::insert(DB::raw("insert into leadform_products set $setstr"));
81
82 }
83 DB::table('UD_CRM_BR_MASTER')->truncate();
84
85 $qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_CRM_BR_MASTER"));
86 $userarr=array();
87 foreach($qlist as $qline)
88 {
89
90 $setstrarr=array();
91
92 $setstrarr[]="BR_CODE='$qline->BR_CODE'";
93 $setstrarr[]="BR_NAME='$qline->BR_NAME'";
94 $setstrarr[]="STATUS='$qline->STATUS'";
95 $setstrarr[]="INS_DATE='$qline->INS_DATE'";
96 $setstrarr[]="REMARKS='$qline->REMARKS'";
97 $setstrarr[]="FIELD1='$qline->FIELD1'";
98 $setstrarr[]="FIELD2='$qline->FIELD2'";
99
100 $setstr=implode(",",$setstrarr);
101 DB::insert(DB::raw("insert into UD_CRM_BR_MASTER set $setstr"));
102
103 }
104 DB::table('UD_LEAD_ENTRY_CUSTOMER_PROFILE')->truncate();
105
106 $qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_LEAD_ENTRY_CUSTOMER_PROFILE"));
107 $userarr=array();
108 foreach($qlist as $qline)
109 {
110
111 $setstrarr=array();
112
113 $setstrarr[]="CUST_PROFILE='$qline->CUST_PROFILE'";
114 $setstrarr[]="INS_DATE='$qline->INS_DATE'";
115 $setstrarr[]="STATUS='$qline->STATUS'";
116
117 $setstr=implode(",",$setstrarr);
118 DB::insert(DB::raw("insert into UD_LEAD_ENTRY_CUSTOMER_PROFILE set $setstr"));
119
109 } 120 }
110 121 DB::table('UD_SM_MAPPING')->truncate();
122
123 $qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_SM_MAPPING"));
124 $userarr=array();
125 foreach($qlist as $qline)
126 {
127
128 $setstrarr=array();
129 //$qlist_BR_NAME=preg_replace("/[^ \w]+/","", $qline->BR_NAME);
130 $setstrarr[]="USER_NAME='$qline->USER_NAME'";
131 $setstrarr[]="EMPLOYEE_CODE='$qline->EMPLOYEE_CODE'";
132
133 $setstr=implode(",",$setstrarr);
134 DB::insert(DB::raw("insert into UD_SM_MAPPING set $setstr"));
135
136 }
137 DB::connection("conn")->disconnect();
138
139 }
140
111 } 141 }
112
113 142
114 } 143 }
......
...@@ -13,111 +13,101 @@ use PDO; ...@@ -13,111 +13,101 @@ use PDO;
13 13
14 use Illuminate\Database\Schema\Blueprint; 14 use Illuminate\Database\Schema\Blueprint;
15 15
16 class lead_form_details extends Command { 16 class oa_leadform_details extends Command {
17 17
18 /** 18 /**
19 * The console command name. 19 * The console command name.
20 * 20 *
21 * @var string 21 * @var string
22 */ 22 */
23 protected $signature = 'lead_form_details'; 23 protected $signature = 'oa_leadform_details';
24 24
25 /** 25 /**
26 * The console command description. 26 * The console command description.
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 protected $description = 'lead_form_details'; 30 protected $description = 'oa_leadform_details';
31 31
32 /** 32 /**
33 * Execute the console command. 33 * Execute the console command.
34 * 34 *
35 * @return mixed 35 * @return mixed
36 */ 36 */
37 public function handle() 37 public function handle()
38 {
39 $nowts=time();
40 echo "\n".date('Y-m-d H:i:s')."\n";
41
42
43 $logdate=strtotime('0 day');
44
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array();
46 $server_ip=env('app_ip');
47 $oa_leadform_details = "oa_leadform_details";
48 $central_ip=env('central_ip');
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
66 if(DB::connection("conn")->getDatabaseName())
38 { 67 {
39 $nowts=time(); 68 $serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
40 echo "\n".date('Y-m-d H:i:s')."\n"; 69 $server_id=$serverclist[0]->id;
41 70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73 $location=$serverclist[0]->location;
74 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(oa_lead_id) as maxid from oa_leadform_details where server_ip='$server_ip'"));
75 $maxids=$maxid[0]->maxid;
42 76
43 $logdate=strtotime('0 day'); 77 $qlist=DB::select(DB::raw("SELECT * from oa_leadform where id>'$maxids'"));
44 78 $userarr=array();
45 $tcol=0;$fieldsarr=array();$extrahdrarr=array(); 79 foreach($qlist as $qline)
46 $server_ip=env('app_ip'); 80 {
47 $lead_form = "lead_form_details"; 81
48 $central_ip=env('central_ip'); 82 $setstrarr=array();
49 83
50 $conn = array( 84 $setstrarr[]="server_id='$server_id'";
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
66 if(DB::connection("conn")->getDatabaseName())
67 {
68 $serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
69 $server_id=$serverclist[0]->id;
70 if($server_id<10){
71 $server_id="0".$server_id;
72 }
73 $location=$serverclist[0]->location;
74 $maxid=DB::connection("conn")->select(DB::raw("SELECT max(lead_form_id) as maxid from lead_form_details where server_ip='$server_ip'"));
75
76 $maxids=$maxid[0]->maxid;
77
78 $qlist=DB::select(DB::raw("SELECT * from lead_form where id>'$maxids'"));
79 print_r($qlist);
80 $userarr=array();
81 foreach($qlist as $qline)
82 {
83
84 $setstrarr=array();
85
86
87 $setstrarr[]="lead_form_id='$qline->id'";
88 $setstrarr[]="created_at='$qline->created_at'";
89 $setstrarr[]="updated_at='$qline->updated_at'";
90 $setstrarr[]="product='$qline->product'";
91 $setstrarr[]="customer_name='$qline->customer_name'";
92 $setstrarr[]="mobile_number='$qline->mobile_number'";
93 $setstrarr[]="city='$qline->city'";
94 $setstrarr[]="state='$qline->state'";
95 $setstrarr[]="agent_memo='$qline->agent_memo'";
96 $setstrarr[]="customer_memo='$qline->customer_memo'";
97 $setstrarr[]="remarks='$qline->remarks'";
98 $setstrarr[]="transfer_memo='$qline->transfer_memo'";
99 $setstrarr[]="server_ip='$server_ip'"; 85 $setstrarr[]="server_ip='$server_ip'";
100 $setstrarr[]="location='$location'"; 86 $setstrarr[]="oa_lead_id='$qline->id'";
101 $setstrarr[]="address='$qline->address'"; 87 $setstrarr[]="created_at='$qline->created_at'";
102 $setstrarr[]="mobile='$qline->mobile'"; 88 $setstrarr[]="updated_at='$qline->updated_at'";
103 $setstrarr[]="client='$qline->client'"; 89 $setstrarr[]="call_created_at='$qline->call_created_at'";
104 $setstrarr[]="user_id='$qline->user_id'"; 90 $setstrarr[]="call_id='$qline->call_id'";
105 $setstrarr[]="firstname='$qline->firstname'"; 91 $setstrarr[]="record_id='$qline->record_id'";
106 $setstrarr[]="clientcode='$qline->clientcode'"; 92 $setstrarr[]="customer_name='$qline->customer_name'";
107 $setstrarr[]="call_id='$qline->call_id'"; 93 $setstrarr[]="mobile='$qline->mobile'";
108 $setstrarr[]="record_id='$qline->record_id'"; 94 $setstrarr[]="call_number='$qline->call_number'";
95 $setstrarr[]="pbcode='$qline->pbcode'";
96 $setstrarr[]="emailid='$qline->emailid'";
97 $setstrarr[]="cod_cust='$qline->cod_cust'";
98 $setstrarr[]="ucic_id='$qline->ucic_id'";
99 $setstrarr[]="unit='$qline->unit'";
100 $setstrarr[]="cust_remarks='$qline->cust_remarks'";
101 $setstrarr[]="agent_remarks='$qline->agent_remarks'";
102 $setstrarr[]="user_id='$qline->user_id'";
109 103
110 $setstr=implode(",",$setstrarr); 104 $setstr=implode(",",$setstrarr);
111 echo "prashant";
112 print_r($setstr);
113 DB::connection("conn")->insert(DB::raw("insert into lead_form_details set $setstr"));
114
115 }
116 DB::connection("conn")->disconnect();
117
118 }
119
120 }
121
122 105
106 DB::connection("conn")->insert(DB::raw("insert into ".$oa_leadform_details." set $setstr"));
107
108 }
109
110 DB::connection("conn")->disconnect();
111 }
112 }
123 } 113 }
......
1 <?php
2
3 Route::get('/', array('uses'=> 'HomeController@index', 'as'=>'index.root'));
4 Route::get('index', array('uses'=> 'HomeController@index', 'as'=>'index.index'));
5
6
7 //ON 19-09-2016 FOR FILE UPLOAD RUN
8 Route::get('upload_8', function()
9 {
10 return view("layout.module.server.8_fbulkServerUpload");
11 });
12
13 Route::get('test_table_8', 'Rom8Controller@testTable');
14 Route::get('eg', 'egController@eg');
15
16 Route::group(['middleware' => ['web']], function () {
17
18 Route::get('home', array('uses' => 'HomeController@home', 'as'=>'home.home'));
19 Route::get('login', array('uses'=> 'HomeController@login', 'as'=>'home.login'));
20 Route::post('login', array('uses'=> 'HomeController@do_login', 'as'=>'home.do_login'));
21 Route::get('logout', array('uses'=> 'HomeController@logout', 'as'=>'home.logout'));
22 Route::get('signup', array('uses'=> 'HomeController@signup', 'as'=>'home.signup'));
23 Route::post('signup', array('uses'=> 'HomeController@do_signup', 'as'=>'home.do_signup'));
24
25 Route::get('userfiles/{path}',array('uses'=>'HomeController@userfiles','as'=>'userfiles.get'))->where('path', '.*');
26
27 Route::get('unsubscribe', array('uses'=> 'HomeController@unsubscribe', 'as'=>'home.unsubscribe'));
28 Route::any('forgotpassword', array('uses'=> 'HomeController@forgotpassword', 'as'=>'signup.forgotpassword'));
29
30 Route::get('profile', array('before' => 'auth','uses' => 'HomeController@profile', 'as'=>'profile.index'));
31 Route::post('profile', array('before' => 'auth','uses' => 'HomeController@do_profile', 'as'=>'profile.update'));
32
33 Route::get('msie', array('uses'=> 'HomeController@msie', 'as'=>'login.msie'));
34 Route::any('ajaxerror', array('uses'=> 'HomeController@ajaxerror', 'as'=>'home.ajaxerror'));
35 Route::any('gettoken', array('uses'=> 'HomeController@gettoken', 'as'=>'home.gettoken'));
36 Route::any('idleapp', array('uses'=> 'HomeController@idleapp', 'as'=>'home.idleapp'));
37
38 Route::any('fileupload', array('uses'=> 'HomeController@fileupload', 'as'=>'upload.file'));
39 Route::get('cron', array('uses'=> 'HomeController@cron', 'as'=>'cron.cron'));
40 Route::get('style', array('uses'=> 'HomeController@style', 'as'=>'style.index'));
41 Route::get('jshead', array('uses'=> 'HomeController@jshead', 'as'=>'jshead.index'));
42 Route::get('jsbody', array('uses'=> 'HomeController@jsbody', 'as'=>'jsbody.index'));
43
44 Route::resource('dashboard','DashboardController');
45 Route::resource('notification','NotificationController');
46 Route::resource('message','MessageController');
47 Route::resource('task','TaskController');
48 Route::resource('user','UserController');
49 Route::resource('group','GroupController');
50 Route::resource('role','RoleController');
51
52 Route::resource('master','MasterController');
53 Route::resource('admin','AdminController');
54 Route::resource('record','RecordController');
55
56 Route::resource('dialer','DialerController');
57 Route::resource('hr','HRController');
58 Route::resource('social','SocialController');
59 Route::resource('web','WebController');
60
61 Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions'));
62 Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store'));
63
64 Route::get('questionare/{qid?}/{optid?}/{level?}', array('uses' => 'QuestionareController@loadQuestions', 'as'=>'questionare.load_questions'));
65 Route::post('questionare', array('uses' => 'QuestionareController@saveQuestionAire', 'as'=>'questionare.save'));
66 //Route::get('notes', array('uses' => 'NotesController@index', 'as'=>'notes.index'));
67 //Route::resource('notesupdate','NotesController');
68
69 Route::get('exceldownload', function()
70 {
71 return view("layout.module.userupload.exceldata");
72 });
73
74 Route::post('useruploaddata', array('uses' => 'UserController@userUpload', 'as'=>'useruploaddata'));
75
76 //Supervisor Call Mangement - By Manish on 16-02-17
77 Route::get('SupervisorModule', array('uses'=> 'RecordController@supervisorUpload', 'as'=>'upload.comments'));
78
79 });
...@@ -1012,7 +1012,18 @@ public function show($id) ...@@ -1012,7 +1012,18 @@ public function show($id)
1012 } 1012 }
1013 } 1013 }
1014 1014
1015 $data="<h5>Bucket : $bucket</h5>$message_display<hr>$summarycounts<br>"; 1015 $data="<h5>Bucket : $bucket</h5>$message_display<hr>$summarycounts";
1016 /* Code for last login details Flexydial Security Patch*/
1017 $userlogin_id=Auth::user()->id;
1018 $user_login_datetime= UserLog::where('user_id', $userlogin_id)->orderBy('id', 'desc')->skip(1)->take(1)->get();
1019
1020 foreach ($user_login_datetime as $user_login_datetime_key => $user_login_datetime_val)
1021 {
1022 $last_login_details=date('Y-m-d H:i:s',strtotime('+5 hour +30 minutes',strtotime($user_login_datetime_val->updated_at)));
1023
1024 $data.="<h5 align='right'><span class='glyphicon glyphicon-user'></span>Last Login Details :$last_login_details</h5><br>";
1025 }
1026 /* Code for last login details Flexydial Security Patch*/
1016 //code end 1027 //code end
1017 1028
1018 $data.="<a class='pre_nxt' href='#' onclick=\"dialerLoadData('$bucket','$currentstatus','$legalstatus',".($page-1).",$('#dialerbkey').html(),$('#dialerbtxt').val());return false;\">&lt;&lt; Previous Page</a> 1029 $data.="<a class='pre_nxt' href='#' onclick=\"dialerLoadData('$bucket','$currentstatus','$legalstatus',".($page-1).",$('#dialerbkey').html(),$('#dialerbtxt').val());return false;\">&lt;&lt; Previous Page</a>
......
...@@ -39,7 +39,7 @@ class Kernel extends HttpKernel ...@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
39 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 39 \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
40 \Illuminate\Session\Middleware\StartSession::class, 40 \Illuminate\Session\Middleware\StartSession::class,
41 \Illuminate\View\Middleware\ShareErrorsFromSession::class, 41 \Illuminate\View\Middleware\ShareErrorsFromSession::class,
42 //\App\Http\Middleware\VerifyCsrfToken::class, 42 \App\Http\Middleware\VerifyCsrfToken::class,
43 \App\Http\Middleware\BeforeFilter::class, 43 \App\Http\Middleware\BeforeFilter::class,
44 \App\Http\Middleware\AfterFilter::class, 44 \App\Http\Middleware\AfterFilter::class,
45 ], 45 ],
......
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.
1 <?php
2
3 namespace App\Models;
4 use Illuminate\Database\Eloquent\Model;
5
6 class ComplaintCategory extends Model{
7
8 protected $table = 'complaint_category';
9
10 protected $fillable = ['category'];
11
12 }
1 <?php
2
3 namespace App\Models;
4 use Illuminate\Database\Eloquent\Model;
5
6 class ComplaintResolclassUnit extends Model{
7
8 protected $table = 'complaint_resol_class_unit';
9
10 protected $fillable = ['resolve_class_unit'];
11
12 }
1 <?php
2
3 namespace App\Models;
4 use Illuminate\Database\Eloquent\Model;
5
6 class ComplaintSubCategory extends Model{
7
8 protected $table = 'complaint_sub_category';
9
10 protected $fillable = ['sub_category','resolve_class_unit_id','category_id'];
11
12 }
...@@ -394,10 +394,10 @@ class User extends Authenticatable ...@@ -394,10 +394,10 @@ class User extends Authenticatable
394 { 394 {
395 $passwordErr = "Your Password Must Contain At Least 1 Number!"; 395 $passwordErr = "Your Password Must Contain At Least 1 Number!";
396 } 396 }
397 else if(!preg_match("/[A-Z]/",$password)) 397 // else if(!preg_match("/[A-Z]/",$password))
398 { 398 // {
399 $passwordErr = "Your Password Must Contain At Least 1 Capital Letter!"; 399 // $passwordErr = "Your Password Must Contain At Least 1 Capital Letter!";
400 } 400 // }
401 else if(!preg_match("/[a-z]/",$password)) 401 else if(!preg_match("/[a-z]/",$password))
402 { 402 {
403 $passwordErr = "Your Password Must Contain At Least 1 Lowercase Letter!"; 403 $passwordErr = "Your Password Must Contain At Least 1 Lowercase Letter!";
......
...@@ -93,7 +93,9 @@ return [ ...@@ -93,7 +93,9 @@ return [
93 "Text Search"=>["menuAction('record/textsearch');"], 93 "Text Search"=>["menuAction('record/textsearch');"],
94 "Master Report"=>["showBlock('MainReport');"], 94 "Master Report"=>["showBlock('MainReport');"],
95 "Bulk Upload"=>["menuAction('record/bulkupload');"]]], 95 "Bulk Upload"=>["menuAction('record/bulkupload');"]]],
96 "Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"], 96 /*Code commented for Flexydial security purpose*/
97 /*"Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"],*/
98 /*Code commented for Flexydial security purpose*/
97 "Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer", 99 "Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer",
98 "submenu"=>["Dialer"=>["kDialerModel();"], 100 "submenu"=>["Dialer"=>["kDialerModel();"],
99 "Reports"=>["menuAction('dialer/reports');"], 101 "Reports"=>["menuAction('dialer/reports');"],
......
...@@ -103,8 +103,57 @@ class FrameworkDbSchema extends Migration { ...@@ -103,8 +103,57 @@ class FrameworkDbSchema extends Migration {
103 $table->string('userremarks', 5000); 103 $table->string('userremarks', 5000);
104 $table->longText('userdata'); 104 $table->longText('userdata');
105 $table->string('group', 200)->index('group'); 105 $table->string('group', 200)->index('group');
106 $table->integer('attempt');
107 $table->string('priority', 10);
108 $table->longText('question');
106 }); 109 });
107 DB::statement("ALTER TABLE `crmcalls` ADD INDEX(`created_at`);"); 110 DB::statement("ALTER TABLE `crmcalls` ADD INDEX(`created_at`);");
111
112 Schema::create('crmcalls_archive', function(Blueprint $table)
113 {
114 $table->bigIncrements('id');
115 $table->timestamps();
116 $table->string('number', 100)->index('number');
117 $table->integer('user_id')->index('user_id');
118 $table->integer('sipid_id');
119 $table->integer('crm_id')->index('crm_id');
120 $table->string('client', 200)->index('campaign_id');
121 $table->string('department', 200)->index('list_id');
122 $table->string('state', 50);
123 $table->string('hsource', 100);
124 $table->string('type', 50);
125 $table->string('statuscode', 20);
126 $table->string('status', 100)->index('status');
127 $table->string('substatus', 100);
128 $table->integer('dialline_id');
129 $table->string('did', 50)->index('did');
130 $table->bigInteger('ts_Wait');
131 $table->bigInteger('ts_Call');
132 $table->bigInteger('ts_Talk');
133 $table->bigInteger('ts_Recstart');
134 $table->bigInteger('ts_Recend');
135 $table->bigInteger('ts_Dispo');
136 $table->bigInteger('ts_Close');
137 $table->integer('waitSec');
138 $table->integer('callSec');
139 $table->integer('talkSec');
140 $table->integer('recstartSec');
141 $table->integer('recendSec');
142 $table->integer('dispoSec');
143 $table->longText('data');
144 $table->integer('recsize');
145 $table->string('uniqueid', 100)->index('uniqueid');
146 $table->string('userstatus', 200)->index('userstatus');
147 $table->string('usersubstatus', 200);
148 $table->dateTime('usercallback');
149 $table->string('userremarks', 5000);
150 $table->longText('userdata');
151 $table->string('group', 200)->index('group');
152 $table->integer('attempt');
153 $table->string('priority', 10);
154 $table->longText('question');
155 });
156 DB::statement("ALTER TABLE `crmcalls_archive` ADD INDEX(`created_at`);");
108 157
109 Schema::create('crmcampaigns', function(Blueprint $table) 158 Schema::create('crmcampaigns', function(Blueprint $table)
110 { 159 {
...@@ -365,6 +414,13 @@ class FrameworkDbSchema extends Migration { ...@@ -365,6 +414,13 @@ class FrameworkDbSchema extends Migration {
365 $table->dateTime('dialer_lastcall')->index('dialer_lastcall'); 414 $table->dateTime('dialer_lastcall')->index('dialer_lastcall');
366 $table->integer('crmlist_id')->index('crmlist_id'); 415 $table->integer('crmlist_id')->index('crmlist_id');
367 $table->string('group', 200)->index('group'); 416 $table->string('group', 200)->index('group');
417 $table->string('bttc', 20);
418 $table->string('service_vs_product', 30);
419 $table->string('resolution', 30);
420 $table->string('satisfaction', 30);
421 $table->string('final_call_assessment', 30);
422 $table->longText('question');
423 $table->string('mf_isa', 30);
368 }); 424 });
369 DB::statement('ALTER TABLE `records` ADD FULLTEXT(`peopledata`);'); 425 DB::statement('ALTER TABLE `records` ADD FULLTEXT(`peopledata`);');
370 426
...@@ -528,6 +584,15 @@ class FrameworkDbSchema extends Migration { ...@@ -528,6 +584,15 @@ class FrameworkDbSchema extends Migration {
528 $table->integer('confup'); 584 $table->integer('confup');
529 $table->string('clients', 10000); 585 $table->string('clients', 10000);
530 }); 586 });
587
588 Schema::create('supervisor_message', function(Blueprint $table) {
589 $table->bigIncrements("id");
590 $table->timestamps();
591 $table->string("sup_id","20");
592 $table->string("agents","1000");
593 $table->string("message","500");
594 $table->string("status","1000");
595 });
531 596
532 Schema::create('userlogs', function(Blueprint $table) 597 Schema::create('userlogs', function(Blueprint $table)
533 { 598 {
...@@ -572,8 +637,111 @@ class FrameworkDbSchema extends Migration { ...@@ -572,8 +637,111 @@ class FrameworkDbSchema extends Migration {
572 $table->string('exten', 50); 637 $table->string('exten', 50);
573 $table->string('extencontext', 100); 638 $table->string('extencontext', 100);
574 $table->string('manager', 200); 639 $table->string('manager', 200);
640 $table->string('dialmode_assign', 20);
641 });
642
643 Schema::create('agent_notes', function(Blueprint $table) {
644 $table->bigIncrements('id');
645 $table->timestamps();
646 $table->integer('user_id');
647 $table->string('field_1', 100);
648 $table->string('field_2', 100);
649 $table->string('field_3', 100);
650 $table->string('field_4', 100);
651 $table->string('field_5', 100);
652 $table->string('field_6', 100);
653 $table->string('field_7', 100);
654 $table->string('field_8', 100);
655 $table->string('field_9', 100);
656 $table->string('field_10', 100);
657 $table->string('field_11', 100);
658 $table->string('field_12', 100);
659 $table->string('field_13', 100);
660 $table->string('field_14', 100);
661 $table->string('field_15', 100);
662 $table->string('field_16', 100);
663 $table->string('field_17', 100);
664 $table->string('field_18', 100);
665 $table->string('field_19', 100);
666 $table->string('field_20', 100);
667 $table->string('field_21', 100);
668 $table->string('field_22', 100);
669 $table->string('field_23', 100);
670 $table->string('field_24', 100);
671 $table->string('field_25', 100);
672 $table->string('field_26', 100);
673 $table->string('field_27', 100);
674 $table->string('field_28', 100);
675 $table->string('field_29', 100);
676 $table->string('field_30', 100);
677 $table->string('field_31', 100);
678 $table->string('field_32', 100);
679 $table->string('field_33', 100);
680 $table->string('field_34', 100);
681 $table->string('field_35', 100);
682 $table->string('field_36', 100);
683 $table->string('field_37', 100);
684 $table->string('field_38', 100);
685 $table->string('field_39', 100);
686 $table->string('field_40', 100);
687 $table->string('field_41', 100);
688 $table->string('field_42', 100);
689 $table->string('field_43', 100);
690 $table->string('field_44', 100);
691 $table->string('field_45', 100);
692 $table->string('field_46', 100);
693 $table->string('field_47', 100);
694 $table->string('field_48', 100);
695 $table->string('field_49', 100);
696 $table->string('field_50', 100);
697 });
698
699 Schema::create('full_remark', function(Blueprint $table) {
700 $table->bigIncrements('id');
701 $table->timestamps();
702 $table->integer('call_id')->index('call_id');
703 $table->string('fullremark', 5000);
575 }); 704 });
576 705
706 Schema::create('authentication_questions', function(Blueprint $table) {
707 $table->bigIncrements('id');
708 $table->timestamps();
709 $table->integer('question_no');
710 $table->integer('group_id');
711 $table->string('question', 200);
712 $table->string('opt_1', 100);
713 $table->string('opt_2', 100);
714 $table->string('opt_3', 100);
715 $table->string('opt_4', 100);
716 });
717
718 Schema::create('question', function(Blueprint $table) {
719 $table->bigIncrements('id');
720 $table->timestamps();
721 $table->integer('question_no');
722 $table->string('questions', 500);
723 $table->string('opt_1', 200);
724 $table->string('opt_2', 200);
725 $table->string('opt_3', 200);
726 $table->string('opt_4', 200);
727 $table->string('opt_5', 200);
728 $table->string('opt_6', 200);
729 $table->string('opt_7', 200);
730 $table->string('opt_8', 200);
731 $table->string('opt_9', 200);
732 $table->string('opt_10', 200);
733 $table->string('type', 100);
734 $table->string('compulsory_qes', 30);
735 });
736
737 Schema::create('question_tree', function(Blueprint $table) {
738 $table->bigIncrements('id');
739 $table->timestamps();
740 $table->integer('parent_id');
741 $table->string('parent_opt', 200);
742 $table->integer('question_id');
743 $table->integer('priority');
744 });
577 745
578 $server=Config::get("app.app_ip"); 746 $server=Config::get("app.app_ip");
579 747
...@@ -687,10 +855,9 @@ class FrameworkDbSchema extends Migration { ...@@ -687,10 +855,9 @@ class FrameworkDbSchema extends Migration {
687 855
688 \DB::table('sipids')->delete(); 856 \DB::table('sipids')->delete();
689 $cnt=0; 857 $cnt=0;
690 for($j=1;$j<=20;$j++) 858
691 {
692 $sipids=array(); 859 $sipids=array();
693 for($i=(($j*1000)+1);$i<=(($j*1000)+1000);$i++) 860 for($i=1;$i<=1000;$i++)
694 { 861 {
695 $sipids[$cnt++]=array( 862 $sipids[$cnt++]=array(
696 'id' => $i, 863 'id' => $i,
...@@ -705,7 +872,6 @@ class FrameworkDbSchema extends Migration { ...@@ -705,7 +872,6 @@ class FrameworkDbSchema extends Migration {
705 ); 872 );
706 } 873 }
707 \DB::table('sipids')->insert($sipids); 874 \DB::table('sipids')->insert($sipids);
708 }
709 875
710 876
711 \DB::table('users')->delete(); 877 \DB::table('users')->delete();
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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.
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.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!