8252849c by G Manojkumar
2 parents d2c7a03f c254a6ee
<?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 UserlogOne extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'UserlogOne';
/**
* The console command description.
*
* @var string
*/
protected $description = 'UserlogOne';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d')."\n";
if(env('app_ip')=="10.125.14.127")
{
$offline=array();
$arr=Config::get("app.hdfcnodes");
$logdate=strtotime('-1 day');
$userlogsTable = "userlogs_".date("d_m_Y",$logdate);
//echo "\n".$userlogsTable."\n";
//$slist=DB::select(DB::raw("select * from server_details where type='COP' and id!='32'"));
$slist=DB::select(DB::raw("select * from server_details where id>11"));
$server_ip='';
$std_code='';
$conn='';
foreach($slist as $sline)
{
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=$sline->server_ip;
$server_id=$sline->id;
$std_code=$sline->std_code;
$conn = array(
'driver' => 'mysql',
'host' => $server_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())
{
echo ",".$server_ip;
$i=0;
$ulist=DB::connection("conn")->select(DB::raw("select * from users WHERE 1"));
foreach($ulist as $uline) {
$users[$uline->id] = $uline->username;
}
if($alist=DB::connection("conn")->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)."'"))){
//if($alist=DB::connection("conn")->select(DB::raw("select * from userlogs WHERE created_at>'2017-09-01' and created_at<'2017-10-01'"))){
foreach($alist as $aline) {
$i++;
$global_id = $server_id . $i;
$rowdata = array('server'=>$server_id,'server_ip'=>$server_ip,'global_id'=>$global_id,'id'=>$aline->id,
'created_at'=>$aline->created_at,'updated_at'=>$aline->updated_at,'user_id'=>$aline->user_id,'user'=>$users[$aline->user_id],
'startdate'=>$aline->startdate,'starttime'=>$aline->starttime,'enddate'=>$aline->enddate,'endtime'=>$aline->endtime,
'durationsec'=>$aline->durationsec,'data'=>$aline->data,'group'=>$aline->group,'login'=>'','dialnext'=>'','dialnext-agentbriefing'=>'','dialnext-downtime'=>'','dialnext-floorannouncements'=>'','dialnext-incoming'=>'','dialnext-lunchbreak'=>'','dialnext-manual'=>'','dialnext-notready'=>'','dialnext-qualityfeedback'=>'','dialnext-teabreak'=>'','dialnext-teammeeting'=>'','dialnext-utilitybreak'=>'','manual'=>'','manual-agentbriefing'=>'','manual-agentbriefing'=>'','manual-downtime'=>'','manual-floorannouncements'=>'','manual-incoming'=>'','manual-lunchbreak'=>'','manual-manual'=>'','manual-notready'=>'','manual-qualityfeedback'=>'','manual-teabreak'=>'','manual-teammeeting'=>'','manual-utilitybreak'=>'','paused'=>'','paused-agentbriefing'=>'','paused-downtime'=>'','paused-floorannouncements'=>'','paused-incoming'=>'','paused-lunchbreak'=>'','paused-manual'=>'','paused-notready'=>'','paused-qualityfeedback'=>'','paused-teabreak'=>'','paused-teammeeting'=>'','paused-utilitybreak'=>'','paused-autowrapup'=>'','paused-wrapup'=>'','progressive'=>'','progressive-agentbriefing'=>'','progressive-agentbriefing'=>'','progressive-downtime'=>'','progressive-floorannouncements'=>'','progressive-incoming'=>'','progressive-lunchbreak'=>'','progressive-manual'=>'','progressive-notready'=>'','progressive-qualityfeedback'=>'','progressive-teabreak'=>'','progressive-teammeeting'=>'','progressive-utilitybreak'=>'','ready-incoming'=>''
);
$data=json_decode($aline->data,true);
foreach($data as $sipid=>$sdata)
{
$prets= isset($sdata[1]) ? $sdata[1] : (strtotime($aline->startdate . " " . $aline->starttime)+19600)*1000;
if(isset($sdata['states']))
{
$previous="login";
foreach($sdata['states'] as $fts=>$states)
{
if($states[0] != 1)
{
$rowdata[$previous] +=round(($fts-$prets)/1000,2);
$previous = (trim($states[1]) != '') ? strtolower($states[0]."-".$states[1]) : strtolower($states[0]);
$prets=$fts;
}
}
$rowdata[$previous] += round(($sdata['ts']-$prets)/1000,2);
}
}
$rowdata["login"] = $aline->durationsec;
$rowdata['not-ready']=$rowdata['paused-agentbriefing']+$rowdata['paused-autowrapup']+$rowdata['paused-downtime']+$rowdata['paused-floorannouncements']+$rowdata['paused-lunchbreak']+$rowdata['paused-notready']+$rowdata['paused-qualityfeedback']+$rowdata['paused-teammeeting']+$rowdata['paused-teabreak']+$rowdata['paused-utilitybreak'];
$key_value = '';
foreach($rowdata AS $key=>$value) {
if($key != 1)
$key_value .= "`$key` = '$value', ";
}
$startTime=$aline->startdate." ".$aline->starttime;
$endTime=$aline->enddate." ".$aline->endtime;
$crmCalls=DB::connection("conn")->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::insert(DB::raw("INSERT INTO ".$userlogsTable." SET $key_value"));
//DB::insert(DB::raw("INSERT INTO userlogs_050218 SET $key_value"));
}
DB::connection("conn")->disconnect();
}else{
DB::connection("conn")->disconnect();
}
}
}
}
}
}
<?php
$DisableNumbersArray = Array('2250910057','2653321205','2656702205','2657145889','2268231057');
?>
......@@ -155,7 +155,10 @@ class DialerController extends Controller {
$users=array();$searchresult="";
if(!empty($kstychCall["previewcrmid"]))$users=$wakka->getPersons("id='".$kstychCall["previewcrmid"]."' $roclientstr limit 1");
else $users=$this->getCallSequencing(1);
if(Auth::user()->username=='R14306'){
Log::useFiles(storage_path().'/logs/recordid_log_'.date("Y-m-d").'.log');
Log::info($kstychCall["previewcrmid"]."~".$users[0]['clientinternalid']."~".$users[0]['mobile']."~".$users[0]['id']);
}
if(!empty($users))
{
$searchresult.="<div id=divworking></div><div style='clear:both'></div><script>kSetDData('C','previewcrmid','".$users[0]['id']."');showRecruit(\"".$users[0]['id']."\");</script>";
......@@ -186,13 +189,13 @@ class DialerController extends Controller {
$users=array();$callnumber=$kstychCall['callnumber'];
$callnumber = trim($callnumber);
//$callnumber = trim($callnumber);
if($kstychDialer['mDialerState']=="Manual"){
/*if($kstychDialer['mDialerState']=="Manual"){
if((!preg_match('/^[0-9]*$/',$callnumber)) || strlen($callnumber)<6){
return Response::make("<script>simpleNotification('error','topRight','Please enter a valid phone number');</script>");
}
}
}*/
if($kstychCall['crmid'])
{
......@@ -205,13 +208,14 @@ class DialerController extends Controller {
}
if($kstychDialer['mDialerState']=="Manual")
{
$callnumber=trim($callnumber);
/* $callnumber=trim($callnumber);
if(!preg_match('/^[1-9][0-9]*$/',$callnumber)){
return Response::make("<script>simpleNotification('error','topRight','Only Digits are allowed');</script>");
}
if(strlen($callnumber)<6){
return Response::make("<script>simpleNotification('error','topRight','Enter a valid Number');</script>");
}
*/
if($crmid!="")
{
$tusers=$wakka->getPersonIDs("(mobile like '%".substr($callnumber,-10)."' OR
......@@ -770,6 +774,7 @@ if($action=="closecall")
$user=$wakka->getPerson($crmcall->crm_id);
$kstychCall["clientcode"]=$user['peopledata']['clientcode'];
if($user['peopledata']['id']==$crmcall->crm_id)
{
$user['peopledata']["dialer_status"]=$kstychCall["userstatus"];
......@@ -835,14 +840,14 @@ if($action=="closecall")
$userlog=UserLog::where('user_id','=',Auth::user()->id)->orderBy("id","DESC")->first();
$userlog->getLastTs($crmcall->sipid_id,$nowts);
$userlog->save();
if(Auth::user()->username=='S32732' && $kstychCall['callnumber']=='9324046534'){
//if(Auth::user()->username=='A21568' || Auth::user()->username=='admin'){
try{
$smscontroller = new SmsController();
$smscontroller->sendSmsBasedOnSubDisposition($kstychCall);
} catch(Exception $e) {
Log::info($e->getMessage());
}
}
//}
}
return Response::make("");
......@@ -1146,6 +1151,11 @@ public function show($id)
foreach($mc as $key=>$tcall){
//Log::info($tcall);
include_once( app_path() . '/Hacks/DisabledDIDs.php');
if( in_array(substr($tcall->number,-10),$DisableNumbersArray) ){
//Log::info("Disabled Number".$tcall->number);
continue;
}
$tccal=substr($tcall->number,-10);
$mc_number=CRMCall::where('userstatus','!=','InboundDROP')->where ('created_at','>',$tcall->created_at)->where('number','like',"%".$tccal."%")->orderBy("id","DESC")->first();
......@@ -1782,7 +1792,7 @@ public function show($id)
if($limit>0)
{
$tusers = array_filter($clientDetails, function($var){
return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted');
return ($var['status']=='Called'&&($var['dialer_substatus']=='NC - Customer in Meeting' || $var['dialer_substatus']=='NC - Ringing / No response' || $var['dialer_substatus']=='NC - Not Reachable' || $var['dialer_substatus']=='NC - Switched off' || $var['dialer_substatus']=='NC - Third Party'));
//return ($var['status']=='Called'&&$var['dialer_status']=='Not Contacted');
});
......@@ -1800,7 +1810,7 @@ public function show($id)
$limit=$limit-sizeof($tusers);
}
if($limit>0)
/*if($limit>0)
{
$tusers = array_filter($clientDetails, function($var){
return ($var['status']=='Called'&&$var['dialer_status']=='Contacted - Follow-Up - Generic');
......@@ -1817,7 +1827,7 @@ public function show($id)
}
$limit=$limit-sizeof($tusers);
}
}*/
if($limit>0)
{
......
<?php
namespace App\Http\Controllers;
use Auth;
use Input;
use Response;
use Config;
use App\Models\OutputReport;
use App\Models\OutputProduct;
use App\Models\CRMCall;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Requests;
class OutputReportController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function createOutputReport()
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$action=Input::get('action');
//echo $action;
if($action=="createOutputReport"){
$products = $request->input('products');
//print_r($products);
//$totalIncome = 0;
foreach ($products as $key => $value) {
$outputReport = OutputReport::firstOrCreate(
array(
'product_id' => $value['productId'],
'user_id' => Auth::user()->id
)
);
//$outputReport->user_id = Auth::user()->id;
$outputReport->user_name = Auth::user()->username;
$outputReport->date = date("Y-m-d");
$outputReport->call_attempts = $request->input('noOfAttempts');
$outputReport->call_contacts = $request->input('noOfContacts');
$outputReport->call_unique_contacts = $request->input('uniqueContacts');
// $totalIncome = $totalIncome + ($value['lc'] * $value['lcAmt']);
if($value['lc'] != '' && $value['lcAmt'] != ''){
$outputReport->income = $value['lc'] * $value['lcAmt'];
}
$outputReport->product_name = $value['product'];
$outputReport->lead_generated = $value['lg'];
$outputReport->lead_generated_amount = $value['lgAmt'];
$outputReport->lead_closed = $value['lc'];
$outputReport->lead_closed_amount = $value['lcAmt'];
$outputReport->created_at = date('Y-m-d H:i:s');
$outputReport->updated_at =date('Y-m-d H:i:s');
$outputReport->save();
}
}
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if($id=="reportdata")
{
//echo $id;
$data = array();
$disabled = "";
$dashboarduser=Auth::user();
if($dashboarduser->usertype == "Supervisor"){
$disabled = "disabled";
}
//if($dashboarduser->usertype == "User"){
// output reports
$products = DB::table('output_products')
->select('id as productId','name','status')
->where('status', '1')
->orderBy('output_products.id')
->get();
$report = DB::table('output_report')
->where('user_id',Auth::user()->id)
->where('date',DATE("Y-m-d",time()))
->get();
$outputReport = array();
foreach ($products as $pkey => $pvalue) {
$outputReport[$pvalue->productId] = array('name' => $pvalue->name, 'productId' => $pvalue->productId);
foreach ($report as $key => $value) {
if($value->product_id == $pvalue->productId){
$outputReport[$value->product_id]['lead_generated'] = $value->lead_generated;
$outputReport[$value->product_id]['lead_generated_amount'] = $value->lead_generated_amount;
$outputReport[$value->product_id]['lead_closed'] = $value->lead_closed;
$outputReport[$value->product_id]['lead_closed_amount'] = $value->lead_closed_amount;
}
}
}
// total income
$totalIncome = DB::select("select sum(income) as income from output_report where user_id=".Auth::user()->id." and date='".date('Y-m-d',time())."'");
// noOfAttempts
$noOfAttempts = CRMCall::where('userstatus','!=','InboundDROP')->where('created_at','>',date('Y-m-d',time()));
$noOfContacts = CRMCall::whereIn('usersubstatus',["Contacted","Feedback"])->where('created_at','>',date('Y-m-d',time()));
$uniqueContacts = DB::table('crmcalls')->select(DB::raw('count(distinct(number)) as total'))->whereIn('usersubstatus',["Contacted","Feedback"])->where('created_at','>',date('Y-m-d',time()));
//print_r($uniqueContacts);
$noOfAttempts = $noOfAttempts->where('user_id','=',$dashboarduser->id)->count();
$noOfContacts = $noOfContacts->where('user_id','=',$dashboarduser->id)->count();
$uniqueContacts =$uniqueContacts->where('user_id','=',$dashboarduser->id)->get();
$data['disabled'] = $disabled;
$data['products'] = $outputReport;
$data['totalIncome'] = $totalIncome[0]->income;
$data['noOfAttempts'] = $noOfAttempts;
$data['noOfContacts'] = $noOfContacts;
$data['uniqueContacts'] = $uniqueContacts[0]->total;
return view("layout.module.outputreport.outputreport", $data);
// }
}
if($id == "supervisordata"){
$users=Input::get("user");
if($users == ""){
$users = "ALL";
}
$supervisor = User::where('supervisor','=',Auth::user()->username)->get();
//if dropdown value is All then use the below foreach othewise just put the user_id in array based on dropdown
$usersarray= array();
if($users=="ALL"){
foreach($supervisor as $usersval){
$usersarray[] = $usersval->id;
}
} else{
$usersarray[] = $users;
}
$totalIncome = DB::select("select sum(income) as income from output_report where user_id IN (".implode(',',$usersarray).")");
$Contacts = DB::select("Select Count(user_id), Sum(call_attempts) as call_attempts,
Sum(call_contacts) as call_contacts,
Sum(call_unique_contacts) as call_unique_contacts
From (Select Distinct user_id, call_attempts, call_contacts, call_unique_contacts From output_report) a
where user_id in (".implode(',',$usersarray).")
");
$report = DB::select("SELECT product_id,product_name, SUM(lead_generated) as totallead, SUM(lead_generated_amount) as totalleadamt, SUM(lead_closed) as totalleadclosed, Sum(lead_closed_amount) as leadcloseamt FROM `output_report` where user_id in (".implode(',',$usersarray).") group by product_id");
//print_r($report);
$data['supervisor'] = $supervisor;
$data['Contacts'] = $Contacts[0];
$data['totalIncome'] = $totalIncome[0]->income;
$data['report'] = $report;
$data['users'] = $users;
return view("layout.module.outputreport.supervisorreport", $data);
}
return view("layout.module.outputreport.$id",array());
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
......@@ -9,26 +9,21 @@ class SmsController extends Controller
{
public $smsUrl = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?';
//public $userarray = array("A21568","admin");
public function sendSmsBasedOnSubDisposition($kstychCall)
{
//public $userarray = array("A21568","admin");
//$users = $this->userarray;
//Log::info(Auth::user()->username." ^ ".$users[0]);
//Log::info(in_array(Auth::user()->username , $users));
//if(in_array(Auth::user()->username , $users)){
$msgText = $this->getSmsTemplate($kstychCall);
if( !empty($msgText) ) {
$msgText = $this->fillValuesInTemplate($msgText);
public function sendSmsBasedOnSubDisposition($kstychCall)
{
$msgText = $this->getSmsTemplate($kstychCall);
if( !empty($msgText) ) {
$msgText = $this->fillValuesInTemplate($msgText);
//Log::info($msgText);
$this->sendSmsRequest($kstychCall, $msgText);
}
$this->sendSmsRequest($kstychCall, $msgText);
}
//}
return;
}
public function sendSmsRequest($kstychCall, $msgText)
{
//$wakka = new KHRMSLib();
$url = $this->smsUrl;
//Log::info($kstychCall['callnumber']);
$inputArray = [
'userId'=>'hdfcbalrt',
"pass"=>'hdfcbalrt25',
......@@ -49,16 +44,21 @@ class SmsController extends Controller
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,3);
$response = curl_exec($ch);
$number=$kstychCall['callnumber'];
$callid=intval($kstychCall['callid'])+0;
$serverip=env(app_ip);
$rmname=Auth::user()->fullname;
$subdispo=$kstychCall["usersubstatus"];
DB::insert(DB::raw("insert into sms_log set server_ip='$serverip',call_id='$callid',rm_name='$rmname',subdispo='$subdispo',number='$number',message='$msgText',response='$response'"));
Log::useFiles(storage_path().'/logs/SMS_Messages_'.date("Y-m-d").'.log');
Log::info('|'.env(app_ip).'|'.date('Y-m-d H:i:s', strtotime('+5 hours 30 minutes')).'|'.Auth::user()->fullname.'|'.$kstychCall['callnumber'].'|"'.$msgText.'"|'.$response.'|');
$number=$kstychCall['callnumber'];
$callid=intval($kstychCall['callid'])+0;
$crmcall=CRMCall::find($callid);
$serverip=env(app_ip);
$agentid=Auth::user()->id;
$agentname=Auth::user()->fullname;
$subdispo=$kstychCall["usersubstatus"];
$clientcode=$kstychCall["clientcode"];
DB::insert(DB::raw("insert into sms_log set server_ip='$serverip',call_id='$callid',call_date='$crmcall->created_at',agent_name='$agentname',agent_id='$agentid',subdispo='$subdispo',number='$number',message='$msgText',response='$response',clientcode='$clientcode'"));
Log::useFiles(storage_path().'/logs/SMS_Messages'.date("Y-m-d").'.log');
Log::info("|".date('Y-m-d H:i:s', strtotime('+5 hours 30 minutes'))."|".Auth::user()->fullname."|".$kstychCall['callnumber']."|".$msgText."|".$response);
//Log::info($response);
curl_close($ch);
} catch(Exception $e) {
......
......@@ -51,6 +51,8 @@ Route::group(['middleware' => ['web']], function () {
Route::resource('hr','HRController');
Route::resource('social','SocialController');
Route::resource('web','WebController');
Route::resource('virtualchannel','VirtualController');
Route::resource('outputreport','OutputReportController');
Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions'));
Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store'));
......
......@@ -313,6 +313,11 @@ class KPAMIListen implements IEventListener
$crmcall->data=json_encode($tdata);
$crmcall->save();
$DisableNumbersArray = array();
include( app_path() . '/Hacks/DisabledDIDs.php');
if( in_array(substr($crmcall->number,-10),$DisableNumbersArray) ){
Log::info("Disabled Number".$crmcall->number); }else{
$newqueue=new Kqueue();
// $userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
......@@ -346,8 +351,6 @@ class KPAMIListen implements IEventListener
}
}
}
function isHoliday() {
return false;
}
......@@ -527,8 +530,8 @@ class KPAMIListen implements IEventListener
$tsip=Sipid::find($crmcall->sipid_id);
$newqueue=new Kqueue();
$newqueue->playhangupfile($dialline->channel,$dialline->server);
//$newqueue=new Kqueue();
//$newqueue->playhangupfile($dialline->channel,$dialline->server);
$newqueue=new Kqueue();
$newqueue->sipNotify($tsip,"dialerUI","hangup","c",$crmcall->id."~".$crmcall->number."~".base64_encode($channel));
......@@ -1399,39 +1402,48 @@ class KPAMIListen implements IEventListener
$tdata=array();
$tdata['uniqueid']=$uniqueid;
$tdata['inboundchannel']=$channel;
//Log::useFiles(storage_path().'inbound_log_'.date("Y-m-d").'.log');
// Log::info("inboundNumber ".$crmcall->number);
$crmcall->data=json_encode($tdata);
$crmcall->save();
if($crmcall->did=='46130234'){
// Log::useFiles(storage_path().'inbound_log_'.date("Y-m-d").'.log');
Log::info("inboundNumber ".$crmcall->number);
}
$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
if($userStatus=="[]")
{
$newqueue=new Kqueue();
$newqueue->playbusyfile($dialline->channel,$dialline->server);
}
$callStat=CRMCall::where("did","like","%".substr($exten,-4)."%")->where("updated_at",">",date("Y-m-d"))->whereIn('state',['DialBegin', 'DialEnd'])->get();
if($callStat!="[]")
{
$newqueue=new Kqueue();
$newqueue->playbusyfile($dialline->channel,$dialline->server);
}
}
}
}
$DisableNumbersArray = array();
include( app_path() . '/Hacks/DisabledDIDs.php');
if( in_array(substr($crmcall->number,-10),$DisableNumbersArray) )
{
Log::info("Disabled Number".$crmcall->number);
}
else
{
$newqueue=new Kqueue();
if( $this->isHoliday() ) {
// TODO: Handle Holidays here
} elseif( $this->isNonWorkingTime() ) {
$newqueue->playafterhrsfile($dialline->channel,$dialline->server);
} else {
$userStatus=User::where("updated_at",">",date("Y-m-d"))->where("exten","like","%".substr($exten,-4)."%")->where("usertype","!=","Admin")->where('presence', '=', '1')->select('*')->get();
if($userStatus=="[]")
{
$newqueue->playabsencefile($dialline->channel,$dialline->server);
}
else
{
$callStat=CRMCall::where("did","like","%".substr($exten,-4)."%")->where("updated_at",">",date("Y-m-d"))->whereIn('state',['DialBegin', 'DialEnd'])->get();
if($callStat!="[]")
{
$newqueue->playbusyfile($dialline->channel,$dialline->server);
}
}
}
}
}
}
}
}
private function redirectIncoming()
{
$diallines=Dialline::where('server','=',$this->sipip)->whereIn("status",["Inbound","Auto"])->where("conf","=","")->get();
......@@ -1462,7 +1474,7 @@ if($crmcall->did=='46130234'){
$users=$wakka->searchPhone("mobile",$crmcall->number);
if(!empty($users))
{
$ppldata=unserialize($users[0]['peopledata']);
$ppldata=unserialize($users[0]['peopledata']);
$crmcall->crm_id=$users[0]['id'];
$crmcall->number=$users[0]['mobile'];
$crmcall->client=($ppldata['client']?$ppldata['client']:"");
......@@ -1778,4 +1790,4 @@ class KPAMIChannelAudio extends ActionMessage
$this->setKey('Direction', $direction);
$this->setKey('State', $state);
}
}
}
\ No newline at end of file
......
......@@ -304,11 +304,11 @@ class Kqueue extends Model{
$this->data=json_encode($odata);
$this->save();
}
public function playhangupfile($fromext,$server)
public function playafterhrsfile($fromext,$server)
{
$odata=array();$odata['VARS']=array();
$odata['fromext']=$fromext;
$odata['context']="kstychPlayHangFile";
$odata['context']="kstychAfterFile";
$odata['callerid']="";
$odata['toext']="3001";
$odata['account']="";
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OutputProduct extends Model{
protected $table = 'output_products';
}
\ No newline at end of file
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OutputReport extends Model{
protected $table = 'output_report';
protected $fillable = ['user_id', 'user_name', 'date', 'call_attempts', 'call_contacts', 'call_unique_contacts', 'income', 'product_id' , 'product_name', 'lead_generated', 'lead_generated_amount', 'lead_closed', 'lead_closed_amount', 'created_at', 'updated_at'];
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ return [
'log' => 'daily',
'log_max_files' => 30,
'providers' => [
......@@ -97,6 +98,8 @@ return [
"Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer",
"submenu"=>["Dialer"=>["kDialerModel();"],
"Reports"=>["menuAction('dialer/reports');"],
"Output Report"=>["menuAction('outputreport/reportdata');"],
"Supervisor Output Report"=>["menuAction('outputreport/supervisordata');"],
]],
"DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"",
"submenu"=>[
......
......@@ -65,25 +65,25 @@ exten => _1004XXX!,n,Hangup
[kstychPlayFile]
exten => 1001,1,Answer
exten => 1001,n,Playback(silence/1)
exten => 1001,n,Playback(/var/lib/asterisk/sounds/RM_not_available_unreachabl)
exten => 1001,n,Playback(/var/lib/asterisk/sounds/audio_busy_rm_V2)
exten => 1001,n,Hangup
[kstychPlayHangFile]
exten => 3001,1,Answer
exten => 3001,n,Playback(silence/1)
exten => 3001,n,Playback(/var/lib/asterisk/sounds/hangup_beep)
exten => 3001,n,Hangup
;[kstychPlayHangFile]
;exten => 3001,1,Answer
;exten => 3001,n,Playback(silence/1)
;exten => 3001,n,Playback(/var/lib/asterisk/sounds/hangup_beep)
;exten => 3001,n,Hangup
;[kstychAbsFile]
;exten => 2001,1,Answer
;exten => 2001,n,Playback(silence/1)
;exten => 2001,n,Playback(/var/lib/asterisk/sounds/RM_not_available_unreachabl)
;exten => 2001,n,Hangup
[kstychAbsFile]
exten => 2001,1,Answer
exten => 2001,n,Playback(silence/1)
exten => 2001,n,Playback(/var/lib/asterisk/sounds/audio_working_hours_vrm_V2)
exten => 2001,n,Hangup
[SIPDialerINB]
exten => _X!,1,Goto(kstychDialerINB,${EXTEN},1)
exten => _X!,n,Hangup()
[kstychDialerIVR]
#include kstych-*.conf
#include kstych-*.conf
\ No newline at end of file
......
......@@ -144,7 +144,7 @@ function kcallHasConnection(number)
function dialerQuickOpen(varid,num,state,substate,autorun)
{
resetCallArray();
console.log("Manojquick");
if(kstychCall['mCallState']=="Wait")
{
var oldpreviewid=kstychCall['previewcrmid'];
......@@ -282,7 +282,6 @@ function kCallAction(num,action)
function dialerDispNumberClick()
{
var lastnumber=$("#spandialer_num").html();
console.log(lastnumber);
kstychCall['callWrapupTime']=300;
if(kstychCall['mCallState']=="Dispo")
......@@ -329,8 +328,8 @@ function incomingCall(calllog,crmid,numnchn)
{
//document.getElementById("hangup").play();
//stopRingTone();
console.log("incoming 1");
resetCallArray();
$("#dialersearchresults").html('<div id=divworking></div><div style="clear:both"></div>');
var number = numnchn.substring(0, numnchn.indexOf('@'));
......@@ -342,11 +341,11 @@ function incomingCall(calllog,crmid,numnchn)
kSetDData('C','callid',calllog);
kSetDData('C','crmid',crmid);
console.log(crmid);
if(crmid>0)showRecruit(crmid);
if(crmid>0)
showRecruit(crmid);
else
{
console.log("incoming else");
createSearchRecordDiv('dialersearchresults');
}
......@@ -362,7 +361,6 @@ function incomingCall(calllog,crmid,numnchn)
function dialerUIUpdate(var1,var2,var3)
{
console.log("UIupdate");
var3parts=var3.split("~");
var3parts[2]=atob(var3parts[2]);
if(var1=="dialstart")
......@@ -433,15 +431,22 @@ function incomingPopupAlert(var1,var2,var3)
{
var loginRoleArray=["R14306"];
var fullexten = $('#userExtension').val();
console.log(fullexten);
console.log("Full Extension : " + fullexten);
var exten =fullexten.split(':')[0];
console.log("exten1 "+exten);
console.log("Exten : " + exten);
//var incomingnotify=growlSNotify(var1,var2,"top-right");
//setTimeout(function(){$.gritter.remove(incomingnotify, {fade: true,speed: 'slow'});incomingnotify=0;},1500);
if((kstychCall['ts_Talk']===0 && kstychCall['ts_Call']===0)){
if($.inArray($('#userLoginRole').val(), loginRoleArray)>-1 && (var3===exten))startRingTone();
}
console.log(var1+"Var 1"+"Var 2"+var2+"Var 3"+var3);
if((kstychCall['ts_Talk']===0 && kstychCall['ts_Call']===0))
{
// if($('#userLoginRole').val()=="Unit_Head")
// startRingTone();
if($.inArray($('#userLoginRole').val(), loginRoleArray)>-1 && (var3===exten))
startRingTone();
}
console.log("Var 1 : "+var1+"Var 2: "+var2+"Var 3 : "+var3);
$.titleAlert(var1+" "+var2, {
requireBlur:true,
stopOnFocus:true,
......@@ -933,7 +938,7 @@ function updateDialerState(objstr,key,val,key2,val2)
if(val=="Manual"){
console.log("Manoj");
resetCallArray();
}
if(val2=="Incoming"){
console.log("Manoj Incoming");
......
......@@ -242,8 +242,9 @@ foreach($tmodules as $mname=>$marr)
<?php } ?>
<div><a href="#" class="btn btn-primary" onclick="menuAction('message');return false;"><i class="fa fa-list"></i> <span>View all messages <?php if($messagescount>0)echo "($messagescount)"; ?></span></a></div>
</ul>
<input type="hidden" id="userLoginRole" value="{{Auth::user()->username}}">
<input type="hidden" id="userExtension" value="{{isset(Auth::user()->exten)?(Auth::user()->exten):'0'}}">
{{--<input type="hidden" id="userLoginRole" value="{{Auth::user()->usertype}}">--}}
<input type="hidden" id="userLoginRole" value="{{Auth::user()->username}}">
<input type="hidden" id="userExtension" value="{{isset(Auth::user()->exten)?(Auth::user()->exten):'0'}}">
</li>
<li class="dropdown notif" style='height:35px'>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style='height:35px' onclick='$("#topmenunotifucount").html("");'><i class="notif-block fa fa-bell"></i><span class="badge badge-info" id=topmenunotifucount><?php if(isset($meta['ncnt'])&&$meta['ncnt']>0)echo $meta['ncnt']; ?></span></a>
......
......@@ -170,6 +170,11 @@ use App\Models\CRMCall;
$number_list=array();
foreach($mc as $key=>$tcall)
{
include( app_path() . '/Hacks/DisabledDIDs.php');
if( in_array(substr($tcall->number,-10),$DisableNumbersArray) ){
continue;
}
$tccal=substr($tcall->number,-10);
$mc_number=CRMCall::where('userstatus','!=','InboundDROP')
->where('created_at','>',$tcall->created_at)
......
......@@ -142,7 +142,6 @@ $user=Auth::user();
}
</style>
<input type="hidden" id="userLoginRole" value="{{Auth::user()->usertype}}">
<div class="layout-app"><!-- row-app -->
<div class="row row-app">
......
<?php
use App\Models\CRMCallArchive;
use App\Models\CRMCall;
use App\Models\User;
use App\Jobs\KHRMSLib;
$wakka = new KHRMSLib();
$dashboarduser=Auth::user();
$userdialmode=$dashboarduser->dialmode_assign;
$userdialmode=explode(",",$userdialmode);
$timeoffset=$dashboarduser->timezone*60;
$locationserverip=DB::select(DB::raw("SELECT location from server_details group by location"));
if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00");
else $logdate=strtotime(date('Y-m-d')." 00:00:00");
$location =(isset($_GET['location'])) ? $_GET['location'] : "Select Location";
$i=1;
$locations=explode(",",$location);
//print_r($locations);
foreach ($locations as $location) {
$serverid=DB::select(DB::raw("SELECT server_ip,id,location from server_details where location='$location' ORDER BY id ASC"));
//echo "All";
//print_r($serverid);
//$serverip->get();
foreach ($serverid as $server_id) {
//$serverids=$server_id->id<10?"0".$server_id->id:$server_id->id;
$serverids=$server_id->id;
//print_r($server_id->server_ip);
$alist=DB::select(DB::raw("SELECT * from sms_report where created_at>='".date("Y-m-d H:i:s",$logdate+$timeoffset)."' and created_at <= '".date("Y-m-d H:i:s",$logdate+24*60*60)."' and server=$serverids ORDER BY id DESC "));
//print_r($alist);
foreach ($alist as $aline) {
$outstr.="<tr><td>".$i."</td>
<td>".$server_id->server_ip."</td>
<td>".$server_id->location."</td>
<td>".$aline->message_time."</td>
<td>".$aline->agent_name."</td>
<td>".$aline->subdispo."</td>
<td>".$aline->number."</td>
<td>".$aline->message."</td>
<td>".$aline->response."</td>
</tr>";
$i++;
}
}
}
if(Input::has("dllogxls"))
{
include_once(app_path().'/lib/phpexcel/PHPExcel.php');
$inputFileType = "Excel5";
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load("assets/extras/blank.xls");
$baseRow = 3;
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$fieldsarr[$tcol++]='#';
$fieldsarr[$tcol++]='server_ip';
$fieldsarr[$tcol++]='location';
$fieldsarr[$tcol++]='message_time';
$fieldsarr[$tcol++]='agent_name';
$fieldsarr[$tcol++]='SubDispo';
$fieldsarr[$tcol++]='Number';
$fieldsarr[$tcol++]='Message';
$fieldsarr[$tcol++]='response';
$highestColumn = sizeof($fieldsarr);
for ($head = 0; $head < $highestColumn; $head++){
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]);
}
$ii=1;
foreach($alist as $aline)
{
$row = $baseRow++;
$col = 0;
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($server_id->server_ip);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($server_id->location);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->message_time);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->agent_name);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->subdispo);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->number);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->message);
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->response);
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="CallLog.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
$objWriter->save('php://output');
return ;
}
?>
<div class=innerAll>
<style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style>
<script>
function showExtraPost(varstr)
{
doAjax("hr?action=LiveUsers","getpostdata="+varstr,"dialoglog");
$('#dialoglog').dialog('open');
return false;
}
$(document).ready(function()
{
if(!$('#dialoglog').hasClass('ui-dialog-content'))
{
$('#dialoglog').dialog({
autoOpen: false,
width: '70%',
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
}
waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000");
$('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'});
});
</script>
<div>
Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' />
Location:<select id="location" style="border:1px solid #efefef;">
<option value='Select Location' disabled selected>Select Location</option>
<option value='All'>All</option>
<?php foreach($locationserverip as $c){$s="";if($c->location==$location)$s='selected';echo "<option value='$c->location' $s>$c->location</option>";} ?>
</select>
<button id="load" onclick='callLogReloadFun("");return false;' value='Submit'>Submit</button>&nbsp;&nbsp;
</div>
<div style="float:right;width:30%">
<button class="pull-right btn btn-sm btn-default" onclick='dlCalllogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button>
</div>
<script>
function dataString()
{
return 'logdate='+$("#modfrom").val()+'&location='+$("#location").val();
}
function callLogReloadFun(sortby)
{
var sortstr='';if(sortby!="")sortstr="&sort="+sortby
var searchStr = dataString();
doAjax('dialer/smslog?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');
}
function dlCalllogXls()
{
var searchStr = dataString();
window.open('dialer/smslog?dllogxls=1&'+searchStr);
return false;
}
</script>
<div style='clear:both'></div>
<div style='overflow:auto'>
<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'>
<thead>
<tr>
<th>#</th>
<th>ServerIp</th>
<th>Location</th>
<th>Message Time</th>
<th>RM Name</th>
<th>SubDispo</th>
<th style='width:120px'>Number</th>
<th>Message</th>
<th>Response</th>
</tr>
</thead>
<?php echo $outstr; ?>
</table>
</div>
<?php
function convert($size)
{
$unit=array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}
echo "<br>".convert(memory_get_peak_usage(true)); // 123 kb
?>
<div id=dialoglog></div>
</div>
......@@ -447,4 +447,4 @@ function deletesavedreport(rname)
{
doAjax('hr?action=DeleteSavedReport&rname='+rname,'','searchresults');
}
</script>
</script>
\ No newline at end of file
......
<?php
use App\Models\User;
if(Auth::user()->id=="1" || Auth::user()->id == "199"){ ?>
<div class="container">
<div style="text-align:center">
<h2>Output Report</h2>
<p></p>
</div>
<div class="row">
<div class="column">
<form class="form-horizontal" id="output-report" name="output-report">
<div class="table-responsive" style="background: #fff;">
<table class="table">
<thead>
<tr>
<th>No.of Attempts</th>
<th>{{$noOfAttempts}}
<input type="hidden" name="noOfAttempts" value="{{$noOfAttempts}}">
</th>
</tr>
<tr>
<th>No.of Contacts</th>
<th>{{$noOfContacts}}
<input type="hidden" name="noOfContacts" value="{{$noOfContacts}}">
</th>
</tr>
<tr>
<th>Unique Contacts</th>
<th>{{$uniqueContacts}}
<input type="hidden" name="uniqueContacts" value="{{$uniqueContacts}}">
</th>
</tr>
<tr>
<th>Income Achievement</th>
<th><span id="showCalculatedAmt">{{$totalIncome}}</span></th>
</tr>
<tr>
<th>Product</th>
<th>LG</th>
<th>Expected Amount(If Applicable)</th>
<th>LC</th>
<th>Amount(If Applicable)</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach ($products as $key => $value) {
?>
<tr>
<td> <input type="hidden" name="products[<?= $i ?>][productId]" value="{{$value['productId']}}">
<input type="hidden" name="products[<?= $i ?>][product]" value="{{ $value['name'] }} " >{{ $value['name'] }}</td>
<td><input type="number" name="products[<?= $i ?>][lg]" min="0" value="{{isset($value['lead_generated'])?$value['lead_generated']:'0'}}" oninput="validity.valid||(value='');" $disabled></td>
<td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lgAmt]" value="{{isset($value['lead_generated_amount'])?$value['lead_generated_amount']:'0'}}" oninput="validity.valid||(value='');" $disabled></td>
<td><input type="number" min="0" name="products[<?= $i ?>][lc]" value="{{isset($value['lead_closed'])?$value['lead_closed']:'0'}}" class="calculateIncome" id="products<?= $i ?>Lc" oninput="validity.valid||(value='');" $disabled></td>
<td><input type="number" min="0" step="0.01" name="products[<?= $i ?>][lcAmt]" value="{{isset($value['lead_closed_amount'])?$value['lead_closed_amount']:'0'}}" oninput="validity.valid||(value='');" class="calculateIncome" id="products<?= $i ?>LcAmt" $disabled></td>
</tr>
<?php
$i++;
} ?>
@if($disabled == "")
<tr>
<td><button type="submit" class="btn btn-primary" onclick='createOutputReport();return false;'>Save</button></td>
</tr>
@endif
</tbody>
</table>
</div>
</form>
<script>
function createOutputReport()
{
var putdata = $('#output-report').serialize();
//console.log("--->"+putdata);
doAjax('outputreport?action=createOutputReport',putdata,'__fake__div__','ajax_create_output_report','singlethis','POST',function(retstr)
{
if(retstr.responseText.indexOf('Error')<0)
{
simpleNotification("success","topRight","User Created Successfully");
menuAction('outputreport/reportdata');
}
else
{
simpleNotification("error","topRight",retstr.responseText);
}
});
}
$( document ).ready(function() {
$( ".calculateIncome" ).change(function() {
var numItems = $('.calculateIncome').length;
var lc = 0;
var lcAmt = 0;
var totalIncome = 0;
for (var i = 1; i <= (numItems/2); i++) {
lc = $('#products'+i+'Lc').val();
lcAmt = $('#products'+i+'LcAmt').val();
if(lc != '' && lcAmt != ''){
totalIncome = totalIncome + (lc * lcAmt);
}
}
$('#showCalculatedAmt').html(totalIncome);
});
});
</script>
</div>
</div>
</div>
<?php } ?>
<div class="container">
<div style="text-align:center">
<h2>Output Report</h2>
<p></p>
</div>
<div class="row">
<div class="column">
<form class="form-horizontal" id="output-report-supervisor" name="output-report-supervisor">
<div class="table-responsive" style="background: #fff;">
<br>
<div class="dropdown">
<label style="text-indent: 2em;">
<h5>
Select RM/PB :
</h5>
</label>
<select id="supervisorid" style="border:3px solid #efefef;" onchange='userchange("");'>
<option value="ALL">ALL
</option>
<?php
foreach($supervisor as $user){
$selected = ($user->id == $users)?"selected":"";
?>
<option value="{{$user->id }}" {{$selected}}>{{$user->username}}</option>
<?php } ?>
</select>
</div>
<br>
<table class="table">
<thead>
<tr>
<th>No.of Attempts</th>
<th>{{ $Contacts->call_attempts }}
</th>
</tr>
<tr>
<th>No.of Contacts</th>
<th> {{ $Contacts->call_contacts }}
</th>
</tr>
<tr>
<th>Unique Contacts</th>
<th> {{ $Contacts->call_unique_contacts }}
</th>
</tr>
<tr>
<th>Income Achievement</th>
<th>{{ $totalIncome }}</th>
</tr>
<tr>
<th>Product</th>
<th>LG</th>
<th>Expected Amount(If Applicable)</th>
<th>LC</th>
<th>Amount(If Applicable)</th>
</tr>
</thead>
<tbody>
<?php foreach($report as $key => $val){ //print_r($val); ?>
<tr>
<td>{{$val->product_name}}</td>
<td>{{$val->totallead}}</td>
<td>{{$val->totalleadamt}}</td>
<td>{{$val->totalleadclosed}}</td>
<td>{{$val->leadcloseamt}}</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</form>
<script>
function userchange()
{
var user = $('#supervisorid').val();
//console.log(user);
doAjax('outputreport/supervisordata?user='+user,'','middlemainreportdiv','ajax_create_supervisor_report','singlethis','GET', function(retstr){
menuAction('outputreport/supervisordata?user='+user);
});
}
</script>
</div>
</div>
......@@ -107,7 +107,7 @@ if($varid!=""||$isuser)
//no edit access and read other data..
//check if we have owner access = read access
$oclientlst=$wakka->clientsReadAccess();
foreach($oclientlst as $tclnt)if($tclnt==$recruitdata["peopledata"]['client']&&$tclnt!=""){$noreaduser=0;break;}
foreach($oclientlst as $tclnt)if(strtolower($tclnt)==strtolower($recruitdata["peopledata"]['client'])&&$tclnt!=""){$noreaduser=0;break;}
}
}
}
......
APP_ENV=local
APP_DEBUG=true
APP_ADMIN_DEBUG=true
APP_KEY=LEynnBaQoqsLncOWZwgdtfxxWU2hEyfp
APP_PROTOCOL=https://
app_name=Flexydial
app_title=Flexydial
app_domain=10.125.14.55
web_domain=10.125.14.55
app_ip=10.125.14.55
central_ip=10.125.14.127
didnumber=-8
asterisk_slaves=10.125.14.55:1001:2000:1:240
asterisk_manager=10.125.14.55
asterisk_extensions=31330,_X!
sip_dialstr=SIP/
APP_Multiple_Logins=yes
kDialer_keeplocalconf=1
kstych_viewportMeta=responsive:1:1
DB_HOST=localhost
DB_DATABASE=kstych_flexydial
DB_USERNAME=root
DB_PASSWORD=yb9738z
CACHE_DRIVER=database
SESSION_DRIVER=database
SESSION_LIFEMin=43200
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=mail
MAIL_PASSWORD=mail
[email protected]
AWS_KEY=
AWS_Secret=
AWS_Region=us-east-1
AWS_Bucket=
FS_DefaultDriver=local
FS_CloudDriver=s3
facebook_appid=
facebook_appkey=
gcm_apikey=
extAuth=
extAuthParams=
xssGlobal=tag,hent
xssGlobalIgnoreKeys=content,pdata,courseintroductiondiv,coursecoverphoto,data,rlog,rstring
MobileTitle=Flexydial
-- phpMyAdmin SQL Dump
-- version 4.5.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 14, 2019 at 07:14 AM
-- Server version: 10.0.28-MariaDB
-- PHP Version: 5.6.29
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `kstych_flexydial`
--
-- --------------------------------------------------------
--
-- Table structure for table `daily_output_report`
--
CREATE TABLE `daily_output_report` (
`id` bigint(20) NOT NULL,
`user_id` varchar(20) NOT NULL,
`date` date NOT NULL,
`attempts` int(10) NOT NULL,
`contacts` int(10) NOT NULL,
`unique_contacts` int(10) NOT NULL,
`income` varchar(30) NOT NULL,
`product_id` varchar(10) NOT NULL,
`product_name` varchar(30) NOT NULL,
`lead_generated` int(10) NOT NULL,
`lead_amount` decimal(15,2) NOT NULL,
`lead_closed` int(10) NOT NULL,
`lead_closed_amount` decimal(15,2) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `daily_output_report`
--
ALTER TABLE `daily_output_report`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `daily_output_report`
--
ALTER TABLE `daily_output_report`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.5.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 15, 2019 at 12:13 PM
-- Server version: 10.0.28-MariaDB
-- PHP Version: 5.6.29
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `flexydial_hdfc_vrm`
--
-- --------------------------------------------------------
--
-- Table structure for table `output_products`
--
DROP TABLE IF EXISTS `output_products`;
CREATE TABLE `output_products` (
`id` bigint(11) NOT NULL,
`Name` varchar(50) NOT NULL,
`Status` int(1) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `output_products`
--
ALTER TABLE `output_products`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `output_products`
--
ALTER TABLE `output_products`
MODIFY `id` bigint(11) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.5.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 15, 2019 at 12:35 PM
-- Server version: 10.0.28-MariaDB
-- PHP Version: 5.6.29
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `flexydial_hdfc_vrm`
--
-- --------------------------------------------------------
--
-- Table structure for table `output_report`
--
CREATE TABLE `output_report` (
`id` bigint(20) NOT NULL,
`user_id` int(11) NOT NULL,
`user_name` varchar(200) NOT NULL,
`date` date NOT NULL,
`call_attempts` int(11) NOT NULL,
`call_contacts` int(11) NOT NULL,
`call_unique_contacts` int(11) NOT NULL,
`income` int(11) NOT NULL,
`product_id` bigint(11) NOT NULL,
`product_name` varchar(50) NOT NULL,
`lead_generated` int(11) NOT NULL,
`lead_generated_amount` decimal(13,2) NOT NULL,
`lead_closed` int(11) NOT NULL,
`lead_closed_amount` decimal(13,2) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `output_report`
--
ALTER TABLE `output_report`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_product_id` (`product_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `output_report`
--
ALTER TABLE `output_report`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `output_report`
--
ALTER TABLE `output_report`
ADD CONSTRAINT `fk_product_id` FOREIGN KEY (`product_id`) REFERENCES `output_products` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- phpMyAdmin SQL Dump
-- version 4.5.3.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 30, 2018 at 12:00 PM
-- Server version: 10.0.28-MariaDB
-- PHP Version: 5.6.29
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `kstych_flexydial`
--
-- --------------------------------------------------------
--
-- Table structure for table `sms_report`
--
CREATE TABLE `sms_report` (
`id` int(10) NOT NULL,
`server` int(10) NOT NULL,
`sms_id` int(11) NOT NULL,
`ins_date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created_at` varchar(50) NOT NULL,
`message_time` datetime NOT NULL,
`server_ip` varchar(20) NOT NULL,
`call_id` int(20) NOT NULL,
`agent_name` varchar(30) NOT NULL,
`subdispo` varchar(60) NOT NULL,
`number` varchar(25) NOT NULL,
`message` varchar(50000) NOT NULL,
`response` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `sms_report`
--
ALTER TABLE `sms_report`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `sms_report`
--
ALTER TABLE `sms_report`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!