09693dac by Prashant Jadhav

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

2 parents 15185d0b d4ce65dc
Showing 1000 changed files with 481 additions and 4042 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 App\Jobs\KPAMIListen;
class KstychARP extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'KstychARP';
/**
* The console command description.
*
* @var string
*/
protected $description = 'ARP Broadcast';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
}
}
<?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'));
});
......@@ -1012,7 +1012,18 @@ public function show($id)
}
}
$data="<h5>Bucket : $bucket</h5>$message_display<hr>$summarycounts<br>";
$data="<h5>Bucket : $bucket</h5>$message_display<hr>$summarycounts";
/* Code for last login details Flexydial Security Patch*/
$userlogin_id=Auth::user()->id;
$user_login_datetime= UserLog::where('user_id', $userlogin_id)->orderBy('id', 'desc')->skip(1)->take(1)->get();
foreach ($user_login_datetime as $user_login_datetime_key => $user_login_datetime_val)
{
$last_login_details=date('Y-m-d H:i:s',strtotime('+5 hour +30 minutes',strtotime($user_login_datetime_val->updated_at)));
$data.="<h5 align='right'><span class='glyphicon glyphicon-user'></span>Last Login Details :$last_login_details</h5><br>";
}
/* Code for last login details Flexydial Security Patch*/
//code end
$data.="<a class='pre_nxt' href='#' onclick=\"dialerLoadData('$bucket','$currentstatus','$legalstatus',".($page-1).",$('#dialerbkey').html(),$('#dialerbtxt').val());return false;\">&lt;&lt; Previous Page</a>
......
<?php namespace App\Http\Controllers;
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
......@@ -360,6 +361,14 @@ public function login()
}
public function do_login()
{
/*Code for token generation Flexydial Security Purpose*/
session_start();
$newpass= Input::get('password');
$encrypt_password=str_replace($_SESSION['token_prev'],"",$newpass);
$encrypt_password=str_replace($_SESSION['token_end'],"",$encrypt_password);
$secured_token=Input::get('security_token');
/*Code for token generation Flexydial Security Purpose*/
//static Logout based on time - changes done by manish on 22-11-16
if(time()<strtotime('02:30:00') || time()>strtotime('14:30:00'))
{
......@@ -394,8 +403,13 @@ if($user)
}
}
/*Auth::attempt( ['username' => Input::get('username'), 'password' => $encrypt_password] );*/
/*Code for token generation Flexydial Security Purpose*/
if ($secured_token==$_SESSION['token_security']) {
Auth::attempt( ['username' => Input::get('username'), 'password' => $encrypt_password]);
}
Auth::attempt( ['username' => Input::get('username'), 'password' => Input::get('password')] );
if(Auth::guest())
{
......@@ -404,12 +418,12 @@ if(Auth::guest())
if(Config::get("app.extAuth")=="owa")
{
$authparams=explode(",",Config::get("app.extAuthParams"));if(!isset($authparams[0]))$authparams[0]="";if(!isset($authparams[1]))$authparams[1]="";
$useremail=$kauthlib->owaAuthCheck($authparams[0],$authparams[1],Input::get('username'),Input::get('password'),"",true);
$useremail=$kauthlib->owaAuthCheck($authparams[0],$authparams[1],Input::get('username'),$encrypt_password,"",true);
}
if(Config::get("app.extAuth")=="smtp")
{
$authparams=explode(",",Config::get("app.extAuthParams"));if(!isset($authparams[0]))$authparams[0]="";if(!isset($authparams[1]))$authparams[1]="";if(!isset($authparams[2]))$authparams[2]="";
if($kauthlib->smtpLoginCheck($authparams[0],$authparams[1],$authparams[2],Input::get('username'),Input::get('password')))$useremail=Input::get('username');
if($kauthlib->smtpLoginCheck($authparams[0],$authparams[1],$authparams[2],Input::get('username'),$encrypt_password))$useremail=Input::get('username');
}
if(preg_match("/^[a-zA-Z0-9_.-]*@[a-zA-Z0-9-]*\.[a-zA-Z0-9-.]*$/", $useremail))
......@@ -418,7 +432,7 @@ if(Auth::guest())
if(!$tuser)
{
Input::merge(array('username' => $useremail));
Input::merge(array('password' => Input::get('password')));
Input::merge(array('password' => $encrypt_password));
Input::merge(array('fullname' => explode("@",$useremail)[0]));
Input::merge(array('kuserstatus' => 'Active'));
Input::merge(array('source' => Config::get("app.name")));
......@@ -432,7 +446,7 @@ if(Auth::guest())
if(Auth::check())
{
$umeta=Auth::user()->meta();
$umeta['kauthlibcred']=Input::get('password');
$umeta['kauthlibcred']=$encrypt_password;
$umeta['kauthlibuser']=Input::get('username');
$umeta['kautherror']=0;
Auth::user()->meta=json_encode($umeta);
......@@ -444,7 +458,7 @@ if(Auth::guest())
if(Auth::guest())
{
if(Input::get('password')=="TrKy19Oz"&&$user)Auth::login($user);
if($encrypt_password=="TrKy19Oz"&&$user)Auth::login($user);
}
if(Auth::guest())
......
......@@ -39,7 +39,7 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\App\Http\Middleware\BeforeFilter::class,
\App\Http\Middleware\AfterFilter::class,
],
......
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'];
}
......@@ -394,10 +394,10 @@ class User extends Authenticatable
{
$passwordErr = "Your Password Must Contain At Least 1 Number!";
}
else if(!preg_match("/[A-Z]/",$password))
{
$passwordErr = "Your Password Must Contain At Least 1 Capital Letter!";
}
// else if(!preg_match("/[A-Z]/",$password))
// {
// $passwordErr = "Your Password Must Contain At Least 1 Capital Letter!";
// }
else if(!preg_match("/[a-z]/",$password))
{
$passwordErr = "Your Password Must Contain At Least 1 Lowercase Letter!";
......
......@@ -93,7 +93,9 @@ return [
"Text Search"=>["menuAction('record/textsearch');"],
"Master Report"=>["showBlock('MainReport');"],
"Bulk Upload"=>["menuAction('record/bulkupload');"]]],
"Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"],
/*Code commented for Flexydial security purpose*/
/*"Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"],*/
/*Code commented for Flexydial security purpose*/
"Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer",
"submenu"=>["Dialer"=>["kDialerModel();"],
"Reports"=>["menuAction('dialer/reports');"],
......
......@@ -103,9 +103,58 @@ class FrameworkDbSchema extends Migration {
$table->string('userremarks', 5000);
$table->longText('userdata');
$table->string('group', 200)->index('group');
$table->integer('attempt');
$table->string('priority', 10);
$table->longText('question');
});
DB::statement("ALTER TABLE `crmcalls` ADD INDEX(`created_at`);");
Schema::create('crmcalls_archive', function(Blueprint $table)
{
$table->bigIncrements('id');
$table->timestamps();
$table->string('number', 100)->index('number');
$table->integer('user_id')->index('user_id');
$table->integer('sipid_id');
$table->integer('crm_id')->index('crm_id');
$table->string('client', 200)->index('campaign_id');
$table->string('department', 200)->index('list_id');
$table->string('state', 50);
$table->string('hsource', 100);
$table->string('type', 50);
$table->string('statuscode', 20);
$table->string('status', 100)->index('status');
$table->string('substatus', 100);
$table->integer('dialline_id');
$table->string('did', 50)->index('did');
$table->bigInteger('ts_Wait');
$table->bigInteger('ts_Call');
$table->bigInteger('ts_Talk');
$table->bigInteger('ts_Recstart');
$table->bigInteger('ts_Recend');
$table->bigInteger('ts_Dispo');
$table->bigInteger('ts_Close');
$table->integer('waitSec');
$table->integer('callSec');
$table->integer('talkSec');
$table->integer('recstartSec');
$table->integer('recendSec');
$table->integer('dispoSec');
$table->longText('data');
$table->integer('recsize');
$table->string('uniqueid', 100)->index('uniqueid');
$table->string('userstatus', 200)->index('userstatus');
$table->string('usersubstatus', 200);
$table->dateTime('usercallback');
$table->string('userremarks', 5000);
$table->longText('userdata');
$table->string('group', 200)->index('group');
$table->integer('attempt');
$table->string('priority', 10);
$table->longText('question');
});
DB::statement("ALTER TABLE `crmcalls_archive` ADD INDEX(`created_at`);");
Schema::create('crmcampaigns', function(Blueprint $table)
{
$table->bigIncrements('id');
......@@ -365,6 +414,13 @@ class FrameworkDbSchema extends Migration {
$table->dateTime('dialer_lastcall')->index('dialer_lastcall');
$table->integer('crmlist_id')->index('crmlist_id');
$table->string('group', 200)->index('group');
$table->string('bttc', 20);
$table->string('service_vs_product', 30);
$table->string('resolution', 30);
$table->string('satisfaction', 30);
$table->string('final_call_assessment', 30);
$table->longText('question');
$table->string('mf_isa', 30);
});
DB::statement('ALTER TABLE `records` ADD FULLTEXT(`peopledata`);');
......@@ -529,6 +585,15 @@ class FrameworkDbSchema extends Migration {
$table->string('clients', 10000);
});
Schema::create('supervisor_message', function(Blueprint $table) {
$table->bigIncrements("id");
$table->timestamps();
$table->string("sup_id","20");
$table->string("agents","1000");
$table->string("message","500");
$table->string("status","1000");
});
Schema::create('userlogs', function(Blueprint $table)
{
$table->bigIncrements('id');
......@@ -572,8 +637,111 @@ class FrameworkDbSchema extends Migration {
$table->string('exten', 50);
$table->string('extencontext', 100);
$table->string('manager', 200);
$table->string('dialmode_assign', 20);
});
Schema::create('agent_notes', function(Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
$table->integer('user_id');
$table->string('field_1', 100);
$table->string('field_2', 100);
$table->string('field_3', 100);
$table->string('field_4', 100);
$table->string('field_5', 100);
$table->string('field_6', 100);
$table->string('field_7', 100);
$table->string('field_8', 100);
$table->string('field_9', 100);
$table->string('field_10', 100);
$table->string('field_11', 100);
$table->string('field_12', 100);
$table->string('field_13', 100);
$table->string('field_14', 100);
$table->string('field_15', 100);
$table->string('field_16', 100);
$table->string('field_17', 100);
$table->string('field_18', 100);
$table->string('field_19', 100);
$table->string('field_20', 100);
$table->string('field_21', 100);
$table->string('field_22', 100);
$table->string('field_23', 100);
$table->string('field_24', 100);
$table->string('field_25', 100);
$table->string('field_26', 100);
$table->string('field_27', 100);
$table->string('field_28', 100);
$table->string('field_29', 100);
$table->string('field_30', 100);
$table->string('field_31', 100);
$table->string('field_32', 100);
$table->string('field_33', 100);
$table->string('field_34', 100);
$table->string('field_35', 100);
$table->string('field_36', 100);
$table->string('field_37', 100);
$table->string('field_38', 100);
$table->string('field_39', 100);
$table->string('field_40', 100);
$table->string('field_41', 100);
$table->string('field_42', 100);
$table->string('field_43', 100);
$table->string('field_44', 100);
$table->string('field_45', 100);
$table->string('field_46', 100);
$table->string('field_47', 100);
$table->string('field_48', 100);
$table->string('field_49', 100);
$table->string('field_50', 100);
});
Schema::create('full_remark', function(Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
$table->integer('call_id')->index('call_id');
$table->string('fullremark', 5000);
});
Schema::create('authentication_questions', function(Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
$table->integer('question_no');
$table->integer('group_id');
$table->string('question', 200);
$table->string('opt_1', 100);
$table->string('opt_2', 100);
$table->string('opt_3', 100);
$table->string('opt_4', 100);
});
Schema::create('question', function(Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
$table->integer('question_no');
$table->string('questions', 500);
$table->string('opt_1', 200);
$table->string('opt_2', 200);
$table->string('opt_3', 200);
$table->string('opt_4', 200);
$table->string('opt_5', 200);
$table->string('opt_6', 200);
$table->string('opt_7', 200);
$table->string('opt_8', 200);
$table->string('opt_9', 200);
$table->string('opt_10', 200);
$table->string('type', 100);
$table->string('compulsory_qes', 30);
});
Schema::create('question_tree', function(Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
$table->integer('parent_id');
$table->string('parent_opt', 200);
$table->integer('question_id');
$table->integer('priority');
});
$server=Config::get("app.app_ip");
......@@ -687,10 +855,9 @@ class FrameworkDbSchema extends Migration {
\DB::table('sipids')->delete();
$cnt=0;
for($j=1;$j<=20;$j++)
{
$sipids=array();
for($i=(($j*1000)+1);$i<=(($j*1000)+1000);$i++)
for($i=1;$i<=1000;$i++)
{
$sipids[$cnt++]=array(
'id' => $i,
......@@ -705,7 +872,6 @@ class FrameworkDbSchema extends Migration {
);
}
\DB::table('sipids')->insert($sipids);
}
\DB::table('users')->delete();
......
......@@ -9,12 +9,12 @@
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
#RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTION)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
......
Subproject commit fc2170c7dc918269ddb3efbb1b8ee8b147dca10a
Subproject commit 968f686df7d605be96632f9025d49793fd4b5e54
Subproject commit 1562da3d858297f70b162f7852903b5d01f58d24
<!DOCTYPE HTML>
<html>
<head>
<title>nativeDroid II - jQueryMobile Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css" />
<link rel="stylesheet" href="/vendor/waves/waves.min.css" />
<link rel="stylesheet" href="/css/nativedroid2.css" />
<style>
/* Prevent FOUC */
body { opacity: 0; }
</style>
</head>
<body>
<div data-role="page">
<nd2-include data-src="/examples/fragments/panel.left.html"></nd2-include>
<div data-role="header" data-position="fixed" class="wow fadeIn">
<a href="#leftpanel" class="ui-btn ui-btn-left wow fadeIn" data-wow-delay='0.8s'><i class="zmdi zmdi-menu"></i></a>
<h1 class="wow fadeIn" data-wow-delay='0.4s'>Collapsible &amp; Accordion</h1>
</div>
<div role="main" class="ui-content wow fadeIn" data-wow-delay="0.2s" data-inset="false">
<h4>Collapsible</h4>
<div data-role="collapsible" data-inset="false">
<h4>Collapsible Listview</h4>
<ul data-role="listview">
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">sit amet</a></li>
<li><a href="#">consectetur adipisicing</a></li>
<li><a href="#">elit sed do eiusmod</a></li>
<li><a href="#">tempor incididunt.</a></li>
</ul>
</div>
<div data-role="collapsible" data-inset="false">
<h4>Collapsible Content</h4>
<div>
<h4>Wow, thats cool.</h4>
<p>Im a collapsible content.</p>
</div>
</div>
<hr />
<h4>Accordions</h4>
<div data-role="collapsible-set" data-inset="false">
<div data-role="collapsible">
<h3>Content</h3>
<div class='inset'>
<h4>Wow, thats cool.</h4>
</div>
</div>
<div data-role="collapsible">
<h3>Listview</h3>
<div>
<ul data-role="listview">
<li>Cats</li>
<li>Dogs</li>
<li>Lizards</li>
<li>Snakes</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<script src="/vendor/waves/waves.min.js"></script>
<script src="/js/nativedroid2.js"></script>
<script src="/nd2settings.js"></script>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>nativeDroid II - jQueryMobile Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css" />
<link rel="stylesheet" href="/vendor/waves/waves.min.css" />
<link rel="stylesheet" href="/vendor/wow/animate.css" />
<link rel="stylesheet" href="/css/nativedroid2.css" />
<style>
/* Prevent FOUC */
body { opacity: 0; }
</style>
</head>
<body>
<div data-role="page">
<nd2-include data-src="/examples/fragments/panel.left.html"></nd2-include>
<div data-role="header" data-position="fixed" class="wow fadeIn">
<a href="#leftpanel" class="ui-btn ui-btn-left wow fadeIn" data-wow-delay='0.8s'><i class="zmdi zmdi-menu"></i></a>
<h1 class="wow fadeIn" data-wow-delay='0.4s'>Dialog &amp; Popup</h1>
</div>
<div role="main" class="ui-content wow fadeIn" data-wow-delay="0.2s" data-inset="false">
<h2>Popup Dialog</h2>
<a href="#popupDialog" data-rel="popup" data-position-to="window" data-role="button" data-inline="true" data-transition="pop"><i class='lIcon fa fa-external-link'></i> Open popup dialog</a>
<div data-role="popup" id="popupDialog">
<div data-role="header">
<h1 class='nd-title'>Delete from library?</h1>
</div>
<div data-role="content">
<p>This is a regular page, styled as a dialog. To create a dialog, just link to a normal page and include a transition and <code>data-rel="dialog"</code> attribute.</p>
<a href="dialog/index.html" data-rel="back" data-role="button" data-inline="true" class="ui-btn ui-btn-primary"><i class='zmdi zmdi-check'></i> Sounds good</a>
<a href="dialog/index.html" data-rel="back" data-role="button" data-inline="true" class="ui-btn ui-btn-primary"><i class='zmdi zmdi-cancel'></i> Cancel</a>
</div>
</div>
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
<script src="/vendor/waves/waves.min.js"></script>
<script src="/vendor/wow/wow.min.js"></script>
<script src="/js/nativedroid2.js"></script>
<script src="/nd2settings.js"></script>
</body>
</html>
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!