09d1b760 by Manish Mihsra

Deleted unwanted files

1 parent 5312c7ba
Showing 1000 changed files with 269 additions and 4428 deletions

Too many changes to show.

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

<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class CreportEight extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'CreportEight';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for CreportEight';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".date("d_m_Y");
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(crmcall_id) as maxid from $calllog_report where server='$server_id'"));
$maxids=$maxid[0]->maxid;
$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))."'"));
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";$record_id="";
if($aline->crm_id>0)
{
$user=DB::select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$record_id=$user[0]->id;
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$globalid=$server_id.$record_id;
$setstrarr[]="server='$server_id'";
$setstrarr[]="record_id='$record_id'";
$setstrarr[]="crmcall_id='$aline->id'";
$setstrarr[]="globalid='$globalid'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
$setstrarr[]="userdata='$aline->userdata'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class DailyLogout extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'DailyLogout';
/**
* The console command description.
*
* @var string
*/
protected $description = 'DailyLogout';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$sipids=Sipid::where("status","=","1")->get();
foreach($sipids as $tsip)
{
$newqueue=new Kqueue();
$newqueue->sipNotify($tsip,"adminCommand","user","logout","");
}
Dialline::where('status','!=','Free')->update(['status'=>'Free','conf'=>'','channel'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
Sipid::where('status','!=','0')->update(['status'=>0,'user'=>0,'ready'=>0,'confup'=>0,'clients'=>'','server'=>'','updated_at'=>'0000-00-00 00:00:00']);
$serverarray=explode(",",Config::get("app.asterisk_slaves"));
foreach($serverarray as $server)
{
$sparts=explode(":",$server);
Sipid::where("id",">=",$sparts[1])->where("id","<=",$sparts[2])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
Dialline::where("id",">=",$sparts[3])->where("id","<=",$sparts[4])->update(['server' => $sparts[0],'updated_at'=>'0000-00-00 00:00:00']);
$newqueue=new Kqueue();
$newqueue->astCommand($sparts[0],"channel request hangup all");
}
User::where('presence','>','0')->update(['presence'=>0]);
Session::truncate();
return "";
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class DeleteCrmcalls extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'DeleteCrmcalls';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete data from CRMCalls before 7 days';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$logdate=strtotime('-7 day');
CRMCall::where('created_at','<',date("Y-m-d",$logdate))->delete();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class InsertCrmArchive extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'InsertCrmArchive';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Insert updated data into crmcalls_archive from crmcalls';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo 'Start';
DB::insert(DB::raw("insert into crmcalls_archive select * from crmcalls where id>(select max(id) from crmcalls_archive)"));
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"));
echo 'End';
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class KstychDaily extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychDaily';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->update(array('postdata'=>'','queries'=>''));
Accesslog::where('endtime','<',date("Y-m-d H:i:s",$nowts-2*24*60*60))->delete();
if(env('app_ip')=="10.3.177.14")
{
if(!Schema::hasTable('calllog_report'))
{
Schema::create('calllog_report', function(Blueprint $table)
{
$table->string('server', 100);
$table->dateTime('start');
$table->integer('length');
$table->string('user',100);
$table->string('name',100);
$table->string('dispo', 200);
$table->string('subdispo', 200);
$table->dateTime('callback');
$table->string('number', 100);
$table->string('clientcode', 100);
$table->string('currentstatus', 100);
$table->string('legalstatus', 100);
$table->string('client', 200);
$table->string('department', 200);
$table->string('state', 50);
$table->string('hsource', 100);
$table->string('type', 50);
$table->string('statuscode', 20);
$table->string('status', 100);
$table->string('statusstr', 100);
$table->integer('dialline');
$table->string('did', 50);
$table->bigInteger('waitsec');
$table->bigInteger('callsec');
$table->bigInteger('talksec');
$table->bigInteger('disposec');
$table->string('remarks', 500);
$table->string('userdata',1000);
});
}
$offline=array();
$arr=Config::get("app.hdfcnodes");
$logdate=strtotime('-1 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$ii=1;$ci=0;
foreach($arr as $server=>$serverline)
{
$ci++;
$conn = array(
'driver' => 'mysql',
'host' => $server,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn$ci", $conn);
try
{
DB::connection("conn$ci")->getDatabaseName();
$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();
$userarr=array();
foreach($alist as $aline)
{
$setstrarr=array();
$clientcode="";$currentstatus="";$legalstatus="";
if($aline->crm_id>0)
{
$user=DB::connection("conn$ci")->select(DB::raw("select id,clientcode,currentstatus,legalstatus from records where id='".$aline->crm_id."' limit 1;"));
if(isset($user[0]))
{
$clientcode=$user[0]->clientcode;
$currentstatus=$user[0]->currentstatus;
$legalstatus=$user[0]->legalstatus;
}
}
$tpostdata=json_decode($aline->data,true);
$fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)+330*60);
$talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec;
$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2);
if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id);
$dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname();
$username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username;
$setstrarr[]="server='$server'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
$setstrarr[]="name='$dispname'";
$setstrarr[]="dispo='$aline->userstatus'";
$setstrarr[]="subdispo='$aline->usersubstatus'";
$setstrarr[]="callback='$aline->usercallback'";
$setstrarr[]="number='$aline->number'";
$setstrarr[]="clientcode='$clientcode'";
$setstrarr[]="currentstatus='$currentstatus'";
$setstrarr[]="legalstatus='$legalstatus'";
$setstrarr[]="client='$aline->client'";
$setstrarr[]="department='$aline->department'";
$setstrarr[]="state='$aline->state'";
$setstrarr[]="hsource='$aline->hsource'";
$setstrarr[]="type='$aline->type'";
$setstrarr[]="status='$aline->status'";
$setstrarr[]="statuscode='$aline->statuscode'";
$setstrarr[]="statusstr='$aline->substatus'";
$setstrarr[]="dialline='$aline->dialline_id'";
$setstrarr[]="did='$aline->did'";
$setstrarr[]="waitsec='".round($aline->waitSec/1000,2)."'";
$setstrarr[]="callsec='".round($aline->callSec/1000,2)."'";
$setstrarr[]="talksec='".round($talktime/1000,2)."'";
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='$aline->userremarks'";
$setstrarr[]="userdata='$aline->userdata'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into calllog_report set $setstr"));
}
}
catch(Exception $e)
{
$offline[]=$server;
}
}
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\KPAGIListen;
class KstychPAGI extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychPAGI';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Daemon to Listen to Asterisk';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$agi = \PAGI\Client\Impl\ClientImpl::getInstance();
$kpagi = new KPAGIListen(array('pagiClient' => $agi));
$kpagi->init();
$kpagi->run();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\KPAMIListen;
class KstychPAMI extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychPAMI {serverip=127.0.0.1}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Daemon to Listen to Asterisk';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$listener = new KPAMIListen($this->argument('serverip'));$listener->run();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class Userlog_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'Userlog_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Userlog_data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
$logdate=strtotime('-1 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$i=0;
$ulist=DB::select(DB::raw("select * from users WHERE 1"));
foreach($ulist as $uline) {
$users[$uline->id] = $uline->username;
}
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)."'"))){
foreach($alist as $aline) {
$i++;
$global_id = $server_id . $i;
if($aline->enddate=='0000-00-00'|| $aline->endtime=='00:00:00' || $aline->durationsec=='0')
{
$enddatetime=date("Y-m-d H:i:s",strtotime($aline->updated_at));
$enddate=explode(" ",$enddatetime)[0];
$endtime=explode(" ",$enddatetime)[1];
$durationsec=date("Y-m-d H:i:s",strtotime($endtime-$aline->starttime));
}
else
{
$enddate=$aline->enddate;
$endtime=$aline->endtime;
$durationsec=$aline->durationsec;
}
$rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$enddate,'endtime'=>$endtime,
'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'=>''
);
$data=json_decode($aline->data,true);
foreach($data as $sipid=>$sdata)
{
$prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
if(isset($sdata['states']))
{
$previous="login";
foreach($sdata['states'] as $fts=>$states)
{
if($states[0] != 1)
{
$rowdata[$previous] +=round(($fts-$prets)/1000,2);
$previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
$prets=$fts;
}
}
$rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
}
}
$rowdata["login"] = $aline->durationsec;
$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'];
$key_value = '';
foreach($rowdata AS $key=>$value) {
if($key != 1)
$key_value .= "`$key` = '$value', ";
}
$startTime=$aline->startdate." ".$aline->starttime;
$endTime=$aline->enddate." ".$aline->endtime;
$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."'"));
$ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
$progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
$manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
$inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
$tt_prog=0;$tt_man=0;$tt_inb=0;
if($crmCalls!=null){
foreach($crmCalls as $crmCall){
$ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
if($crmCall->type == 'Progressive')
{
$progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Manual')
{
$manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Inbound')
{
$inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
}
}
$tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
$tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
$tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
$prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
$key_value .= "`tt_prog` = '$tt_prog', ";
$key_value .= "`tt_man` = '$tt_man', ";
$key_value .= "`tt_inb` = '$tt_inb', ";
$key_value .= "`ts_Wait` = '$ts_Wait', ";
$key_value .= "`ts_Call` = '$ts_Call', ";
$key_value .= "`ts_Talk` = '$ts_Talk', ";
$key_value .= "`ts_Dispo` = '$ts_Dispo', ";
$key_value .= "`progts_Wait` = '$progTs_Wait', ";
$key_value .= "`progts_Call` = '$progTs_Call', ";
$key_value .= "`progts_Talk` = '$progTs_Talk', ";
$key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
$key_value .= "`mants_Wait` = '$manTs_Wait', ";
$key_value .= "`mants_Call` = '$manTs_Call', ";
$key_value .= "`mants_Talk` = '$manTs_Talk', ";
$key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
$key_value .= "`incts_Wait` = '$inbTs_Wait', ";
$key_value .= "`incts_Call` = '$inbTs_Call', ";
$key_value .= "`incts_Talk` = '$inbTs_Talk', ";
$key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
$key_value .= "`prod_tos` = '$prod_TOS', ";
$key_value = substr($key_value, 0, -2);
$userlogsTable = "userlogs_".date("d_m_Y",$logdate);
DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
}
}
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class Userlog_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'Userlog_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Userlog_data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
$logdate=strtotime('-1 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip='10.3.179.121';
$server_id='08';
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
$i=0;
$ulist=DB::select(DB::raw("select * from users WHERE 1"));
foreach($ulist as $uline) {
$users[$uline->id] = $uline->username;
}
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)."'"))){
foreach($alist as $aline) {
$i++;
$global_id = $server_id . $i;
$rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$aline->enddate,'endtime'=>$aline->endtime,
'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'=>''
);
$data=json_decode($aline->data,true);
foreach($data as $sipid=>$sdata)
{
$prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
if(isset($sdata['states']))
{
$previous="login";
foreach($sdata['states'] as $fts=>$states)
{
if($states[0] != 1)
{
$rowdata[$previous] +=round(($fts-$prets)/1000,2);
$previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
$prets=$fts;
}
}
$rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
}
}
$rowdata["login"] = $aline->durationsec;
$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'];
$key_value = '';
foreach($rowdata AS $key=>$value) {
if($key != 1)
$key_value .= "`$key` = '$value', ";
}
$startTime=$aline->startdate." ".$aline->starttime;
$endTime=$aline->enddate." ".$aline->endtime;
$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."'"));
$ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0;
$progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0;
$manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0;
$inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0;
$tt_prog=0;$tt_man=0;$tt_inb=0;
if($crmCalls!=null){
foreach($crmCalls as $crmCall){
$ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
if($crmCall->type == 'Progressive')
{
$progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Manual')
{
$manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
if($crmCall->type == 'Inbound')
{
$inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2);
$inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2);
$inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2);
$inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2);
}
}
}
$tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo;
$tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo;
$tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo;
$prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo;
$key_value .= "`tt_prog` = '$tt_prog', ";
$key_value .= "`tt_man` = '$tt_man', ";
$key_value .= "`tt_inb` = '$tt_inb', ";
$key_value .= "`ts_Wait` = '$ts_Wait', ";
$key_value .= "`ts_Call` = '$ts_Call', ";
$key_value .= "`ts_Talk` = '$ts_Talk', ";
$key_value .= "`ts_Dispo` = '$ts_Dispo', ";
$key_value .= "`progts_Wait` = '$progTs_Wait', ";
$key_value .= "`progts_Call` = '$progTs_Call', ";
$key_value .= "`progts_Talk` = '$progTs_Talk', ";
$key_value .= "`progts_Dispo` = '$progTs_Dispo', ";
$key_value .= "`mants_Wait` = '$manTs_Wait', ";
$key_value .= "`mants_Call` = '$manTs_Call', ";
$key_value .= "`mants_Talk` = '$manTs_Talk', ";
$key_value .= "`mants_Dispo` = '$manTs_Dispo', ";
$key_value .= "`incts_Wait` = '$inbTs_Wait', ";
$key_value .= "`incts_Call` = '$inbTs_Call', ";
$key_value .= "`incts_Talk` = '$inbTs_Talk', ";
$key_value .= "`incts_Dispo` = '$inbTs_Dispo', ";
$key_value .= "`prod_tos` = '$prod_TOS', ";
$key_value = substr($key_value, 0, -2);
$userlogsTable = "userlogs_".date("d_m_Y",$logdate);
DB::connection("conn")->insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
}
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "1";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
echo $central_ip;
echo $location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_1 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_1';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_1';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "2";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_2 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_2';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_2';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "3";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_3 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_3';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_3';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "4";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_4 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_4';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_4';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "5";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_5 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_5';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_5';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "6";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_6 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_6';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_6';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "6";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_daily extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_daily';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_daily';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//echo "\n".date('Y-m-d')."\n";
echo "1";
echo "\n".date('Y-m-d H:i:s')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$kformlib=new \App\Jobs\KFormLib($wakka->HRCoreVars["HRFiledsStr"]);
$kformlib->gthis=$wakka;
$themehome=$wakka->GetThemePath('/');
$updatetime=time();
$clientlst=$wakka->GetBBBUserData("clientslist");
$isadmin=$wakka->IsAdmin();
$username=$wakka->GetUserName();
$triggers=Input::get("triggers");
$tmpstr=explode(",",$kformlib->HRFiledsStr);
$success="";$message="";$successcnt=0;$duplicatecount=0;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
DB::connection("conn")->getDatabaseName();
$serverclist=DB::connection("conn")->select(DB::raw("select location from server_details where server_ip='$server_ip'"));
$location=$serverclist[0]->location;
echo $central_ip;
echo $location;
$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"));
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
foreach($excelarray as $key => $array){
$excelarray[$key] = (array)$array;
}
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) as cnt from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestColumn = $highestColumn[0]->cnt;
$highestrow = count($excelarray);
$flag = 0;
$editflag=0;
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
if($excelarray[$i]["id"]=="CREATE")
{
$excelarray[$i]["id"]=$wakka->Query("insert into","","records",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPerson($excelarray[$i]["id"]);
$ppldata=$empdata["peopledata"];
$createdlog=$empdata['modifylog'];
$fdirty=$empdata['dirty'];
$createdlog[$updatetime]=$username."::";
$createdlog["updated"]=$updatetime;
$newdata=$ppldata;
foreach($excelarray[$i] as $key => $value)
{
if($value!="")
{
if("A".$ppldata[$key]!="A".$value)//forcing string comparrision //MAGIC
{
$value=str_replace("'"," ",$value);
if(strstr($createdlog[$updatetime],$key)==FALSE)$createdlog[$updatetime].="$key|".str_replace(array("|",",")," ",$ppldata[$key])."|".str_replace(array("|",",")," ",$value).",";
$fdirty[$key]=1;
$newdata[$key]=$value;
}
}
}
/*Start - Changes need to be done*/
if($excelarray[$i]["status"]==null)
{
$empdata['status'] = "rom";
}
if($excelarray[$i]["dialer_status"]==null)
{
$empdata['dialer_status'] = "rom";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$empdata['dialer_substatus'] = "rom";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPerson($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $excelarray[$i];
}
else
{
$reason = "";
$reason .= "Record ID is not on local server,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['record_id'] = $excelarray[$i]["id"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
else
{
$reason = "";
if($excelarray[$i]["id"]=="")
$reason .= "Column ID is blank,";
$excelarray[$i]['server_ip'] =$server_ip;
$excelarray[$i]['location'] =$location;
if($excelarray[$i]["clientcode"]!="")
$excelarray[$i]['cust_id'] =$excelarray[$i]["clientcode"];
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
$setSuccess=array();
$setSuccess[] = "server_ip='$server_ip'";
$setSuccess[] = "location='$location'";
$setSuccess[] = "record_id='".$succes['id']."'";
$setSuccess[] = "cust_id='".$succes['clientcode']."'";
$setSuccess[] = "modified='".$succes['modified']."'";
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='$server_ip' and id='".$succes['id']."'"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
$setFailure=array();
$setFailure[] = "server_ip='$server_ip'";
$setFailure[] = "location='$location'";
$setFailure[] = "cust_id='".$failur['clientcode']."'";
$setFailure[] = "record_id='".$failur['record_id']."'";
$setFailure[] = "reason='".$failur['Reason']."'";
$setFailure = implode(",",$setFailure);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure_daily set $setFailure"));
}
}
//DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat_daily` where SERVER_IP='10.3.179.121'"));
DB::connection("conn")->disconnect();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class recording_reconcilation extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'recording_reconcilation';
/**
* The console command description.
*
* @var string
*/
protected $description = 'recording_reconcilation';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime(date('Y-m-d')." 00:00:00");
//$logdate=strtotime("-1 days"." 00:00:00");
$logtodate=strtotime(date('Y-m-d')." 23:59:59");
//$logtodate=strtotime("-1 days"." 23:59:59");
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$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");
$ftp_server="10.3.177.14";
$ftp_user_name="buzzworks";
$ftp_user_pass="0per@ti0n@1";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
//check maximum id saved in the table
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(call_id) as maxid from recording_reconcilation where server_ip='$server_ip'"));
if($maxid)$maxids=$maxid[0]->maxid;
echo "\n"."maxids---".$maxids."\n";
echo "\n".date("Y-m-d H:i:s",$logdate)."\n";
echo "\n".date("Y-m-d H:i:s",$logtodate)."\n";
//query for calllog and recording
/*$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();*/
$qlist=DB::table('crmcalls')->select('*')->where('id','=','1079409')->get();
//create csv file
$ii=1;
$fileName = 'recording_Excel_'.date("Y-m-d",$logdate);
$fileName=storage_path().'/recording_excel/'.$fileName .'.csv';
$filesave = fopen($fileName, 'w');
fputcsv($filesave, $reporthead);
$userdatavalue="";
foreach ($qlist as $qline)
{
$fulldate=date("Y-m-d H:i:s",strtotime($qline->created_at)+330*60);
//$talktime=$qline->talkSec+$qline->recstartSec+$qline->recendSec;
//$length=round(($qline->waitSec+$qline->callSec+$talktime+$qline->dispoSec)/1000,2);
$length=round(($qline->talkSec+$qline->recstartSec+$qline->recendSec)/1000,2);
echo "\n"."startdate--".explode(" ",$fulldate)[0]."\n";
echo "\n"."starttime--".explode(" ",$fulldate)[1]."\n";
echo "\n"."call duration--". $length."\n";
$userdatavalue="";
$userdata=json_decode($qline->userdata,true);
//print_r(array_values($userdata));
if($userdata)
{
if(array_values($userdata)!=""||array_values($userdata)!=null)
{
$userdatavalue=implode(",",array_values($userdata));
}
else
{
$userdatavalue="";
}
}
$setstrarr=array();
$setstrarr[]="server_ip='$server_ip'";
$setstrarr[]="call_id='$qline->id'";
$setstrarr[]="call_start_date='".explode(" ",$fulldate)[0]."'";
$setstrarr[]="call_start_time='".explode(" ",$fulldate)[1]."'";
$setstrarr[]="call_duration='$length'";
$setstrarr[]="DNIS='$qline->did'";
$setstrarr[]="ANI='$qline->number'";
$setstrarr[]="call_direction='$qline->type'";
$setstrarr[]="cti_var1='$userdatavalue'";
$setstrarr[]="cti_var2='$qline->client'";
$setstrarr[]="cti_var4='$qline->crm_id'";
//send recording file to server
$file = storage_path()."/app/drec/2017-09/".$qline->id.".gsm";//tobe uploaded
//$remote_file = "/home/buzzworks/recording_test";
$remote_file = "recording_test/".$server_ip."_".$qline->id.".wav";
/*$out='wav';
header("Content-type: audio/x-$out");
header("Content-disposition: attachment; filename=\"".basename($file).".$out\"");
$descriptorspec = array(0 => array("pipe", "r"),1 => array("pipe", "w"),2 => array("pipe", "w"));
$process = proc_open( "/usr/bin/sox $file /tmp/".basename($file).".$out", $descriptorspec, $pipes );
while( stream_get_contents( $pipes[1] ));
header("Content-length: ".filesize("/tmp/".basename($file).".$out"));
readfile("/tmp/".basename($file).".$out");unlink("/tmp/".basename($file).".$out");
fclose( $pipes[1] );
fclose( $pipes[2] );*/
// set up basic connection
if($login_result)
{
echo "Successfully connect";
if (file_exists($file))
{
echo "The file $file exists";
if(ftp_put($conn_id, $remote_file, $file, FTP_BINARY))
{
echo "successfully uploaded $file\n";
$setstrarr[]="transfer_status='success'";
$setstrarr[]="recording_filename='$remote_file'";
$success_fail="success";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into recording_reconcilation set $setstr"));
$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);
fputcsv($filesave, $data);
}
else
{
echo "There was a problem while uploading $file\n";
$setstrarr[]="transfer_status='fail'";
$success_fail="fail";
}
}
else
{
echo "The file $file does not exist";
$setstrarr[]="transfer_status='file does not exist'";
$success_fail="file does not exist";
}
}
else
{
echo "not connect to server";
}
// close the connection
}
echo "file save\n";
fclose($filesave);
ftp_close($conn_id);
//send csv file to ftp server
$conn_id_csv = ftp_connect($ftp_server);
$remote_filecsv = "recording_excel/".$server_ip."_".date("Y-m-d",$logdate).".csv";
$login_result_csv = ftp_login($conn_id_csv, $ftp_user_name, $ftp_user_pass);
if($login_result_csv)
{
if (file_exists($fileName))
{
echo "The file $fileName exists\n";
if(ftp_put($conn_id_csv, $remote_filecsv, $fileName, FTP_BINARY))
{
echo "successfully uploaded $fileName\n";
}
else
{
echo "There was a problem while uploading $fileName\n";
}
}
else
{
echo "The file $fileName does not exist";
}
}
else
{
echo "not connect to server";
}
ftp_close($conn_id_csv);
DB::connection("conn")->disconnect();
}
}
}
?>
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class records_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'records_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'records_details';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id,location from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$location=$serverclist[0]->location;
echo ",".$server_ip;
$qlist=DB::select(DB::raw("SELECT id,clientcode,client,status,clientinternalid,mobile,priority,modified,question,firstname FROM `records`"));
$datainser='';
foreach($qlist as $qline)
{
$record_id=$qline->id;
$clientcode=$qline->clientcode;
$client=$qline->client;
$status=$qline->status;
$clientinternalid=$qline->clientinternalid;
$mobile=$qline->mobile;
$priority=$qline->priority;
$modified=$qline->modified;
$question=$qline->question;
$firstname=$qline->firstname;
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'"));
}
DB::connection("conn")->disconnect();
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;
use Illuminate\Database\Schema\Blueprint;
class relationship_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
echo 'Start';
$local_data=DB::select(DB::raw("SELECT mvalue FROM `hrms_masters` where mid='1'"));
$local_data_value=$local_data[0]->mvalue;
echo "Hrms core data----".$local_data_value;
if(is_array($local_data_value)) $core_data_value= array_map(__METHOD__, $local_data_value);
if(!empty($local_data_value) && is_string($local_data_value)) {
$core_data_value = str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $local_data_value);
echo "core data value replace".$core_data_value;
}
DB::update(DB::raw("UPDATE hrms_masters_demo SET mvalue='$core_data_value' WHERE mid='1'"));
echo 'End';
}
}
<?php namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'App\Console\Commands\KstychDaily',
'App\Console\Commands\KstychPAMI',
'App\Console\Commands\KstychPAGI',
'App\Console\Commands\DailyLogout',
'App\Console\Commands\bulkServerUpload',
'App\Console\Commands\bulkServerUpload_1',
'App\Console\Commands\bulkServerUpload_2',
'App\Console\Commands\bulkServerUpload_3',
'App\Console\Commands\bulkServerUpload_4',
//'App\Console\Commands\bulkServerUpload_5',
'App\Console\Commands\bulkServerUpload_daily',
'App\Console\Commands\InsertCrmArchive',
'App\Console\Commands\DeleteCrmcalls',
'App\Console\Commands\records_details',
'App\Console\Commands\CreportEight',
'App\Console\Commands\questionnaire_details',
'App\Console\Commands\Userlog_data',
'App\Console\Commands\lead_form_details',
'App\Console\Commands\full_remark_details',
'App\Console\Commands\recording_reconcilation',
'App\Console\Commands\dailyupload_calllog',
'App\Console\Commands\dailyupload_questionaire',
'App\Console\Commands\relationship_data',
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('KstychDaily')->daily()->withoutOverlapping();
//$schedule->command('bulkServerUpload')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('Userlog_data')->dailyAt('01:10')->appendOutputTo(storage_path()."/reason/Userlog_data.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload')->dailyAt('14:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_1')->dailyAt('16:18')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_2')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_3')->dailyAt('19:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_4')->dailyAt('20:45')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
//$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkServerUpload_daily.txt")->withoutOverlapping();
//$schedule->command('bulkServerUpload_daily')->everyMinute()->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_daily')->dailyAt('05:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_daily')->dailyAt('07:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_daily')->dailyAt('09:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_daily')->dailyAt('11:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('bulkServerUpload_daily')->dailyAt('13:05')->appendOutputTo(storage_path()."/reason/bulkserver_daily.txt")->withoutOverlapping();
$schedule->command('dailyupload_questionaire')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailyupload_questionaire.txt")->withoutOverlapping();
$schedule->command('CreportEight')->everyFiveMinutes()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping();
//$schedule->command('CreportEight')->hourly()->appendOutputTo(storage_path()."/reason/CreportEight.txt")->withoutOverlapping();
$schedule->command('questionnaire_details')->hourly()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping();
$schedule->command('InsertCrmArchive')->hourly()->withoutOverlapping();
$schedule->command('DeleteCrmcalls')->hourly()->withoutOverlapping();
$schedule->command('DailyLogout')->dailyAt('14:30')->withoutOverlapping();
$schedule->command('lead_form_details')->everyTenMinutes()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping();
$schedule->command('records_details')->dailyAt('17:45')->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping();
//$schedule->command('recording_reconcilation')->everyMinute()->appendOutputTo(storage_path()."/reason/recording_reconcilation.txt")->withoutOverlapping();
//$schedule->command('lead_form_details')->everyMinute()->appendOutputTo(storage_path()."/reason/lead_form_details.txt")->withoutOverlapping();
$schedule->command('dailyupload_calllog')->dailyAt('19:30')->appendOutputTo(storage_path()."/reason/dailycalllog_records.txt")->withoutOverlapping();
//$schedule->command('records_details')->everyMinute()->appendOutputTo(storage_path()."/reason/records_details.txt")->withoutOverlapping();
$schedule->command('full_remark_details')->hourly()->appendOutputTo(storage_path()."/reason/full_remark_details.txt")->withoutOverlapping();
//$schedule->command('questionnaire_details')->everyMinute()->appendOutputTo(storage_path()."/reason/questionnaire_details.txt")->withoutOverlapping();
//$schedule->command('relationship_data')->everyMinute()->appendOutputTo(storage_path()."/reason/relationship_data.txt")->withoutOverlapping();
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use DB;
use App\Models\ComplaintCategory;
use App\Models\ComplaintResolclassUnit;
use App\Models\ComplaintSubCategory;
use App\Models\CRMCall;
use Config;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class dailyupload_questionaire extends Command {
class complaint_data extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dailyupload_questionaire';
protected $signature = 'complaint_data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'dailyupload_questionaire';
protected $description = 'complaint_data';
/**
* Execute the console command.
......@@ -37,16 +37,12 @@ class dailyupload_questionaire extends Command {
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
echo date('Y-m-d H:i:s')."\n";
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$questionaire_details = "questionaire_details_".date("d_m_Y",$logdate);
$created_at=date("Y-m-d H:i:s");
$conn = array(
'driver' => 'mysql',
......@@ -61,59 +57,60 @@ class dailyupload_questionaire extends Command {
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
DB::table('complaint_category')->truncate();
DB::table('complaint_resol_class_unit')->truncate();
DB::table('complaint_sub_category')->truncate();
$clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $questionaire_details group by server"));
$complaintdataList = DB::connection("conn")->select(DB::raw("SELECT * FROM complaint_category"));
$caar=[];
foreach($clist as $cline)
{
$caar[$cline->server]= $cline->cnt;
}
$complaintData = 0; $newCategory = 0; $newSubCategory = 0; $newComplaintResolClassUnit = 0;
$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)."'"));
foreach ($complaintdataList as $list) {
$category = ComplaintCategory::where('category','=',$list->category)->first();
$location_cont='0';
$central_cont='0';
if(count($category)){
$categoryId = $category->id;
$location_cont=$mlist[0]->countrecord;
if(array_key_exists($server_id,$caar)){
$central_cont=$caar[$server_id];
}else{
$central_cont=0;
$addCategory = ComplaintCategory::create(['category'=>$list->category]);
$categoryId = $addCategory->id;
$newCategory++;
}
$dif=($mlist[0]->countrecord)-($central_cont);
if($dif<=1 && $dif>=-1){
$result="Y";
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'"));
$complaintResolClassUnit = ComplaintResolclassUnit::where('resolve_class_unit','=',$list->resolve_class_unit)->first();
if(count($complaintResolClassUnit)){
$complaintResolClassUnitId = $complaintResolClassUnit->id;
}else{
$addComplaintResolClassUnit = ComplaintResolclassUnit::create(['resolve_class_unit'=>$list->resolve_class_unit]);
$complaintResolClassUnitId = $addComplaintResolClassUnit->id;
$newComplaintResolClassUnit++;
}
$result="N";
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'"));
$subCategory = ComplaintSubCategory::where('resolve_class_unit_id','=',$complaintResolClassUnitId)->where('category_id','=',$categoryId)->where('sub_category','=',$list->sub_category)->first();
if(count($subCategory)){
$subCategoryId = $subCategory->id;
}else{
$addSubCategory = ComplaintSubCategory::create(['sub_category'=>$list->sub_category,'resolve_class_unit_id'=>$complaintResolClassUnitId,'category_id'=>$categoryId]);
$subCategoryId = $addSubCategory->id;
$newSubCategory++;
}
$complaintData++;
}
DB::connection("conn")->disconnect();
}
}
}
......
......@@ -13,38 +13,38 @@ use PDO;
use Illuminate\Database\Schema\Blueprint;
class questionnaire_details extends Command {
class complaint_details extends Command {
/**
/**
* The console command name.
*
* @var string
*/
protected $signature = 'questionnaire_details';
protected $signature = 'complaint_details';
/**
/**
* The console command description.
*
* @var string
*/
protected $description = 'questionnaire_details';
protected $description = 'complaint_details';
/**
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$questionaire = "questionaire_details_".date("d_m_Y");
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$central_ip=env('central_ip');
$conn = array(
......@@ -71,74 +71,69 @@ class questionnaire_details extends Command {
$server_id="0".$server_id;
}
echo ",".$server_id;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(question_id) as maxid from $questionaire where server='$server_id'"));
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(complaint_id) as maxid from complaint_details where server='$server_id'"));
$maxids=$maxid[0]->maxid;
//$qlist=DB::select(DB::raw("SELECT * from questionaire_details where id>'$maxids'"));
$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))."'"));
$qlist=DB::select(DB::raw("SELECT * from complaint_details where id>$maxids"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$crtdate=date("Y-m-d H:i:s",strtotime($qline->created_at)+330*60);
$update=date("Y-m-d H:i:s",strtotime($qline->updated_at)+330*60);
$qtime=date("Y-m-d H:i:s",strtotime($qline->question_time)+330*60);
$setstrarr[]="server='$server_id'";
$setstrarr[]="question_id='$qline->id'";
$setstrarr[]="created_at='$crtdate'";
$setstrarr[]="updated_at='$update'";
$setstrarr[]="user_id='$qline->user_id'";
$setstrarr[]="cust_id='$qline->cust_id'";
$setstrarr[]="complaint_id='$qline->id'";
$setstrarr[]="upload_date='$qline->upload_date'";
$setstrarr[]="call_id='$qline->call_id'";
$setstrarr[]="name='$qline->name'";
$setstrarr[]="number='$qline->number'";
$setstrarr[]="question_time='$qtime'";
$setstrarr[]="question='$qline->question'";
$setstrarr[]="primary_question='$qline->primary_question'";
$setstrarr[]="primary_response='$qline->primary_response'";
$setstrarr[]="primary_text='$qline->primary_text'";
$setstrarr[]="followup1_question='$qline->followup1_question'";
$setstrarr[]="followup1_response='$qline->followup1_response'";
$setstrarr[]="followup1_text='$qline->followup1_text'";
$setstrarr[]="followup2_question='$qline->followup2_question'";
$setstrarr[]="followup2_response='$qline->followup2_response'";
$setstrarr[]="followup2_text='$qline->followup2_text'";
$setstrarr[]="followup3_question='$qline->followup3_question'";
$setstrarr[]="followup3_response='$qline->followup3_response'";
$setstrarr[]="followup3_text='$qline->followup3_text'";
$setstrarr[]="followup4_question='$qline->followup4_question'";
$setstrarr[]="followup4_response='$qline->followup4_response'";
$setstrarr[]="followup4_text='$qline->followup4_text'";
$setstrarr[]="followup5_question='$qline->followup5_question'";
$setstrarr[]="followup5_response='$qline->followup5_response'";
$setstrarr[]="followup5_text='$qline->followup5_text'";
$setstrarr[]="followup6_question='$qline->followup6_question'";
$setstrarr[]="followup6_response='$qline->followup6_response'";
$setstrarr[]="followup6_text='$qline->followup6_text'";
$setstrarr[]="followup7_question='$qline->followup7_question'";
$setstrarr[]="followup7_response='$qline->followup7_response'";
$setstrarr[]="followup7_text='$qline->followup7_text'";
$setstrarr[]="cust_band='$qline->cust_band'";
$setstrarr[]="cust_type='$qline->cust_type'";
$setstrarr[]="source_of_info='$qline->source_of_info'";
$setstrarr[]="service_type='$qline->service_type'";
$setstrarr[]="priority='$qline->priority'";
$setstrarr[]="category='$qline->category'";
$setstrarr[]="sub_category='$qline->sub_category'";
$setstrarr[]="resolving_branch='$qline->resolving_branch'";
$setstrarr[]="cust_city='$qline->cust_city'";
$setstrarr[]="acknowledge='$qline->acknowledge'";
$setstrarr[]="resolve_class_unit='$qline->resolve_class_unit'";
$setstrarr[]="rbb='$qline->rbb'";
$setstrarr[]="non_rrb='$qline->non_rrb'";
$setstrarr[]="complainant_name='$qline->complainant_name'";
$setstrarr[]="existing_customer='$qline->existing_customer'";
$setstrarr[]="cust_id='$qline->cust_id'";
$setstrarr[]="shadow_cust_id='$qline->shadow_cust_id'";
$setstrarr[]="casa_number='$qline->casa_number'";
$setstrarr[]="docket_number='$qline->docket_number'";
$setstrarr[]="cust_mobile='$qline->cust_mobile'";
$setstrarr[]="contact_number='$qline->contact_number'";
$setstrarr[]="email='$qline->email'";
$setstrarr[]="case_reference='$qline->case_reference'";
$setstrarr[]="logging_branch_name='$qline->logging_branch_name'";
$setstrarr[]="logging_class_unit='$qline->logging_class_unit'";
$setstrarr[]="nature_of_complaint='$qline->nature_of_complaint'";
$setstrarr[]="detailed_suggestion='$qline->detailed_suggestion'";
$setstrarr[]="additional_info='$qline->additional_info'";
$setstrarr[]="cust_name_on_card='$qline->cust_name_on_card'";
if($qline->card_number==''){
$setstrarr[]="card_number='' ";
}else{
$setstrarr[]="card_number='".substr($qline->card_number,0,6).'******'.substr($qline->card_number,-4,4)."'";
}
$setstrarr[]="aan='$qline->aan'";
$setstrarr[]="logging_branch_code='$qline->logging_branch_code'";
$setstrarr[]="resolving_branch_code='$qline->resolving_branch_code'";
$setstrarr[]="status='$qline->status'";
$setstrarr[]="server='$server_id'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$questionaire." set $setstr"));
DB::connection("conn")->insert(DB::raw("insert into complaint_details set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
}
......
......@@ -13,29 +13,29 @@ use PDO;
use Illuminate\Database\Schema\Blueprint;
class full_remark_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'full_remark_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'full_remark_details';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
class complaint_fields extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'complaint_fields';
/**
* The console command description.
*
* @var string
*/
protected $description = 'complaint_fields';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
......@@ -44,7 +44,7 @@ class full_remark_details extends Command {
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$full_remark = "full_remark_details";
$lead_form = "lead_form_details";
$central_ip=env('central_ip');
$conn = array(
......@@ -65,40 +65,43 @@ class full_remark_details extends Command {
if(DB::connection("conn")->getDatabaseName())
{
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(full_remark_id) as maxid from $full_remark where server_id='$server_id'"));
$maxids=$maxid[0]->maxid;
//$qlist=DB::select(DB::raw("SELECT * from full_remark"));
$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))."'"));
DB::table('complaint_fields')->truncate();
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from complaint_fields"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="server_id='$server_id'";
$setstrarr[]="full_remark_id='$qline->id'";
$setstrarr[]="call_id='$qline->call_id'";
$setstrarr[]="fullremark='$qline->fullremark'";
$setstrarr[]="created_at='$qline->created_at'";
$setstrarr[]="cust_band='$qline->cust_band'";
$setstrarr[]="cust_type='$qline->cust_type'";
$setstrarr[]="source_of_info='$qline->source_of_info'";
$setstrarr[]="service_type='$qline->service_type'";
$setstrarr[]="priority='$qline->priority'";
$setstrarr[]="category='$qline->category'";
$setstrarr[]="sub_category='$qline->sub_category'";
$setstrarr[]="resolving_branch='$qline->resolving_branch'";
$setstrarr[]="cust_city='$qline->cust_city'";
$setstrarr[]="acknowledge='$qline->acknowledge'";
$setstrarr[]="resolve_class_unit='$qline->resolve_class_unit'";
$setstrarr[]="rbb='$qline->rbb'";
$setstrarr[]="non_rbb='$qline->non_rbb'";
$setstrarr[]="logging_branch_name='$qline->logging_branch_name'";
$setstrarr[]="logging_branch_code='$qline->logging_branch_code'";
$setstrarr[]="resolving_branch_code='$qline->resolving_branch_code'";
$setstrarr[]="resolving_branch_w_code='$qline->resolving_branch_w_code'";
$setstrarr[]="logging_branch_w_code='$qline->logging_branch_w_code'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$full_remark." set $setstr"));
DB::insert(DB::raw("insert into complaint_fields set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
}
......
......@@ -13,38 +13,39 @@ use PDO;
use Illuminate\Database\Schema\Blueprint;
class dailyupload_calllog extends Command {
class leadform_products extends Command {
/**
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dailyupload_calllog';
protected $signature = 'leadform_products';
/**
/**
* The console command description.
*
* @var string
*/
protected $description = 'dailyupload_calllog';
protected $description = 'leadform_products';
/**
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$central_ip=env('central_ip');
$calllog_report = "calllog_report_".date("d_m_Y",$logdate);
$created_at=date("Y-m-d H:i:s");
$conn = array(
'driver' => 'mysql',
......@@ -60,55 +61,83 @@ class dailyupload_calllog extends Command {
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
DB::table('leadform_products')->truncate();
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_PRODUCT_MASTER"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="products='$qline->PRODUCT_NAME'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into leadform_products set $setstr"));
$serverclist=DB::connection("conn")->select(DB::raw("select id from server_details where server_ip='$server_ip'"));
$server_id=$serverclist[0]->id;
if($server_id<10){
$server_id="0".$server_id;
}
DB::table('UD_CRM_BR_MASTER')->truncate();
$clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server"));
$caar=[];
foreach($clist as $cline)
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_CRM_BR_MASTER"));
$userarr=array();
foreach($qlist as $qline)
{
$caar[$cline->server]= $cline->cnt;
$setstrarr=array();
$setstrarr[]="BR_CODE='$qline->BR_CODE'";
$setstrarr[]="BR_NAME='$qline->BR_NAME'";
$setstrarr[]="STATUS='$qline->STATUS'";
$setstrarr[]="INS_DATE='$qline->INS_DATE'";
$setstrarr[]="REMARKS='$qline->REMARKS'";
$setstrarr[]="FIELD1='$qline->FIELD1'";
$setstrarr[]="FIELD2='$qline->FIELD2'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into UD_CRM_BR_MASTER set $setstr"));
}
$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)."'"));
DB::table('UD_LEAD_ENTRY_CUSTOMER_PROFILE')->truncate();
$location_cont='0';
$central_cont='0';
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_LEAD_ENTRY_CUSTOMER_PROFILE"));
$userarr=array();
foreach($qlist as $qline)
{
$location_cont=$mlist[0]->countrecord;
if(array_key_exists($server_id,$caar)){
$central_cont=$caar[$server_id];
}else{
$central_cont=0;
$setstrarr=array();
}
$dif=($mlist[0]->countrecord)-($central_cont);
$setstrarr[]="CUST_PROFILE='$qline->CUST_PROFILE'";
$setstrarr[]="INS_DATE='$qline->INS_DATE'";
$setstrarr[]="STATUS='$qline->STATUS'";
if($dif<=5 && $dif>=-5){
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into UD_LEAD_ENTRY_CUSTOMER_PROFILE set $setstr"));
$result="Y";
}
DB::table('UD_SM_MAPPING')->truncate();
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'"));
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from UD_SM_MAPPING"));
$userarr=array();
foreach($qlist as $qline)
{
}else{
$setstrarr=array();
//$qlist_BR_NAME=preg_replace("/[^ \w]+/","", $qline->BR_NAME);
$setstrarr[]="USER_NAME='$qline->USER_NAME'";
$setstrarr[]="EMPLOYEE_CODE='$qline->EMPLOYEE_CODE'";
$result="N";
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'"));
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into UD_SM_MAPPING set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
......
......@@ -13,29 +13,29 @@ use PDO;
use Illuminate\Database\Schema\Blueprint;
class lead_form_details extends Command {
class oa_leadform_details extends Command {
/**
/**
* The console command name.
*
* @var string
*/
protected $signature = 'lead_form_details';
protected $signature = 'oa_leadform_details';
/**
/**
* The console command description.
*
* @var string
*/
protected $description = 'lead_form_details';
protected $description = 'oa_leadform_details';
/**
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
......@@ -44,7 +44,7 @@ class lead_form_details extends Command {
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$oa_leadform_details = "oa_leadform_details";
$central_ip=env('central_ip');
$conn = array(
......@@ -71,53 +71,43 @@ class lead_form_details extends Command {
$server_id="0".$server_id;
}
$location=$serverclist[0]->location;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(lead_form_id) as maxid from lead_form_details where server_ip='$server_ip'"));
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(oa_lead_id) as maxid from oa_leadform_details where server_ip='$server_ip'"));
$maxids=$maxid[0]->maxid;
$qlist=DB::select(DB::raw("SELECT * from lead_form where id>'$maxids'"));
print_r($qlist);
$qlist=DB::select(DB::raw("SELECT * from oa_leadform where id>'$maxids'"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="lead_form_id='$qline->id'";
$setstrarr[]="server_id='$server_id'";
$setstrarr[]="server_ip='$server_ip'";
$setstrarr[]="oa_lead_id='$qline->id'";
$setstrarr[]="created_at='$qline->created_at'";
$setstrarr[]="updated_at='$qline->updated_at'";
$setstrarr[]="product='$qline->product'";
$setstrarr[]="call_created_at='$qline->call_created_at'";
$setstrarr[]="call_id='$qline->call_id'";
$setstrarr[]="record_id='$qline->record_id'";
$setstrarr[]="customer_name='$qline->customer_name'";
$setstrarr[]="mobile_number='$qline->mobile_number'";
$setstrarr[]="city='$qline->city'";
$setstrarr[]="state='$qline->state'";
$setstrarr[]="agent_memo='$qline->agent_memo'";
$setstrarr[]="customer_memo='$qline->customer_memo'";
$setstrarr[]="remarks='$qline->remarks'";
$setstrarr[]="transfer_memo='$qline->transfer_memo'";
$setstrarr[]="server_ip='$server_ip'";
$setstrarr[]="location='$location'";
$setstrarr[]="address='$qline->address'";
$setstrarr[]="mobile='$qline->mobile'";
$setstrarr[]="client='$qline->client'";
$setstrarr[]="call_number='$qline->call_number'";
$setstrarr[]="pbcode='$qline->pbcode'";
$setstrarr[]="emailid='$qline->emailid'";
$setstrarr[]="cod_cust='$qline->cod_cust'";
$setstrarr[]="ucic_id='$qline->ucic_id'";
$setstrarr[]="unit='$qline->unit'";
$setstrarr[]="cust_remarks='$qline->cust_remarks'";
$setstrarr[]="agent_remarks='$qline->agent_remarks'";
$setstrarr[]="user_id='$qline->user_id'";
$setstrarr[]="firstname='$qline->firstname'";
$setstrarr[]="clientcode='$qline->clientcode'";
$setstrarr[]="call_id='$qline->call_id'";
$setstrarr[]="record_id='$qline->record_id'";
$setstr=implode(",",$setstrarr);
echo "prashant";
print_r($setstr);
DB::connection("conn")->insert(DB::raw("insert into lead_form_details set $setstr"));
}
DB::connection("conn")->disconnect();
DB::connection("conn")->insert(DB::raw("insert into ".$oa_leadform_details." set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
......
<?php
Route::get('/', array('uses'=> 'HomeController@index', 'as'=>'index.root'));
Route::get('index', array('uses'=> 'HomeController@index', 'as'=>'index.index'));
//ON 19-09-2016 FOR FILE UPLOAD RUN
Route::get('upload_8', function()
{
return view("layout.module.server.8_fbulkServerUpload");
});
Route::get('test_table_8', 'Rom8Controller@testTable');
Route::get('eg', 'egController@eg');
Route::group(['middleware' => ['web']], function () {
Route::get('home', array('uses' => 'HomeController@home', 'as'=>'home.home'));
Route::get('login', array('uses'=> 'HomeController@login', 'as'=>'home.login'));
Route::post('login', array('uses'=> 'HomeController@do_login', 'as'=>'home.do_login'));
Route::get('logout', array('uses'=> 'HomeController@logout', 'as'=>'home.logout'));
Route::get('signup', array('uses'=> 'HomeController@signup', 'as'=>'home.signup'));
Route::post('signup', array('uses'=> 'HomeController@do_signup', 'as'=>'home.do_signup'));
Route::get('userfiles/{path}',array('uses'=>'HomeController@userfiles','as'=>'userfiles.get'))->where('path', '.*');
Route::get('unsubscribe', array('uses'=> 'HomeController@unsubscribe', 'as'=>'home.unsubscribe'));
Route::any('forgotpassword', array('uses'=> 'HomeController@forgotpassword', 'as'=>'signup.forgotpassword'));
Route::get('profile', array('before' => 'auth','uses' => 'HomeController@profile', 'as'=>'profile.index'));
Route::post('profile', array('before' => 'auth','uses' => 'HomeController@do_profile', 'as'=>'profile.update'));
Route::get('msie', array('uses'=> 'HomeController@msie', 'as'=>'login.msie'));
Route::any('ajaxerror', array('uses'=> 'HomeController@ajaxerror', 'as'=>'home.ajaxerror'));
Route::any('gettoken', array('uses'=> 'HomeController@gettoken', 'as'=>'home.gettoken'));
Route::any('idleapp', array('uses'=> 'HomeController@idleapp', 'as'=>'home.idleapp'));
Route::any('fileupload', array('uses'=> 'HomeController@fileupload', 'as'=>'upload.file'));
Route::get('cron', array('uses'=> 'HomeController@cron', 'as'=>'cron.cron'));
Route::get('style', array('uses'=> 'HomeController@style', 'as'=>'style.index'));
Route::get('jshead', array('uses'=> 'HomeController@jshead', 'as'=>'jshead.index'));
Route::get('jsbody', array('uses'=> 'HomeController@jsbody', 'as'=>'jsbody.index'));
Route::resource('dashboard','DashboardController');
Route::resource('notification','NotificationController');
Route::resource('message','MessageController');
Route::resource('task','TaskController');
Route::resource('user','UserController');
Route::resource('group','GroupController');
Route::resource('role','RoleController');
Route::resource('master','MasterController');
Route::resource('admin','AdminController');
Route::resource('record','RecordController');
Route::resource('dialer','DialerController');
Route::resource('hr','HRController');
Route::resource('social','SocialController');
Route::resource('web','WebController');
Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions'));
Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store'));
Route::get('questionare/{qid?}/{optid?}/{level?}', array('uses' => 'QuestionareController@loadQuestions', 'as'=>'questionare.load_questions'));
Route::post('questionare', array('uses' => 'QuestionareController@saveQuestionAire', 'as'=>'questionare.save'));
//Route::get('notes', array('uses' => 'NotesController@index', 'as'=>'notes.index'));
//Route::resource('notesupdate','NotesController');
Route::get('exceldownload', function()
{
return view("layout.module.userupload.exceldata");
});
Route::post('useruploaddata', array('uses' => 'UserController@userUpload', 'as'=>'useruploaddata'));
//Supervisor Call Mangement - By Manish on 16-02-17
Route::get('SupervisorModule', array('uses'=> 'RecordController@supervisorUpload', 'as'=>'upload.comments'));
});
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.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ComplaintCategory extends Model{
protected $table = 'complaint_category';
protected $fillable = ['category'];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ComplaintResolclassUnit extends Model{
protected $table = 'complaint_resol_class_unit';
protected $fillable = ['resolve_class_unit'];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ComplaintSubCategory extends Model{
protected $table = 'complaint_sub_category';
protected $fillable = ['sub_category','resolve_class_unit_id','category_id'];
}
Subproject commit 968f686df7d605be96632f9025d49793fd4b5e54
Subproject commit 1562da3d858297f70b162f7852903b5d01f58d24
/*!
* jQuery UI Effects Size 1.11.2
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/size-effect/
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
"jquery",
"./effect"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
return $.effects.effect.size = function( o, done ) {
// Create element
var original, baseline, factor,
el = $( this ),
props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
// Always restore
props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
// Copy for children
props2 = [ "width", "height", "overflow" ],
cProps = [ "fontSize" ],
vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
// Set options
mode = $.effects.setMode( el, o.mode || "effect" ),
restore = o.restore || mode !== "effect",
scale = o.scale || "both",
origin = o.origin || [ "middle", "center" ],
position = el.css( "position" ),
props = restore ? props0 : props1,
zero = {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
};
if ( mode === "show" ) {
el.show();
}
original = {
height: el.height(),
width: el.width(),
outerHeight: el.outerHeight(),
outerWidth: el.outerWidth()
};
if ( o.mode === "toggle" && mode === "show" ) {
el.from = o.to || zero;
el.to = o.from || original;
} else {
el.from = o.from || ( mode === "show" ? zero : original );
el.to = o.to || ( mode === "hide" ? zero : original );
}
// Set scaling factor
factor = {
from: {
y: el.from.height / original.height,
x: el.from.width / original.width
},
to: {
y: el.to.height / original.height,
x: el.to.width / original.width
}
};
// Scale the css box
if ( scale === "box" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( vProps );
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
props = props.concat( hProps );
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
}
}
// Scale the content
if ( scale === "content" || scale === "both" ) {
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
props = props.concat( cProps ).concat( props2 );
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
}
}
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
el.css( "overflow", "hidden" ).css( el.from );
// Adjust
if (origin) { // Calculate baseline shifts
baseline = $.effects.getBaseline( origin, original );
el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
}
el.css( el.from ); // set top & left
// Animate
if ( scale === "content" || scale === "both" ) { // Scale the children
// Add margins/font-size
vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
hProps = hProps.concat([ "marginLeft", "marginRight" ]);
props2 = props0.concat(vProps).concat(hProps);
el.find( "*[width]" ).each( function() {
var child = $( this ),
c_original = {
height: child.height(),
width: child.width(),
outerHeight: child.outerHeight(),
outerWidth: child.outerWidth()
};
if (restore) {
$.effects.save(child, props2);
}
child.from = {
height: c_original.height * factor.from.y,
width: c_original.width * factor.from.x,
outerHeight: c_original.outerHeight * factor.from.y,
outerWidth: c_original.outerWidth * factor.from.x
};
child.to = {
height: c_original.height * factor.to.y,
width: c_original.width * factor.to.x,
outerHeight: c_original.height * factor.to.y,
outerWidth: c_original.width * factor.to.x
};
// Vertical props scaling
if ( factor.from.y !== factor.to.y ) {
child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
}
// Horizontal props scaling
if ( factor.from.x !== factor.to.x ) {
child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
}
// Animate children
child.css( child.from );
child.animate( child.to, o.duration, o.easing, function() {
// Restore children
if ( restore ) {
$.effects.restore( child, props2 );
}
});
});
}
// Animate
el.animate( el.to, {
queue: false,
duration: o.duration,
easing: o.easing,
complete: function() {
if ( el.to.opacity === 0 ) {
el.css( "opacity", el.from.opacity );
}
if ( mode === "hide" ) {
el.hide();
}
$.effects.restore( el, props );
if ( !restore ) {
// we need to calculate our new positioning based on the scaling
if ( position === "static" ) {
el.css({
position: "relative",
top: el.to.top,
left: el.to.left
});
} else {
$.each([ "top", "left" ], function( idx, pos ) {
el.css( pos, function( _, str ) {
var val = parseInt( str, 10 ),
toRef = idx ? el.to.left : el.to.top;
// if original was "auto", recalculate the new value from wrapper
if ( str === "auto" ) {
return toRef + "px";
}
return val + toRef + "px";
});
});
}
}
$.effects.removeWrapper( el );
done();
}
});
};
}));
/*!
* jQuery UI Mouse 1.11.2
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/mouse/
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
"jquery",
"./widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
var mouseHandled = false;
$( document ).mouseup( function() {
mouseHandled = false;
});
return $.widget("ui.mouse", {
version: "1.11.2",
options: {
cancel: "input,textarea,button,select,option",
distance: 1,
delay: 0
},
_mouseInit: function() {
var that = this;
this.element
.bind("mousedown." + this.widgetName, function(event) {
return that._mouseDown(event);
})
.bind("click." + this.widgetName, function(event) {
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
$.removeData(event.target, that.widgetName + ".preventClickEvent");
event.stopImmediatePropagation();
return false;
}
});
this.started = false;
},
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind("." + this.widgetName);
if ( this._mouseMoveDelegate ) {
this.document
.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
}
},
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
if ( mouseHandled ) {
return;
}
this._mouseMoved = false;
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
this._mouseDownEvent = event;
var that = this,
btnIsLeft = (event.which === 1),
// event.target.nodeName works around a bug in IE 8 with
// disabled inputs (#7620)
elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
return true;
}
this.mouseDelayMet = !this.options.delay;
if (!this.mouseDelayMet) {
this._mouseDelayTimer = setTimeout(function() {
that.mouseDelayMet = true;
}, this.options.delay);
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted = (this._mouseStart(event) !== false);
if (!this._mouseStarted) {
event.preventDefault();
return true;
}
}
// Click event may never have fired (Gecko & Opera)
if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
$.removeData(event.target, this.widgetName + ".preventClickEvent");
}
// these delegates are required to keep context
this._mouseMoveDelegate = function(event) {
return that._mouseMove(event);
};
this._mouseUpDelegate = function(event) {
return that._mouseUp(event);
};
this.document
.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
mouseHandled = true;
return true;
},
_mouseMove: function(event) {
// Only check for mouseups outside the document if you've moved inside the document
// at least once. This prevents the firing of mouseup in the case of IE<9, which will
// fire a mousemove event if content is placed under the cursor. See #7778
// Support: IE <9
if ( this._mouseMoved ) {
// IE mouseup check - mouseup happened when mouse was out of window
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event);
// Iframe mouseup check - mouseup occurred in another document
} else if ( !event.which ) {
return this._mouseUp( event );
}
}
if ( event.which || event.button ) {
this._mouseMoved = true;
}
if (this._mouseStarted) {
this._mouseDrag(event);
return event.preventDefault();
}
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
this._mouseStarted =
(this._mouseStart(this._mouseDownEvent, event) !== false);
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
}
return !this._mouseStarted;
},
_mouseUp: function(event) {
this.document
.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
if (this._mouseStarted) {
this._mouseStarted = false;
if (event.target === this._mouseDownEvent.target) {
$.data(event.target, this.widgetName + ".preventClickEvent", true);
}
this._mouseStop(event);
}
mouseHandled = false;
return false;
},
_mouseDistanceMet: function(event) {
return (Math.max(
Math.abs(this._mouseDownEvent.pageX - event.pageX),
Math.abs(this._mouseDownEvent.pageY - event.pageY)
) >= this.options.distance
);
},
_mouseDelayMet: function(/* event */) {
return this.mouseDelayMet;
},
// These are placeholder methods, to be overriden by extending plugin
_mouseStart: function(/* event */) {},
_mouseDrag: function(/* event */) {},
_mouseStop: function(/* event */) {},
_mouseCapture: function(/* event */) { return true; }
});
}));
/*!
* jQuery UI Progressbar 1.11.2
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/progressbar/
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([
"jquery",
"./core",
"./widget"
], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function( $ ) {
return $.widget( "ui.progressbar", {
version: "1.11.2",
options: {
max: 100,
value: 0,
change: null,
complete: null
},
min: 0,
_create: function() {
// Constrain initial value
this.oldValue = this.options.value = this._constrainedValue();
this.element
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.attr({
// Only set static values, aria-valuenow and aria-valuemax are
// set inside _refreshValue()
role: "progressbar",
"aria-valuemin": this.min
});
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
.appendTo( this.element );
this._refreshValue();
},
_destroy: function() {
this.element
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
.removeAttr( "aria-valuemin" )
.removeAttr( "aria-valuemax" )
.removeAttr( "aria-valuenow" );
this.valueDiv.remove();
},
value: function( newValue ) {
if ( newValue === undefined ) {
return this.options.value;
}
this.options.value = this._constrainedValue( newValue );
this._refreshValue();
},
_constrainedValue: function( newValue ) {
if ( newValue === undefined ) {
newValue = this.options.value;
}
this.indeterminate = newValue === false;
// sanitize value
if ( typeof newValue !== "number" ) {
newValue = 0;
}
return this.indeterminate ? false :
Math.min( this.options.max, Math.max( this.min, newValue ) );
},
_setOptions: function( options ) {
// Ensure "value" option is set after other values (like max)
var value = options.value;
delete options.value;
this._super( options );
this.options.value = this._constrainedValue( value );
this._refreshValue();
},
_setOption: function( key, value ) {
if ( key === "max" ) {
// Don't allow a max less than min
value = Math.max( this.min, value );
}
if ( key === "disabled" ) {
this.element
.toggleClass( "ui-state-disabled", !!value )
.attr( "aria-disabled", value );
}
this._super( key, value );
},
_percentage: function() {
return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
},
_refreshValue: function() {
var value = this.options.value,
percentage = this._percentage();
this.valueDiv
.toggle( this.indeterminate || value > this.min )
.toggleClass( "ui-corner-right", value === this.options.max )
.width( percentage.toFixed(0) + "%" );
this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuenow" );
if ( !this.overlayDiv ) {
this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
}
} else {
this.element.attr({
"aria-valuemax": this.options.max,
"aria-valuenow": value
});
if ( this.overlayDiv ) {
this.overlayDiv.remove();
this.overlayDiv = null;
}
}
if ( this.oldValue !== value ) {
this.oldValue = value;
this._trigger( "change" );
}
if ( value === this.options.max ) {
this._trigger( "complete" );
}
}
});
}));
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!