c1f22105 by Prashant Jadhav

latest changes and new features

1 parent c28829f5
Showing 904 changed files with 3328 additions and 838 deletions
No preview for this file type
No preview for this file type
No preview for this file type
<?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";
$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' => '10.3.177.14',
'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();
// $excelarray = DB::table('bz_record_upload_uat')->select('*')->get();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat limit 1"));
$excelarray = (array)$excelarray;
$highestColumn = DB::connection("conn")->select(DB::raw("select count(*) from information_schema.columns where table_name='bz_record_upload_uat'"));
$highestrow = count($excelarray);
echo $highestColumn;
$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_demo",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records_demo","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPersonServer($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;
}
}
}
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPersonServer($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
}
}
}
mysqli_close($conn);
}
}
<?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";
$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' => '10.3.177.14',
'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();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat_080117 where SERVER_IP='10.3.179.121' and ins_date>'2016-11-29' order by auto_id asc limit 0,20000"));
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_080117'"));
$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_demo",array('created'=>date('Y-m-d H:i:s')));
}
else $excelarray[$i]["id"]=intval($excelarray[$i]["id"]);
if($wakka->getCount("records_demo","id='".$excelarray[$i]["id"]."'")==1)
{
$empdata=$wakka->getPersonServer($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)
{
$newdata['status'] = "";
}
if($excelarray[$i]["dialer_status"]==null)
{
$newdata['dialer_status'] = "";
}
if($excelarray[$i]["dialer_substatus"]==null)
{
$newdata['dialer_substatus'] = "";
}
/*End - Changes need to be done*/
$empdata["peopledata"]=$newdata;
$empdata['modifylog']=$createdlog;
$empdata['dirty']=$fdirty;
$wakka->setPersonServer($excelarray[$i]["id"],$empdata);
$excelarray[$i]['modified']=date('Y-m-d H:i:s');
$successArr[] = $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[] = "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();
}
}
\ No newline at end of file
<?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()
{
$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' => '10.3.177.14',
'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();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' and client='G4015' order by auto_id asc limit 0,20000"));
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;
}
}
}
$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');
}
}
}
mysqli_close($conn);
}
}
......@@ -43,12 +43,13 @@ class CreportEight extends Command {
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_id="08";
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".date("d_m_Y");
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
......@@ -63,6 +64,12 @@ class CreportEight extends Command {
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'"));
......
......@@ -49,6 +49,8 @@ class InsertCrmArchive extends Command {
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 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"));
}
}
}
}
}
......@@ -42,7 +42,12 @@ class bulkServerUpload extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +69,7 @@ class bulkServerUpload extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +84,11 @@ class bulkServerUpload extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 0,20000"));
$server_ip='10.3.179.121';
$location='Mumbai';
$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();
......@@ -99,7 +105,7 @@ class bulkServerUpload extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +114,6 @@ class bulkServerUpload extends Command {
$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"]);
......@@ -164,9 +169,28 @@ class bulkServerUpload extends Command {
$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"]=="")
......@@ -181,10 +205,10 @@ class bulkServerUpload extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -201,7 +225,6 @@ class bulkServerUpload extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
......@@ -210,6 +233,7 @@ class bulkServerUpload extends Command {
$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);
......@@ -217,7 +241,6 @@ class bulkServerUpload extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
//DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat` where SERVER_IP='10.3.179.121'"));
DB::connection("conn")->disconnect();
}
......
......@@ -42,7 +42,13 @@ class bulkServerUpload_1 extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_1 extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +85,12 @@ class bulkServerUpload_1 extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 20001,40000"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......
......@@ -18,21 +18,21 @@ use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_5 extends Command {
class bulkServerUpload_2 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_5';
protected $signature = 'bulkServerUpload_2';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_5';
protected $description = 'bulkServerUpload_2';
/**
* Execute the console command.
......@@ -42,7 +42,13 @@ class bulkServerUpload_5 extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_5 extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +85,12 @@ class bulkServerUpload_5 extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 100001,120000"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......@@ -99,7 +107,7 @@ class bulkServerUpload_5 extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +116,6 @@ class bulkServerUpload_5 extends Command {
$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"]);
......@@ -164,9 +171,28 @@ class bulkServerUpload_5 extends Command {
$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"]=="")
......@@ -181,10 +207,10 @@ class bulkServerUpload_5 extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -201,7 +227,6 @@ class bulkServerUpload_5 extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
......@@ -210,6 +235,7 @@ class bulkServerUpload_5 extends Command {
$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);
......@@ -217,7 +243,6 @@ class bulkServerUpload_5 extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_failure set $setFailure"));
}
}
// DB::connection("conn")->delete(DB::raw("DELETE FROM `bz_record_upload_uat` where SERVER_IP='10.3.179.121'"));
DB::connection("conn")->disconnect();
}
......
......@@ -42,7 +42,13 @@ class bulkServerUpload_3 extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_3 extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +85,12 @@ class bulkServerUpload_3 extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 60001,80000"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......@@ -99,7 +107,7 @@ class bulkServerUpload_3 extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +116,6 @@ class bulkServerUpload_3 extends Command {
$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"]);
......@@ -164,9 +171,28 @@ class bulkServerUpload_3 extends Command {
$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"]=="")
......@@ -181,10 +207,10 @@ class bulkServerUpload_3 extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -201,7 +227,6 @@ class bulkServerUpload_3 extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
......@@ -210,6 +235,7 @@ class bulkServerUpload_3 extends Command {
$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);
......
......@@ -18,21 +18,21 @@ use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_daily extends Command {
class bulkServerUpload_4 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_daily';
protected $signature = 'bulkServerUpload_4';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_daily';
protected $description = 'bulkServerUpload_4';
/**
* Execute the console command.
......@@ -42,7 +42,13 @@ class bulkServerUpload_daily extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_daily extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -78,11 +84,12 @@ class bulkServerUpload_daily extends Command {
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_daily where SERVER_IP='10.3.179.121' order by auto_id asc limit 0,200"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......@@ -91,7 +98,7 @@ class bulkServerUpload_daily extends Command {
$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_daily'"));
$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);
......@@ -99,7 +106,7 @@ class bulkServerUpload_daily extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +115,6 @@ class bulkServerUpload_daily extends Command {
$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"]);
......@@ -164,9 +170,28 @@ class bulkServerUpload_daily extends Command {
$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"]=="")
......@@ -181,10 +206,10 @@ class bulkServerUpload_daily extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -198,10 +223,9 @@ class bulkServerUpload_daily extends Command {
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success_daily set $setSuccess"));
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
......@@ -210,17 +234,15 @@ class bulkServerUpload_daily extends Command {
$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")->insert(DB::raw("insert into bz_record_upload_uat_failure 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();
}
}
......
......@@ -18,21 +18,21 @@ use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_2 extends Command {
class bulkServerUpload_6 extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_2';
protected $signature = 'bulkServerUpload_6';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_2';
protected $description = 'bulkServerUpload_6';
/**
* Execute the console command.
......@@ -42,7 +42,13 @@ class bulkServerUpload_2 extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_2 extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +85,12 @@ class bulkServerUpload_2 extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 40001,60000"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......@@ -99,7 +107,7 @@ class bulkServerUpload_2 extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +116,6 @@ class bulkServerUpload_2 extends Command {
$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"]);
......@@ -164,9 +171,28 @@ class bulkServerUpload_2 extends Command {
$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"]=="")
......@@ -181,10 +207,10 @@ class bulkServerUpload_2 extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -201,7 +227,6 @@ class bulkServerUpload_2 extends Command {
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $setSuccess"));
}
}
if(!empty($failureArr)){
foreach($failureArr as $failur)
{
......@@ -210,6 +235,7 @@ class bulkServerUpload_2 extends Command {
$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);
......
......@@ -18,21 +18,21 @@ use Input;
use Illuminate\Database\Schema\Blueprint;
class bulkServerUpload_4 extends Command {
class bulkServerUpload_daily extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'bulkServerUpload_4';
protected $signature = 'bulkServerUpload_daily';
/**
* The console command description.
*
* @var string
*/
protected $description = 'bulkServerUpload_4';
protected $description = 'bulkServerUpload_daily';
/**
* Execute the console command.
......@@ -42,7 +42,13 @@ class bulkServerUpload_4 extends Command {
public function handle()
{
echo "\n".date('Y-m-d')."\n";
//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();
......@@ -64,7 +70,7 @@ class bulkServerUpload_4 extends Command {
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'yb9738z'),
......@@ -79,10 +85,14 @@ class bulkServerUpload_4 extends Command {
DB::connection("conn")->getDatabaseName();
$excelarray = DB::connection("conn")->select(DB::raw("select * from bz_record_upload_uat where SERVER_IP='10.3.179.121' order by auto_id asc limit 80001,100000"));
$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"));
$server_ip='10.3.179.121';
$location='Mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
......@@ -99,7 +109,7 @@ class bulkServerUpload_4 extends Command {
$flag = 0;
$editflag=0;
for($i=0;$i<=$highestrow;$i++)
for($i=0;$i<$highestrow;$i++)
{
if($excelarray[$i]["id"]!="")
{
......@@ -108,7 +118,6 @@ class bulkServerUpload_4 extends Command {
$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"]);
......@@ -164,9 +173,28 @@ class bulkServerUpload_4 extends Command {
$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"]=="")
......@@ -181,10 +209,10 @@ class bulkServerUpload_4 extends Command {
$excelarray[$i]['Reason'] = $reason;
$failureArr[] = $excelarray[$i];
}
}
if(!empty($successArr)){
foreach($successArr as $succes)
{
......@@ -198,10 +226,11 @@ class bulkServerUpload_4 extends Command {
$setSuccess = implode(",",$setSuccess);
DB::connection("conn")->insert(DB::raw("insert into bz_record_upload_uat_success set $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)
{
......@@ -210,14 +239,19 @@ class bulkServerUpload_4 extends Command {
$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")->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 dailyupload_calllog extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dailyupload_calllog';
/**
* The console command description.
*
* @var string
*/
protected $description = 'dailyupload_calllog';
/**
* 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();
$server_ip=env('app_ip');
$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',
'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;
}
$clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $calllog_report group by server"));
$caar=[];
foreach($clist as $cline)
{
$caar[$cline->server]= $cline->cnt;
}
$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)."'"));
$location_cont='0';
$central_cont='0';
$location_cont=$mlist[0]->countrecord;
if(array_key_exists($server_id,$caar)){
$central_cont=$caar[$server_id];
}else{
$central_cont=0;
}
$dif=($mlist[0]->countrecord)-($central_cont);
if($dif<=5 && $dif>=-5){
$result="Y";
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'"));
}else{
$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'"));
}
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 dailyupload_questionaire extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dailyupload_questionaire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'dailyupload_questionaire';
/**
* 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();
$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',
'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;
}
$clist=DB::connection("conn")->select(DB::raw("select count(*) as cnt,server from $questionaire_details group by server"));
$caar=[];
foreach($clist as $cline)
{
$caar[$cline->server]= $cline->cnt;
}
$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)."'"));
$location_cont='0';
$central_cont='0';
$location_cont=$mlist[0]->countrecord;
if(array_key_exists($server_id,$caar)){
$central_cont=$caar[$server_id];
}else{
$central_cont=0;
}
$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'"));
}else{
$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'"));
}
DB::connection("conn")->disconnect();
}
}
}
......@@ -13,21 +13,21 @@ use PDO;
use Illuminate\Database\Schema\Blueprint;
class seatcount extends Command {
class full_remark_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'seatcount';
protected $signature = 'full_remark_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'seatcount';
protected $description = 'full_remark_details';
/**
* Execute the console command.
......@@ -37,18 +37,19 @@ class seatcount extends Command {
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');
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_id="08";
$seatcount = "seatcount";
$server_ip=env('app_ip');
$full_remark = "full_remark_details";
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
......@@ -64,15 +65,18 @@ class seatcount extends Command {
if(DB::connection("conn")->getDatabaseName())
{
echo ",".$server_id;
$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 daily_count 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 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))."'"));
$userarr=array();
foreach($qlist as $qline)
......
<?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 lead_form_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'lead_form_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'lead_form_details';
/**
* 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();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$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,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;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(lead_form_id) as maxid from lead_form_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);
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="lead_form_id='$qline->id'";
$setstrarr[]="created_at='$qline->created_at'";
$setstrarr[]="updated_at='$qline->updated_at'";
$setstrarr[]="product='$qline->product'";
$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[]="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();
}
}
}
......@@ -43,13 +43,13 @@ class questionnaire_details extends Command {
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_id="08";
$questionaire = "questionaire_details_".date("d_m_Y");
//$questionaire = "questionaire_details_23_06_2017";
$questionaire = "questionaire_details_".date("d_m_Y");
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
'host' => '10.3.177.14',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
......@@ -65,7 +65,12 @@ class questionnaire_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;
}
echo ",".$server_id;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(question_id) as maxid from $questionaire where server='$server_id'"));
......@@ -73,6 +78,8 @@ class questionnaire_details extends Command {
$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))."'"));
$userarr=array();
......
<?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();
}
}
}
?>
......@@ -38,69 +38,66 @@ class records_details extends Command {
{
$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();
//$slist=DB::connection("conn")->select(DB::raw("select * from server_details where type='COP' and id='1'"));
$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);
//$slist=DB::select(DB::raw("select * from server_details where type='COP' and id>'27' and id!='54'"));
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;
$server_ip='10.3.179.121';
$location='mumbai';
$conn='';
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
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)
{
$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);
$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;
if(DB::connection("conn")->getDatabaseName())
{
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_server_1 set client='$client', server_ip='$server_ip', record_id='$record_id', cust_id='$clientcode', records_status='$status', group_id='$clientinternalid', location='$location',mobile='$mobile',question='$question',firstname='$firstname',priority='$priority',modified='$modified'"));
}
DB::connection("conn")->disconnect();
}
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';
}
}
......@@ -6,52 +6,91 @@ 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\InsertCrmArchive',
'App\Console\Commands\DeleteCrmcalls',
];
/**
* 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('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_5')->dailyAt('22:15')->appendOutputTo(storage_path()."/reason/bulkserver.txt")->withoutOverlapping();
$schedule->command('InsertCrmArchive')->hourly()->withoutOverlapping();
$schedule->command('DeleteCrmcalls')->hourly()->withoutOverlapping();
$schedule->command('DailyLogout')->dailyAt('14:30')->withoutOverlapping();
}
/**
* 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 App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$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())
{
$relationshipList = DB::connection("conn")->select(DB::raw("SELECT * FROM relationship_tagging"));
$relationshipData = 0; $newService = 0; $newCategory = 0; $newSubCategory = 0;
foreach ($relationshipList as $list) {
$serviceId = 0;
$service = DB::select(DB::raw("SELECT * FROM relationship_service WHERE title = '$list->service'"));
if(count($service)){
$serviceId = $service[0]->id;
}else{
$addService = DB::table('relationship_service')->insert(['title'=>$list->service]);
$serviceId = $addService;
$newService++;
}
$category = DB::select(DB::raw("SELECT * FROM relationship_category WHERE service_id = $serviceId AND title = '$list->category'"));
if(count($category)){
$categoryId = $category[0]->id;
}else{
$addCategory = DB::table('relationship_category')->insert(['service_id'=>$serviceId,'title'=>$list->category]);
$categoryId = $addCategory;
$newCategory++;
}
$subCategory = DB::select(DB::raw("SELECT * FROM relationship_sub_category WHERE category_id = $categoryId AND title = '$list->sub_category'"));
if(count($subCategory)){
$subCategoryId = $subCategory[0]->id;
}else{
$addSubCategory = DB::table('relationship_sub_category')->insert(['category_id'=>$categoryId,'title'=>$list->sub_category]);
$subCategoryId = $addSubCategory;
$newSubCategory++;
}
//DB::table('relationship_tagging')->where('id', $list->id)->update(['status'=>'InActive']);
$relationshipData++;
}
echo "Total ".$relationshipData." data process and ". $newService." service, ".$newCategory." category, ".$newSubCategory." sub category added";
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 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))."'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' 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'";
$countid=DB::connection("conn")->select(DB::raw("SELECT count(crmcall_id) as countid from $calllog_report where server='$server_id' and crmcall_id='$aline->id'"));
$countids=$countid[0]->countid;
if($countids>0){continue;}
$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'";
$setstrarr[]="attempt='$aline->attempt'";
$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 DB;
use App\Models\RelationshipService;
use App\Models\RelationshipCategory;
use App\Models\RelationshipSubCategory;
use Config;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
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');
$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())
{
$relationshipList = DB::connection("conn")->select(DB::raw("SELECT * FROM relationship_tagging"));
$relationshipData = 0; $newService = 0; $newCategory = 0; $newSubCategory = 0;
foreach ($relationshipList as $list) {
$service = RelationshipService::where('title','=',$list->service)->first();
if(count($service)){
$serviceId = $service->id;
}else{
$addService = RelationshipService::create(['title'=>$list->service]);
$serviceId = $addService->id;
$newService++;
}
//echo $list->service." : ".$serviceId." - ";
$category = RelationshipCategory::where('service_id','=',$serviceId)->where('title','=',$list->category)->first();
if(count($category)){
$categoryId = $category->id;
}else{
$addCategory = RelationshipCategory::create(['service_id'=>$serviceId,'title'=>$list->category]);
$categoryId = $addCategory->id;
$newCategory++;
}
//echo $list->category." : ".$categoryId." - ";
$subCategory = RelationshipSubCategory::where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->first();
if(count($subCategory)){
$subCategoryId = $subCategory->id;
$updateSubCategory = DB::table('relationship_sub_category')->where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->update(['status'=>$list->status]);
}else{
$addSubCategory = RelationshipSubCategory::create(['category_id'=>$categoryId,'title'=>$list->sub_category,'status'=>$list->status]);
$subCategoryId = $addSubCategory->id;
$newSubCategory++;
}
echo $list->sub_category." : ".$subCategoryId."\n";
//DB::table('relationship_tagging')->where('id', $list->id)->update(['status'=>'InActive']);
$relationshipData++;
}
echo "Total ".$relationshipData." data process and ". $newService." service, ".$newCategory." category, ".$newSubCategory." sub category added\n";
DB::connection("conn")->disconnect();
}
}
}
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use App\Models\RelationshipService;
use App\Models\RelationshipCategory;
use App\Models\RelationshipSubCategory;
use Config;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
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');
$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())
{
DB::table('relationship_service')->truncate();
DB::table('relationship_category')->truncate();
DB::table('relationship_sub_category')->truncate();
$relationshipList = DB::connection("conn")->select(DB::raw("SELECT * FROM relationship_tagging"));
$relationshipData = 0; $newService = 0; $newCategory = 0; $newSubCategory = 0;
foreach ($relationshipList as $list) {
$service = RelationshipService::where('title','=',$list->service)->first();
if(count($service)){
$serviceId = $service->id;
}else{
$addService = RelationshipService::create(['title'=>$list->service]);
$serviceId = $addService->id;
$newService++;
}
//echo $list->service." : ".$serviceId." - ";
$category = RelationshipCategory::where('service_id','=',$serviceId)->where('title','=',$list->category)->first();
if(count($category)){
$categoryId = $category->id;
}else{
$addCategory = RelationshipCategory::create(['service_id'=>$serviceId,'title'=>$list->category]);
$categoryId = $addCategory->id;
$newCategory++;
}
//echo $list->category." : ".$categoryId." - ";
$subCategory = RelationshipSubCategory::where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->first();
if(count($subCategory)){
$subCategoryId = $subCategory->id;
//$updateSubCategory = DB::table('relationship_sub_category')->where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->update(['status'=>$list->status]);
}else{
$addSubCategory = RelationshipSubCategory::create(['category_id'=>$categoryId,'title'=>$list->sub_category,'status'=>$list->status]);
$subCategoryId = $addSubCategory->id;
$newSubCategory++;
}
echo $list->sub_category." : ".$subCategoryId."\n";
//DB::table('relationship_tagging')->where('id', $list->id)->update(['status'=>'InActive']);
$relationshipData++;
}
echo "Total ".$relationshipData." data process and ". $newService." service, ".$newCategory." category, ".$newSubCategory." sub category added\n";
DB::connection("conn")->disconnect();
}
}
}
......@@ -38,6 +38,7 @@ class CreportEight extends Command {
public function handle()
{
$nowts=time();
$date=date('F_Y');
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
......@@ -45,8 +46,8 @@ class CreportEight extends Command {
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$central_ip=env('central_ip');
$server_ip=env('app_ip');
$calllog_report = "calllog_report_".date("d_m_Y");
//$calllog_report = "calllog_report_".date("d_m_Y");
$calllog_report = "calllog_report_".$date;
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
......@@ -75,7 +76,10 @@ class CreportEight extends Command {
$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))."'"));
$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
//$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))."'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' and created_at<'".date("Y-m-d H:i:s",$logdate-(60*60))."'"));
$userarr=array();
foreach($alist as $aline)
......@@ -108,6 +112,7 @@ class CreportEight extends Command {
$setstrarr[]="record_id='$record_id'";
$setstrarr[]="crmcall_id='$aline->id'";
$setstrarr[]="globalid='$globalid'";
$setstrarr[]="created_at='$aline->created_at'";
$setstrarr[]="start='$fulldate'";
$setstrarr[]="length='$length'";
$setstrarr[]="user='$username'";
......@@ -137,6 +142,9 @@ class CreportEight extends Command {
$setstrarr[]="disposec='".round($aline->dispoSec/1000,2)."'";
$setstrarr[]="remarks='".str_replace("'","",$aline->userremarks)."'";
$setstrarr[]="userdata='$aline->userdata'";
$setstrarr[]="attempt='$aline->attempt'";
$setstrarr[]="priority='$aline->priority'";
$setstrarr[]="question='$aline->question'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
......
......@@ -49,7 +49,7 @@ class InsertCrmArchive extends Command {
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"));
DB::update(DB::raw("UPDATE crmcalls_archive as ca INNER JOIN crmcalls as c on ca.id = c.id set ca.state = c.state,ca.statuscode = c.statuscode,ca.status = c.status,ca.substatus = c.substatus,ca.callSec = c.callSec,ca.ts_Talk = c.ts_Talk,ca.ts_Recstart = c.ts_Recstart,ca.ts_Recend = c.ts_Recend,ca.ts_Dispo = c.ts_Dispo,ca.ts_Close = c.ts_Close,ca.dispoSec = c.dispoSec,ca.recstartSec=c.recstartSec,ca.data = c.data,ca.recsize = c.recsize,ca.userstatus = c.userstatus,ca.usersubstatus = c.usersubstatus,ca.usercallback = c.usercallback ,ca.userremarks = c.userremarks,ca.attempt = c.attempt,ca.priority = c.priority,ca.question = c.question"));
echo 'End';
}
......
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class calllog extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'calllog';
/**
* The console command description.
*
* @var string
*/
protected $description = 'App Main Daily Task for calllog';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
$date=date('F_Y');
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;
$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 H:i:s",$logdate-(60*60))."'"));
//$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))."'"));
//$alist=DB::select(DB::raw("SELECT * from crmcalls where id>'$maxids' 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'";
$countid=DB::connection("conn")->select(DB::raw("SELECT count(crmcall_id) as countid from $calllog_report where server='$server_id' and crmcall_id='$aline->id'"));
$countids=$countid[0]->countid;
if($countids>0){continue;}
$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'";
$setstrarr[]="attempt='$aline->attempt'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into ".$calllog_report." set $setstr"));
}
}
}
......@@ -89,9 +89,9 @@ class dailyupload_calllog extends Command {
$central_cont=0;
}
$dif=($mlist[0]->countrecord)-($central_cont);
$dif=($central_cont)-($mlist[0]->countrecord);
if($dif<=5 && $dif>=-5){
if($dif==0){
$result="Y";
......
......@@ -94,9 +94,9 @@ class dailyupload_questionaire extends Command {
$central_cont=0;
}
$dif=($mlist[0]->countrecord)-($central_cont);
$dif=($central_cont)-($mlist[0]->countrecord);
if($dif<=1 && $dif>=-1){
if($dif==0){
$result="Y";
......
......@@ -15,109 +15,110 @@ use Illuminate\Database\Schema\Blueprint;
class lead_form_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'lead_form_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'lead_form_details';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
/**
* The console command name.
*
* @var string
*/
protected $signature = 'lead_form_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'lead_form_details';
/**
* 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();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$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())
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$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;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(lead_form_id) as maxid from lead_form_details where server_ip='$server_ip'"));
$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');
$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);
$maxids=$maxid[0]->maxid;
$qlist=DB::select(DB::raw("SELECT * from lead_form where id>'$maxids'"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
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;
$maxid=DB::connection("conn")->select(DB::raw("SELECT max(lead_form_id) as maxid from lead_form_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);
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="lead_form_id='$qline->id'";
$setstrarr[]="created_at='$qline->created_at'";
$setstrarr[]="updated_at='$qline->updated_at'";
$setstrarr[]="product='$qline->product'";
$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[]="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();
$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);
$setstrarr[]="lead_form_id='$qline->id'";
$setstrarr[]="created_at='$crtdate'";
$setstrarr[]="updated_at='$update'";
$setstrarr[]="br_code='$qline->br_code'";
$setstrarr[]="br_name='$qline->br_name'";
$setstrarr[]="lg_code='$qline->lg_code'";
$setstrarr[]="processing_entity='$qline->processing_entity'";
$setstrarr[]="lead_owner='$qline->lead_owner'";
$setstrarr[]="lead_priority='$qline->lead_priority'";
$setstrarr[]="product='$qline->product'";
$setstrarr[]="customer_profile='$qline->customer_profile'";
$setstrarr[]="customer_name='$qline->customer_name'";
$setstrarr[]="connected_number='$qline->connected_number'";
$setstrarr[]="remarks='$qline->remarks'";
$setstrarr[]="mobile='$qline->mobile'";
$setstrarr[]="client='$qline->client'";
$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'";
$setstrarr[]="server_id='$server_id'";
$setstrarr[]="server_ip='$server_ip'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into lead_form_details set $setstr"));
}
}
DB::connection("conn")->disconnect();
}
}
}
......
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use App\Models\RelationshipService;
use App\Models\RelationshipCategory;
use App\Models\RelationshipSubCategory;
use Config;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
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');
$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())
{
$relationshipList = DB::connection("conn")->select(DB::raw("SELECT * FROM relationship_tagging"));
$relationshipData = 0; $newService = 0; $newCategory = 0; $newSubCategory = 0;
foreach ($relationshipList as $list) {
$service = RelationshipService::where('title','=',$list->service)->first();
if(count($service)){
$serviceId = $service->id;
}else{
$addService = RelationshipService::create(['title'=>$list->service]);
$serviceId = $addService->id;
$newService++;
}
echo $list->service." : ".$serviceId." - ";
$category = RelationshipCategory::where('service_id','=',$serviceId)->where('title','=',$list->category)->first();
if(count($category)){
$categoryId = $category->id;
}else{
$addCategory = RelationshipCategory::create(['service_id'=>$serviceId,'title'=>$list->category]);
$categoryId = $addCategory->id;
$newCategory++;
}
echo $list->category." : ".$categoryId." - ";
$subCategory = RelationshipSubCategory::where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->first();
if(count($subCategory)){
$subCategoryId = $subCategory->id;
}else{
$addSubCategory = RelationshipSubCategory::create(['category_id'=>$categoryId,'title'=>$list->sub_category,'status'=>$list->status]);
$subCategoryId = $addSubCategory->id;
$newSubCategory++;
}
echo $list->sub_category." : ".$subCategoryId."\n";
//DB::table('relationship_tagging')->where('id', $list->id)->update(['status'=>'InActive']);
$relationshipData++;
}
echo "Total ".$relationshipData." data process and ". $newService." service, ".$newCategory." category, ".$newSubCategory." sub category added\n";
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 question_tree extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'question_tree';
/**
* The console command description.
*
* @var string
*/
protected $description = 'question_tree';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$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())
{
DB::table('question_tree')->truncate();
DB::table('question')->truncate();
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from question_tree"));
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="parent_id='$qline->parent_id'";
$setstrarr[]="parent_opt='$qline->parent_opt'";
$setstrarr[]="question_id='$qline->question_id'";
$setstrarr[]="priority='$qline->priority'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into question_tree set $setstr"));
}
$slist=DB::connection("conn")->select(DB::raw("SELECT * from question_bank"));
foreach($slist as $sline)
{
$setstrarr=array();
$setstrarr[]="question_no='$sline->question_no'";
$setstrarr[]="questions='$sline->questions'";
$setstrarr[]="opt_1='$sline->opt_1'";
$setstrarr[]="opt_2='$sline->opt_2'";
$setstrarr[]="opt_3='$sline->opt_3'";
$setstrarr[]="opt_4='$sline->opt_4'";
$setstrarr[]="opt_5='$sline->opt_5'";
$setstrarr[]="opt_6='$sline->opt_6'";
$setstrarr[]="opt_7='$sline->opt_7'";
$setstrarr[]="opt_8='$sline->opt_8'";
$setstrarr[]="opt_9='$sline->opt_9'";
$setstrarr[]="opt_10='$sline->opt_10'";
$setstrarr[]="type='$sline->type'";
$setstrarr[]="compulsory_qes='$sline->compulsory_qes'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into question set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
......@@ -46,7 +46,7 @@ use Illuminate\Database\Schema\Blueprint;
$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");
$reporthead=array("id","server_ip","call_start_date","call_start_time","call_duration","DNIS","ANI","call_id","call_direction","transfer_type","cti_var1","cti_var2","cti_var4","cti_var5","cti_var6","cti_var10","transfer_status","recording_filename");
$ftp_server="10.3.177.14";
$ftp_user_name="buzzworks";
......@@ -78,14 +78,20 @@ use Illuminate\Database\Schema\Blueprint;
//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;
$server_type=DB::connection("conn")->select(DB::raw("SELECT type from server_details where server_ip='$server_ip'"));
if($server_type)$servertype=$server_type[0]->type;
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";
echo "\n"."servertype---".$servertype."\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();
$qlist=DB::table('crmcalls_archive')->select('*')->whereIN('id',array('1014744','1014698','1014743','1014752','1014744','1014755','1014774','1014780','1014781','1014782','1014793'))->get();
//create csv file
$ii=1;
......@@ -101,7 +107,9 @@ use Illuminate\Database\Schema\Blueprint;
$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);
$length=round(($qline->talkSec+$qline->recstartSec+$qline->recendSec)/1000,0);
$length=gmdate("H:i:s", $length);
echo "\n"."startdate--".explode(" ",$fulldate)[0]."\n";
echo "\n"."starttime--".explode(" ",$fulldate)[1]."\n";
echo "\n"."call duration--". $length."\n";
......@@ -124,21 +132,38 @@ use Illuminate\Database\Schema\Blueprint;
$call_direction="";
$disposubdispo="";
$transfer_status="";
if($qline->type=='Manual' || $qline->type='Progressive')
{
$call_direction="OB-".$qline->type;
$transfer_type='null';
}
else
{
$call_direction=$qline->type;
$transfer_type='null';
}
$disposubdispo=$qline->userstatus.','.$qline->usersubstatus;
$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[]="call_id='$qline->id'";
$setstrarr[]="call_direction='$call_direction'";
$setstrarr[]="transfer_type='$transfer_type'";
$setstrarr[]="cti_var1='$userdatavalue'";
$setstrarr[]="cti_var2='$qline->client'";
$setstrarr[]="cti_var4='$qline->crm_id'";
$setstrarr[]="cti_var5='$qline->id'";
$setstrarr[]="cti_var6='$servertype'";
$setstrarr[]="cti_var10='$disposubdispo'";
//send recording file to server
......@@ -175,7 +200,9 @@ use Illuminate\Database\Schema\Blueprint;
$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);
$data=array($ii++,$server_ip,explode(" ",$fulldate)[0],explode(" ",$fulldate)[1],$length,$qline->did,$qline->number,$qline->id,$call_direction,$transfer_type,$userdatavalue,$qline->client,$qline->crm_id,$qline->id,$servertype,$disposubdispo,$success_fail,$remote_file);
fputcsv($filesave, $data);
......
<?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 App\Jobs\KHRMSLib;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class recording_reconcilation_metadata extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'recording_reconcilation_metadata';
/**
* The console command description.
*
* @var string
*/
protected $description = 'recording_reconcilation_metadata';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n"."start Time---".date('Y-m-d H:i:s')."\n";
$logdate=strtotime(date('Y-m-d')." 00:00:00");
//$logdate=strtotime(date("2017-09-01")." 00:00:00");
$logtodate=strtotime(date('Y-m-d')." 23:59:59");
//$logtodate=strtotime(date("2017-11-30")." 23:59:59");
$server_ip=env('app_ip');
$central_ip=env('central_ip');
$wakka = new KHRMSLib();
$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_metadata where server_ip='$server_ip'"));
if($maxid)$maxids=$maxid[0]->maxid;
$server_type=DB::connection("conn")->select(DB::raw("SELECT type from server_details where server_ip='$server_ip'"));
if($server_type)$servertype=$server_type[0]->type;
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";
echo "\n"."servertype---".$servertype."\n";*/
$qlist="";
//query for calllog and recording
//$qlist=DB::table('crmcalls_archive')->select('id','created_at','recstartSec','recendSec','userdata','crm_id','type','userstatus','usersubstatus','did','number','client')->where('id','>','$maxids')->get();
$qlist=DB::select("SELECT id,created_at,recstartSec,recendSec,userdata,crm_id,type,userstatus,usersubstatus,did,number,client FROM crmcalls_archive where id > '$maxids' ");
//$qlist=DB::select("SELECT * FROM crmcalls_archive where id > '$maxids' ");
/*$qlist=DB::table('crmcalls_archive')->select('*')->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_archive')->select('*')->whereIN('id',array('1014744','1014698','1014743','1014752','1014744','1014755','1014774','1014780','1014781','1014782','1014793'))->get();*/
$userdatavalue="";
foreach ($qlist as $qline)
{
//$file = storage_path()."/app/drec/2017-11/".$qline->id.".gsm";//tobe uploaded
//echo "\n".date("Y-m",strtotime($qline->created_at))."\n";
$file = storage_path()."/app/drec/".date("Y-m",strtotime($qline->created_at))."/".$qline->id.".gsm";
//$remote_file = "/home/buzzworks/recording_test";
$remote_file = "recording_test/".$server_ip."_".$qline->id.".wav";
//echo "\n"."file is exist or not".file_exists($file)."\n";
if (file_exists($file))
{
$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,0);
$length=gmdate("H:i:s", $length);
/*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="";
}
}
$user=$wakka->getPerson($qline->crm_id);
$clientcode=$user["peopledata"]["clientcode"];
$call_direction="";
$disposubdispo="";
$transfer_status="";
if($qline->type=='Manual' || $qline->type='Progressive')
{
$call_direction="OB-".$qline->type;
$transfer_type='null';
}
else
{
$call_direction=$qline->type;
$transfer_type='null';
}
$disposubdispo=$qline->userstatus.','.$qline->usersubstatus;
$setstrarr=array();
$setstrarr[]="server_ip='$server_ip'";
$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_id='$qline->id'";
$setstrarr[]="call_direction='$call_direction'";
$setstrarr[]="transfer_type='$transfer_type'";
$setstrarr[]="cti_var1='$userdatavalue'";
$setstrarr[]="cti_var2='$qline->client'";
$setstrarr[]="cti_var4='$qline->crm_id'";
$setstrarr[]="cti_var5='$qline->id'";
$setstrarr[]="cti_var6='$servertype'";
$setstrarr[]="cti_var10='$disposubdispo'";
$setstrarr[]="customer_id='$clientcode'";
/*echo "Successfully connect";
echo "The file $file exists";
echo "successfully uploaded $file\n";*/
//$setstrarr[]="transfer_status='success'";
$setstrarr[]="recording_filename='$file'";
$setstr=implode(",",$setstrarr);
DB::connection("conn")->insert(DB::raw("insert into recording_reconcilation_metadata set $setstr"));
}
// close the connection
}
echo "\n"."End Time---".date('Y-m-d H:i:s')."\n";
DB::connection("conn")->disconnect();
}
}
}
?>
......@@ -42,7 +42,7 @@ class relationship_tag extends Command {
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$central_ip=env('app_ip');
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
......@@ -62,6 +62,11 @@ class relationship_tag extends Command {
if(DB::connection("conn")->getDatabaseName())
{
DB::table('relationship_service')->truncate();
DB::table('relationship_category')->truncate();
DB::table('relationship_sub_category')->truncate();
$relationshipList = DB::connection("conn")->select(DB::raw("SELECT * FROM relationship_tagging"));
$relationshipData = 0; $newService = 0; $newCategory = 0; $newSubCategory = 0;
......@@ -71,30 +76,34 @@ class relationship_tag extends Command {
if(count($service)){
$serviceId = $service->id;
}else{
$addService = RelationshipService::create(['title'=>$list->service]);
$serviceId = $addService->id;
$newService++;
}
echo $list->service." : ".$serviceId." - ";
//echo $list->service." : ".$serviceId." - ";
$category = RelationshipCategory::where('service_id','=',$serviceId)->where('title','=',$list->category)->first();
if(count($category)){
$categoryId = $category->id;
}else{
$addCategory = RelationshipCategory::create(['service_id'=>$serviceId,'title'=>$list->category]);
$categoryId = $addCategory->id;
$newCategory++;
}
echo $list->category." : ".$categoryId." - ";
//echo $list->category." : ".$categoryId." - ";
$subCategory = DB::select(DB::raw("SELECT * from relationship_sub_category where category_id = $categoryId and title = '$list->sub_category'"));
$subCategory = RelationshipSubCategory::where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->first();
//$subCategory = RelationshipSubCategory::where('category_id','=',$categoryId)->where('title','=',$list->sub_category)->first();
if(count($subCategory)){
$subCategoryId = $subCategory->id;
}else{
$addSubCategory = RelationshipSubCategory::create(['category_id'=>$categoryId,'title'=>$list->sub_category]);
$addSubCategory = RelationshipSubCategory::create(['category_id'=>$categoryId,'title'=>$list->sub_category,'status'=>$list->status]);
$subCategoryId = $addSubCategory->id;
$newSubCategory++;
}
......@@ -111,4 +120,4 @@ class relationship_tag extends Command {
}
}
\ No newline at end of file
}
......
<?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 relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$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())
{
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from relationship_tagging"));
foreach($qlist as $qline)
{
$setstrarr=array();
$idqlist=DB::select(DB::raw("SELECT * from relationship_service where title='$qline->service'"));
if(!empty($idqlist)){
$servid=$idqlist[0]->id;
}else{
$servid='';
}
$setstrarr[]="title='$qline->service'";
$setstrarr[]="status='$qline->status'";
$setstr=implode(",",$setstrarr);
if($servid!='')
{
DB::update(DB::raw("update relationship_service set $setstr where id=$servid"));
}else{
DB::insert(DB::raw("insert into relationship_service set $setstr"));
//$servid = DB::table('relationship_service')->insertGetId();
}
}
$service_id=DB::select(DB::raw("SELECT * from relationship_service"));
//foreach($qlist as $qline)
//{
foreach ($service_id as $sid)
{
$setcatarr=array();
$idrlist=DB::select(DB::raw("SELECT * from relationship_category where title='$qline->category' and service_id=$sid->id"));
if(!empty($idrlist)){
$cateid=$idrlist[0]->id;
print_r($cateid);
echo "update";
}else{
$cateid='';
echo "no id";
}
$setcatarr[]="service_id='$sid->id'";
$setcatarr[]="title='$qline->category'";
$setcatarr[]="status='$qline->status'";
$setcat=implode(",",$setcatarr);
if($cateid!='')
{
DB::update(DB::raw("update relationship_category set $setcat where service_id=$cateid"));
echo "update";
}else{
DB::insert(DB::raw("insert into relationship_category set $setcat"));
echo "insert";
}
}echo "prashant1";
//}
$category_id=DB::select(DB::raw("SELECT * from relationship_category"));
foreach($qlist as $qline)
{
foreach ($category_id as $cid) {
$subcatarr=array();
$idslist=DB::select(DB::raw("SELECT * from relationship_sub_category where title='$qline->sub_category'"));
if(!empty($idslist)){
$subcateid=$idslist[0]->id;
}else{
$subcateid='';
}
$subcatarr[]="category_id='$cid->id'";
$subcatarr[]="title='$qline->sub_category'";
$subcatarr[]="status='$qline->status'";
$setsubcat=implode(",",$subcatarr);
if($subcateid!='')
{
//DB::update(DB::raw("update relationship_sub_category set $setsubcat where category_id=$subcateid"));
}else{
//DB::insert(DB::raw("insert into relationship_sub_category set $setsubcat"));
//$servid = DB::table('relationship_sub_category')->insertGetId();
}
}
}
echo "prashant";
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 relationship_tag extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'relationship_tag';
/**
* The console command description.
*
* @var string
*/
protected $description = 'relationship_tag';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$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())
{
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from relationship_tagging"));
foreach($qlist as $qline)
{
$idqlist=DB::select(DB::raw("SELECT title,id from relationship_service where title='$qline->service' and id=$qline->id"));
if(!empty($idqlist)){
$servid=$idqlist[0]->id;
}else{
$servid='';
}
$setstrarr=array();
$setstrarr[]="title='$qline->service'";
$setstrarr[]="status='$qline->status'";
$setstr=implode(",",$setstrarr);
if($servid!='')
{
DB::update(DB::raw("update relationship_service set $setstr where id=$servid"));
}else{
DB::insert(DB::raw("insert into relationship_service set $setstr"));
}
}
$service_id=DB::select(DB::raw("SELECT title,id from relationship_service"));
foreach($qlist as $qline)
{
foreach ($service_id as $sid) {
$idrlist=DB::select(DB::raw("SELECT id,title from relationship_category where title='$qline->category' and service_id='$sid->id'"));
if(!empty($idrlist)){
$cateid=$idrlist[0]->id;
}else{
$cateid='';
}
$setcatarr=array();
$setcatarr[]="service_id='$sid->id'";
$setcatarr[]="title='$qline->category'";
$setcatarr[]="status='$qline->status'";
$setcat=implode(",",$setstrarr);
if($cateid!='')
{
DB::update(DB::raw("update relationship_category set $setcat where id=$cateid"));
}else{
DB::insert(DB::raw("insert into relationship_category set $setcat"));
}
}
}
$category_id=DB::select(DB::raw("SELECT title,id from relationship_category"));
foreach($qlist as $qline)
{
foreach ($category_id as $cid) {
$idslist=DB::select(DB::raw("SELECT id,title from relationship_sub_category where title='$qline->category' and category_id='$cid->id'"));
if(!empty($idslist)){
print_r($idslist);
$subcateid=$idslist[0]->id;
}else{
$subcateid='';
}
$subcatarr[]="category_id='$cid->id'";
$subcatarr[]="title='$qline->sub_category'";
$subcatarr[]="status='$qline->status'";
$setsubcat=implode(",",$subcatarr);
if($$subcateid!='')
{
DB::update(DB::raw("update relationship_sub_category set $setsubcat where id=$subcateid"));
}else{
DB::insert(DB::raw("insert into relationship_sub_category set $setsubcat"));
}
}
}
echo "prashant3<br>";
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 rlpcust_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'rlpcust_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'rlpcust_details';
/**
* 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();
$server_ip=env('app_ip');
$p11086_cop_rlp_cust_base_uat = "p11086_cop_rlp_cust_base_uat";
$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())
{
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from p11086_cop_rlp_cust_base_uat"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="region='$qline->region'";
$setstrarr[]="unit='$qline->unit'";
$setstrarr[]="supervisor='$qline->supervisor'";
$setstrarr[]="region_head_name='$qline->region_head_name'";
$setstrarr[]="pbcode='$qline->pbcode'";
$setstrarr[]="cod_cust='$qline->cod_cust'";
$setstrarr[]="group_id='$qline->group_id'";
$setstrarr[]="total_connects='$qline->total_connects'";
$setstrarr[]="total_uniq_connects='$qline->total_uniq_connects'";
$setstrarr[]="crm_contact='$qline->crm_contact'";
$setstrarr[]="al_qm_opp='$qline->al_qm_opp'";
$setstrarr[]="al_upg_opp='$qline->al_upg_opp'";
$setstrarr[]="al_al_cnc_opp='$qline->al_al_cnc_opp'";
$setstrarr[]="al_pa_opp='$qline->al_pa_opp'";
$setstrarr[]="al_zip_opp='$qline->al_zip_opp'";
$setstrarr[]="al_called_opp='$qline->al_called_opp'";
$setstrarr[]="al_pitch='$qline->al_pitch'";
$setstrarr[]="al_lg='$qline->al_lg'";
$setstrarr[]="pl_10sec_opp='$qline->pl_10sec_opp'";
$setstrarr[]="pl_pa_opp='$qline->pl_pa_opp'";
$setstrarr[]="pl_pq_opp='$qline->pl_pq_opp'";
$setstrarr[]="bl_10sec_opp='$qline->bl_10sec_opp'";
$setstrarr[]="bl_pq_opp='$qline->bl_pq_opp'";
$setstrarr[]="pl_called_opp='$qline->pl_called_opp'";
$setstrarr[]="pl_pitch='$qline->pl_pitch'";
$setstrarr[]="pl_lg='$qline->pl_lg'";
$setstrarr[]="twl_pa_opp='$qline->twl_pa_opp'";
$setstrarr[]="twl_called_opp='$qline->twl_called_opp'";
$setstrarr[]="twl_pitch='$qline->twl_pitch'";
$setstrarr[]="twl_lg='$qline->twl_lg'";
$setstrarr[]="hl_bt_opp='$qline->hl_bt_opp'";
$setstrarr[]="hl_pq_opp='$qline->hl_pq_opp'";
$setstrarr[]="hl_called_opp='$qline->hl_called_opp'";
$setstrarr[]="hl_pitch='$qline->hl_pitch'";
$setstrarr[]="hl_lg='$qline->hl_lg'";
$setstrarr[]="gl_pitch='$qline->gl_pitch'";
$setstrarr[]="gl_lg='$qline->gl_lg'";
$setstrarr[]="las_opp='$qline->las_opp'";
$setstrarr[]="las_called_opp='$qline->las_called_opp'";
$setstrarr[]="las_pitch='$qline->las_pitch'";
$setstrarr[]="las_lg='$qline->las_lg'";
$setstrarr[]="lap_opp='$qline->lap_opp'";
$setstrarr[]="lap_called_opp='$qline->lap_called_opp'";
$setstrarr[]="lap_lg='$qline->lap_lg'";
$setstrarr[]="hsl_opp='$qline->hsl_opp'";
$setstrarr[]="hsl_called_opp='$qline->hsl_called_opp'";
$setstrarr[]="hsl_pitch='$qline->hsl_pitch'";
$setstrarr[]="cc_eli_new_opp='$qline->cc_eli_new_opp'";
$setstrarr[]="cc_called_opp='$qline->cc_called_opp'";
$setstrarr[]="cc_pitch='$qline->cc_pitch'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstrarr[]="region='$qline->region'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into $p11086_cop_rlp_cust_base_uat set $setstr"));
}
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 rlppb_details extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'rlppb_details';
/**
* The console command description.
*
* @var string
*/
protected $description = 'rlppb_details';
/**
* 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();
$server_ip=env('app_ip');
$p11086_cop_rlp_pb_base_uat = "p11086_cop_rlp_pb_base_uat";
$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())
{
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from p11086_cop_rlp_pb_base_uat"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="region='$qline->region'";
$setstrarr[]="unit='$qline->unit'";
$setstrarr[]="supervisor='$qline->supervisor'";
$setstrarr[]="region_head_name='$qline->region_head_name'";
$setstrarr[]="pbcode='$qline->pbcode'";
$setstrarr[]="no_of_cod_cust='$qline->no_of_cod_cust'";
$setstrarr[]="no_of_grp_id='$qline->no_of_grp_id'";
$setstrarr[]="total_connects='$qline->total_connects'";
$setstrarr[]="total_uniq_connects='$qline->total_uniq_connects'";
$setstrarr[]="crm_contact='$qline->crm_contact'";
$setstrarr[]="varience='$qline->varience'";
$setstrarr[]="al_qm_opp='$qline->al_qm_opp'";
$setstrarr[]="al_upg_opp='$qline->al_upg_opp'";
$setstrarr[]="al_al_cnc_opp='$qline->al_al_cnc_opp'";
$setstrarr[]="al_pa_opp='$qline->al_pa_opp'";
$setstrarr[]="al_zip_opp='$qline->al_zip_opp'";
$setstrarr[]="al_called_opp='$qline->al_called_opp'";
$setstrarr[]="al_pitch='$qline->al_pitch'";
$setstrarr[]="al_pitch_with_opp='$qline->al_pitch_with_opp'";
$setstrarr[]="al_pitch_with_out_opp='$qline->al_pitch_with_out_opp'";
$setstrarr[]="al_lg='$qline->al_lg'";
$setstrarr[]="pl_10sec_opp='$qline->pl_10sec_opp'";
$setstrarr[]="pl_pa_opp='$qline->pl_pa_opp'";
$setstrarr[]="pl_pq_opp='$qline->pl_pq_opp'";
$setstrarr[]="bl_10sec_opp='$qline->bl_10sec_opp'";
$setstrarr[]="bl_pq_opp='$qline->bl_pq_opp'";
$setstrarr[]="pl_called_opp='$qline->pl_called_opp'";
$setstrarr[]="pl_pitch='$qline->pl_pitch'";
$setstrarr[]="pl_pitch_with_opp='$qline->pl_pitch_with_opp'";
$setstrarr[]="pl_pitch_with_out_opp='$qline->pl_pitch_with_out_opp'";
$setstrarr[]="pl_lg='$qline->pl_lg'";
$setstrarr[]="twl_pa_opp='$qline->twl_pa_opp'";
$setstrarr[]="twl_called_opp='$qline->twl_called_opp'";
$setstrarr[]="twl_pitch='$qline->twl_pitch'";
$setstrarr[]="twl_pitch_with_opp='$qline->twl_pitch_with_opp'";
$setstrarr[]="twl_pitch_with_out_opp='$qline->twl_pitch_with_out_opp'";
$setstrarr[]="twl_lg='$qline->twl_lg'";
$setstrarr[]="hl_pq_opp='$qline->hl_pq_opp'";
$setstrarr[]="hl_bt_opp='$qline->hl_bt_opp'";
$setstrarr[]="hl_called_opp='$qline->hl_called_opp'";
$setstrarr[]="hl_pitch='$qline->hl_pitch'";
$setstrarr[]="hl_pitch_with_opp='$qline->hl_pitch_with_opp'";
$setstrarr[]="hl_pitch_with_out_opp='$qline->hl_pitch_with_out_opp'";
$setstrarr[]="hl_lg='$qline->hl_lg'";
$setstrarr[]="gl_pitch='$qline->gl_pitch'";
$setstrarr[]="gl_lg='$qline->gl_lg'";
$setstrarr[]="las_opp='$qline->las_opp'";
$setstrarr[]="las_called_opp='$qline->las_called_opp'";
$setstrarr[]="las_pitch='$qline->las_pitch'";
$setstrarr[]="las_pitch_with_opp='$qline->las_pitch_with_opp'";
$setstrarr[]="las_pitch_with_out_opp='$qline->las_pitch_with_out_opp'";
$setstrarr[]="las_lg='$qline->las_lg'";
$setstrarr[]="lap_opp='$qline->lap_opp'";
$setstrarr[]="lap_called_opp='$qline->lap_called_opp'";
$setstrarr[]="lap_lg='$qline->lap_lg'";
$setstrarr[]="hsl_opp='$qline->hsl_opp'";
$setstrarr[]="hsl_called_opp='$qline->hsl_called_opp'";
$setstrarr[]="hsl_pitch='$qline->hsl_pitch'";
$setstrarr[]="hsl_pitch_with_opp='$qline->hsl_pitch_with_opp'";
$setstrarr[]="hsl_pitch_with_out_opp='$qline->hsl_pitch_with_out_opp'";
$setstrarr[]="cc_eli_new_opp='$qline->cc_eli_new_opp'";
$setstrarr[]="cc_called_opp='$qline->cc_called_opp'";
$setstrarr[]="cc_pitch='$qline->cc_pitch'";
$setstrarr[]="cc_pitch_with_opp='$qline->cc_pitch_with_opp'";
$setstrarr[]="cc_pitch_with_out_opp='$qline->cc_pitch_with_out_opp'";
$setstrarr[]="cc_lg='$qline->cc_lg'";
$setstrarr[]="cc_activation_opp='$qline->cc_activation_opp'";
$setstrarr[]="cc_activation_called_opp='$qline->cc_activation_called_opp'";
$setstrarr[]="li_opp='$qline->li_opp'";
$setstrarr[]="li_called_opp='$qline->li_called_opp'";
$setstrarr[]="fd_opp='$qline->fd_opp'";
$setstrarr[]="fd_called_opp='$qline->fd_called_opp'";
$setstrarr[]="fd_pitch='$qline->fd_pitch'";
$setstrarr[]="fd_pitch_with_opp='$qline->fd_pitch_with_opp'";
$setstrarr[]="fd_pitch_with_out_opp='$qline->fd_pitch_with_out_opp'";
$setstrarr[]="ltd_act_saving_opp='$qline->ltd_act_saving_opp'";
$setstrarr[]="ltd_act_saving_called_opp='$qline->ltd_act_saving_called_opp'";
$setstrarr[]="mb_opp='$qline->mb_opp'";
$setstrarr[]="mb_called_opp='$qline->mb_called_opp'";
$setstrarr[]="mb_pitch='$qline->mb_pitch'";
$setstrarr[]="mb_pitch_with_opp='$qline->mb_pitch_with_opp'";
$setstrarr[]="mb_pitch_with_out_opp='$qline->mb_pitch_with_out_opp'";
$setstrarr[]="nb_mb_lg='$qline->nb_mb_lg'";
$setstrarr[]="aadhaar_opp='$qline->aadhaar_opp'";
$setstrarr[]="aadhaar_called_opp='$qline->aadhaar_called_opp'";
$setstrarr[]="aadhaar_pitch='$qline->aadhaar_pitch'";
$setstrarr[]="aadhaar_pitch_with_opp='$qline->aadhaar_pitch_with_opp'";
$setstrarr[]="aadhaar_pitch_with_out_opp='$qline->aadhaar_pitch_with_out_opp'";
$setstrarr[]="aadhaar_activation='$qline->aadhaar_activation'";
$setstrarr[]="digi2_score_opp='$qline->digi2_score_opp'";
$setstrarr[]="digi2_score_called_opp='$qline->digi2_score_called_opp'";
$setstrarr[]="digi_physical_opp='$qline->digi_physical_opp'";
$setstrarr[]="digi_physical_called_opp='$qline->digi_physical_called_opp'";
$setstrarr[]="digi_billpay_opp='$qline->digi_billpay_opp'";
$setstrarr[]="digi_billpay_called_opp='$qline->digi_billpay_called_opp'";
$setstrarr[]="bill_pay_pitch='$qline->bill_pay_pitch'";
$setstrarr[]="digi_bill_pay_pitch_with_opp='$qline->digi_bill_pay_pitch_with_opp'";
$setstrarr[]="digi_bill_pay_pitch_with_out_opp='$qline->digi_bill_pay_pitch_with_out_opp'";
$setstrarr[]="digi_basic_banking_opp='$qline->digi_basic_banking_opp'";
$setstrarr[]="digi_basic_banking_called_opp='$qline->digi_basic_banking_called_opp'";
$setstrarr[]="digi_ecom_shopping_opp='$qline->digi_ecom_shopping_opp'";
$setstrarr[]="digi_ecom_shopping_called_opp='$qline->digi_ecom_shopping_called_opp'";
$setstrarr[]="digi_investment_opp='$qline->digi_investment_opp'";
$setstrarr[]="digi_investment_called_opp='$qline->digi_investment_called_opp'";
$setstrarr[]="invest_pitch='$qline->invest_pitch'";
$setstrarr[]="digi_investment_pitch_with_opp='$qline->digi_investment_pitch_with_opp'";
$setstrarr[]="digi_investment_pitch_with_out_opp='$qline->digi_investment_pitch_with_out_opp'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into $p11086_cop_rlp_pb_base_uat set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!