Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flexydial
/
hdfc-beu-v2
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
a02abcee
authored
2019-06-27 21:25:11 +0530
by
Manish Mihsra
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added New Monitoring Report
1 parent
c5a7b341
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
271 additions
and
346 deletions
application/app/Http/Controllers/ReportController.php
application/app/Jobs/KPAMIListen.php
application/app/Models/User.php
application/resources/views/layout/module/reports/liveusers.blade.php
application/app/Http/Controllers/ReportController.php
View file @
a02abce
...
...
@@ -21,6 +21,7 @@ use App\Models\Cutoff;
use
App\Jobs\KHRMSLib
;
use
App\Models\Sipid
;
use
App\Models\Dialline
;
use
App\Models\User
;
use
App\Models\UserLog
;
use
App\Models\Kqueue
;
use
DB
;
...
...
@@ -37,64 +38,152 @@ class ReportController extends Controller
public
function
show
(
$id
)
{
$data
=
array
();
$wakka
=
new
KHRMSLib
();
$dashboarduser
=
Auth
::
user
();
$timeoffset
=
$dashboarduser
->
timezone
;
//-330; //$dashboarduser->timezone;
$timeoffset
=
$timeoffset
*
60
;
if
(
$id
==
"reports"
)
{
return
view
(
"layout.module.reports.reports"
,
array
()
);
return
view
(
"layout.module.reports.reports"
);
}
if
(
$id
==
"campaigns"
)
$logtime
=
(
isset
(
$_GET
[
'logtime'
]))
?
$_GET
[
'logtime'
]
:
9
;
$logtimeto
=
(
isset
(
$_GET
[
'logtimeto'
]))
?
$_GET
[
'logtimeto'
]
:
20
;
$logdate
=
(
isset
(
$_GET
[
'logdate'
]))
?
strtotime
(
$_GET
[
'logdate'
]
.
" "
.
$logtime
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 09:00:00"
);
$logdateto
=
(
isset
(
$_GET
[
'logdateto'
]))
?
strtotime
(
$_GET
[
'logdateto'
]
.
" "
.
$logtimeto
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 20:00:00"
);
$campaign
=
(
isset
(
$_GET
[
'campaign'
]))
?
$_GET
[
'campaign'
]
:
"Select"
;
$oclientlst
=
$wakka
->
clientsReadAccess
();
sort
(
$oclientlst
);
$oclientlst
[
0
]
=
'Select'
;
$data
[
'wakka'
]
=
$wakka
;
$data
[
'dashboarduser'
]
=
$dashboarduser
;
$data
[
'timeoffset'
]
=
$timeoffset
;
$data
[
'logtime'
]
=
$logtime
;
$data
[
'logtimeto'
]
=
$logtimeto
;
$data
[
'logdate'
]
=
$logdate
;
$data
[
'logdateto'
]
=
$logdateto
;
$data
[
'campaign'
]
=
$campaign
;
$data
[
'oclientlst'
]
=
$oclientlst
;
if
(
$id
==
"liveusers"
)
{
return
view
(
"layout.module.reports.campaigns"
,
array
());
$campStr
=
""
;
$ratio
=
0
;
$totalCall
=
0
;
$dialedCall
=
0
;
$waitCall
=
0
;
$inCall
=
0
;
$availChnl
=
0
;
$usrIdArr
=
array
();
$tabHeadStr
=
""
;
$tabBodyStr
=
""
;
foreach
(
$oclientlst
as
$c
)
{
$s
=
""
;
if
(
$c
==
$campaign
)
$s
=
'selected'
;
$campStr
.=
"<option value='
$c
'
$s
>
$c
</option>"
;
}
if
(
$id
==
"calllog"
)
{
return
view
(
"layout.module.reports.calllog"
,
array
());
if
(
$campaign
!=
"Select"
)
{
$mastersdata
=
$wakka
->
getCompanyMaster
(
$campaign
);
if
(
!
empty
(
$mastersdata
[
"autodialercampaign"
]))
$ratio
=
$mastersdata
[
"autodialercampaign"
];
$userArr
=
User
::
where
(
'presence'
,
'='
,
"1"
)
->
where
(
'sel_campaign'
,
'='
,
$campaign
)
->
select
(
'id'
,
'username'
,
'fullname'
,
'current_dialmode'
)
->
get
();
$diallineArr
=
Dialline
::
where
(
"enabled"
,
"="
,
"1"
)
->
get
();
$totalChnl
=
$diallineArr
->
count
();
foreach
(
$diallineArr
as
$dialline
)
{
if
(
$dialline
->
status
!=
'Free'
)
$totalCall
++
;
if
(
$dialline
->
status
!=
'Free'
&&
$dialline
->
src_channel
!=
''
&&
$dialline
->
channel
==
''
)
$dialedCall
++
;
if
(
$dialline
->
status
==
'Auto'
&&
$dialline
->
conf
==
''
&&
$dialline
->
src_channel
!=
''
&&
$dialline
->
channel
!=
''
)
$waitCall
++
;
if
(
$dialline
->
status
!=
'Free'
&&
$dialline
->
conf
!=
''
)
$inCall
++
;
}
if
(
$id
==
"agentreport"
)
{
return
view
(
"layout.module.reports.agentreport"
,
array
());
$availChnl
=
$totalChnl
-
$totalCall
;
$tabHeadStr
.=
"<tr>
<th>User</th>
<th>Campaign</th>
<th>Mode</th>
<th>Status</th>
</tr>"
;
foreach
(
$userArr
as
$usr
)
{
$usrIdArr
[]
=
$usr
->
id
;
$statusStr
=
"<span class='btn btn-sm btn-warning'>Free</span>"
;
$sipIdArr
=
Sipid
::
where
(
'user'
,
"="
,
$usr
->
id
)
->
where
(
'status'
,
'='
,
1
)
->
select
(
'id'
,
'status'
,
'ready'
,
'patched'
)
->
first
();
if
(
$sipIdArr
->
ready
==
1
)
$statusStr
=
"<span class='btn btn-sm btn-success'>Available</span>"
;
if
(
$sipIdArr
->
patched
==
1
)
$statusStr
=
"<span class='btn btn-sm btn-info'>OnCall</span>"
;
if
(
$sipIdArr
->
prepare_call
==
1
&&
$sipIdArr
->
patched
==
0
)
$statusStr
=
"<span class='btn btn-sm btn-info'>Wrap-Up</span>"
;
$tabBodyStr
.=
"<tr><td>"
.
$usr
->
fullname
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$campaign
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$usr
->
current_dialmode
.
"</td>"
;
$tabBodyStr
.=
"<td>"
.
$statusStr
.
"</td></tr>"
;
}
if
(
$id
==
"campreport"
)
{
return
view
(
"layout.module.reports.campreport"
,
array
());
$freeUsr
=
Sipid
::
whereIn
(
'user'
,
$usrIdArr
)
->
where
(
'status'
,
'='
,
1
)
->
where
(
'ready'
,
'='
,
1
)
->
where
(
'patched'
,
'='
,
0
)
->
count
();
$data
[
'ratio'
]
=
$ratio
;
$data
[
'totalUsr'
]
=
$userArr
->
count
();
$data
[
'totalChnl'
]
=
$totalChnl
;
$data
[
'availChnl'
]
=
$availChnl
;
$data
[
'dialedCall'
]
=
$dialedCall
;
$data
[
'waitCall'
]
=
$waitCall
;
$data
[
'inCall'
]
=
$inCall
;
$data
[
'freeUsr'
]
=
$totalChnl
;
$data
[
'tabHeadStr'
]
=
$tabHeadStr
;
$data
[
'tabBodyStr'
]
=
$tabBodyStr
;
}
if
(
$id
==
"statusreport"
)
{
return
view
(
"layout.module.reports.
statusreport"
,
array
()
);
$data
[
'campStr'
]
=
$campStr
;
return
view
(
"layout.module.reports.
liveusers"
,
$data
);
}
if
(
$id
==
"
questionnaire
"
)
if
(
$id
==
"
calllog
"
)
{
return
view
(
"layout.module.reports.
questairereport
"
,
array
());
return
view
(
"layout.module.reports.
calllog
"
,
array
());
}
if
(
$id
==
"
callmanagement
"
)
if
(
$id
==
"
agenttime
"
)
{
return
view
(
"layout.module.reports.callmanagementreport
"
,
array
());
return
view
(
"layout.module.reports.agenttime
"
,
array
());
}
if
(
$id
==
"
supmessages
"
)
if
(
$id
==
"
agenttimeAverage
"
)
{
return
view
(
"layout.module.reports.supmessagesreport
"
,
array
());
return
view
(
"layout.module.reports.agenttimeAverage
"
,
array
());
}
if
(
$id
==
"liveusers
"
)
if
(
$id
==
"campreport
"
)
{
return
view
(
"layout.module.reports.
liveusers
"
,
array
());
return
view
(
"layout.module.reports.
campreport
"
,
array
());
}
if
(
$id
==
"
recarchive
"
)
if
(
$id
==
"
statusreport
"
)
{
return
view
(
"layout.module.reports.
recarchive
"
,
array
());
return
view
(
"layout.module.reports.
statusreport
"
,
array
());
}
if
(
$id
==
"re
cqc
"
)
if
(
$id
==
"re
lationshipreport
"
)
{
return
view
(
"layout.module.reports.re
cqc
"
,
array
());
return
view
(
"layout.module.reports.re
lationshipreport
"
,
array
());
}
}
}
...
...
application/app/Jobs/KPAMIListen.php
View file @
a02abce
...
...
@@ -478,6 +478,12 @@ class KPAMIListen implements IEventListener
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
if
(
!
empty
(
$tsip
))
{
$tsip
->
patched
=
0
;
$tsip
->
save
();
}
//$newqueue=new Kqueue();
//$newqueue->playhangupfile($dialline->channel,$dialline->server);
...
...
@@ -733,6 +739,7 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
channel
=
$dchannel
;
$dialline
->
save
();
}
...
...
@@ -745,6 +752,29 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
}
}
else
if
(
$accountcodearr
[
1
]
==
"a"
)
{
$crmcall
=
CRMCall
::
find
(
$accountcodearr
[
2
]);
if
(
$crmcall
)
{
$nowts
=
microtime
(
true
)
*
1000
;
$crmcall
->
setTs
(
'ts_Call'
,
$nowts
);
$crmcall
->
state
=
$eventname
;
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
save
();
}
$crmcall
->
addEventLog
(
$nowts
,
"
$accountcode
:Unknown :
$eventname
$dchannelstate
:
$dchannelstatedesc
$duniqueid
$dexten
:
$dpriority
$channel
$dialstring
"
);
$crmcall
->
save
();
}
}
}
...
...
@@ -806,17 +836,21 @@ class KPAMIListen implements IEventListener
$crmcall
->
state
=
$eventname
;
$crmcall
->
status
=
$dialstatus
;
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
$tsip
->
patched
=
1
;
$tsip
->
save
();
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
conf
=
"1000"
.
$tsip
->
id
;
$dialline
->
channel
=
$channel
;
$dialline
->
save
();
}
$recfile
=
$crmcall
->
newRecFilePath
();
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
//start recording
$newqueue
=
new
Kqueue
();
$newqueue
->
recordChannel
(
$tsip
->
server
,
$dchannel
,
$recfile
);
...
...
@@ -957,6 +991,7 @@ class KPAMIListen implements IEventListener
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
channel
=
$dchannel
;
$dialline
->
save
();
}
...
...
@@ -969,6 +1004,29 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
}
}
else
if
(
$accountcodearr
[
1
]
==
"a"
)
{
$crmcall
=
CRMCall
::
find
(
$accountcodearr
[
2
]);
if
(
$crmcall
)
{
$nowts
=
microtime
(
true
)
*
1000
;
$crmcall
->
setTs
(
'ts_Call'
,
$nowts
);
$crmcall
->
state
=
$eventname
;
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
src_channel
=
$dchannel
;
$dialline
->
save
();
}
$crmcall
->
addEventLog
(
$nowts
,
"
$accountcode
:Unknown :
$eventname
$dchannelstate
:
$dchannelstatedesc
$duniqueid
$dexten
:
$dpriority
$channel
$dialstring
"
);
$crmcall
->
save
();
}
}
}
...
...
@@ -1034,17 +1092,21 @@ class KPAMIListen implements IEventListener
$crmcall
->
state
=
$eventname
;
$crmcall
->
status
=
$dialstatus
;
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
$tsip
->
patched
=
1
;
$tsip
->
save
();
$dialline
=
Dialline
::
find
(
$crmcall
->
dialline_id
);
if
(
$dialline
)
{
$dialline
->
conf
=
"1000"
.
$tsip
->
id
;
$dialline
->
channel
=
$channel
;
$dialline
->
save
();
}
$recfile
=
$crmcall
->
newRecFilePath
();
$tsip
=
Sipid
::
find
(
$crmcall
->
sipid_id
);
//start recording
$newqueue
=
new
Kqueue
();
$newqueue
->
recordChannel
(
$tsip
->
server
,
$dchannel
,
$recfile
);
...
...
@@ -1534,8 +1596,10 @@ class KPAMIListen implements IEventListener
$crmcall
->
save
();
$dialline
->
conf
=
"1000"
.
$found
->
id
;
$dialline
->
user_id
=
$found
->
user
;
$dialline
->
conf
=
"1000"
.
$found
->
id
;
$dialline
->
save
();
if
(
$crmcall
->
crm_id
>
0
){
DB
::
table
(
'records'
)
->
where
(
'id'
,
$crmcall
->
crm_id
)
->
update
([
'filter_condition'
=>
'3'
,
'usr_id'
=>
$found
->
user
]);
...
...
application/app/Models/User.php
View file @
a02abce
...
...
@@ -14,7 +14,7 @@ class User extends Authenticatable
protected
$table
=
'users'
;
protected
$hidden
=
array
(
'password'
);
protected
$fillable
=
array
(
'username'
,
'password'
,
'email'
,
'status'
,
'organization'
,
'group'
,
'data'
);
protected
$fillable
=
array
(
'username'
,
'password'
,
'email'
,
'status'
,
'organization'
,
'group'
,
'data'
,
'sel_campaign'
,
'current_dialmode'
);
private
$dataarr
=
array
();
...
...
application/resources/views/layout/module/reports/liveusers.blade.php
View file @
a02abce
<?php
use
App\Models\CRMCall
;
use
App\Models\CRMCallArchive
;
use
App\Models\User
;
use
App\Models\UserLog
;
use
App\Jobs\KHRMSLib
;
$wakka
=
new
KHRMSLib
();
$dashboarduser
=
Auth
::
user
();
$timeoffset
=
$dashboarduser
->
timezone
;
//-330; //$dashboarduser->timezone;
$timeoffset
=
$timeoffset
*
60
;
$logtime
=
(
isset
(
$_GET
[
'logtime'
]))
?
$_GET
[
'logtime'
]
:
9
;
$logtimeto
=
(
isset
(
$_GET
[
'logtimeto'
]))
?
$_GET
[
'logtimeto'
]
:
20
;
$logdate
=
(
isset
(
$_GET
[
'logdate'
]))
?
strtotime
(
$_GET
[
'logdate'
]
.
" "
.
$logtime
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 09:00:00"
);
$logdateto
=
(
isset
(
$_GET
[
'logdateto'
]))
?
strtotime
(
$_GET
[
'logdateto'
]
.
" "
.
$logtimeto
.
":00:00"
)
:
strtotime
(
date
(
"Y-m-d"
)
.
" 20:00:00"
);
$oclientlst
=
$wakka
->
clientsReadAccess
();
sort
(
$oclientlst
);
$alist
=
CRMCallArchive
::
whereIn
(
'client'
,
$oclientlst
)
->
where
(
'created_at'
,
'>='
,
date
(
"Y-m-d H:i:s"
,
$logdate
+
$timeoffset
))
->
where
(
'created_at'
,
'<='
,
date
(
"Y-m-d H:i:s"
,
$logdateto
+
$timeoffset
))
->
orderBy
(
'user_id'
,
'ASC'
)
->
orderBy
(
'ts_Close'
,
'ASC'
)
->
get
();
$userlog
=
UserLog
::
where
(
'created_at'
,
'>='
,
date
(
"Y-m-d H:i:s"
,
$logdate
+
$timeoffset
))
->
where
(
'created_at'
,
'<='
,
date
(
"Y-m-d H:i:s"
,
$logdateto
+
$timeoffset
))
->
get
();
$total_Accounts_loaded
=
DB
::
table
(
'records'
)
->
whereIn
(
'client'
,
$oclientlst
)
->
get
();
$breaks
=
array
(
"AgentBriefing"
,
"TeamMeeting"
,
"QualityFeedback"
,
"LunchBreak"
,
"TeaBreak"
,
"UtilityBreak"
,
"FloorAnnouncements"
,
"DownTime"
);
$reporthead
=
array
(
"Campaigns"
,
"Accounts Loaded"
,
"LoggedIn users"
,
"Unique accounts dialled"
,
"Total accounts Dialled"
,
"Disposed Calls"
,
"Contacts"
,
"RPC"
,
"PTP"
,
"Preview"
,
"Wrap"
,
"Idle"
,
"Talk"
,
"Hold"
);
$reportarray
=
array
();
$campaign_wisearr
=
array
();
$camp_userlist
=
array
();
$uniquenumberarray
=
array
();
$prev_close
=
0
;
foreach
(
$alist
as
$key
=>
$value
)
{
if
(
!
array_key_exists
(
$value
->
client
,
$camp_userlist
))
$camp_userlist
[
$value
->
client
]
=
[];
if
(
!
in_array
(
$value
->
user_id
,
$camp_userlist
[
$value
->
client
]))
$camp_userlist
[
$value
->
client
][]
=
$value
->
user_id
;
$campaign_wisearr
[
$value
->
client
][
"LoggedIn users"
]
=
count
(
$camp_userlist
[
$value
->
client
]);
$campaign_wisearr
[
$value
->
client
][
"Campaigns"
]
=
$value
->
client
;
$campaign_wisearr
[
$value
->
client
][
"Total accounts Dialled"
]
++
;
if
(
!
array_key_exists
(
$value
->
client
,
$uniquenumberarray
))
$uniquenumberarray
[
$value
->
client
]
=
[];
if
(
!
in_array
(
$value
->
number
,
$uniquenumberarray
[
$value
->
client
]))
$uniquenumberarray
[
$value
->
client
][]
=
$value
->
number
;
$campaign_wisearr
[
$value
->
client
][
"Unique accounts dialled"
]
=
count
(
$uniquenumberarray
[
$value
->
client
]);
if
(
$value
->
userstatus
==
'Contacted'
)
{
$campaign_wisearr
[
$value
->
client
][
"Disposed Calls"
]
++
;
}
if
(
$value
->
resultCode
==
'PTP'
||
$value
->
resultCode
==
'CB'
||
$value
->
resultCode
==
'RTP'
||
$value
->
resultCode
==
'CEREP'
||
$value
->
resultCode
==
'PV'
||
$value
->
resultCode
==
'DEAD'
||
$value
->
resultCode
==
'LM'
||
$value
->
resultCode
==
'TPC'
)
{
$campaign_wisearr
[
$value
->
client
][
"Contacts"
]
++
;
}
if
(
$value
->
resultCode
==
'PTP'
||
$value
->
resultCode
==
'CEREP'
||
$value
->
resultCode
==
'PV'
)
{
$campaign_wisearr
[
$value
->
client
][
"PTP"
]
++
;
}
if
(
$value
->
resultCode
==
'PTP'
||
$value
->
resultCode
==
'CB'
||
$value
->
resultCode
==
'CEREP'
||
$value
->
resultCode
==
'RTP'
||
$value
->
resultCode
==
'PV'
)
{
$campaign_wisearr
[
$value
->
client
][
"RPC"
]
++
;
}
if
(
$prev_user
!=
$value
->
user_id
||
$prev_close
<=
$value
->
ts_Wait
)
{
$talktime
=
$value
->
talkSec
+
$value
->
recstartSec
+
$value
->
recendSec
;
$totaltime
=
$value
->
callSec
+
$talktime
+
$value
->
dispoSec
;
$campaign_wisearr
[
$value
->
client
][
"oncall"
]
+=
$totaltime
/
1000
;
// $campaign_wisearr[$value->client]["Preview"]+=$value->waitSec/1000;
$campaign_wisearr
[
$value
->
client
][
"Hold"
]
+=
$value
->
callSec
/
1000
;
$campaign_wisearr
[
$value
->
client
][
"Talk"
]
+=
$talktime
/
1000
;
$campaign_wisearr
[
$value
->
client
][
"Wrap"
]
+=
$value
->
dispoSec
/
1000
;
}
$prev_close
=
$value
->
ts_Close
;
//-ts_Wait
$prev_user
=
$value
->
user_id
;
//-ts_Wait
}
function
cmp
(
$a
,
$b
)
{
return
$a
[
"ts"
]
-
$b
[
"ts"
];
}
$userLogin
=
array
();
$checkhead
=
array_merge
(
$reporthead
,
$breaks
);
foreach
(
$userlog
as
$ulog
)
{
$data
=
json_decode
(
$ulog
->
data
,
true
);
usort
(
$data
,
"cmp"
);
$lastSip
=
end
(
$data
);
$starttime
=
strtotime
(
$ulog
->
startdate
.
' '
.
$ulog
->
starttime
);
$endtime
=
round
(
$lastSip
[
'ts'
]
/
1000
);
$userLogin
[
$ulog
->
user_id
][
'duration'
]
+=
(
$endtime
-
$starttime
);
$prets
=
strtotime
(
$ulog
->
startdate
.
" "
.
$ulog
->
starttime
)
*
1000
;
$previous
=
"Paused-Paused"
;
foreach
(
$data
as
$sdata
)
{
$pts
=
$sdata
[
'ts'
];
if
(
isset
(
$sdata
[
'states'
]))
{
foreach
(
$sdata
[
'states'
]
as
$ts
=>
$states
)
{
$previous
=
str_replace
(
'Paused-'
,
''
,
$previous
);
if
(
!
in_array
(
$previous
,
$checkhead
)
&&
!
in_array
(
$previous
,
array
(
'Progressive-'
,
'Manual-'
,
'Ready-Incoming'
,
'Ready-Predictive'
,
'DialNext-'
)))
{
$previous
=
'Paused'
;
}
$reportarray
[
$ulog
->
user_id
][
$previous
]
+=
round
(
$ts
-
$prets
,
2
)
/
1000
;
$prets
=
$ts
;
$previous
=
$states
[
0
]
.
'-'
.
$states
[
1
];
}
$previous
=
str_replace
(
'Paused-'
,
''
,
$previous
);
$reportarray
[
$ulog
->
user_id
][
$previous
]
+=
round
(
$pts
-
$prets
,
2
)
/
1000
;
$prets
=
$pts
;
}
}
}
if
(
count
(
$userLogin
))
foreach
(
$userLogin
as
$userid
=>
$value
)
{
$break_time
=
0
;
foreach
(
$breaks
as
$break
)
{
$break_time
+=
$reportarray
[
$userid
][
$break
];
}
$reportarray
[
$userid
][
"Duration"
]
=
$value
[
'duration'
];
$reportarray
[
$userid
][
"Total"
]
=
$value
[
'duration'
]
-
$break_time
-
$reportarray
[
$userid
][
'Paused'
];
$reportarray
[
$userid
][
"Preview"
]
=
$reportarray
[
$userid
][
"Total"
]
-
$reportarray
[
$userid
][
'oncall'
];
$reportarray
[
$userid
][
"Breaks"
]
=
$break_time
;
$reportarray
[
$userid
][
"Idle"
]
=
$reportarray
[
$userid
][
'Paused'
];
}
$i
=
1
;
foreach
(
$camp_userlist
as
$campaign
=>
$campaignUserCountArr
)
{
// $campaign_wisearr[$campaign]['#']= $i++;
foreach
(
$campaignUserCountArr
as
$eachCampaignUserCount
)
{
if
(
array_key_exists
(
$eachCampaignUserCount
,
$reportarray
))
{
$campaign_wisearr
[
$campaign
][
'Duration'
]
+=
$reportarray
[
$eachCampaignUserCount
][
'Duration'
];
$campaign_wisearr
[
$campaign
][
'Idle'
]
+=
$reportarray
[
$eachCampaignUserCount
][
'Idle'
];
$campaign_wisearr
[
$campaign
][
'Breaks'
]
+=
$reportarray
[
$eachCampaignUserCount
][
'Breaks'
];
$campaign_wisearr
[
$campaign
][
'Preview'
]
+=
$reportarray
[
$eachCampaignUserCount
][
'Preview'
];
$campaign_wisearr
[
$campaign
][
'Total'
]
+=
$reportarray
[
$eachCampaignUserCount
][
'Total'
];
}
}
}
foreach
(
$total_Accounts_loaded
as
$key
=>
$value
)
{
$campaign_wisearr
[
$value
->
client
][
"Campaigns"
]
=
$value
->
client
;
$campaign_wisearr
[
$value
->
client
][
'Accounts Loaded'
]
++
;
}
$highestColumn
=
sizeof
(
$reporthead
);
if
(
count
(
$campaign_wisearr
))
{
$outhead
=
"<tr>"
;
$outstr
=
""
;
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
){
if
(
$reporthead
[
$head
]
==
'#'
)
{
$mode_str
=
"<a onclick='displayMode("
.
'"summation"'
.
");return false;' href='#'><i class='fa fa-plus-square-o'></i></a> / <a onclick='displayMode("
.
'"percent"'
.
");return false;' href='#'>%</a>"
;
$outhead
.=
"<td>"
.
$mode_str
.
"</td>"
;
}
else
{
$outhead
.=
"<td>"
.
$reporthead
[
$head
]
.
"</td>"
;
}
}
$outhead
.=
"</tr>"
;
$utotalarr
=
array
(
"Campaigns"
=>
'Total'
);
foreach
(
$campaign_wisearr
as
$uid
=>
$uarr
)
{
$outstr
.=
"<tr>"
;
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
){
if
(
$head
<
1
)
{
$data_str
=
$uarr
[
$reporthead
[
$head
]];
}
elseif
(
$head
<
9
)
{
$data_str
=
$uarr
[
$reporthead
[
$head
]];
$utotalarr
[
$reporthead
[
$head
]]
+=
$uarr
[
$reporthead
[
$head
]];
}
else
{
$data_str
=
secToDuration
(
round
(
$uarr
[
$reporthead
[
$head
]]));
$utotalarr
[
$reporthead
[
$head
]]
+=
$uarr
[
$reporthead
[
$head
]];
}
$outstr
.=
"<td>"
.
$data_str
.
"</td>"
;
}
$outstr
.=
"</tr>"
;
}
$outstr
.=
"<tr>"
;
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
)
{
if
(
$head
<
9
)
{
$data_str
=
$utotalarr
[
$reporthead
[
$head
]];
}
else
{
$data_str
=
secToDuration
(
$utotalarr
[
$reporthead
[
$head
]]);
}
$outstr
.=
"<td>"
.
$data_str
.
"</td>"
;
}
$outstr
.=
"</tr>"
;
}
else
{
$outhead
.=
"<tr><td>No Records Found.</td></tr>"
;
}
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
=
2
;
$highestColumn
=
sizeof
(
$reporthead
);
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
){
$colstr
=
PHPExcel_Cell
::
stringFromColumnIndex
(
$head
);
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
$colstr
.
"1"
,
$reporthead
[
$head
]);
}
foreach
(
$campaign_wisearr
as
$uid
=>
$uarr
)
{
$row
=
$baseRow
++
;
$col
=
0
;
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
){
$excelval
=
(
$head
<
6
)
?
$uarr
[
$reporthead
[
$head
]]
:
secToDuration
(
round
(
$uarr
[
$reporthead
[
$head
]]));
$colstr
=
PHPExcel_Cell
::
stringFromColumnIndex
(
$head
);
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
$colstr
.
$row
,
$excelval
);
}
}
$row
++
;
for
(
$head
=
0
;
$head
<
$highestColumn
;
$head
++
){
$excelval
=
(
$head
<
6
)
?
$utotalarr
[
$reporthead
[
$head
]]
:
secToDuration
(
round
(
$utotalarr
[
$reporthead
[
$head
]]));
$colstr
=
PHPExcel_Cell
::
stringFromColumnIndex
(
$head
);
$objPHPExcel
->
getActiveSheet
()
->
setCellValue
(
$colstr
.
$row
,
$excelval
);
}
header
(
'Content-Type: application/vnd.ms-excel'
);
header
(
'Content-Disposition: attachment;filename="Campaignlevel.xls"'
);
header
(
'Cache-Control: max-age=0'
);
$objWriter
=
PHPExcel_IOFactory
::
createWriter
(
$objPHPExcel
,
$inputFileType
);
$objWriter
->
save
(
'php://output'
);
return
;
}
function
secToDuration
(
$sec
)
{
return
sprintf
(
"%02d%s%02d%s%02d"
,
floor
(
$sec
/
3600
),
':'
,
(
$sec
/
60
)
%
60
,
':'
,
$sec
%
60
);
}
?>
<style>
#logtable
.td
{
vertical-align
:
top
;}
#logtable
.tr
{
height
:
28px
;
overflow-y
:
hidden
;}
</style>
<div
class=
innerAll
>
<h4
style=
"float:left;width:50%;margin:10px 0;"
>
Campaign Level Report
</h4>
<h4
style=
"float:left;width:50%;margin:10px 0;"
>
Monitor
</h4>
<div
style=
"float:right;width:50%"
>
<button
class=
'pull-right btn btn-sm btn-default'
onclick=
'dlAgentlogXls();return false;'
title=
'Download'
><i
class=
'fa fa-download'
></i>
Download
</button>
</div>
<div
style=
"clear:both"
></div>
<hr
style=
"margin-bottom: 5px;"
>
<div>
Search
<input
id=
filter
name=
"filter"
type=
"text"
style=
"border:1px solid #efefef; padding: 2px 10px;"
>
Date: From
<input
size=
10
id=
'modfrom'
name=
'modfrom'
type=
'text'
value=
'
<?php
echo
date
(
"Y-m-d"
,
$logdate
);
?>
'
onchange=
'statusLogReloadFun("");'
/>
<select
id=
"modtime"
style=
"border:1px solid #efefef;"
onchange=
'statusLogReloadFun("");'
>
<?php
foreach
(
range
(
0
,
23
)
as
$hour
)
{
$selected
=
(
$hour
==
$logtime
)
?
"selected"
:
""
;
echo
"<option value='
$hour
'
$selected
>"
.
str_pad
(
$hour
,
2
,
"0"
,
STR_PAD_LEFT
)
.
":00</option>"
;
}
?>
</select>
To
<input
size=
10
id=
'modto'
name=
'modto'
type=
'text'
value=
'
<?php
echo
date
(
"Y-m-d"
,
$logdateto
);
?>
'
onchange=
'statusLogReloadFun("");'
/>
<select
id=
"modtimeto"
style=
"border:1px solid #efefef;"
onchange=
'statusLogReloadFun("");'
>
<?php
foreach
(
range
(
0
,
23
)
as
$hour
)
{
$selected
=
(
$hour
==
$logtimeto
)
?
"selected"
:
""
;
echo
"<option value='
$hour
'
$selected
>"
.
str_pad
(
$hour
,
2
,
"0"
,
STR_PAD_LEFT
)
.
":00</option>"
;
}
?>
</select>
Campaign
<select
id=
"campaign"
style=
"border:1px solid #efefef;"
onchange=
'statusLogReloadFun("");'
>
{!! $campStr !!}
</select>
</div>
<div
style=
"clear:both"
></div>
<hr
style=
"margin:5px;"
>
<div
style=
"overflow: auto; margin-top: 10px;"
>
<table
id=
logtable
class=
'footable table table-striped table-bordered table-white table-primary footable-loaded'
style=
'font-size:12px; margin:0; border:1px solid #BBB;'
>
<thead>
<?php
echo
$outhead
;
?>
</thead>
<?php
echo
$outstr
;
?>
<div
style=
"margin-top: 10px;"
>
@if($campaign != "Select")
<div
class=
"row"
>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Pacing:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$ratio}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Total User:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$totalUsr}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
User InCall:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$inCall}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Free User:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$freeUsr}}"
>
</div>
</div>
<div
class=
"row"
style=
"margin-top: 20px;"
>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Total Channel:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$totalChnl}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Avail Channel:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$availChnl}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Call Dialing:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$dialedCall}}"
>
</div>
<div
class=
"col-md-1"
>
<label
for=
"total_agent"
class=
"pull-right"
>
Call Waiting:
</label>
</div>
<div
class=
"col-md-1"
>
<input
type=
"text"
class=
"form-control"
disabled=
"disabled"
value=
"{{$waitCall}}"
>
</div>
</div>
<div
style=
"margin-top: 20px;"
>
<table
class=
"table table-borderless"
>
<thead>
{!! $tabHeadStr !!}
</thead>
<tbody>
{!! $tabBodyStr !!}
</tbody>
</table>
</div>
<div
id=
dialoglog
></div>
</div>
@else
<div
class=
"panel panel-info"
><span>
Please Select Campaign From DropDown
</span></div>
@endif
<script>
$(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");
}
}
});
}
</div>
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
);
?>
'});
$('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '
<?php
echo
(
date
(
'Y'
)
-
70
)
.
":"
.
(
date
(
'Y'
)
+
5
);
?>
'});
});
</div>
<script>
function
dataString
()
{
return '
logdate
=
'+$("#modfrom").val()+'
&
logtime
=
'+$("#modtime").val()+'
&
logdateto
=
'+$("#modto").val()+'
&
logtimeto
=
'+$("#modtimeto").val()+'
&
campaign
=
All
';//
+$("#campaign").val();
return
'
campaign='
+
$
(
"#campaign"
).
val
();
}
function
statusLogReloadFun
(
sortby
)
{
var
sortstr
=
''
;
if
(
sortby
!=
""
)
sortstr
=
"&sort="
+
sortby
var
searchStr
=
dataString
();
doAjax('
dialer
/
campaignlevel
?
'+searchStr+sortstr,'','
rightmainreportdiv
','
ajax_dialer_reports
','
singlethis
','
GET
');
}
function dlAgentlogXls()
{
var searchStr = dataString();
window.open('
dialer
/
campaignlevel
?
dllogxls
=
1
&
'
+
searchStr
);
return
false
;
doAjax
(
'report/liveusers?'
+
searchStr
+
sortstr
,
''
,
'rightmainreportdiv'
,
'ajax_dialer_reports'
,
'singlethis'
,
'GET'
);
}
setTimeout
(
function
(){
statusLogReloadFun
(
""
)
},
10000
);
</script>
\ No newline at end of file
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment