Working on Report
Showing
36 changed files
with
9878 additions
and
248 deletions
application/app/Http/2502_routes.php
deleted
100644 → 0
| 1 | <?php | ||
| 2 | |||
| 3 | Route::get('/', array('uses'=> 'HomeController@index', 'as'=>'index.root')); | ||
| 4 | Route::get('index', array('uses'=> 'HomeController@index', 'as'=>'index.index')); | ||
| 5 | |||
| 6 | Route::get('test_table_8', 'Rom8Controller@testTable'); | ||
| 7 | Route::get('eg', 'egController@eg'); | ||
| 8 | |||
| 9 | Route::group(['middleware' => ['web']], function () { | ||
| 10 | |||
| 11 | Route::get('home', array('uses' => 'HomeController@home', 'as'=>'home.home')); | ||
| 12 | Route::get('login', array('uses'=> 'HomeController@login', 'as'=>'home.login')); | ||
| 13 | Route::post('login', array('uses'=> 'HomeController@do_login', 'as'=>'home.do_login')); | ||
| 14 | Route::get('logout', array('uses'=> 'HomeController@logout', 'as'=>'home.logout')); | ||
| 15 | Route::get('signup', array('uses'=> 'HomeController@signup', 'as'=>'home.signup')); | ||
| 16 | Route::post('signup', array('uses'=> 'HomeController@do_signup', 'as'=>'home.do_signup')); | ||
| 17 | |||
| 18 | Route::get('userfiles/{path}',array('uses'=>'HomeController@userfiles','as'=>'userfiles.get'))->where('path', '.*'); | ||
| 19 | |||
| 20 | Route::get('unsubscribe', array('uses'=> 'HomeController@unsubscribe', 'as'=>'home.unsubscribe')); | ||
| 21 | Route::any('forgotpassword', array('uses'=> 'HomeController@forgotpassword', 'as'=>'signup.forgotpassword')); | ||
| 22 | |||
| 23 | Route::get('profile', array('before' => 'auth','uses' => 'HomeController@profile', 'as'=>'profile.index')); | ||
| 24 | Route::post('profile', array('before' => 'auth','uses' => 'HomeController@do_profile', 'as'=>'profile.update')); | ||
| 25 | |||
| 26 | Route::get('msie', array('uses'=> 'HomeController@msie', 'as'=>'login.msie')); | ||
| 27 | Route::any('ajaxerror', array('uses'=> 'HomeController@ajaxerror', 'as'=>'home.ajaxerror')); | ||
| 28 | Route::any('gettoken', array('uses'=> 'HomeController@gettoken', 'as'=>'home.gettoken')); | ||
| 29 | Route::any('idleapp', array('uses'=> 'HomeController@idleapp', 'as'=>'home.idleapp')); | ||
| 30 | |||
| 31 | Route::any('fileupload', array('uses'=> 'HomeController@fileupload', 'as'=>'upload.file')); | ||
| 32 | Route::get('cron', array('uses'=> 'HomeController@cron', 'as'=>'cron.cron')); | ||
| 33 | Route::get('style', array('uses'=> 'HomeController@style', 'as'=>'style.index')); | ||
| 34 | Route::get('jshead', array('uses'=> 'HomeController@jshead', 'as'=>'jshead.index')); | ||
| 35 | Route::get('jsbody', array('uses'=> 'HomeController@jsbody', 'as'=>'jsbody.index')); | ||
| 36 | |||
| 37 | Route::resource('dashboard','DashboardController'); | ||
| 38 | Route::resource('notification','NotificationController'); | ||
| 39 | Route::resource('message','MessageController'); | ||
| 40 | Route::resource('task','TaskController'); | ||
| 41 | Route::resource('user','UserController'); | ||
| 42 | Route::resource('group','GroupController'); | ||
| 43 | Route::resource('role','RoleController'); | ||
| 44 | Route::resource('dispositionPlan','DispositionPlanController'); | ||
| 45 | |||
| 46 | Route::resource('master','MasterController'); | ||
| 47 | Route::resource('admin','AdminController'); | ||
| 48 | Route::resource('record','RecordController'); | ||
| 49 | Route::resource('campaign','CampaignController'); | ||
| 50 | |||
| 51 | Route::resource('dialer','DialerController'); | ||
| 52 | Route::resource('hr','HRController'); | ||
| 53 | Route::resource('social','SocialController'); | ||
| 54 | Route::resource('web','WebController'); | ||
| 55 | |||
| 56 | Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions')); | ||
| 57 | Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store')); | ||
| 58 | |||
| 59 | Route::get('questionare/{qid?}/{optid?}/{level?}', array('uses' => 'QuestionareController@loadQuestions', 'as'=>'questionare.load_questions')); | ||
| 60 | Route::post('questionare', array('uses' => 'QuestionareController@saveQuestionAire', 'as'=>'questionare.save')); | ||
| 61 | //Route::get('notes', array('uses' => 'NotesController@index', 'as'=>'notes.index')); | ||
| 62 | //Route::resource('notesupdate','NotesController'); | ||
| 63 | |||
| 64 | Route::get('exceldownload', function() | ||
| 65 | { | ||
| 66 | return view("layout.module.userupload.exceldata"); | ||
| 67 | }); | ||
| 68 | |||
| 69 | Route::post('useruploaddata', array('uses' => 'UserController@userUpload', 'as'=>'useruploaddata')); | ||
| 70 | |||
| 71 | //Supervisor Call Mangement - By Manish on 16-02-17 | ||
| 72 | Route::get('SupervisorModule', array('uses'=> 'RecordController@supervisorUpload', 'as'=>'upload.comments')); | ||
| 73 | |||
| 74 | //Supervisor Call Mangement - By Manish on 22-03-17 | ||
| 75 | Route::post('complaint', array('uses'=> 'ComplaintController@saveComplaint', 'as'=>'upload.complaint')); | ||
| 76 | Route::post('resclassUnit', array('uses'=> 'ComplaintController@getBranchName', 'as'=>'get.branchname')); | ||
| 77 | Route::post('childcase', array('uses'=> 'ComplaintController@saveChildCase', 'as'=>'upload.case')); | ||
| 78 | |||
| 79 | //Supervisor Message Announcement - By Manish on 12-04-17 | ||
| 80 | Route::get('category/{resClassUnit}', array('uses'=> 'ComplaintController@getCat', 'as'=>'get.cat')); | ||
| 81 | Route::get('subcategory/{catId}/{resClassUnit}', array('uses'=> 'ComplaintController@getSubCat', 'as'=>'get.subcat')); | ||
| 82 | |||
| 83 | Route::post('SupervisorMessage', array('uses'=> 'MessageController@sendSupVisorMessage', 'as'=>'send.message')); | ||
| 84 | Route::get('supmessage/{msg_id?}/{username?}', array('uses'=> 'MessageController@viewSupVisorMessage', 'as'=>'view.allmessage')); | ||
| 85 | Route::get('viewmessage/{msg_id?}/{username?}', array('uses'=> 'MessageController@viewMessage', 'as'=>'view.message')); | ||
| 86 | |||
| 87 | //Addition of Customer Racing | ||
| 88 | Route::post('custrace', array('uses'=> 'RacingCustomerController@saveRacingCustomer', 'as'=>'upload.raccust')); | ||
| 89 | |||
| 90 | //Addition of Lead Entry Form | ||
| 91 | Route::post('leadentryform', array('uses'=> 'LeadEntryFormController@saveLeadEntryFormDetails', 'as'=>'upload.rleadform')); | ||
| 92 | Route::post('oaentryform', array('uses'=> 'OneAssistController@saveOneAssistFormDetails', 'as'=>'upload.oaleadform')); | ||
| 93 | |||
| 94 | Route::post('racingcustupdate',array('uses'=> 'RacingCustomerController@updateracingcust', 'as'=>'upload.updateraccust')); | ||
| 95 | Route::get('dialmode', array('uses'=> 'DialModeController@dialmodeview', 'as'=>'view.module')); | ||
| 96 | Route::post('dialmodeassign', array('uses'=> 'DialModeController@dialmodeassign', 'as'=>'assign.dialmodes')); | ||
| 97 | ///for the rlp pbwise | ||
| 98 | Route::get('rlp', array('uses'=> 'RecordController@rlpPbwise', 'as'=>'rlppb.comments')); | ||
| 99 | |||
| 100 | }); |
| ... | @@ -1547,42 +1547,7 @@ print_r($supervisorUsers); | ... | @@ -1547,42 +1547,7 @@ print_r($supervisorUsers); |
| 1547 | $data['count'] = $count; | 1547 | $data['count'] = $count; |
| 1548 | return view("layout.module.dialer.appointment",$data); | 1548 | return view("layout.module.dialer.appointment",$data); |
| 1549 | } | 1549 | } |
| 1550 | if($id=="reports") | 1550 | |
| 1551 | { | ||
| 1552 | return view("layout.module.dialer.reports",array()); | ||
| 1553 | } | ||
| 1554 | if($id=="campaigns") | ||
| 1555 | { | ||
| 1556 | return view("layout.module.dialer.campaigns",array()); | ||
| 1557 | } | ||
| 1558 | if($id=="calllog") | ||
| 1559 | { | ||
| 1560 | return view("layout.module.dialer.calllog",array()); | ||
| 1561 | } | ||
| 1562 | if($id=="agentreport") | ||
| 1563 | { | ||
| 1564 | return view("layout.module.dialer.agentreport",array()); | ||
| 1565 | } | ||
| 1566 | if($id=="campreport") | ||
| 1567 | { | ||
| 1568 | return view("layout.module.dialer.campreport",array()); | ||
| 1569 | } | ||
| 1570 | if($id=="statusreport") | ||
| 1571 | { | ||
| 1572 | return view("layout.module.dialer.statusreport",array()); | ||
| 1573 | } | ||
| 1574 | if($id=="questionnaire") | ||
| 1575 | { | ||
| 1576 | return view("layout.module.dialer.questairereport",array()); | ||
| 1577 | } | ||
| 1578 | if($id=="callmanagement") | ||
| 1579 | { | ||
| 1580 | return view("layout.module.dialer.callmanagementreport",array()); | ||
| 1581 | } | ||
| 1582 | if($id=="supmessages") | ||
| 1583 | { | ||
| 1584 | return view("layout.module.dialer.supmessagesreport",array()); | ||
| 1585 | } | ||
| 1586 | 1551 | ||
| 1587 | if($id=='playrecfile') | 1552 | if($id=='playrecfile') |
| 1588 | { | 1553 | { |
| ... | @@ -1613,18 +1578,6 @@ print_r($supervisorUsers); | ... | @@ -1613,18 +1578,6 @@ print_r($supervisorUsers); |
| 1613 | } | 1578 | } |
| 1614 | return; | 1579 | return; |
| 1615 | } | 1580 | } |
| 1616 | if($id=="liveusers") | ||
| 1617 | { | ||
| 1618 | return view("layout.module.dialer.liveusers",array()); | ||
| 1619 | } | ||
| 1620 | if($id=="recarchive") | ||
| 1621 | { | ||
| 1622 | return view("layout.module.dialer.recarchive",array()); | ||
| 1623 | } | ||
| 1624 | if($id=="recqc") | ||
| 1625 | { | ||
| 1626 | return view("layout.module.dialer.recqc",array()); | ||
| 1627 | } | ||
| 1628 | //relationship area dropdown option fetched code. code by Yashwant Sir | 1581 | //relationship area dropdown option fetched code. code by Yashwant Sir |
| 1629 | if($id=="relationship") | 1582 | if($id=="relationship") |
| 1630 | { | 1583 | { | ... | ... |
| 1 | <?php | ||
| 2 | |||
| 3 | namespace App\Http\Controllers; | ||
| 4 | |||
| 5 | use Illuminate\Http\Request; | ||
| 6 | |||
| 7 | use Auth; | ||
| 8 | use Input; | ||
| 9 | use Response; | ||
| 10 | use Config; | ||
| 11 | use App\Http\Requests; | ||
| 12 | use App\Models\Group; | ||
| 13 | use App\Models\Master; | ||
| 14 | use App\Models\Record; | ||
| 15 | use App\Models\CRMCall; | ||
| 16 | use App\Models\CRMCallArchive; | ||
| 17 | use App\Models\CRM; | ||
| 18 | use App\Models\CRMCampaign; | ||
| 19 | use App\Models\CRMList; | ||
| 20 | use App\Models\Cutoff; | ||
| 21 | use App\Jobs\KHRMSLib; | ||
| 22 | use App\Models\Sipid; | ||
| 23 | use App\Models\Dialline; | ||
| 24 | use App\Models\UserLog; | ||
| 25 | use App\Models\Kqueue; | ||
| 26 | use DB; | ||
| 27 | use Log; | ||
| 28 | use Session; | ||
| 29 | |||
| 30 | class ReportController extends Controller | ||
| 31 | { | ||
| 32 | public function __construct() | ||
| 33 | { | ||
| 34 | $this->middleware('auth'); | ||
| 35 | $this->middleware('module_access'); | ||
| 36 | } | ||
| 37 | |||
| 38 | public function show($id) | ||
| 39 | { | ||
| 40 | if($id=="reports") | ||
| 41 | { | ||
| 42 | return view("layout.module.reports.reports",array()); | ||
| 43 | } | ||
| 44 | |||
| 45 | if($id=="campaigns") | ||
| 46 | { | ||
| 47 | return view("layout.module.reports.campaigns",array()); | ||
| 48 | } | ||
| 49 | |||
| 50 | if($id=="calllog") | ||
| 51 | { | ||
| 52 | return view("layout.module.reports.calllog",array()); | ||
| 53 | } | ||
| 54 | |||
| 55 | if($id=="agentreport") | ||
| 56 | { | ||
| 57 | return view("layout.module.reports.agentreport",array()); | ||
| 58 | } | ||
| 59 | |||
| 60 | if($id=="campreport") | ||
| 61 | { | ||
| 62 | return view("layout.module.reports.campreport",array()); | ||
| 63 | } | ||
| 64 | |||
| 65 | if($id=="statusreport") | ||
| 66 | { | ||
| 67 | return view("layout.module.reports.statusreport",array()); | ||
| 68 | } | ||
| 69 | |||
| 70 | if($id=="questionnaire") | ||
| 71 | { | ||
| 72 | return view("layout.module.reports.questairereport",array()); | ||
| 73 | } | ||
| 74 | |||
| 75 | if($id=="callmanagement") | ||
| 76 | { | ||
| 77 | return view("layout.module.reports.callmanagementreport",array()); | ||
| 78 | } | ||
| 79 | |||
| 80 | if($id=="supmessages") | ||
| 81 | { | ||
| 82 | return view("layout.module.reports.supmessagesreport",array()); | ||
| 83 | } | ||
| 84 | |||
| 85 | if($id=="liveusers") | ||
| 86 | { | ||
| 87 | return view("layout.module.reports.liveusers",array()); | ||
| 88 | } | ||
| 89 | |||
| 90 | if($id=="recarchive") | ||
| 91 | { | ||
| 92 | return view("layout.module.reports.recarchive",array()); | ||
| 93 | } | ||
| 94 | |||
| 95 | if($id=="recqc") | ||
| 96 | { | ||
| 97 | return view("layout.module.reports.recqc",array()); | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } |
application/app/Http/routes-2002.php
deleted
100644 → 0
| 1 | <?php | ||
| 2 | |||
| 3 | Route::get('/', array('uses'=> 'HomeController@index', 'as'=>'index.root')); | ||
| 4 | Route::get('index', array('uses'=> 'HomeController@index', 'as'=>'index.index')); | ||
| 5 | |||
| 6 | Route::get('test_table_8', 'Rom8Controller@testTable'); | ||
| 7 | Route::get('eg', 'egController@eg'); | ||
| 8 | |||
| 9 | Route::group(['middleware' => ['web']], function () { | ||
| 10 | |||
| 11 | Route::get('home', array('uses' => 'HomeController@home', 'as'=>'home.home')); | ||
| 12 | Route::get('login', array('uses'=> 'HomeController@login', 'as'=>'home.login')); | ||
| 13 | Route::post('login', array('uses'=> 'HomeController@do_login', 'as'=>'home.do_login')); | ||
| 14 | Route::get('logout', array('uses'=> 'HomeController@logout', 'as'=>'home.logout')); | ||
| 15 | Route::get('signup', array('uses'=> 'HomeController@signup', 'as'=>'home.signup')); | ||
| 16 | Route::post('signup', array('uses'=> 'HomeController@do_signup', 'as'=>'home.do_signup')); | ||
| 17 | |||
| 18 | Route::get('userfiles/{path}',array('uses'=>'HomeController@userfiles','as'=>'userfiles.get'))->where('path', '.*'); | ||
| 19 | |||
| 20 | Route::get('unsubscribe', array('uses'=> 'HomeController@unsubscribe', 'as'=>'home.unsubscribe')); | ||
| 21 | Route::any('forgotpassword', array('uses'=> 'HomeController@forgotpassword', 'as'=>'signup.forgotpassword')); | ||
| 22 | |||
| 23 | Route::get('profile', array('before' => 'auth','uses' => 'HomeController@profile', 'as'=>'profile.index')); | ||
| 24 | Route::post('profile', array('before' => 'auth','uses' => 'HomeController@do_profile', 'as'=>'profile.update')); | ||
| 25 | |||
| 26 | Route::get('msie', array('uses'=> 'HomeController@msie', 'as'=>'login.msie')); | ||
| 27 | Route::any('ajaxerror', array('uses'=> 'HomeController@ajaxerror', 'as'=>'home.ajaxerror')); | ||
| 28 | Route::any('gettoken', array('uses'=> 'HomeController@gettoken', 'as'=>'home.gettoken')); | ||
| 29 | Route::any('idleapp', array('uses'=> 'HomeController@idleapp', 'as'=>'home.idleapp')); | ||
| 30 | |||
| 31 | Route::any('fileupload', array('uses'=> 'HomeController@fileupload', 'as'=>'upload.file')); | ||
| 32 | Route::get('cron', array('uses'=> 'HomeController@cron', 'as'=>'cron.cron')); | ||
| 33 | Route::get('style', array('uses'=> 'HomeController@style', 'as'=>'style.index')); | ||
| 34 | Route::get('jshead', array('uses'=> 'HomeController@jshead', 'as'=>'jshead.index')); | ||
| 35 | Route::get('jsbody', array('uses'=> 'HomeController@jsbody', 'as'=>'jsbody.index')); | ||
| 36 | |||
| 37 | Route::resource('dashboard','DashboardController'); | ||
| 38 | Route::resource('notification','NotificationController'); | ||
| 39 | Route::resource('message','MessageController'); | ||
| 40 | Route::resource('task','TaskController'); | ||
| 41 | Route::resource('user','UserController'); | ||
| 42 | Route::resource('group','GroupController'); | ||
| 43 | Route::resource('role','RoleController'); | ||
| 44 | |||
| 45 | Route::resource('master','MasterController'); | ||
| 46 | Route::resource('admin','AdminController'); | ||
| 47 | Route::resource('record','RecordController'); | ||
| 48 | Route::resource('campaign','CampaignController'); | ||
| 49 | |||
| 50 | Route::resource('dialer','DialerController'); | ||
| 51 | Route::resource('hr','HRController'); | ||
| 52 | Route::resource('social','SocialController'); | ||
| 53 | Route::resource('web','WebController'); | ||
| 54 | |||
| 55 | Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions')); | ||
| 56 | Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store')); | ||
| 57 | |||
| 58 | Route::get('questionare/{qid?}/{optid?}/{level?}', array('uses' => 'QuestionareController@loadQuestions', 'as'=>'questionare.load_questions')); | ||
| 59 | Route::post('questionare', array('uses' => 'QuestionareController@saveQuestionAire', 'as'=>'questionare.save')); | ||
| 60 | //Route::get('notes', array('uses' => 'NotesController@index', 'as'=>'notes.index')); | ||
| 61 | //Route::resource('notesupdate','NotesController'); | ||
| 62 | |||
| 63 | Route::get('exceldownload', function() | ||
| 64 | { | ||
| 65 | return view("layout.module.userupload.exceldata"); | ||
| 66 | }); | ||
| 67 | |||
| 68 | Route::post('useruploaddata', array('uses' => 'UserController@userUpload', 'as'=>'useruploaddata')); | ||
| 69 | |||
| 70 | //Supervisor Call Mangement - By Manish on 16-02-17 | ||
| 71 | Route::get('SupervisorModule', array('uses'=> 'RecordController@supervisorUpload', 'as'=>'upload.comments')); | ||
| 72 | |||
| 73 | //Supervisor Call Mangement - By Manish on 22-03-17 | ||
| 74 | Route::post('complaint', array('uses'=> 'ComplaintController@saveComplaint', 'as'=>'upload.complaint')); | ||
| 75 | Route::post('resclassUnit', array('uses'=> 'ComplaintController@getBranchName', 'as'=>'get.branchname')); | ||
| 76 | Route::post('childcase', array('uses'=> 'ComplaintController@saveChildCase', 'as'=>'upload.case')); | ||
| 77 | |||
| 78 | //Supervisor Message Announcement - By Manish on 12-04-17 | ||
| 79 | Route::get('category/{resClassUnit}', array('uses'=> 'ComplaintController@getCat', 'as'=>'get.cat')); | ||
| 80 | Route::get('subcategory/{catId}/{resClassUnit}', array('uses'=> 'ComplaintController@getSubCat', 'as'=>'get.subcat')); | ||
| 81 | |||
| 82 | Route::post('SupervisorMessage', array('uses'=> 'MessageController@sendSupVisorMessage', 'as'=>'send.message')); | ||
| 83 | Route::get('supmessage/{msg_id?}/{username?}', array('uses'=> 'MessageController@viewSupVisorMessage', 'as'=>'view.allmessage')); | ||
| 84 | Route::get('viewmessage/{msg_id?}/{username?}', array('uses'=> 'MessageController@viewMessage', 'as'=>'view.message')); | ||
| 85 | |||
| 86 | //Addition of Customer Racing | ||
| 87 | Route::post('custrace', array('uses'=> 'RacingCustomerController@saveRacingCustomer', 'as'=>'upload.raccust')); | ||
| 88 | |||
| 89 | //Addition of Lead Entry Form | ||
| 90 | Route::post('leadentryform', array('uses'=> 'LeadEntryFormController@saveLeadEntryFormDetails', 'as'=>'upload.rleadform')); | ||
| 91 | Route::post('oaentryform', array('uses'=> 'OneAssistController@saveOneAssistFormDetails', 'as'=>'upload.oaleadform')); | ||
| 92 | |||
| 93 | Route::post('racingcustupdate',array('uses'=> 'RacingCustomerController@updateracingcust', 'as'=>'upload.updateraccust')); | ||
| 94 | Route::get('dialmode', array('uses'=> 'DialModeController@dialmodeview', 'as'=>'view.module')); | ||
| 95 | Route::post('dialmodeassign', array('uses'=> 'DialModeController@dialmodeassign', 'as'=>'assign.dialmodes')); | ||
| 96 | ///for the rlp pbwise | ||
| 97 | Route::get('rlp', array('uses'=> 'RecordController@rlpPbwise', 'as'=>'rlppb.comments')); | ||
| 98 | |||
| 99 | }); |
| ... | @@ -53,6 +53,7 @@ Route::group(['middleware' => ['web']], function () { | ... | @@ -53,6 +53,7 @@ Route::group(['middleware' => ['web']], function () { |
| 53 | Route::resource('hr','HRController'); | 53 | Route::resource('hr','HRController'); |
| 54 | Route::resource('social','SocialController'); | 54 | Route::resource('social','SocialController'); |
| 55 | Route::resource('web','WebController'); | 55 | Route::resource('web','WebController'); |
| 56 | Route::resource('report','ReportController'); | ||
| 56 | 57 | ||
| 57 | Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions')); | 58 | Route::get('notes', array('uses' => 'NotesController@loadQuestions', 'as'=>'questionare.load_questions')); |
| 58 | Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store')); | 59 | Route::post('notes',array('uses' => 'NotesController@store', 'as'=>'notes.store')); | ... | ... |
| ... | @@ -98,7 +98,7 @@ return [ | ... | @@ -98,7 +98,7 @@ return [ |
| 98 | "Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"], | 98 | "Task" => ["disp"=>"Tasks","icon"=>"edit","dash"=>"","onclick"=>"showBlock('Workflow');"], |
| 99 | "Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer", | 99 | "Dialer" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"Dialer", |
| 100 | "submenu"=>["Dialer"=>["kDialerModel();"], | 100 | "submenu"=>["Dialer"=>["kDialerModel();"], |
| 101 | "Reports"=>["menuAction('dialer/reports');"], | 101 | "Reports"=>["menuAction('report/reports');"], |
| 102 | ]], | 102 | ]], |
| 103 | "DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"", | 103 | "DialerCampaign" => ["disp"=>"Dialer","icon"=>"phone","dash"=>"", |
| 104 | "submenu"=>[ | 104 | "submenu"=>[ |
| ... | @@ -129,6 +129,7 @@ return [ | ... | @@ -129,6 +129,7 @@ return [ |
| 129 | "Record" => ["disp"=>"Record","icon"=>"file","dash"=>"","onclick"=>""], | 129 | "Record" => ["disp"=>"Record","icon"=>"file","dash"=>"","onclick"=>""], |
| 130 | "User" => ["disp"=>"User","icon"=>"home","dash"=>"","onclick"=>""], | 130 | "User" => ["disp"=>"User","icon"=>"home","dash"=>"","onclick"=>""], |
| 131 | "Role" => ["disp"=>"Role","icon"=>"home","dash"=>"","onclick"=>""], | 131 | "Role" => ["disp"=>"Role","icon"=>"home","dash"=>"","onclick"=>""], |
| 132 | "Report" => ["disp"=>"Report","icon"=>"home","dash"=>"","onclick"=>""], | ||
| 132 | "DialMode" => ["disp"=>"DialMode","icon"=>"home","dash"=>"","onclick"=>""], | 133 | "DialMode" => ["disp"=>"DialMode","icon"=>"home","dash"=>"","onclick"=>""], |
| 133 | "SupervisorModule" => ["disp"=>"SupervisorModule","icon"=>"globe","dash"=>"","onclick"=>"menuAction('SupervisorModule');"], | 134 | "SupervisorModule" => ["disp"=>"SupervisorModule","icon"=>"globe","dash"=>"","onclick"=>"menuAction('SupervisorModule');"], |
| 134 | "Notes" => ["disp"=>"Notes","icon"=>"globe","dash"=>"","onclick"=>"menuAction('notes');"], | 135 | "Notes" => ["disp"=>"Notes","icon"=>"globe","dash"=>"","onclick"=>"menuAction('notes');"], | ... | ... |
| 1 | <?php | ||
| 2 | use App\Models\Sipid; | ||
| 3 | use App\Models\UserLog; | ||
| 4 | use App\Models\CRMCall; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Jobs\KHRMSLib; | ||
| 7 | |||
| 8 | |||
| 9 | $selectedvals=explode(":",Input::get("selectedvals",":::::")); | ||
| 10 | $hdfcnodes=array(); | ||
| 11 | $offline=array(); | ||
| 12 | $arr=Config::get("app.hdfcnodes"); | ||
| 13 | foreach($arr as $server=>$arrline) | ||
| 14 | { | ||
| 15 | $tvals=explode(":",$arrline); | ||
| 16 | |||
| 17 | if($selectedvals[0]=="")$hdfcnodes[]=$server; | ||
| 18 | else if($selectedvals[0]==$tvals[0]) | ||
| 19 | { | ||
| 20 | if($selectedvals[1]=="")$hdfcnodes[]=$server; | ||
| 21 | else if($selectedvals[1]==$tvals[1]) | ||
| 22 | { | ||
| 23 | if($selectedvals[2]=="")$hdfcnodes[]=$server; | ||
| 24 | else if($selectedvals[2]==$tvals[2]) | ||
| 25 | { | ||
| 26 | if($selectedvals[3]=="")$hdfcnodes[]=$server; | ||
| 27 | else if($selectedvals[3]==$tvals[3]) | ||
| 28 | { | ||
| 29 | if($selectedvals[4]=="")$hdfcnodes[]=$server; | ||
| 30 | else if($selectedvals[4]==$tvals[4]) | ||
| 31 | { | ||
| 32 | $hdfcnodes[]=$server; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | $wakka = new KHRMSLib(); | ||
| 43 | $dashboarduser=Auth::user(); | ||
| 44 | $uidlist=array();$onlineusers=array(); | ||
| 45 | |||
| 46 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 47 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 48 | |||
| 49 | $i=1; | ||
| 50 | $reporthead=array("#","UserId","UserName","In","Out","InOut","Sessions","Duration"); | ||
| 51 | $reportarray=array(); | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | foreach($hdfcnodes as $ci=>$server) | ||
| 56 | { | ||
| 57 | $conn = array( | ||
| 58 | 'driver' => 'mysql', | ||
| 59 | 'host' => $server, | ||
| 60 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 61 | 'username' => env('DB_USERNAME', 'root'), | ||
| 62 | 'password' => env('DB_PASSWORD', ''), | ||
| 63 | 'charset' => 'utf8', | ||
| 64 | 'collation' => 'utf8_unicode_ci', | ||
| 65 | 'prefix' => '', | ||
| 66 | 'options' => array( | ||
| 67 | PDO::ATTR_TIMEOUT => 5, | ||
| 68 | ), | ||
| 69 | ); | ||
| 70 | Config::set("database.connections.conn$ci", $conn); | ||
| 71 | |||
| 72 | try | ||
| 73 | { | ||
| 74 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | $alist=UserLog::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('durationsec','>',0); | ||
| 79 | $alist=$alist->get(); | ||
| 80 | $userarr=array(); | ||
| 81 | foreach($alist as $aline) | ||
| 82 | { | ||
| 83 | if(!isset($userarr[$aline->user_id."conn$ci"]))$userarr[$aline->user_id."conn$ci"]=User::on("conn$ci")->find($aline->user_id."conn$ci"); | ||
| 84 | $tuser=$userarr[$aline->user_id."conn$ci"]; | ||
| 85 | |||
| 86 | if(!isset($reportarray[$aline->user_id."conn$ci"]))$reportarray[$aline->user_id."conn$ci"]=array("#"=>$i++,"UserId"=>$aline->user_id."conn$ci","UserName"=>$tuser->username,"In"=>"","Out"=>"","InOut"=>0,"Sessions"=>0,"Duration"=>0); | ||
| 87 | |||
| 88 | if($reportarray[$aline->user_id."conn$ci"]["In"]=="")$reportarray[$aline->user_id."conn$ci"]["In"]=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 89 | $reportarray[$aline->user_id."conn$ci"]["Out"]=date("Y-m-d H:i:s",strtotime($aline->updated_at)-($dashboarduser->timezone*60)); | ||
| 90 | $reportarray[$aline->user_id."conn$ci"]["InOut"]=strtotime($reportarray[$aline->user_id."conn$ci"]["Out"])-strtotime($reportarray[$aline->user_id."conn$ci"]["In"]); | ||
| 91 | |||
| 92 | $data=json_decode($aline->data,true); | ||
| 93 | foreach($data as $sipid=>$sdata) | ||
| 94 | { | ||
| 95 | $reportarray[$aline->user_id."conn$ci"]["Sessions"]++; | ||
| 96 | $reportarray[$aline->user_id."conn$ci"]["Duration"]+=$aline->durationsec; | ||
| 97 | if(isset($sdata['states'])) | ||
| 98 | { | ||
| 99 | $previous="Login"; | ||
| 100 | $prets=strtotime($aline->startdate." ".$aline->starttime); | ||
| 101 | foreach($sdata['states'] as $ts=>$states) | ||
| 102 | { | ||
| 103 | $fts=$ts/1000; | ||
| 104 | if(!in_array($previous,$reporthead))$reporthead[]=$previous; | ||
| 105 | $reportarray[$aline->user_id."conn$ci"][$previous]+=round($fts-$prets,2); | ||
| 106 | $previous=$states[0]."-".$states[1];$prets=$fts; | ||
| 107 | } | ||
| 108 | if(!in_array($previous,$reporthead))$reporthead[]=$previous; | ||
| 109 | $reportarray[$aline->user_id."conn$ci"][$previous]+=round((strtotime($aline->enddate." ".$aline->endtime))-$prets,2); | ||
| 110 | } | ||
| 111 | else | ||
| 112 | { | ||
| 113 | $reportarray[$aline->user_id."conn$ci"]["Login"]+=$aline->durationsec; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | }catch(Exception $e) | ||
| 119 | { | ||
| 120 | $offline[]=$server; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | if(Input::has("dllogxls")) | ||
| 129 | { | ||
| 130 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 131 | |||
| 132 | $inputFileType = "Excel5"; | ||
| 133 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 134 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 135 | $baseRow = 3; | ||
| 136 | |||
| 137 | |||
| 138 | $highestColumn = sizeof($reporthead); | ||
| 139 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 140 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 141 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 142 | } | ||
| 143 | |||
| 144 | foreach($reportarray as $uid=>$uarr) | ||
| 145 | { | ||
| 146 | $row = $baseRow++; | ||
| 147 | $col = 0; | ||
| 148 | |||
| 149 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 150 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 151 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 152 | } | ||
| 153 | } | ||
| 154 | |||
| 155 | |||
| 156 | header('Content-Type: application/vnd.ms-excel'); | ||
| 157 | header('Content-Disposition: attachment;filename="AgentLog.xls"'); | ||
| 158 | header('Cache-Control: max-age=0'); | ||
| 159 | |||
| 160 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 161 | $objWriter->save('php://output'); | ||
| 162 | |||
| 163 | return ; | ||
| 164 | } | ||
| 165 | |||
| 166 | |||
| 167 | $highestColumn = sizeof($reporthead); | ||
| 168 | $outhead="<tr>";$outstr=""; | ||
| 169 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 170 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 171 | } | ||
| 172 | $outhead.="</tr>"; | ||
| 173 | foreach($reportarray as $uid=>$uarr) | ||
| 174 | { | ||
| 175 | $outstr.="<tr>"; | ||
| 176 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 177 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 178 | } | ||
| 179 | $outstr.="</tr>"; | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | //charts | ||
| 186 | $cat1=array(); | ||
| 187 | $cat1arr=array(); | ||
| 188 | foreach($reportarray as $uid=>$uarr) | ||
| 189 | { | ||
| 190 | $cat1[]="'$uarr[UserName]'"; | ||
| 191 | |||
| 192 | for ($head = 8; $head < $highestColumn; $head++){ | ||
| 193 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 194 | |||
| 195 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]]/60,1); | ||
| 196 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 197 | } | ||
| 198 | } | ||
| 199 | |||
| 200 | $cat1arrstr=""; | ||
| 201 | foreach($cat1arr as $name=>$data) | ||
| 202 | { | ||
| 203 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 204 | $cat1arrstr.=implode(",",$data); | ||
| 205 | $cat1arrstr.="] },\n"; | ||
| 206 | } | ||
| 207 | |||
| 208 | |||
| 209 | $cat2=array(); | ||
| 210 | foreach($reportarray as $uid=>$uarr) | ||
| 211 | { | ||
| 212 | for ($head = 8; $head < $highestColumn; $head++){ | ||
| 213 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]]/60,1); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | ?> | ||
| 217 | |||
| 218 | |||
| 219 | <div class=innerAll> | ||
| 220 | |||
| 221 | |||
| 222 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 223 | <script> | ||
| 224 | $(document).ready(function() | ||
| 225 | { | ||
| 226 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 227 | { | ||
| 228 | $('#dialoglog').dialog({ | ||
| 229 | autoOpen: false, | ||
| 230 | width: '70%', | ||
| 231 | buttons: { | ||
| 232 | "Ok": function() { | ||
| 233 | $(this).dialog("close"); | ||
| 234 | }, | ||
| 235 | "Cancel": function() { | ||
| 236 | $(this).dialog("close"); | ||
| 237 | } | ||
| 238 | } | ||
| 239 | }); | ||
| 240 | } | ||
| 241 | |||
| 242 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 243 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 244 | }); | ||
| 245 | </script> | ||
| 246 | <div style="float:left;width:50%"> | ||
| 247 | |||
| 248 | Search <input id=filter name="filter" type="text"> | ||
| 249 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='agentLogReloadFun("");' /> | ||
| 250 | |||
| 251 | </div> | ||
| 252 | <div style="float:left;width:50%"> | ||
| 253 | |||
| 254 | |||
| 255 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 256 | |||
| 257 | </div> | ||
| 258 | <div style="clear:both"></div> | ||
| 259 | <hr> | ||
| 260 | |||
| 261 | <div class=col-md-12> | ||
| 262 | |||
| 263 | |||
| 264 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 265 | <script> | ||
| 266 | $(function () { | ||
| 267 | $('#userlogschart1').highcharts({ | ||
| 268 | chart: { | ||
| 269 | type: 'column' | ||
| 270 | }, | ||
| 271 | title: { | ||
| 272 | text: '' | ||
| 273 | }, | ||
| 274 | xAxis: { | ||
| 275 | labels:{ | ||
| 276 | enabled:false//default is true | ||
| 277 | }, | ||
| 278 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 279 | }, | ||
| 280 | yAxis: { | ||
| 281 | min: 0, | ||
| 282 | title: { | ||
| 283 | text: '' | ||
| 284 | }, | ||
| 285 | stackLabels: { | ||
| 286 | enabled: false, | ||
| 287 | // style: { | ||
| 288 | // fontWeight: '', | ||
| 289 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 290 | // } | ||
| 291 | } | ||
| 292 | }, | ||
| 293 | // legend: { | ||
| 294 | // align: 'right', | ||
| 295 | // x: -30, | ||
| 296 | // verticalAlign: 'top', | ||
| 297 | // y: 25, | ||
| 298 | // floating: true, | ||
| 299 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 300 | // borderColor: '#CCC', | ||
| 301 | // borderWidth: 1, | ||
| 302 | // shadow: false | ||
| 303 | // }, | ||
| 304 | tooltip: { | ||
| 305 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 306 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 307 | }, | ||
| 308 | plotOptions: { | ||
| 309 | column: { | ||
| 310 | stacking: 'normal', | ||
| 311 | dataLabels: { | ||
| 312 | enabled: false, | ||
| 313 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 314 | // style: { | ||
| 315 | // textShadow: '0 0 3px black' | ||
| 316 | // } | ||
| 317 | } | ||
| 318 | } | ||
| 319 | }, | ||
| 320 | series: [<?php echo $cat1arrstr; ?>] | ||
| 321 | }); | ||
| 322 | }); | ||
| 323 | |||
| 324 | |||
| 325 | |||
| 326 | |||
| 327 | function agentLogReloadFun(sortby) | ||
| 328 | { | ||
| 329 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 330 | |||
| 331 | doAjax('dialer/aagentreport?logdate='+$("#modfrom").val()+sortstr+'&selectedvals='+getarvalval(),'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 332 | } | ||
| 333 | function dlAgentlogXls() | ||
| 334 | { | ||
| 335 | window.open('dialer/aagentreport?dllogxls=1&logdate='+$("#modfrom").val()+'&selectedvals='+getarvalval());return false; | ||
| 336 | } | ||
| 337 | </script> | ||
| 338 | |||
| 339 | </div> | ||
| 340 | |||
| 341 | <div style='clear:both'></div> | ||
| 342 | |||
| 343 | <div class=col-md-12> | ||
| 344 | |||
| 345 | |||
| 346 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 347 | <script> | ||
| 348 | $(function () { | ||
| 349 | $('#userlogschart2').highcharts({ | ||
| 350 | chart: { | ||
| 351 | type: 'column' | ||
| 352 | }, | ||
| 353 | title: { | ||
| 354 | text: '' | ||
| 355 | }, | ||
| 356 | subtitle: { | ||
| 357 | text: '' | ||
| 358 | }, | ||
| 359 | xAxis: { | ||
| 360 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 361 | crosshair: true | ||
| 362 | }, | ||
| 363 | yAxis: { | ||
| 364 | min: 0, | ||
| 365 | title: { | ||
| 366 | text: '' | ||
| 367 | } | ||
| 368 | }, | ||
| 369 | tooltip: { | ||
| 370 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 371 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 372 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 373 | footerFormat: '</table>', | ||
| 374 | shared: true, | ||
| 375 | useHTML: true | ||
| 376 | }, | ||
| 377 | plotOptions: { | ||
| 378 | column: { | ||
| 379 | pointPadding: 0.2, | ||
| 380 | borderWidth: 0 | ||
| 381 | } | ||
| 382 | }, | ||
| 383 | legend : { | ||
| 384 | floating: true, | ||
| 385 | align: 'right', | ||
| 386 | x: -30, | ||
| 387 | verticalAlign: 'top', | ||
| 388 | }, | ||
| 389 | series: [{ | ||
| 390 | name: 'Mins', | ||
| 391 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 392 | |||
| 393 | },] | ||
| 394 | }); | ||
| 395 | }); | ||
| 396 | |||
| 397 | </script> | ||
| 398 | |||
| 399 | </div> | ||
| 400 | |||
| 401 | |||
| 402 | |||
| 403 | <div style='clear:both'></div> | ||
| 404 | |||
| 405 | <div style='overflow:auto'> | ||
| 406 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 407 | <thead> | ||
| 408 | <?php echo $outhead; ?> | ||
| 409 | </thead> | ||
| 410 | <?php echo $outstr; ?> | ||
| 411 | </table> | ||
| 412 | </div> | ||
| 413 | |||
| 414 | <div id=dialoglog></div> | ||
| 415 | |||
| 416 | |||
| 417 | |||
| 418 | |||
| 419 | |||
| 420 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | |||
| 7 | $selectedvals=explode(":",Input::get("selectedvals",":::::")); | ||
| 8 | $hdfcnodes=array(); | ||
| 9 | $offline=array(); | ||
| 10 | $arr=Config::get("app.hdfcnodes"); | ||
| 11 | foreach($arr as $server=>$arrline) | ||
| 12 | { | ||
| 13 | $tvals=explode(":",$arrline); | ||
| 14 | |||
| 15 | if($selectedvals[0]=="")$hdfcnodes[]=$server; | ||
| 16 | else if($selectedvals[0]==$tvals[0]) | ||
| 17 | { | ||
| 18 | if($selectedvals[1]=="")$hdfcnodes[]=$server; | ||
| 19 | else if($selectedvals[1]==$tvals[1]) | ||
| 20 | { | ||
| 21 | if($selectedvals[2]=="")$hdfcnodes[]=$server; | ||
| 22 | else if($selectedvals[2]==$tvals[2]) | ||
| 23 | { | ||
| 24 | if($selectedvals[3]=="")$hdfcnodes[]=$server; | ||
| 25 | else if($selectedvals[3]==$tvals[3]) | ||
| 26 | { | ||
| 27 | if($selectedvals[4]=="")$hdfcnodes[]=$server; | ||
| 28 | else if($selectedvals[4]==$tvals[4]) | ||
| 29 | { | ||
| 30 | $hdfcnodes[]=$server; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | $wakka = new KHRMSLib(); | ||
| 42 | $dashboarduser=Auth::user(); | ||
| 43 | |||
| 44 | |||
| 45 | $i=1; | ||
| 46 | $totaltime=0;$ttlovr10=0;$ttlovr5=0;$ttlovr1=0;$ttlovr0=0;$outstr="";$usrcnt=0; | ||
| 47 | $totaltimeIn=0;$ttlovr10In=0;$ttlovr5In=0;$ttlovr1In=0;$ttlovr0In=0;$usrcntIn=0; | ||
| 48 | $actionarr=array();$actionarrIn=array(); | ||
| 49 | |||
| 50 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00");else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | if(Input::has("dllogxls")) | ||
| 57 | { | ||
| 58 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 59 | |||
| 60 | $inputFileType = "Excel5"; | ||
| 61 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 62 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 63 | $baseRow = 3; | ||
| 64 | |||
| 65 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 66 | $fieldsarr[$tcol++]='#'; | ||
| 67 | $fieldsarr[$tcol++]='Start'; | ||
| 68 | $fieldsarr[$tcol++]='Length'; | ||
| 69 | $fieldsarr[$tcol++]='User'; | ||
| 70 | $fieldsarr[$tcol++]='Name'; | ||
| 71 | $fieldsarr[$tcol++]='Dispo'; | ||
| 72 | $fieldsarr[$tcol++]='SubDispo'; | ||
| 73 | $fieldsarr[$tcol++]='CB'; | ||
| 74 | $fieldsarr[$tcol++]='Number'; | ||
| 75 | $fieldsarr[$tcol++]='ClientCode'; | ||
| 76 | $fieldsarr[$tcol++]='CurrentStatus'; | ||
| 77 | $fieldsarr[$tcol++]='LegalStatus'; | ||
| 78 | $fieldsarr[$tcol++]='Data'; | ||
| 79 | $fieldsarr[$tcol++]='SubData'; | ||
| 80 | |||
| 81 | $fieldsarr[$tcol++]='State'; | ||
| 82 | $fieldsarr[$tcol++]='HSource'; | ||
| 83 | $fieldsarr[$tcol++]='Type'; | ||
| 84 | $fieldsarr[$tcol++]='Status'; | ||
| 85 | $fieldsarr[$tcol++]='StatusCode'; | ||
| 86 | $fieldsarr[$tcol++]='StatusStr'; | ||
| 87 | $fieldsarr[$tcol++]='DialLine'; | ||
| 88 | $fieldsarr[$tcol++]='DID'; | ||
| 89 | $fieldsarr[$tcol++]='WaitSec'; | ||
| 90 | $fieldsarr[$tcol++]='CallSec'; | ||
| 91 | $fieldsarr[$tcol++]='TalkSec'; | ||
| 92 | $fieldsarr[$tcol++]='DispoSec'; | ||
| 93 | $fieldsarr[$tcol++]='Remarks'; | ||
| 94 | |||
| 95 | $highestColumn = sizeof($fieldsarr); | ||
| 96 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 97 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 98 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]); | ||
| 99 | } | ||
| 100 | |||
| 101 | $ii=1; | ||
| 102 | foreach($hdfcnodes as $ci=>$server) | ||
| 103 | { | ||
| 104 | $conn = array( | ||
| 105 | 'driver' => 'mysql', | ||
| 106 | 'host' => $server, | ||
| 107 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 108 | 'username' => env('DB_USERNAME', 'root'), | ||
| 109 | 'password' => env('DB_PASSWORD', ''), | ||
| 110 | 'charset' => 'utf8', | ||
| 111 | 'collation' => 'utf8_unicode_ci', | ||
| 112 | 'prefix' => '', | ||
| 113 | 'options' => array( | ||
| 114 | PDO::ATTR_TIMEOUT => 5, | ||
| 115 | ), | ||
| 116 | ); | ||
| 117 | Config::set("database.connections.conn$ci", $conn); | ||
| 118 | |||
| 119 | try | ||
| 120 | { | ||
| 121 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 122 | |||
| 123 | |||
| 124 | $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 125 | if(Input::get('sort')=='cpu')$alist=$alist->orderBy("callSec","DESC");else $alist=$alist->orderBy("id","DESC");$alist=$alist->get(); | ||
| 126 | $userarr=array(); | ||
| 127 | foreach($alist as $aline) | ||
| 128 | { | ||
| 129 | $row = $baseRow++; | ||
| 130 | $col = 0; | ||
| 131 | |||
| 132 | |||
| 133 | $clientcode="";$currentstatus="";$legalstatus=""; | ||
| 134 | if($aline->crm_id>0) | ||
| 135 | { | ||
| 136 | $user=$wakka->getPerson($aline->crm_id); | ||
| 137 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 138 | $currentstatus=$user["peopledata"]["currentstatus"]; | ||
| 139 | $legalstatus=$user["peopledata"]["legalstatus"]; | ||
| 140 | } | ||
| 141 | $tpostdata=json_decode($aline->data,true); | ||
| 142 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 143 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 144 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 145 | |||
| 146 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id); | ||
| 147 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 148 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++); | ||
| 153 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($fulldate); | ||
| 154 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($length); | ||
| 155 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($username); | ||
| 156 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($dispname); | ||
| 157 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->userstatus); | ||
| 158 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->usersubstatus); | ||
| 159 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(($aline->usercallback!="0000-00-00 00:00:00"?date("Y-m-d H:i:s",strtotime($aline->usercallback)-($dashboarduser->timezone*60)):"")); | ||
| 160 | |||
| 161 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->number); | ||
| 162 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($clientcode); | ||
| 163 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($currentstatus); | ||
| 164 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($legalstatus); | ||
| 165 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->client); | ||
| 166 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->department); | ||
| 167 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->state); | ||
| 168 | |||
| 169 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->hsource); | ||
| 170 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->type); | ||
| 171 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->status); | ||
| 172 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->statuscode); | ||
| 173 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->substatus); | ||
| 174 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->dialline_id); | ||
| 175 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->did); | ||
| 176 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(round($aline->waitSec/1000,2)); | ||
| 177 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(round($aline->callSec/1000,2)); | ||
| 178 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(round($talktime/1000,2)); | ||
| 179 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(round($aline->dispoSec/1000,2)); | ||
| 180 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->userremarks); | ||
| 181 | |||
| 182 | $userdata=json_decode($aline->userdata,true); | ||
| 183 | $extravals=$extrahdrarr; | ||
| 184 | if(!empty($userdata)) | ||
| 185 | { | ||
| 186 | foreach($userdata as $key=>$val) | ||
| 187 | { | ||
| 188 | if(!isset($extrahdrarr[$key])) | ||
| 189 | { | ||
| 190 | $extrahdrarr[$key]=""; | ||
| 191 | $extravals[$key]=""; | ||
| 192 | |||
| 193 | $colstr=PHPExcel_Cell::stringFromColumnIndex(sizeof($fieldsarr)+sizeof($extrahdrarr)); | ||
| 194 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $key); | ||
| 195 | } | ||
| 196 | $extravals[$key]=$val; | ||
| 197 | } | ||
| 198 | foreach($extravals as $key=>$val) | ||
| 199 | { | ||
| 200 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($val); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | } | ||
| 204 | |||
| 205 | }catch(Exception $e) | ||
| 206 | { | ||
| 207 | $offline[]=$server; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | |||
| 212 | |||
| 213 | header('Content-Type: application/vnd.ms-excel'); | ||
| 214 | header('Content-Disposition: attachment;filename="CallLog.xls"'); | ||
| 215 | header('Cache-Control: max-age=0'); | ||
| 216 | |||
| 217 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 218 | $objWriter->save('php://output'); | ||
| 219 | |||
| 220 | return ; | ||
| 221 | } | ||
| 222 | |||
| 223 | |||
| 224 | |||
| 225 | foreach($hdfcnodes as $ci=>$server) | ||
| 226 | { | ||
| 227 | $conn = array( | ||
| 228 | 'driver' => 'mysql', | ||
| 229 | 'host' => $server, | ||
| 230 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 231 | 'username' => env('DB_USERNAME', 'root'), | ||
| 232 | 'password' => env('DB_PASSWORD', ''), | ||
| 233 | 'charset' => 'utf8', | ||
| 234 | 'collation' => 'utf8_unicode_ci', | ||
| 235 | 'prefix' => '', | ||
| 236 | 'options' => array( | ||
| 237 | PDO::ATTR_TIMEOUT => 5, | ||
| 238 | ), | ||
| 239 | ); | ||
| 240 | Config::set("database.connections.conn$ci", $conn); | ||
| 241 | |||
| 242 | try | ||
| 243 | { | ||
| 244 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 245 | |||
| 246 | $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 247 | if(Input::get('sort')=='cpu')$alist=$alist->orderBy("callSec","DESC");else $alist=$alist->orderBy("id","DESC");$alist=$alist->get(); | ||
| 248 | $userarr=array(); | ||
| 249 | foreach($alist as $aline) | ||
| 250 | { | ||
| 251 | $clientcode=""; | ||
| 252 | if($aline->crm_id>0) | ||
| 253 | { | ||
| 254 | $user=$wakka->getPerson($aline->crm_id); | ||
| 255 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 256 | } | ||
| 257 | $tpostdata=json_decode($aline->data,true); | ||
| 258 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 259 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 260 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 261 | |||
| 262 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::on("conn$ci")->find($aline->user_id); | ||
| 263 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 264 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 265 | |||
| 266 | $recstr=''; | ||
| 267 | if($dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 268 | { | ||
| 269 | if(isset($tpostdata['recFolder']))$recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> </a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> </a><span id='recspan_".$aline->id."'</span>"; | ||
| 270 | } | ||
| 271 | |||
| 272 | $outstr.="<tr><td>".$i."</td> | ||
| 273 | <td title='$fulldate'>".explode(" ",$fulldate)[1]."</td> | ||
| 274 | <td>$length</td> | ||
| 275 | <td>".$username."</td> | ||
| 276 | <td>".$dispname."</td> | ||
| 277 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 278 | <td>".$aline->usersubstatus."</td> | ||
| 279 | <td>".($aline->usercallback!="0000-00-00 00:00:00"?date("Y-m-d H:i:s",strtotime($aline->usercallback)-($dashboarduser->timezone*60)):"")."</td> | ||
| 280 | <td><a href=# class='' onclick='dialerQuickOpen(\"$aline->crm_id\",\"$aline->number\",\"Progressive\",\"\",0);return false;'>".$aline->number."</a></td> | ||
| 281 | <td>$clientcode</td> | ||
| 282 | <td>".$aline->client."</td> | ||
| 283 | <td>".$aline->department."</td> | ||
| 284 | <td>".$aline->state."</td> | ||
| 285 | <td>".$aline->hsource."</td> | ||
| 286 | <td>".$aline->type."</td> | ||
| 287 | <td>".$aline->status."</td> | ||
| 288 | <td>".$aline->statuscode."</td> | ||
| 289 | <td>".$aline->substatus."</td> | ||
| 290 | <td>".$aline->dialline_id."</td> | ||
| 291 | <td>".$aline->did."</td> | ||
| 292 | <td>".round($aline->waitSec/1000,2)."</td> | ||
| 293 | <td>".round($aline->callSec/1000,2)."</td> | ||
| 294 | <td>".round($talktime/1000,2)."</td> | ||
| 295 | <td>".round($aline->dispoSec/1000,2)."</td> | ||
| 296 | <td>$recstr</td> | ||
| 297 | </tr>"; | ||
| 298 | |||
| 299 | |||
| 300 | if($aline->type=='Inbound') | ||
| 301 | { | ||
| 302 | if($talktime>120000)$ttlovr10In++; | ||
| 303 | else if($talktime>60000)$ttlovr5In++; | ||
| 304 | else if($talktime>30000)$ttlovr1In++; | ||
| 305 | else if($talktime>1000)$ttlovr0In++; | ||
| 306 | |||
| 307 | $totaltimeIn+=round($talktime/1000,2); | ||
| 308 | $usrcntIn++; | ||
| 309 | |||
| 310 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 311 | if(!isset($actionarrIn[$turl]))$actionarrIn[$turl]=array('cnt'=>0,'time'=>0); | ||
| 312 | $actionarrIn[$turl]['cnt']++; | ||
| 313 | $actionarrIn[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 314 | } | ||
| 315 | else | ||
| 316 | { | ||
| 317 | if($talktime>120000)$ttlovr10++; | ||
| 318 | else if($talktime>60000)$ttlovr5++; | ||
| 319 | else if($talktime>30000)$ttlovr1++; | ||
| 320 | else if($talktime>1000)$ttlovr0++; | ||
| 321 | |||
| 322 | $totaltime+=round($talktime/1000,2); | ||
| 323 | $usrcnt++; | ||
| 324 | |||
| 325 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 326 | if(!isset($actionarr[$turl]))$actionarr[$turl]=array('cnt'=>0,'time'=>0); | ||
| 327 | $actionarr[$turl]['cnt']++; | ||
| 328 | $actionarr[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 329 | } | ||
| 330 | |||
| 331 | |||
| 332 | |||
| 333 | $i++; | ||
| 334 | } | ||
| 335 | }catch(Exception $e) | ||
| 336 | { | ||
| 337 | $offline[]=$server; | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | ?> | ||
| 342 | |||
| 343 | |||
| 344 | |||
| 345 | <div class=innerAll> | ||
| 346 | |||
| 347 | |||
| 348 | |||
| 349 | |||
| 350 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 351 | <script> | ||
| 352 | function showExtraPost(varstr) | ||
| 353 | { | ||
| 354 | doAjax("hr?action=LiveUsers","getpostdata="+varstr,"dialoglog"); | ||
| 355 | |||
| 356 | $('#dialoglog').dialog('open'); | ||
| 357 | return false; | ||
| 358 | } | ||
| 359 | |||
| 360 | $(document).ready(function() | ||
| 361 | { | ||
| 362 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 363 | { | ||
| 364 | $('#dialoglog').dialog({ | ||
| 365 | autoOpen: false, | ||
| 366 | width: '70%', | ||
| 367 | buttons: { | ||
| 368 | "Ok": function() { | ||
| 369 | $(this).dialog("close"); | ||
| 370 | }, | ||
| 371 | "Cancel": function() { | ||
| 372 | $(this).dialog("close"); | ||
| 373 | } | ||
| 374 | } | ||
| 375 | }); | ||
| 376 | } | ||
| 377 | |||
| 378 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 379 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 380 | }); | ||
| 381 | </script> | ||
| 382 | <div style="float:left;width:50%"> | ||
| 383 | |||
| 384 | Search <input id=filter name="filter" type="text"> | ||
| 385 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='callLogReloadFun("");' /> | ||
| 386 | |||
| 387 | </div> | ||
| 388 | <div style="float:left;width:50%"> | ||
| 389 | |||
| 390 | |||
| 391 | <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> | ||
| 392 | |||
| 393 | </div> | ||
| 394 | <div style="clear:both"></div> | ||
| 395 | <hr> | ||
| 396 | |||
| 397 | <?php | ||
| 398 | $categories=array();$avgarr=array();$cntarr=array(); | ||
| 399 | foreach($actionarr as $act=>$actarr) | ||
| 400 | { | ||
| 401 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 402 | { | ||
| 403 | //echo "<label>$act</label> ".round($actarr['time']/$actarr['cnt'],2)." [".round($actarr[time],1)."/$actarr[cnt]]<br>"; | ||
| 404 | |||
| 405 | $categories[]="'$act'"; | ||
| 406 | $avgarr[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 407 | $cntarr[]=$actarr['cnt']; | ||
| 408 | } | ||
| 409 | } | ||
| 410 | |||
| 411 | array_multisort($cntarr,$avgarr,$categories); | ||
| 412 | |||
| 413 | |||
| 414 | |||
| 415 | $categoriesIn=array();$avgarrIn=array();$cntarrIn=array(); | ||
| 416 | foreach($actionarrIn as $act=>$actarr) | ||
| 417 | { | ||
| 418 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 419 | { | ||
| 420 | //echo "<label>$act</label> ".round($actarr['time']/$actarr['cnt'],2)." [".round($actarr[time],1)."/$actarr[cnt]]<br>"; | ||
| 421 | |||
| 422 | $categoriesIn[]="'$act'"; | ||
| 423 | $avgarrIn[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 424 | $cntarrIn[]=$actarr['cnt']; | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | array_multisort($cntarrIn,$avgarrIn,$categoriesIn); | ||
| 429 | ?> | ||
| 430 | |||
| 431 | |||
| 432 | <div class=col-md-2> | ||
| 433 | <br> | ||
| 434 | <h5>Stats - Outbound</h5><hr><br> | ||
| 435 | |||
| 436 | <ul style="list-style:none"> | ||
| 437 | <li class="notify_alert"> | ||
| 438 | <span><a href=# onclick="return false;">Total CallTime</a></span> | ||
| 439 | <span class="label label-small label-default pull-right" >{!!round($totaltime,2)!!}</span> | ||
| 440 | </li> | ||
| 441 | <li class="notify_alert"> | ||
| 442 | <span><a href=# onclick="return false;">Total Calls</a></span> | ||
| 443 | <span class="label label-small label-default pull-right" >{!!$usrcnt!!}</span> | ||
| 444 | </li> | ||
| 445 | <li class="notify_alert"> | ||
| 446 | <span><a href=# onclick="return false;">Average CallTime</a></span> | ||
| 447 | <span class="label label-small label-default pull-right" >{!!($usrcnt>0)?round($totaltime/$usrcnt,2):'0'!!}</span> | ||
| 448 | </li> | ||
| 449 | |||
| 450 | <li class="notify_alert"> | ||
| 451 | <span><a href=# onclick="return false;">Calls > 2 Min</a></span> | ||
| 452 | <span class="label label-small label-default pull-right" >{!!$ttlovr10!!}</span> | ||
| 453 | </li> | ||
| 454 | <li class="notify_alert"> | ||
| 455 | <span><a href=# onclick="return false;">Calls > 1 Min</a></span> | ||
| 456 | <span class="label label-small label-default pull-right" >{!!$ttlovr5!!}</span> | ||
| 457 | </li> | ||
| 458 | <li class="notify_alert"> | ||
| 459 | <span><a href=# onclick="return false;">Calls > 30 sec</a></span> | ||
| 460 | <span class="label label-small label-default pull-right" >{!!$ttlovr1!!}</span> | ||
| 461 | </li> | ||
| 462 | <li class="notify_alert"> | ||
| 463 | <span><a href=# onclick="return false;">Calls > 1 sec</a></span> | ||
| 464 | <span class="label label-small label-default pull-right" >{!!$ttlovr0!!}</span> | ||
| 465 | </li> | ||
| 466 | </ul> | ||
| 467 | |||
| 468 | </div> | ||
| 469 | <div class=col-md-10> | ||
| 470 | |||
| 471 | |||
| 472 | <div id=userlogschart1 style='min-height:300px;height:<?php echo sizeof($categories)*18; ?>px;width:100%'></div> | ||
| 473 | <script> | ||
| 474 | $(function () { | ||
| 475 | var categories = [<?php echo implode(",",$categories); ?>]; | ||
| 476 | $(document).ready(function () { | ||
| 477 | var userchart1=new Highcharts.Chart({ | ||
| 478 | chart: { | ||
| 479 | renderTo: 'userlogschart1', | ||
| 480 | type: 'bar' | ||
| 481 | }, | ||
| 482 | title: { | ||
| 483 | text: 'User Actions by Avg time and Usages' | ||
| 484 | }, | ||
| 485 | xAxis: [{ | ||
| 486 | categories: categories, | ||
| 487 | reversed: false, | ||
| 488 | labels: { | ||
| 489 | step: 1 | ||
| 490 | } | ||
| 491 | }, { // mirror axis on right side | ||
| 492 | opposite: true, | ||
| 493 | reversed: false, | ||
| 494 | categories: categories, | ||
| 495 | linkedTo: 0, | ||
| 496 | labels: { | ||
| 497 | //step: 1 | ||
| 498 | formatter: function () { | ||
| 499 | return ''; | ||
| 500 | } | ||
| 501 | } | ||
| 502 | }], | ||
| 503 | yAxis: { | ||
| 504 | // title: { | ||
| 505 | // text: null | ||
| 506 | // }, | ||
| 507 | // labels: { | ||
| 508 | // formatter: function () { | ||
| 509 | // return (Math.abs(this.value) / 1000000) + 'M'; | ||
| 510 | // } | ||
| 511 | // }, | ||
| 512 | // min: -4000000, | ||
| 513 | // max: 4000000 | ||
| 514 | }, | ||
| 515 | |||
| 516 | plotOptions: { | ||
| 517 | series: { | ||
| 518 | stacking: 'normal' | ||
| 519 | } | ||
| 520 | }, | ||
| 521 | |||
| 522 | tooltip: { | ||
| 523 | formatter: function () { | ||
| 524 | return '<b>' + this.series.name + ' ' + this.point.category + '</b><br/>' + | ||
| 525 | 'Val: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0); | ||
| 526 | } | ||
| 527 | }, | ||
| 528 | |||
| 529 | series: [{ | ||
| 530 | name: 'Avg Time', | ||
| 531 | data: [<?php echo implode(",",$avgarr); ?>] | ||
| 532 | }, { | ||
| 533 | name: 'Count', | ||
| 534 | data: [<?php echo implode(",",$cntarr); ?>] | ||
| 535 | }] | ||
| 536 | }); | ||
| 537 | }); | ||
| 538 | |||
| 539 | }); | ||
| 540 | |||
| 541 | function callLogReloadFun(sortby) | ||
| 542 | { | ||
| 543 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 544 | |||
| 545 | doAjax('dialer/acalllog?logdate='+$("#modfrom").val()+sortstr+'&selectedvals='+getarvalval(),'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 546 | } | ||
| 547 | function getCallRec(id) | ||
| 548 | { | ||
| 549 | doAjax("dialer/acalllog","getCallRec=1&calllog="+id+'&selectedvals='+getarvalval(),'recspan_'+id,'rec_ajax','singlefail','GET'); | ||
| 550 | } | ||
| 551 | function dlCalllogXls() | ||
| 552 | { | ||
| 553 | window.open('dialer/acalllog?dllogxls=1&logdate='+$("#modfrom").val()+'&selectedvals='+getarvalval());return false; | ||
| 554 | } | ||
| 555 | </script> | ||
| 556 | |||
| 557 | </div> | ||
| 558 | |||
| 559 | <div style='clear:both'></div> | ||
| 560 | |||
| 561 | |||
| 562 | <div class=col-md-2> | ||
| 563 | <br> | ||
| 564 | <h5>Stats - Inbound</h5><hr><br> | ||
| 565 | |||
| 566 | <ul style="list-style:none"> | ||
| 567 | <li class="notify_alert"> | ||
| 568 | <span><a href=# onclick="return false;">Total CallTime</a></span> | ||
| 569 | <span class="label label-small label-default pull-right" >{!!round($totaltimeIn,2)!!}</span> | ||
| 570 | </li> | ||
| 571 | <li class="notify_alert"> | ||
| 572 | <span><a href=# onclick="return false;">Total Calls</a></span> | ||
| 573 | <span class="label label-small label-default pull-right" >{!!$usrcntIn!!}</span> | ||
| 574 | </li> | ||
| 575 | <li class="notify_alert"> | ||
| 576 | <span><a href=# onclick="return false;">Average CallTime</a></span> | ||
| 577 | <span class="label label-small label-default pull-right" >{!!($usrcntIn>0)?round($totaltimeIn/$usrcntIn,2):'0'!!}</span> | ||
| 578 | </li> | ||
| 579 | |||
| 580 | <li class="notify_alert"> | ||
| 581 | <span><a href=# onclick="return false;">Calls > 2 Min</a></span> | ||
| 582 | <span class="label label-small label-default pull-right" >{!!$ttlovr10In!!}</span> | ||
| 583 | </li> | ||
| 584 | <li class="notify_alert"> | ||
| 585 | <span><a href=# onclick="return false;">Calls > 1 Min</a></span> | ||
| 586 | <span class="label label-small label-default pull-right" >{!!$ttlovr5In!!}</span> | ||
| 587 | </li> | ||
| 588 | <li class="notify_alert"> | ||
| 589 | <span><a href=# onclick="return false;">Calls > 30 sec</a></span> | ||
| 590 | <span class="label label-small label-default pull-right" >{!!$ttlovr1In!!}</span> | ||
| 591 | </li> | ||
| 592 | <li class="notify_alert"> | ||
| 593 | <span><a href=# onclick="return false;">Calls > 1 sec</a></span> | ||
| 594 | <span class="label label-small label-default pull-right" >{!!$ttlovr0In!!}</span> | ||
| 595 | </li> | ||
| 596 | </ul> | ||
| 597 | |||
| 598 | </div> | ||
| 599 | <div class=col-md-10> | ||
| 600 | |||
| 601 | |||
| 602 | <div id=userlogschart2 style='min-height:300px;height:<?php echo sizeof($categoriesIn)*18; ?>px;width:100%'></div> | ||
| 603 | <script> | ||
| 604 | $(function () { | ||
| 605 | var categories = [<?php echo implode(",",$categoriesIn); ?>]; | ||
| 606 | $(document).ready(function () { | ||
| 607 | var userchart1=new Highcharts.Chart({ | ||
| 608 | chart: { | ||
| 609 | renderTo: 'userlogschart2', | ||
| 610 | type: 'bar' | ||
| 611 | }, | ||
| 612 | title: { | ||
| 613 | text: 'User Actions by Avg time and Usages' | ||
| 614 | }, | ||
| 615 | xAxis: [{ | ||
| 616 | categories: categories, | ||
| 617 | reversed: false, | ||
| 618 | labels: { | ||
| 619 | step: 1 | ||
| 620 | } | ||
| 621 | }, { // mirror axis on right side | ||
| 622 | opposite: true, | ||
| 623 | reversed: false, | ||
| 624 | categories: categories, | ||
| 625 | linkedTo: 0, | ||
| 626 | labels: { | ||
| 627 | //step: 1 | ||
| 628 | formatter: function () { | ||
| 629 | return ''; | ||
| 630 | } | ||
| 631 | } | ||
| 632 | }], | ||
| 633 | yAxis: { | ||
| 634 | // title: { | ||
| 635 | // text: null | ||
| 636 | // }, | ||
| 637 | // labels: { | ||
| 638 | // formatter: function () { | ||
| 639 | // return (Math.abs(this.value) / 1000000) + 'M'; | ||
| 640 | // } | ||
| 641 | // }, | ||
| 642 | // min: -4000000, | ||
| 643 | // max: 4000000 | ||
| 644 | }, | ||
| 645 | |||
| 646 | plotOptions: { | ||
| 647 | series: { | ||
| 648 | stacking: 'normal' | ||
| 649 | } | ||
| 650 | }, | ||
| 651 | |||
| 652 | tooltip: { | ||
| 653 | formatter: function () { | ||
| 654 | return '<b>' + this.series.name + ' ' + this.point.category + '</b><br/>' + | ||
| 655 | 'Val: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0); | ||
| 656 | } | ||
| 657 | }, | ||
| 658 | |||
| 659 | series: [{ | ||
| 660 | name: 'Avg Time', | ||
| 661 | data: [<?php echo implode(",",$avgarrIn); ?>] | ||
| 662 | }, { | ||
| 663 | name: 'Count', | ||
| 664 | data: [<?php echo implode(",",$cntarrIn); ?>] | ||
| 665 | }] | ||
| 666 | }); | ||
| 667 | }); | ||
| 668 | |||
| 669 | }); | ||
| 670 | |||
| 671 | </script> | ||
| 672 | |||
| 673 | </div> | ||
| 674 | |||
| 675 | <div style='clear:both'></div> | ||
| 676 | |||
| 677 | <div style='overflow:auto'> | ||
| 678 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 679 | <thead> | ||
| 680 | <tr> | ||
| 681 | <th>#</th> | ||
| 682 | <th>Start</th> | ||
| 683 | <th onclick='callLogReloadFun("");return false;'>Length</th> | ||
| 684 | <th>User</th> | ||
| 685 | <th>Name</th> | ||
| 686 | <th>Dispo</th> | ||
| 687 | <th>SubDispo</th> | ||
| 688 | <th>CB</th> | ||
| 689 | <th style='width:120px'>Number</th> | ||
| 690 | <th>ClientCode</th> | ||
| 691 | <th>Data</th> | ||
| 692 | <th>SubData</th> | ||
| 693 | <th>State</th> | ||
| 694 | <th>HSource</th> | ||
| 695 | <th>Type</th> | ||
| 696 | <th>Status</th> | ||
| 697 | <th>StatusCode</th> | ||
| 698 | <th>StatusStr</th> | ||
| 699 | <th>DialLine</th> | ||
| 700 | <th>DID</th> | ||
| 701 | <th>WaitSec</th> | ||
| 702 | <th>CallSec</th> | ||
| 703 | <th>TalkSec</th> | ||
| 704 | <th>DispoSec</th> | ||
| 705 | <th>Recording</th> | ||
| 706 | </tr> | ||
| 707 | </thead> | ||
| 708 | <?php echo $outstr; ?> | ||
| 709 | </table> | ||
| 710 | </div> | ||
| 711 | <?php | ||
| 712 | function convert($size) | ||
| 713 | { | ||
| 714 | $unit=array('b','kb','mb','gb','tb','pb'); | ||
| 715 | return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | ||
| 716 | } | ||
| 717 | |||
| 718 | echo "<br>".convert(memory_get_peak_usage(true)); // 123 kb | ||
| 719 | |||
| 720 | |||
| 721 | ?> | ||
| 722 | <div id=dialoglog></div> | ||
| 723 | |||
| 724 | |||
| 725 | |||
| 726 | |||
| 727 | |||
| 728 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | $selectedvals=explode(":",Input::get("selectedvals",":::::")); | ||
| 7 | $hdfcnodes=array(); | ||
| 8 | $offline=array(); | ||
| 9 | $arr=Config::get("app.hdfcnodes"); | ||
| 10 | foreach($arr as $server=>$arrline) | ||
| 11 | { | ||
| 12 | $tvals=explode(":",$arrline); | ||
| 13 | |||
| 14 | if($selectedvals[0]=="")$hdfcnodes[]=$server; | ||
| 15 | else if($selectedvals[0]==$tvals[0]) | ||
| 16 | { | ||
| 17 | if($selectedvals[1]=="")$hdfcnodes[]=$server; | ||
| 18 | else if($selectedvals[1]==$tvals[1]) | ||
| 19 | { | ||
| 20 | if($selectedvals[2]=="")$hdfcnodes[]=$server; | ||
| 21 | else if($selectedvals[2]==$tvals[2]) | ||
| 22 | { | ||
| 23 | if($selectedvals[3]=="")$hdfcnodes[]=$server; | ||
| 24 | else if($selectedvals[3]==$tvals[3]) | ||
| 25 | { | ||
| 26 | if($selectedvals[4]=="")$hdfcnodes[]=$server; | ||
| 27 | else if($selectedvals[4]==$tvals[4]) | ||
| 28 | { | ||
| 29 | $hdfcnodes[]=$server; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | |||
| 38 | $wakka = new KHRMSLib(); | ||
| 39 | $dashboarduser=Auth::user(); | ||
| 40 | |||
| 41 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 42 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | $i=1; | ||
| 47 | $reporthead=array("#","UserId","UserName","Count","Total","Wait","Call","Talk","Dispo"); | ||
| 48 | $reportarray=array(); | ||
| 49 | |||
| 50 | |||
| 51 | foreach($hdfcnodes as $ci=>$server) | ||
| 52 | { | ||
| 53 | $conn = array( | ||
| 54 | 'driver' => 'mysql', | ||
| 55 | 'host' => $server, | ||
| 56 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 57 | 'username' => env('DB_USERNAME', 'root'), | ||
| 58 | 'password' => env('DB_PASSWORD', ''), | ||
| 59 | 'charset' => 'utf8', | ||
| 60 | 'collation' => 'utf8_unicode_ci', | ||
| 61 | 'prefix' => '', | ||
| 62 | 'options' => array( | ||
| 63 | PDO::ATTR_TIMEOUT => 5, | ||
| 64 | ), | ||
| 65 | ); | ||
| 66 | Config::set("database.connections.conn$ci", $conn); | ||
| 67 | |||
| 68 | try | ||
| 69 | { | ||
| 70 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 71 | |||
| 72 | $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 73 | $alist=$alist->get(); | ||
| 74 | $userarr=array(); | ||
| 75 | foreach($alist as $aline) | ||
| 76 | { | ||
| 77 | if(!isset($userarr[$aline->user_id."conn$ci"]))$userarr[$aline->user_id."conn$ci"]=User::on("conn$ci")->find($aline->user_id."conn$ci"); | ||
| 78 | $tuser=$userarr[$aline->user_id."conn$ci"]; | ||
| 79 | |||
| 80 | if(!isset($reportarray[$aline->user_id."conn$ci"]))$reportarray[$aline->user_id."conn$ci"]=array("#"=>$i++,"UserId"=>$tuser->id,"UserName"=>$tuser->username,"Count"=>0,"Total"=>0,"Wait"=>0,"Call"=>0,"Talk"=>0,"Dispo"=>0); | ||
| 81 | |||
| 82 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 83 | |||
| 84 | $reportarray[$aline->user_id."conn$ci"]["Count"]++; | ||
| 85 | $reportarray[$aline->user_id."conn$ci"]["Total"]+=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 86 | $reportarray[$aline->user_id."conn$ci"]["Wait"]+=round($aline->waitSec/1000,2); | ||
| 87 | $reportarray[$aline->user_id."conn$ci"]["Call"]+=round($aline->callSec/1000,2); | ||
| 88 | $reportarray[$aline->user_id."conn$ci"]["Talk"]+=round($talktime/1000,2); | ||
| 89 | $reportarray[$aline->user_id."conn$ci"]["Dispo"]+=round($aline->dispoSec/1000,2); | ||
| 90 | } | ||
| 91 | |||
| 92 | }catch(Exception $e) | ||
| 93 | { | ||
| 94 | $offline[]=$server; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | if(Input::has("dllogxls")) | ||
| 100 | { | ||
| 101 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 102 | |||
| 103 | $inputFileType = "Excel5"; | ||
| 104 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 105 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 106 | $baseRow = 3; | ||
| 107 | |||
| 108 | |||
| 109 | $highestColumn = sizeof($reporthead); | ||
| 110 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 111 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 112 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 113 | } | ||
| 114 | |||
| 115 | foreach($reportarray as $uid=>$uarr) | ||
| 116 | { | ||
| 117 | $row = $baseRow++; | ||
| 118 | $col = 0; | ||
| 119 | |||
| 120 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 121 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 122 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 123 | } | ||
| 124 | } | ||
| 125 | |||
| 126 | |||
| 127 | header('Content-Type: application/vnd.ms-excel'); | ||
| 128 | header('Content-Disposition: attachment;filename="TimeLog.xls"'); | ||
| 129 | header('Cache-Control: max-age=0'); | ||
| 130 | |||
| 131 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 132 | $objWriter->save('php://output'); | ||
| 133 | |||
| 134 | return ; | ||
| 135 | } | ||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | $highestColumn = sizeof($reporthead); | ||
| 140 | $outhead="<tr>";$outstr=""; | ||
| 141 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 142 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 143 | } | ||
| 144 | $outhead.="</tr>"; | ||
| 145 | foreach($reportarray as $uid=>$uarr) | ||
| 146 | { | ||
| 147 | $outstr.="<tr>"; | ||
| 148 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 149 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 150 | } | ||
| 151 | $outstr.="</tr>"; | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | |||
| 156 | |||
| 157 | //charts | ||
| 158 | $cat1=array(); | ||
| 159 | $cat1arr=array(); | ||
| 160 | foreach($reportarray as $uid=>$uarr) | ||
| 161 | { | ||
| 162 | $cat1[]="'$uarr[UserName]'"; | ||
| 163 | |||
| 164 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 165 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 166 | |||
| 167 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]]/60,1); | ||
| 168 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | $cat1arrstr=""; | ||
| 173 | foreach($cat1arr as $name=>$data) | ||
| 174 | { | ||
| 175 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 176 | $cat1arrstr.=implode(",",$data); | ||
| 177 | $cat1arrstr.="] },\n"; | ||
| 178 | } | ||
| 179 | |||
| 180 | |||
| 181 | $cat2=array(); | ||
| 182 | foreach($reportarray as $uid=>$uarr) | ||
| 183 | { | ||
| 184 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 185 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]]/60,1); | ||
| 186 | } | ||
| 187 | } | ||
| 188 | ?> | ||
| 189 | |||
| 190 | |||
| 191 | <div class=innerAll> | ||
| 192 | |||
| 193 | |||
| 194 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 195 | <script> | ||
| 196 | $(document).ready(function() | ||
| 197 | { | ||
| 198 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 199 | { | ||
| 200 | $('#dialoglog').dialog({ | ||
| 201 | autoOpen: false, | ||
| 202 | width: '70%', | ||
| 203 | buttons: { | ||
| 204 | "Ok": function() { | ||
| 205 | $(this).dialog("close"); | ||
| 206 | }, | ||
| 207 | "Cancel": function() { | ||
| 208 | $(this).dialog("close"); | ||
| 209 | } | ||
| 210 | } | ||
| 211 | }); | ||
| 212 | } | ||
| 213 | |||
| 214 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 215 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 216 | }); | ||
| 217 | </script> | ||
| 218 | <div style="float:left;width:50%"> | ||
| 219 | |||
| 220 | Search <input id=filter name="filter" type="text"> | ||
| 221 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='campLogReloadFun("");' /> | ||
| 222 | |||
| 223 | </div> | ||
| 224 | <div style="float:left;width:50%"> | ||
| 225 | |||
| 226 | |||
| 227 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 228 | |||
| 229 | </div> | ||
| 230 | <div style="clear:both"></div> | ||
| 231 | <hr> | ||
| 232 | |||
| 233 | <div class=col-md-12> | ||
| 234 | |||
| 235 | |||
| 236 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 237 | <script> | ||
| 238 | $(function () { | ||
| 239 | $('#userlogschart1').highcharts({ | ||
| 240 | chart: { | ||
| 241 | type: 'column' | ||
| 242 | }, | ||
| 243 | title: { | ||
| 244 | text: '' | ||
| 245 | }, | ||
| 246 | xAxis: { | ||
| 247 | labels:{ | ||
| 248 | enabled:false//default is true | ||
| 249 | }, | ||
| 250 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 251 | }, | ||
| 252 | yAxis: { | ||
| 253 | min: 0, | ||
| 254 | title: { | ||
| 255 | text: '' | ||
| 256 | }, | ||
| 257 | stackLabels: { | ||
| 258 | enabled: false, | ||
| 259 | // style: { | ||
| 260 | // fontWeight: '', | ||
| 261 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 262 | // } | ||
| 263 | } | ||
| 264 | }, | ||
| 265 | // legend: { | ||
| 266 | // align: 'right', | ||
| 267 | // x: -30, | ||
| 268 | // verticalAlign: 'top', | ||
| 269 | // y: 25, | ||
| 270 | // floating: true, | ||
| 271 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 272 | // borderColor: '#CCC', | ||
| 273 | // borderWidth: 1, | ||
| 274 | // shadow: false | ||
| 275 | // }, | ||
| 276 | tooltip: { | ||
| 277 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 278 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 279 | }, | ||
| 280 | plotOptions: { | ||
| 281 | column: { | ||
| 282 | stacking: 'normal', | ||
| 283 | dataLabels: { | ||
| 284 | enabled: false, | ||
| 285 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 286 | // style: { | ||
| 287 | // textShadow: '0 0 3px black' | ||
| 288 | // } | ||
| 289 | } | ||
| 290 | } | ||
| 291 | }, | ||
| 292 | series: [<?php echo $cat1arrstr; ?>] | ||
| 293 | }); | ||
| 294 | }); | ||
| 295 | |||
| 296 | |||
| 297 | |||
| 298 | |||
| 299 | function campLogReloadFun(sortby) | ||
| 300 | { | ||
| 301 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 302 | |||
| 303 | doAjax('dialer/acampreport?logdate='+$("#modfrom").val()+sortstr+'&selectedvals='+getarvalval(),'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 304 | } | ||
| 305 | function dlAgentlogXls() | ||
| 306 | { | ||
| 307 | window.open('dialer/acampreport?dllogxls=1&logdate='+$("#modfrom").val()+'&selectedvals='+getarvalval());return false; | ||
| 308 | } | ||
| 309 | </script> | ||
| 310 | |||
| 311 | </div> | ||
| 312 | |||
| 313 | <div style='clear:both'></div> | ||
| 314 | |||
| 315 | <div class=col-md-12> | ||
| 316 | |||
| 317 | |||
| 318 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 319 | <script> | ||
| 320 | $(function () { | ||
| 321 | $('#userlogschart2').highcharts({ | ||
| 322 | chart: { | ||
| 323 | type: 'column' | ||
| 324 | }, | ||
| 325 | title: { | ||
| 326 | text: '' | ||
| 327 | }, | ||
| 328 | subtitle: { | ||
| 329 | text: '' | ||
| 330 | }, | ||
| 331 | xAxis: { | ||
| 332 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 333 | crosshair: true | ||
| 334 | }, | ||
| 335 | yAxis: { | ||
| 336 | min: 0, | ||
| 337 | title: { | ||
| 338 | text: '' | ||
| 339 | } | ||
| 340 | }, | ||
| 341 | tooltip: { | ||
| 342 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 343 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 344 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 345 | footerFormat: '</table>', | ||
| 346 | shared: true, | ||
| 347 | useHTML: true | ||
| 348 | }, | ||
| 349 | plotOptions: { | ||
| 350 | column: { | ||
| 351 | pointPadding: 0.2, | ||
| 352 | borderWidth: 0 | ||
| 353 | } | ||
| 354 | }, | ||
| 355 | legend : { | ||
| 356 | floating: true, | ||
| 357 | align: 'right', | ||
| 358 | x: -30, | ||
| 359 | verticalAlign: 'top', | ||
| 360 | }, | ||
| 361 | series: [{ | ||
| 362 | name: 'Mins', | ||
| 363 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 364 | |||
| 365 | },] | ||
| 366 | }); | ||
| 367 | }); | ||
| 368 | |||
| 369 | </script> | ||
| 370 | |||
| 371 | </div> | ||
| 372 | |||
| 373 | |||
| 374 | |||
| 375 | <div style='clear:both'></div> | ||
| 376 | |||
| 377 | <div style='overflow:auto'> | ||
| 378 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 379 | <thead> | ||
| 380 | <?php echo $outhead; ?> | ||
| 381 | </thead> | ||
| 382 | <?php echo $outstr; ?> | ||
| 383 | </table> | ||
| 384 | </div> | ||
| 385 | |||
| 386 | <div id=dialoglog></div> | ||
| 387 | |||
| 388 | |||
| 389 | |||
| 390 | |||
| 391 | |||
| 392 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\Sipid; | ||
| 3 | use App\Models\UserLog; | ||
| 4 | use App\Models\CRMCall; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Jobs\KHRMSLib; | ||
| 7 | |||
| 8 | $wakka = new KHRMSLib(); | ||
| 9 | $dashboarduser=Auth::user(); | ||
| 10 | $uidlist=array();$onlineusers=array(); | ||
| 11 | |||
| 12 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 13 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 14 | |||
| 15 | $alist=UserLog::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('durationsec','>',0); | ||
| 16 | |||
| 17 | //if(!$dashboarduser->moduleACL("Admin",false,false,true)) | ||
| 18 | if($dashboarduser->usertype != 'Admin') | ||
| 19 | { | ||
| 20 | $uidlist[]=$dashboarduser->id; | ||
| 21 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 22 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 23 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 24 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 25 | })->get(); | ||
| 26 | |||
| 27 | foreach($allusers as $tuser) | ||
| 28 | { | ||
| 29 | $uidlist[]=$tuser->id; | ||
| 30 | if($tuser->presence==1)$onlineusers[]=$tuser; | ||
| 31 | } | ||
| 32 | |||
| 33 | $alist=$alist->whereIn('user_id',$uidlist); | ||
| 34 | } | ||
| 35 | else | ||
| 36 | { | ||
| 37 | $allusers=User::all(); | ||
| 38 | foreach($allusers as $tuser) | ||
| 39 | { | ||
| 40 | $uidlist[]=$tuser->id; | ||
| 41 | if($tuser->presence==1)$onlineusers[]=$tuser; | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | //$sipids=Sipid::whereIn("user",$uidlist)->where("status","=","1")->get(); | ||
| 46 | |||
| 47 | $alist=$alist->get(); | ||
| 48 | |||
| 49 | $userarr=array();$i=1; | ||
| 50 | $reporthead=array("#","UserId","User","Name","In","Out","InOut","Sessions","Duration","not-ready","Manual-","Progressive-","Prod-TOS","Prog-Time","Man-Time","Inc-Time","Talk-Time","Disp-Time","Wait-Time","Call-Time","Prog-Talk-Time","Prog-Disp-Time","Prog-Wait-Time","Prog-Call-Time","Man-Talk-Time","Man-Disp-Time","Man-Wait-Time","Man-Call-Time","Inc-Talk-Time","Inc-Disp-Time","Inc-Wait-Time","Inc-Call-Time"); | ||
| 51 | $reportarray=array(); | ||
| 52 | foreach($alist as $aline) | ||
| 53 | { | ||
| 54 | if(!isset($userarr[$aline->user_id."conn$ci"]))$userarr[$aline->user_id."conn$ci"]=User::find($aline->user_id."conn$ci"); | ||
| 55 | $tuser=$userarr[$aline->user_id."conn$ci"]; | ||
| 56 | /* | ||
| 57 | if(!isset($reportarray[$aline->user_id."conn$ci"]))$reportarray[$aline->user_id."conn$ci"]=array("#"=>$i++,"UserId"=>$aline->user_id."conn$ci","User"=>$tuser->username,"Name"=>$tuser->fullname,"In"=>"","Out"=>"","InOut"=>0,"Sessions"=>0,"Duration"=>0); | ||
| 58 | |||
| 59 | */ | ||
| 60 | if(!isset($reportarray[$aline->user_id."conn$ci"]))$reportarray[$aline->user_id."conn$ci"]=array("#"=>$i++,"UserId"=>$aline->user_id,"User"=>$tuser->username,"Name"=>$tuser->fullname,"In"=>"","Out"=>"","InOut"=>0,"Sessions"=>0,"Duration"=>0,"not-ready"=>0); | ||
| 61 | |||
| 62 | if($reportarray[$aline->user_id."conn$ci"]["In"]=="")$reportarray[$aline->user_id."conn$ci"]["In"]=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 63 | $reportarray[$aline->user_id."conn$ci"]["Out"]=date("Y-m-d H:i:s",strtotime($aline->updated_at)-($dashboarduser->timezone*60)); | ||
| 64 | $reportarray[$aline->user_id."conn$ci"]["InOut"]=strtotime($reportarray[$aline->user_id."conn$ci"]["Out"])-strtotime($reportarray[$aline->user_id."conn$ci"]["In"]); | ||
| 65 | |||
| 66 | // $reportarray[$aline->user_id."conn$ci"]["not-ready"]=12; | ||
| 67 | |||
| 68 | $reportarray[$aline->user_id."conn$ci"]["Sessions"]++; | ||
| 69 | if($aline->durationsec!=0){ | ||
| 70 | $reportarray[$aline->user_id."conn$ci"]["Duration"]=$aline->durationsec; | ||
| 71 | |||
| 72 | $data=json_decode($aline->data,true); | ||
| 73 | foreach($data as $sipid=>$sdata) | ||
| 74 | { | ||
| 75 | $pts=$sdata['ts']; | ||
| 76 | // $reportarray[$aline->user_id."conn$ci"]["Sessions"]++; | ||
| 77 | // $reportarray[$aline->user_id."conn$ci"]["Duration"]+=$aline->durationsec; | ||
| 78 | if(isset($sdata['states'])) | ||
| 79 | { | ||
| 80 | $previous="Login"; | ||
| 81 | $fts=""; | ||
| 82 | $prets=strtotime($aline->startdate." ".$aline->starttime); | ||
| 83 | foreach($sdata['states'] as $ts=>$states) | ||
| 84 | { | ||
| 85 | if($fts!=""){ | ||
| 86 | /*$fts=$ts/1000;*/ | ||
| 87 | if(!in_array($previous,$reporthead))$reporthead[]=$previous; | ||
| 88 | $reportarray[$aline->user_id."conn$ci"][$previous]+=round($ts-$prets,2)/1000; | ||
| 89 | } | ||
| 90 | |||
| 91 | $prets=$ts; | ||
| 92 | $fts=$ts; | ||
| 93 | $previous=$states[0]."-".$states[1]; | ||
| 94 | } | ||
| 95 | //print_r($sdata['states']); | ||
| 96 | if(!in_array($previous,$reporthead))$reporthead[]=$previous; | ||
| 97 | $reportarray[$aline->user_id."conn$ci"][$previous]+=round($pts-$fts,2); | ||
| 98 | } | ||
| 99 | else | ||
| 100 | { | ||
| 101 | // $reportarray[$aline->user_id."conn$ci"]["Login"]+=$aline->durationsec; | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | $startTime=$aline->startdate." ".$aline->starttime; | ||
| 106 | $endTime=$aline->enddate." ".$aline->endtime; | ||
| 107 | |||
| 108 | $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."'")); | ||
| 109 | |||
| 110 | $ts_Wait=0;$ts_Call=0;$ts_Talk=0;$ts_Dispo=0; | ||
| 111 | $progTs_Wait=0;$progTs_Call=0;$progTs_Talk=0;$progTs_Dispo=0; | ||
| 112 | $manTs_Wait=0;$manTs_Call=0;$manTs_Talk=0;$manTs_Dispo=0; | ||
| 113 | $inbTs_Wait=0;$inbTs_Call=0;$inbTs_Talk=0;$inbTs_Dispo=0; | ||
| 114 | $tt_prog=0;$tt_man=0;$tt_inb=0; | ||
| 115 | |||
| 116 | if($crmCalls!=null){ | ||
| 117 | |||
| 118 | foreach($crmCalls as $crmCall){ | ||
| 119 | $ts_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 120 | $ts_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 121 | $ts_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 122 | $ts_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 123 | |||
| 124 | if($crmCall->type == 'Progressive') | ||
| 125 | { | ||
| 126 | $progTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 127 | $progTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 128 | $progTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 129 | $progTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 130 | } | ||
| 131 | |||
| 132 | if($crmCall->type == 'Manual') | ||
| 133 | { | ||
| 134 | $manTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 135 | $manTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 136 | $manTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 137 | $manTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 138 | } | ||
| 139 | |||
| 140 | if($crmCall->type == 'Inbound') | ||
| 141 | { | ||
| 142 | $inbTs_Wait += round(($crmCall->ts_Call - $crmCall->ts_Wait)/1000,2); | ||
| 143 | $inbTs_Call += round(($crmCall->ts_Talk - $crmCall->ts_Call)/1000,2); | ||
| 144 | $inbTs_Talk += round(($crmCall->ts_Dispo - $crmCall->ts_Talk)/1000,2); | ||
| 145 | $inbTs_Dispo += round(($crmCall->ts_Close - $crmCall->ts_Dispo)/1000,2); | ||
| 146 | } | ||
| 147 | |||
| 148 | } | ||
| 149 | } | ||
| 150 | |||
| 151 | $tt_prog = $progTs_Wait + $progTs_Call + $progTs_Talk + $progTs_Dispo; | ||
| 152 | $tt_man = $manTs_Wait + $manTs_Call + $manTs_Talk + $manTs_Dispo; | ||
| 153 | $tt_inb = $inbTs_Wait + $inbTs_Call + $inbTs_Talk + $inbTs_Dispo; | ||
| 154 | |||
| 155 | $prod_TOS = $ts_Wait + $ts_Call + $ts_Talk + $ts_Dispo; | ||
| 156 | |||
| 157 | $reportarray[$aline->user_id."conn$ci"]["Prog-Time"]= $tt_prog; | ||
| 158 | $reportarray[$aline->user_id."conn$ci"]["Man-Time"]= $tt_man; | ||
| 159 | $reportarray[$aline->user_id."conn$ci"]["Inc-Time"]= $tt_inb; | ||
| 160 | |||
| 161 | $reportarray[$aline->user_id."conn$ci"]["Wait-Time"]= $ts_Wait; | ||
| 162 | $reportarray[$aline->user_id."conn$ci"]["Call-Time"]= $ts_Call; | ||
| 163 | $reportarray[$aline->user_id."conn$ci"]["Talk-Time"]= $ts_Talk; | ||
| 164 | $reportarray[$aline->user_id."conn$ci"]["Disp-Time"]= $ts_Dispo; | ||
| 165 | $reportarray[$aline->user_id."conn$ci"]["Prog-Wait-Time"]= $progTs_Wait; | ||
| 166 | $reportarray[$aline->user_id."conn$ci"]["Prog-Call-Time"]= $progTs_Call; | ||
| 167 | $reportarray[$aline->user_id."conn$ci"]["Prog-Talk-Time"]= $progTs_Talk; | ||
| 168 | $reportarray[$aline->user_id."conn$ci"]["Prog-Disp-Time"]= $progTs_Dispo; | ||
| 169 | $reportarray[$aline->user_id."conn$ci"]["Man-Wait-Time"]= $manTs_Wait; | ||
| 170 | $reportarray[$aline->user_id."conn$ci"]["Man-Call-Time"]= $manTs_Call; | ||
| 171 | $reportarray[$aline->user_id."conn$ci"]["Man-Talk-Time"]= $manTs_Talk; | ||
| 172 | $reportarray[$aline->user_id."conn$ci"]["Man-Disp-Time"]= $manTs_Dispo; | ||
| 173 | $reportarray[$aline->user_id."conn$ci"]["Inc-Wait-Time"]= $inbTs_Wait; | ||
| 174 | $reportarray[$aline->user_id."conn$ci"]["Inc-Call-Time"]= $inbTs_Call; | ||
| 175 | $reportarray[$aline->user_id."conn$ci"]["Inc-Talk-Time"]= $inbTs_Talk; | ||
| 176 | $reportarray[$aline->user_id."conn$ci"]["Inc-Disp-Time"]= $inbTs_Dispo; | ||
| 177 | $reportarray[$aline->user_id."conn$ci"]["Prod-TOS"]= $prod_TOS; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | if(Input::has("dllogxls")) | ||
| 182 | { | ||
| 183 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 184 | |||
| 185 | $inputFileType = "Excel5"; | ||
| 186 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 187 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 188 | $baseRow = 3; | ||
| 189 | |||
| 190 | $highestColumn = sizeof($reporthead); | ||
| 191 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 192 | if($head==9){ | ||
| 193 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 194 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", "NotReady"); | ||
| 195 | $colstr=PHPExcel_Cell::stringFromColumnIndex(10); | ||
| 196 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", "ProdTos"); | ||
| 197 | |||
| 198 | |||
| 199 | }else{ | ||
| 200 | if($head<9){ | ||
| 201 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 202 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 203 | }else{ | ||
| 204 | $rom=$head+1; | ||
| 205 | $colstr=PHPExcel_Cell::stringFromColumnIndex($rom); | ||
| 206 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 207 | |||
| 208 | |||
| 209 | } | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | foreach($reportarray as $uid=>$uarr) | ||
| 214 | { | ||
| 215 | $row = $baseRow++; | ||
| 216 | $col = 0; | ||
| 217 | $rom=''; | ||
| 218 | $notreadyn=0; | ||
| 219 | for ($head = 10; $head < $highestColumn; $head++){ | ||
| 220 | //if($head!=12) | ||
| 221 | $notreadyn=$notreadyn+$uarr[$reporthead[$head]]; | ||
| 222 | $rom.=",".$uarr[$reporthead[$head]].","; | ||
| 223 | } | ||
| 224 | $notready=$uarr[$reporthead[8]]-$notreadyn; | ||
| 225 | |||
| 226 | |||
| 227 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 228 | if($head==9){ | ||
| 229 | |||
| 230 | |||
| 231 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 232 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $notready); | ||
| 233 | $prodtos=$uarr[$reporthead[10]]+$uarr[$reporthead[12]]; | ||
| 234 | $colstr=PHPExcel_Cell::stringFromColumnIndex(10); | ||
| 235 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row,$prodtos); | ||
| 236 | |||
| 237 | |||
| 238 | }else{ | ||
| 239 | if($head<9){ $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 240 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 241 | }else{ | ||
| 242 | $rom=$head+1; | ||
| 243 | $colstr=PHPExcel_Cell::stringFromColumnIndex($rom); | ||
| 244 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 245 | |||
| 246 | |||
| 247 | } | ||
| 248 | } | ||
| 249 | } | ||
| 250 | } | ||
| 251 | |||
| 252 | |||
| 253 | header('Content-Type: application/vnd.ms-excel'); | ||
| 254 | header('Content-Disposition: attachment;filename="AgentLog.xls"'); | ||
| 255 | header('Cache-Control: max-age=0'); | ||
| 256 | |||
| 257 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 258 | $objWriter->save('php://output'); | ||
| 259 | |||
| 260 | return ; | ||
| 261 | } | ||
| 262 | |||
| 263 | |||
| 264 | $highestColumn = sizeof($reporthead); | ||
| 265 | $outhead="<tr>";$outstr=""; | ||
| 266 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 267 | /*if($reporthead[$head]=='Login'){ | ||
| 268 | $outhead.="<td> NotReady </td>"; | ||
| 269 | $outhead.="<td> ProdTos </td>"; | ||
| 270 | |||
| 271 | |||
| 272 | }else{*/ | ||
| 273 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 274 | /*}*/ | ||
| 275 | } | ||
| 276 | $outhead.="</tr>"; | ||
| 277 | $prodtos=''; | ||
| 278 | $notreadyn=0; | ||
| 279 | $rom=''; | ||
| 280 | foreach($reportarray as $uid=>$uarr) | ||
| 281 | { | ||
| 282 | $rom=''; | ||
| 283 | $notreadyn=0; | ||
| 284 | for ($head = 10; $head < $highestColumn; $head++){ | ||
| 285 | //if($head!=12) | ||
| 286 | $notreadyn=$notreadyn+$uarr[$reporthead[$head]]; | ||
| 287 | $rom.=",".$uarr[$reporthead[$head]].","; | ||
| 288 | } | ||
| 289 | $notready=$uarr[$reporthead[8]]-$notreadyn; | ||
| 290 | $outstr.="<tr>"; | ||
| 291 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 292 | if($head==9){ | ||
| 293 | |||
| 294 | $outstr.="<td>".gmdate('H:i:s',round($notready))."</td>"; | ||
| 295 | |||
| 296 | // $outstr.="<td>".gmdate('H:i:s',round($uarr[$reporthead[$head]]))."</td>"; | ||
| 297 | $prodtos=$uarr[$reporthead[10]]+$uarr[$reporthead[12]]; | ||
| 298 | $outstr.="<td>".gmdate('H:i:s',round($prodtos))."</td>"; | ||
| 299 | |||
| 300 | }else{ | ||
| 301 | |||
| 302 | if($head>7||$head==6){ | ||
| 303 | //if($head==12){ | ||
| 304 | //$outstr.="<td>".gmdate('H:i:s',$uarr[$reporthead[$head]]).",".$uarr[$reporthead[$head]]."</td>"; | ||
| 305 | |||
| 306 | |||
| 307 | //}else{ | ||
| 308 | |||
| 309 | $outstr.="<td>".gmdate('H:i:s',round($uarr[$reporthead[$head]]))."</td>"; | ||
| 310 | //} | ||
| 311 | }else{ | ||
| 312 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 313 | |||
| 314 | } | ||
| 315 | } | ||
| 316 | } | ||
| 317 | $outstr.="</tr>"; | ||
| 318 | } | ||
| 319 | |||
| 320 | |||
| 321 | |||
| 322 | //charts | ||
| 323 | $cat1=array(); | ||
| 324 | $cat1arr=array(); | ||
| 325 | foreach($reportarray as $uid=>$uarr) | ||
| 326 | { | ||
| 327 | $cat1[]="'$uarr[UserName]'"; | ||
| 328 | |||
| 329 | for ($head = 8; $head < $highestColumn; $head++){ | ||
| 330 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 331 | |||
| 332 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]]/60,1); | ||
| 333 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 337 | $cat1arrstr=""; | ||
| 338 | foreach($cat1arr as $name=>$data) | ||
| 339 | { | ||
| 340 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 341 | $cat1arrstr.=implode(",",$data); | ||
| 342 | $cat1arrstr.="] },\n"; | ||
| 343 | } | ||
| 344 | |||
| 345 | |||
| 346 | $cat2=array(); | ||
| 347 | foreach($reportarray as $uid=>$uarr) | ||
| 348 | { | ||
| 349 | for ($head = 8; $head < $highestColumn; $head++){ | ||
| 350 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]]/60,1); | ||
| 351 | } | ||
| 352 | } | ||
| 353 | ?> | ||
| 354 | |||
| 355 | |||
| 356 | <div class=innerAll> | ||
| 357 | |||
| 358 | |||
| 359 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 360 | <script> | ||
| 361 | $(document).ready(function() | ||
| 362 | { | ||
| 363 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 364 | { | ||
| 365 | $('#dialoglog').dialog({ | ||
| 366 | autoOpen: false, | ||
| 367 | width: '70%', | ||
| 368 | buttons: { | ||
| 369 | "Ok": function() { | ||
| 370 | $(this).dialog("close"); | ||
| 371 | }, | ||
| 372 | "Cancel": function() { | ||
| 373 | $(this).dialog("close"); | ||
| 374 | } | ||
| 375 | } | ||
| 376 | }); | ||
| 377 | } | ||
| 378 | |||
| 379 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 380 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 381 | }); | ||
| 382 | </script> | ||
| 383 | <div style="float:left;width:50%"> | ||
| 384 | |||
| 385 | Search <input id=filter name="filter" type="text"> | ||
| 386 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='agentLogReloadFun("");' /> | ||
| 387 | |||
| 388 | </div> | ||
| 389 | <div style="float:left;width:50%"> | ||
| 390 | |||
| 391 | |||
| 392 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 393 | |||
| 394 | </div> | ||
| 395 | <div style="clear:both"></div> | ||
| 396 | <hr> | ||
| 397 | |||
| 398 | <div class=col-md-12> | ||
| 399 | |||
| 400 | |||
| 401 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 402 | <script> | ||
| 403 | $(function () { | ||
| 404 | $('#userlogschart1').highcharts({ | ||
| 405 | chart: { | ||
| 406 | type: 'column' | ||
| 407 | }, | ||
| 408 | title: { | ||
| 409 | text: '' | ||
| 410 | }, | ||
| 411 | xAxis: { | ||
| 412 | labels:{ | ||
| 413 | enabled:false//default is true | ||
| 414 | }, | ||
| 415 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 416 | }, | ||
| 417 | yAxis: { | ||
| 418 | min: 0, | ||
| 419 | title: { | ||
| 420 | text: '' | ||
| 421 | }, | ||
| 422 | stackLabels: { | ||
| 423 | enabled: false, | ||
| 424 | // style: { | ||
| 425 | // fontWeight: '', | ||
| 426 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 427 | // } | ||
| 428 | } | ||
| 429 | }, | ||
| 430 | // legend: { | ||
| 431 | // align: 'right', | ||
| 432 | // x: -30, | ||
| 433 | // verticalAlign: 'top', | ||
| 434 | // y: 25, | ||
| 435 | // floating: true, | ||
| 436 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 437 | // borderColor: '#CCC', | ||
| 438 | // borderWidth: 1, | ||
| 439 | // shadow: false | ||
| 440 | // }, | ||
| 441 | tooltip: { | ||
| 442 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 443 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 444 | }, | ||
| 445 | plotOptions: { | ||
| 446 | column: { | ||
| 447 | stacking: 'normal', | ||
| 448 | dataLabels: { | ||
| 449 | enabled: false, | ||
| 450 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 451 | // style: { | ||
| 452 | // textShadow: '0 0 3px black' | ||
| 453 | // } | ||
| 454 | } | ||
| 455 | } | ||
| 456 | }, | ||
| 457 | series: [<?php echo $cat1arrstr; ?>] | ||
| 458 | }); | ||
| 459 | }); | ||
| 460 | |||
| 461 | |||
| 462 | |||
| 463 | |||
| 464 | function agentLogReloadFun(sortby) | ||
| 465 | { | ||
| 466 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 467 | |||
| 468 | doAjax('dialer/agentreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 469 | } | ||
| 470 | function dlAgentlogXls() | ||
| 471 | { | ||
| 472 | window.open('dialer/agentreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 473 | } | ||
| 474 | </script> | ||
| 475 | |||
| 476 | </div> | ||
| 477 | |||
| 478 | <div style='clear:both'></div> | ||
| 479 | |||
| 480 | <div class=col-md-12> | ||
| 481 | |||
| 482 | |||
| 483 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 484 | <script> | ||
| 485 | $(function () { | ||
| 486 | $('#userlogschart2').highcharts({ | ||
| 487 | chart: { | ||
| 488 | type: 'column' | ||
| 489 | }, | ||
| 490 | title: { | ||
| 491 | text: '' | ||
| 492 | }, | ||
| 493 | subtitle: { | ||
| 494 | text: '' | ||
| 495 | }, | ||
| 496 | xAxis: { | ||
| 497 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 498 | crosshair: true | ||
| 499 | }, | ||
| 500 | yAxis: { | ||
| 501 | min: 0, | ||
| 502 | title: { | ||
| 503 | text: '' | ||
| 504 | } | ||
| 505 | }, | ||
| 506 | tooltip: { | ||
| 507 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 508 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 509 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 510 | footerFormat: '</table>', | ||
| 511 | shared: true, | ||
| 512 | useHTML: true | ||
| 513 | }, | ||
| 514 | plotOptions: { | ||
| 515 | column: { | ||
| 516 | pointPadding: 0.2, | ||
| 517 | borderWidth: 0 | ||
| 518 | } | ||
| 519 | }, | ||
| 520 | legend : { | ||
| 521 | floating: true, | ||
| 522 | align: 'right', | ||
| 523 | x: -30, | ||
| 524 | verticalAlign: 'top', | ||
| 525 | }, | ||
| 526 | series: [{ | ||
| 527 | name: 'Mins', | ||
| 528 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 529 | |||
| 530 | },] | ||
| 531 | }); | ||
| 532 | }); | ||
| 533 | |||
| 534 | </script> | ||
| 535 | |||
| 536 | </div> | ||
| 537 | |||
| 538 | |||
| 539 | |||
| 540 | <div style='clear:both'></div> | ||
| 541 | |||
| 542 | <div style='overflow:auto'> | ||
| 543 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 544 | <thead> | ||
| 545 | <?php echo $outhead; ?> | ||
| 546 | </thead> | ||
| 547 | <?php echo $outstr; ?> | ||
| 548 | </table> | ||
| 549 | </div> | ||
| 550 | |||
| 551 | <div id=dialoglog></div> | ||
| 552 | |||
| 553 | |||
| 554 | |||
| 555 | |||
| 556 | |||
| 557 | </div> |
| 1 | |||
| 2 | <?php | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\CRMCallArchive; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Models\UserLog; | ||
| 7 | use App\Jobs\KHRMSLib; | ||
| 8 | |||
| 9 | $wakka = new KHRMSLib(); | ||
| 10 | $dashboarduser=Auth::user(); | ||
| 11 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 12 | $timeoffset = $timeoffset*60; | ||
| 13 | |||
| 14 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9; | ||
| 15 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20; | ||
| 16 | |||
| 17 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") | ||
| 18 | : strtotime(date("Y-m-d")." 09:00:00"); | ||
| 19 | $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00") | ||
| 20 | : strtotime(date("Y-m-d")." 20:00:00"); | ||
| 21 | $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All"; | ||
| 22 | |||
| 23 | // testing input | ||
| 24 | //$logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-26 ".$logtime.":00:00");$logdateto = strtotime("2017-10-26 ".$logtimeto.":00:00");$campaign = 'All'; | ||
| 25 | // testing input | ||
| 26 | |||
| 27 | $alist=CRMCallArchive::where('user_id','!=',0)->where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 28 | $alist->orderBy('user_id', 'ASC')->orderBy('ts_Close', 'ASC'); | ||
| 29 | |||
| 30 | $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)); | ||
| 31 | |||
| 32 | if($campaign != 'All') $alist->where('client','=',$campaign); | ||
| 33 | |||
| 34 | $userarr=array(); | ||
| 35 | $allusers = DB::table('users as u1')->leftjoin('users AS u2', 'u2.username', '=', 'u1.supervisor') | ||
| 36 | ->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor') | ||
| 37 | ->where('u1.status','=','Active'); | ||
| 38 | |||
| 39 | $roclientstr=array();$didlinesstr=array(); | ||
| 40 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 41 | $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst); $oclientlst[0] = 'All'; | ||
| 42 | |||
| 43 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 44 | { | ||
| 45 | $roclientstr[]="$tclnt"; | ||
| 46 | |||
| 47 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 48 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 49 | } | ||
| 50 | |||
| 51 | $breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime"); | ||
| 52 | |||
| 53 | $reporthead=array_merge(array("#","RM","RM Code","Team Manager","Sessions","CallCount","TOS","Net Total","Wait","Call","Talk","Dispo","ProgressiveTotal","P-Call","P-Talk","P-Dispo","ManualTotal","M-Call","M-Talk","M-Dispo","IncomingTotal","I-Call","I-Talk","I-Dispo","PausedTotal"),$breaks); | ||
| 54 | $reportarray=array(); | ||
| 55 | |||
| 56 | $i=1; | ||
| 57 | if($dashboarduser->usertype != 'Admin') | ||
| 58 | { | ||
| 59 | $uidlist=array($dashboarduser->id); | ||
| 60 | $allusers=$allusers->where(function ($query) use($dashboarduser) { | ||
| 61 | $query->where('u1.supervisor','=',$dashboarduser->username) | ||
| 62 | ->orWhere('u1.lteam2','=',$dashboarduser->username) | ||
| 63 | ->orWhere('u1.lteam','=',$dashboarduser->username); | ||
| 64 | })->get(); | ||
| 65 | |||
| 66 | foreach($allusers as $tuser) | ||
| 67 | { | ||
| 68 | $uidlist[]=$tuser->id; | ||
| 69 | |||
| 70 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | $reportarray[$dashboarduser->id]=array("#"=>$i++,"RM"=>$dashboarduser->fullname,"RM Code"=>$dashboarduser->username,"Team Manager"=>$dashboarduser->supervisor); | ||
| 75 | $alist=$alist->whereIn('user_id',$uidlist); | ||
| 76 | |||
| 77 | /*$alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 78 | $query->orWhereIn('client',$roclientstr) | ||
| 79 | ->orWhereIn('did',$didlinesstr); | ||
| 80 | });*/ | ||
| 81 | |||
| 82 | $userlog=$userlog->whereIn('user_id',$uidlist); | ||
| 83 | }else{ | ||
| 84 | $allusers=$allusers->get(); | ||
| 85 | foreach($allusers as $tuser) | ||
| 86 | { | ||
| 87 | |||
| 88 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | // echo "<pre>"; print_r($allusers);exit; | ||
| 93 | |||
| 94 | $alist=$alist->get(); | ||
| 95 | $userlog=$userlog->get(); | ||
| 96 | $prev_close = 0; | ||
| 97 | |||
| 98 | // echo count($userlog);exit; | ||
| 99 | |||
| 100 | foreach($alist as $aline) | ||
| 101 | { | ||
| 102 | if($prev_user != $aline->user_id || $prev_close <= $aline->ts_Wait) | ||
| 103 | { | ||
| 104 | $userid=$aline->user_id; | ||
| 105 | |||
| 106 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 107 | $totaltime=$aline->callSec+$talktime+$aline->dispoSec; | ||
| 108 | |||
| 109 | $reportarray[$userid]["oncall"]+=$totaltime/1000; | ||
| 110 | // $reportarray[$userid]["Wait"]+=$aline->waitSec/1000; | ||
| 111 | $reportarray[$userid]["Call"]+=$aline->callSec/1000; | ||
| 112 | $reportarray[$userid]["Talk"]+=$talktime/1000; | ||
| 113 | $reportarray[$userid]["Dispo"]+=$aline->dispoSec/1000; | ||
| 114 | |||
| 115 | if($aline->type == 'Progressive') | ||
| 116 | { | ||
| 117 | $reportarray[$userid]["P-Call"]+=$aline->callSec/1000; | ||
| 118 | $reportarray[$userid]["P-Talk"]+=$talktime/1000; | ||
| 119 | $reportarray[$userid]["P-Dispo"]+=$aline->dispoSec/1000; | ||
| 120 | $reportarray[$userid]["ProgressiveTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 121 | } | ||
| 122 | |||
| 123 | if($aline->type == 'Manual') | ||
| 124 | { | ||
| 125 | $reportarray[$userid]["M-Call"]+=$aline->callSec/1000; | ||
| 126 | $reportarray[$userid]["M-Talk"]+=$talktime/1000; | ||
| 127 | $reportarray[$userid]["M-Dispo"]+=$aline->dispoSec/1000; | ||
| 128 | $reportarray[$userid]["ManualTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 129 | } | ||
| 130 | |||
| 131 | if($aline->type == 'Inbound') | ||
| 132 | { | ||
| 133 | $reportarray[$userid]["I-Call"]+=$aline->callSec/1000; | ||
| 134 | $reportarray[$userid]["I-Talk"]+=$talktime/1000; | ||
| 135 | $reportarray[$userid]["I-Dispo"]+=$aline->dispoSec/1000; | ||
| 136 | $reportarray[$userid]["IncomingTotal"]+=($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | $reportarray[$userid]["CallCount"]++; | ||
| 140 | $prev_close = $aline->ts_Close;//-ts_Wait | ||
| 141 | $prev_user = $aline->user_id;//-ts_Wait | ||
| 142 | } | ||
| 143 | |||
| 144 | function cmp($a, $b) { | ||
| 145 | return $a["ts"] - $b["ts"]; | ||
| 146 | } | ||
| 147 | $userLogin=array(); | ||
| 148 | foreach($userlog as $ulog) | ||
| 149 | { | ||
| 150 | $data=json_decode($ulog->data,true); | ||
| 151 | usort($data, "cmp"); | ||
| 152 | |||
| 153 | $lastSip = end($data); | ||
| 154 | $starttime = strtotime($ulog->startdate.' '.$ulog->starttime); | ||
| 155 | //echo "starttime:".$starttime; | ||
| 156 | $endtime = round($lastSip['ts']/1000); | ||
| 157 | //console.log($endtime); | ||
| 158 | //echo "End time:".$endtime; | ||
| 159 | $userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime); | ||
| 160 | //echo "Userlog:".$userLogin[$ulog->user_id]['duration']; | ||
| 161 | $userLogin[$ulog->user_id]['start'][] = $starttime; | ||
| 162 | $userLogin[$ulog->user_id]['end'][] = $endtime; | ||
| 163 | |||
| 164 | $prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000; | ||
| 165 | $previous="Paused-Paused"; | ||
| 166 | foreach($data as $sdata) | ||
| 167 | { | ||
| 168 | $pts=$sdata['ts']; | ||
| 169 | if(isset($sdata['states'])) | ||
| 170 | { | ||
| 171 | foreach($sdata['states'] as $ts=>$states) | ||
| 172 | { | ||
| 173 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 174 | |||
| 175 | if(!in_array($previous,$reporthead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-','Paused-WRAPUP'))) { | ||
| 176 | $previous = 'Paused'; | ||
| 177 | } | ||
| 178 | |||
| 179 | $reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000; | ||
| 180 | |||
| 181 | $prets=$ts; | ||
| 182 | $previous=$states[0].'-'.$states[1]; | ||
| 183 | } | ||
| 184 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 185 | $reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000; | ||
| 186 | $prets=$pts; | ||
| 187 | } | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | if(count($userLogin)) foreach ($userLogin as $userid => $value) | ||
| 192 | { | ||
| 193 | $break_time=0; | ||
| 194 | foreach ($breaks as $break) { | ||
| 195 | $break_time+=$reportarray[$userid][$break]; | ||
| 196 | $reportarray[$userid]["PausedTotal"]+=$reportarray[$userid][$break]; | ||
| 197 | } | ||
| 198 | $sessionsStr = ""; | ||
| 199 | for($i = 0; $i < count($value['start']); $i++){ | ||
| 200 | if($sessionsStr == ""){ | ||
| 201 | $sessionsStr .= date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 202 | }else{ | ||
| 203 | $sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 204 | } | ||
| 205 | } | ||
| 206 | $reportarray[$userid]["Sessions"]=$sessionsStr; | ||
| 207 | // $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset); | ||
| 208 | // $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset); | ||
| 209 | $reportarray[$userid]["TOS"]=$value['duration']; | ||
| 210 | $reportarray[$userid]["Net Total"]=$value['duration']-$break_time; | ||
| 211 | $reportarray[$userid]["Wait"]=$reportarray[$userid]["Net Total"]-$reportarray[$userid]['oncall']; | ||
| 212 | if($reportarray[$userid]["Wait"] < 0){ | ||
| 213 | $reportarray[$userid]["Net Total"] += abs($reportarray[$userid]["Wait"]); | ||
| 214 | $reportarray[$userid]["TOS"] += abs($reportarray[$userid]["Wait"]); | ||
| 215 | $reportarray[$userid]["Wait"] = 0; | ||
| 216 | } | ||
| 217 | } | ||
| 218 | |||
| 219 | $highestColumn = sizeof($reporthead); | ||
| 220 | if(count($reportarray)) { | ||
| 221 | $outhead="<tr>";$outstr=""; | ||
| 222 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 223 | if($reporthead[$head] == "Sessions"){ | ||
| 224 | $outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>"; | ||
| 225 | }elseif($reporthead[$head] == "PausedTotal" || $reporthead[$head] == "ProgressiveTotal" || $reporthead[$head] == "ManualTotal" || $reporthead[$head] == "IncomingTotal"){ | ||
| 226 | $outhead.="<td class='warning'>".$reporthead[$head]."</td>"; | ||
| 227 | }elseif($reporthead[$head] == "Paused"){ | ||
| 228 | $outhead.="<td>ManualPaused</td>"; | ||
| 229 | }else{ | ||
| 230 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | $outhead.="</tr>"; | ||
| 234 | $utotalarr = array("RM"=>'Net Total'); | ||
| 235 | |||
| 236 | $reportRowNo = 1; | ||
| 237 | foreach($reportarray as $uid=>$uarr) | ||
| 238 | { | ||
| 239 | if(array_key_exists('TOS',$uarr) && array_key_exists('RM Code',$uarr)) | ||
| 240 | { | ||
| 241 | $outstr.="<tr>"; | ||
| 242 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 243 | if($head < 1){ | ||
| 244 | $data_str = $reportRowNo; $reportRowNo++; | ||
| 245 | }elseif($head < 5) { | ||
| 246 | // if($head < 6) { | ||
| 247 | $data_str = $uarr[$reporthead[$head]]; | ||
| 248 | } | ||
| 249 | elseif($head < 6) { | ||
| 250 | $data_str = $uarr[$reporthead[$head]]; | ||
| 251 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 252 | } | ||
| 253 | else { | ||
| 254 | $data_str = secToDuration(round($uarr[$reporthead[$head]])); | ||
| 255 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 256 | } | ||
| 257 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 258 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 259 | }else{ | ||
| 260 | $outstr.="<td>".$data_str."</td>"; | ||
| 261 | } | ||
| 262 | } | ||
| 263 | $outstr.="</tr>"; | ||
| 264 | } | ||
| 265 | } | ||
| 266 | $outstr.="<tr>"; | ||
| 267 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 268 | { | ||
| 269 | if($head < 6) { | ||
| 270 | $data_str = $utotalarr[$reporthead[$head]]; | ||
| 271 | } | ||
| 272 | else { | ||
| 273 | $data_str = secToDuration($utotalarr[$reporthead[$head]]); | ||
| 274 | } | ||
| 275 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 276 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 277 | }else{ | ||
| 278 | $outstr.="<td>".$data_str."</td>"; | ||
| 279 | } | ||
| 280 | } | ||
| 281 | $outstr.="</tr>"; | ||
| 282 | } else { | ||
| 283 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 284 | } | ||
| 285 | |||
| 286 | if(Input::has("dllogxls")) | ||
| 287 | { | ||
| 288 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 289 | |||
| 290 | $inputFileType = "Excel5"; | ||
| 291 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 292 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 293 | $baseRow = 2; | ||
| 294 | |||
| 295 | |||
| 296 | $highestColumn = sizeof($reporthead); | ||
| 297 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 298 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 299 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 300 | } | ||
| 301 | foreach($reportarray as $uid=>$uarr) | ||
| 302 | { | ||
| 303 | if(array_key_exists('TOS',$uarr) && array_key_exists('RM Code',$uarr)) | ||
| 304 | { | ||
| 305 | $row = $baseRow++; | ||
| 306 | $col = 0; | ||
| 307 | |||
| 308 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 309 | $excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]])); | ||
| 310 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 311 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 312 | } | ||
| 313 | $row++; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | |||
| 317 | //$row++; | ||
| 318 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 319 | $excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]])); | ||
| 320 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 321 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 322 | } | ||
| 323 | |||
| 324 | header('Content-Type: application/vnd.ms-excel'); | ||
| 325 | header('Content-Disposition: attachment;filename="AgentTime.xls"'); | ||
| 326 | header('Cache-Control: max-age=0'); | ||
| 327 | |||
| 328 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 329 | $objWriter->save('php://output'); | ||
| 330 | |||
| 331 | return ; | ||
| 332 | } | ||
| 333 | |||
| 334 | function secToDuration($sec) { | ||
| 335 | return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60); | ||
| 336 | } | ||
| 337 | ?> | ||
| 338 | |||
| 339 | <style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;} | ||
| 340 | /*#logtable.table thead tr{ | ||
| 341 | display:block; | ||
| 342 | } | ||
| 343 | |||
| 344 | #logtable.table tbody{ | ||
| 345 | display:block; | ||
| 346 | height:500px; | ||
| 347 | overflow:auto;//set tbody to auto | ||
| 348 | }*/ | ||
| 349 | </style> | ||
| 350 | |||
| 351 | <div class=innerAll> | ||
| 352 | <h4 style="float:left;width:50%;margin:10px 0;">Login Report <small>(Agent Time Report)</small></h4> | ||
| 353 | <div style="float:right;width:50%"> | ||
| 354 | <?php if(Auth::user()->username=='admin'){ ?> | ||
| 355 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button> | ||
| 356 | <?php } ?> | ||
| 357 | </div> | ||
| 358 | <div style="clear:both"></div> | ||
| 359 | <hr style="margin-bottom: 5px;"> | ||
| 360 | <div> | ||
| 361 | Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;"> | ||
| 362 | Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 363 | <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 364 | <?php | ||
| 365 | foreach (range(0,23) as $hour) { | ||
| 366 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 367 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 368 | } | ||
| 369 | ?> | ||
| 370 | </select> | ||
| 371 | To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' /> | ||
| 372 | <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 373 | <?php | ||
| 374 | foreach (range(0,23) as $hour) { | ||
| 375 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 376 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 377 | } | ||
| 378 | ?></select> | ||
| 379 | Campaign | ||
| 380 | <select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 381 | <?php foreach($oclientlst as $c){$s="";if($c==$campaign)$s='selected';echo "<option value='$c' $s>$c</option>";} ?> | ||
| 382 | </select> | ||
| 383 | </div> | ||
| 384 | |||
| 385 | <div style="clear:both"></div> | ||
| 386 | <hr style="margin:5px;"> | ||
| 387 | |||
| 388 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 389 | <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;'> | ||
| 390 | <thead><?php echo $outhead; ?></thead> | ||
| 391 | <tbody id="logTableData"><?php echo $outstr; ?></tbody> | ||
| 392 | </table> | ||
| 393 | </div> | ||
| 394 | |||
| 395 | <div id=dialoglog></div> | ||
| 396 | </div> | ||
| 397 | |||
| 398 | <script> | ||
| 399 | $(document).ready(function() { | ||
| 400 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 401 | { | ||
| 402 | $('#dialoglog').dialog({ | ||
| 403 | autoOpen: false, | ||
| 404 | width: '70%', | ||
| 405 | buttons: { | ||
| 406 | "Ok": function() { | ||
| 407 | $(this).dialog("close"); | ||
| 408 | }, | ||
| 409 | "Cancel": function() { | ||
| 410 | $(this).dialog("close"); | ||
| 411 | } | ||
| 412 | } | ||
| 413 | }); | ||
| 414 | } | ||
| 415 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logTableData') },"2000"); | ||
| 416 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 417 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 418 | }); | ||
| 419 | |||
| 420 | function dataString() | ||
| 421 | { | ||
| 422 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val(); | ||
| 423 | } | ||
| 424 | function statusLogReloadFun(sortby) | ||
| 425 | { | ||
| 426 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 427 | var searchStr = dataString(); | ||
| 428 | doAjax('dialer/agenttime?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 429 | } | ||
| 430 | function dlAgentlogXls() | ||
| 431 | { | ||
| 432 | var searchStr = dataString(); | ||
| 433 | window.open('dialer/agenttime?dllogxls=1&'+searchStr); | ||
| 434 | return false; | ||
| 435 | } | ||
| 436 | </script> |
| 1 | |||
| 2 | <?php | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\CRMCallArchive; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Models\UserLog; | ||
| 7 | use App\Jobs\KHRMSLib; | ||
| 8 | |||
| 9 | $wakka = new KHRMSLib(); | ||
| 10 | $dashboarduser=Auth::user(); | ||
| 11 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 12 | $timeoffset = $timeoffset*60; | ||
| 13 | |||
| 14 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9; | ||
| 15 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20; | ||
| 16 | |||
| 17 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") | ||
| 18 | : strtotime(date("Y-m-d")." 09:00:00"); | ||
| 19 | $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00") | ||
| 20 | : strtotime(date("Y-m-d")." 20:00:00"); | ||
| 21 | $campaign =(isset($_GET['campaign'])) ? $_GET['campaign'] : "All"; | ||
| 22 | |||
| 23 | |||
| 24 | // testing input | ||
| 25 | //$logtime = 9;$logtimeto = 20;$logdate = strtotime("2017-10-26 ".$logtime.":00:00");$logdateto = strtotime("2017-10-26 ".$logtimeto.":00:00");$campaign = 'All'; | ||
| 26 | // testing input | ||
| 27 | |||
| 28 | $alist=CRMCallArchive::where('user_id','!=',0)->where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 29 | $alist->orderBy('user_id', 'ASC')->orderBy('ts_Close', 'ASC'); | ||
| 30 | |||
| 31 | $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)); | ||
| 32 | |||
| 33 | if($campaign != 'All') $alist->where('client','=',$campaign); | ||
| 34 | |||
| 35 | $userarr=array(); | ||
| 36 | $allusers = DB::table('users as u1')->leftjoin('users AS u2', 'u2.username', '=', 'u1.supervisor') | ||
| 37 | ->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor') | ||
| 38 | ->where('u1.status','=','Active'); | ||
| 39 | |||
| 40 | $roclientstr=array();$didlinesstr=array(); | ||
| 41 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 42 | $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst); $oclientlst[0] = 'All'; | ||
| 43 | |||
| 44 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 45 | { | ||
| 46 | $roclientstr[]="$tclnt"; | ||
| 47 | |||
| 48 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 49 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 50 | } | ||
| 51 | |||
| 52 | $breaks=array("Paused","AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime"); | ||
| 53 | |||
| 54 | $reporthead=array_merge(array("#","RM","RM Code","Team Manager","Sessions","CallCount","TOS","Net Total","Wait","Call","Talk","Dispo","ProgressiveTotal","P-Call","P-Talk","P-Dispo","ManualTotal","M-Call","M-Talk","M-Dispo","IncomingTotal","I-Call","I-Talk","I-Dispo","PausedTotal"),$breaks); | ||
| 55 | $reportarray=array(); | ||
| 56 | |||
| 57 | $i=1; | ||
| 58 | if($dashboarduser->usertype != 'Admin') | ||
| 59 | { | ||
| 60 | $uidlist=array($dashboarduser->id); | ||
| 61 | $allusers=$allusers->where(function ($query) use($dashboarduser) { | ||
| 62 | $query->where('u1.supervisor','=',$dashboarduser->username) | ||
| 63 | ->orWhere('u1.lteam2','=',$dashboarduser->username) | ||
| 64 | ->orWhere('u1.lteam','=',$dashboarduser->username); | ||
| 65 | })->get(); | ||
| 66 | |||
| 67 | foreach($allusers as $tuser) | ||
| 68 | { | ||
| 69 | $uidlist[]=$tuser->id; | ||
| 70 | |||
| 71 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | $reportarray[$dashboarduser->id]=array("#"=>$i++,"RM"=>$dashboarduser->fullname,"RM Code"=>$dashboarduser->username,"Team Manager"=>$dashboarduser->supervisor); | ||
| 76 | $alist=$alist->whereIn('user_id',$uidlist); | ||
| 77 | |||
| 78 | /*$alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 79 | $query->orWhereIn('client',$roclientstr) | ||
| 80 | ->orWhereIn('did',$didlinesstr); | ||
| 81 | });*/ | ||
| 82 | |||
| 83 | $userlog=$userlog->whereIn('user_id',$uidlist); | ||
| 84 | }else{ | ||
| 85 | $allusers=$allusers->get(); | ||
| 86 | foreach($allusers as $tuser) | ||
| 87 | { | ||
| 88 | |||
| 89 | $reportarray[$tuser->id]=array("#"=>$i++,"RM"=>$tuser->telecaller,"RM Code"=>$tuser->username,"Team Manager"=>$tuser->sepervisor); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | // echo "<pre>"; print_r($allusers);exit; | ||
| 94 | |||
| 95 | $alist=$alist->get(); | ||
| 96 | $userlog=$userlog->get(); | ||
| 97 | $prev_close = 0; | ||
| 98 | |||
| 99 | // echo count($userlog);exit; | ||
| 100 | $userLogin=array(); | ||
| 101 | $startdatearry=array(); | ||
| 102 | foreach ($userlog as $ulogstartdate) { | ||
| 103 | array_push($startdatearry,$ulogstartdate->startdate); | ||
| 104 | } | ||
| 105 | $countlogindays=count(array_unique($startdatearry)); | ||
| 106 | foreach($userlog as $ulog) | ||
| 107 | { | ||
| 108 | $data=json_decode($ulog->data,true); | ||
| 109 | usort($data, "cmp"); | ||
| 110 | |||
| 111 | $lastSip = end($data); | ||
| 112 | $starttime = strtotime($ulog->startdate.' '.$ulog->starttime); | ||
| 113 | |||
| 114 | $endtime = round($lastSip['ts']/1000); | ||
| 115 | $userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime); | ||
| 116 | $userLogin[$ulog->user_id]['start'][] = $starttime; | ||
| 117 | $userLogin[$ulog->user_id]['end'][] = $endtime; | ||
| 118 | |||
| 119 | $prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000; | ||
| 120 | $previous="Paused-Paused"; | ||
| 121 | foreach($data as $sdata) | ||
| 122 | { | ||
| 123 | $pts=$sdata['ts']; | ||
| 124 | if(isset($sdata['states'])) | ||
| 125 | { | ||
| 126 | foreach($sdata['states'] as $ts=>$states) | ||
| 127 | { | ||
| 128 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 129 | |||
| 130 | if(!in_array($previous,$reporthead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-','Paused-WRAPUP'))) { | ||
| 131 | $previous = 'Paused'; | ||
| 132 | } | ||
| 133 | |||
| 134 | $reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000; | ||
| 135 | |||
| 136 | $prets=$ts; | ||
| 137 | $previous=$states[0].'-'.$states[1]; | ||
| 138 | } | ||
| 139 | if($previous != "Paused-WRAPUP")$previous = str_replace('Paused-', '', $previous); | ||
| 140 | $reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000; | ||
| 141 | $prets=$pts; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | } | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | foreach($alist as $aline) | ||
| 149 | { | ||
| 150 | if($prev_user != $aline->user_id || $prev_close <= $aline->ts_Wait) | ||
| 151 | { | ||
| 152 | $userid=$aline->user_id; | ||
| 153 | |||
| 154 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 155 | $totaltime=$aline->callSec+$talktime+$aline->dispoSec; | ||
| 156 | |||
| 157 | $reportarray[$userid]["oncall"]+=($totaltime/1000)/$countlogindays; | ||
| 158 | // $reportarray[$userid]["Wait"]+=$aline->waitSec/1000; | ||
| 159 | $reportarray[$userid]["Call"]+=($aline->callSec/1000)/$countlogindays; | ||
| 160 | $reportarray[$userid]["Talk"]+=($talktime/1000)/$countlogindays; | ||
| 161 | $reportarray[$userid]["Dispo"]+=($aline->dispoSec/1000)/$countlogindays; | ||
| 162 | |||
| 163 | if($aline->type == 'Progressive') | ||
| 164 | { | ||
| 165 | $reportarray[$userid]["P-Call"]+=($aline->callSec/1000)/$countlogindays; | ||
| 166 | $reportarray[$userid]["P-Talk"]+=($talktime/1000)/$countlogindays; | ||
| 167 | $reportarray[$userid]["P-Dispo"]+=($aline->dispoSec/1000)/$countlogindays; | ||
| 168 | $reportarray[$userid]["ProgressiveTotal"]+=(($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000))/$countlogindays; | ||
| 169 | } | ||
| 170 | |||
| 171 | if($aline->type == 'Manual') | ||
| 172 | { | ||
| 173 | $reportarray[$userid]["M-Call"]+=($aline->callSec/1000)/$countlogindays; | ||
| 174 | $reportarray[$userid]["M-Talk"]+=($talktime/1000)/$countlogindays; | ||
| 175 | $reportarray[$userid]["M-Dispo"]+=($aline->dispoSec/1000)/$countlogindays; | ||
| 176 | $reportarray[$userid]["ManualTotal"]+=(($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000))/$countlogindays; | ||
| 177 | } | ||
| 178 | |||
| 179 | if($aline->type == 'Inbound') | ||
| 180 | { | ||
| 181 | $reportarray[$userid]["I-Call"]+=($aline->callSec/1000)/$countlogindays; | ||
| 182 | $reportarray[$userid]["I-Talk"]+=($talktime/1000)/$countlogindays; | ||
| 183 | $reportarray[$userid]["I-Dispo"]+=($aline->dispoSec/1000)/$countlogindays; | ||
| 184 | $reportarray[$userid]["IncomingTotal"]+=(($aline->callSec/1000)+($talktime/1000)+($aline->dispoSec/1000))/$countlogindays; | ||
| 185 | } | ||
| 186 | } | ||
| 187 | $reportarray[$userid]["CallCount"]++; | ||
| 188 | $prev_close = $aline->ts_Close;//-ts_Wait | ||
| 189 | $prev_user = $aline->user_id;//-ts_Wait | ||
| 190 | } | ||
| 191 | |||
| 192 | function cmp($a, $b) { | ||
| 193 | return $a["ts"] - $b["ts"]; | ||
| 194 | } | ||
| 195 | |||
| 196 | |||
| 197 | if(count($userLogin)) foreach ($userLogin as $userid => $value) | ||
| 198 | { | ||
| 199 | $break_time=0; | ||
| 200 | foreach ($breaks as $break) { | ||
| 201 | $break_time+=$reportarray[$userid][$break]; | ||
| 202 | $reportarray[$userid]["PausedTotal"]+=$reportarray[$userid][$break]; | ||
| 203 | } | ||
| 204 | $sessionsStr = ""; | ||
| 205 | for($i = 0; $i < count($value['start']); $i++){ | ||
| 206 | if($sessionsStr == ""){ | ||
| 207 | $sessionsStr .= date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 208 | }else{ | ||
| 209 | $sessionsStr .= ",\n".date("Y-m-d H:i:s", $value['start'][$i]-$timeoffset)." - ".date("Y-m-d H:i:s", $value['end'][$i]-$timeoffset); | ||
| 210 | } | ||
| 211 | } | ||
| 212 | $reportarray[$userid]["Sessions"]=$sessionsStr; | ||
| 213 | // $reportarray[$userid]["Signin"]=date("Y-m-d H:i:s", min($value['start'])-$timeoffset); | ||
| 214 | // $reportarray[$userid]["Signout"]=date("Y-m-d H:i:s", max($value['end'])-$timeoffset); | ||
| 215 | $reportarray[$userid]["TOS"]=$value['duration']/$countlogindays; | ||
| 216 | $reportarray[$userid]["Net Total"]=($value['duration']-$break_time)/$countlogindays; | ||
| 217 | $reportarray[$userid]["Wait"]=($reportarray[$userid]["Net Total"]-$reportarray[$userid]['oncall']); | ||
| 218 | if($reportarray[$userid]["Wait"] < 0){ | ||
| 219 | $reportarray[$userid]["Net Total"] += abs($reportarray[$userid]["Wait"]); | ||
| 220 | $reportarray[$userid]["TOS"] += abs($reportarray[$userid]["Wait"]); | ||
| 221 | $reportarray[$userid]["Wait"] = 0; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | $highestColumn = sizeof($reporthead); | ||
| 226 | if(count($reportarray)) { | ||
| 227 | $outhead="<tr>";$outstr=""; | ||
| 228 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 229 | if($reporthead[$head] == "Sessions"){ | ||
| 230 | $outhead.="<td style='width:270px;display:block;'>".$reporthead[$head]."</td>"; | ||
| 231 | }elseif($reporthead[$head] == "PausedTotal" || $reporthead[$head] == "ProgressiveTotal" || $reporthead[$head] == "ManualTotal" || $reporthead[$head] == "IncomingTotal"){ | ||
| 232 | $outhead.="<td class='warning'>".$reporthead[$head]."</td>"; | ||
| 233 | }elseif($reporthead[$head] == "Paused"){ | ||
| 234 | $outhead.="<td>ManualPaused</td>"; | ||
| 235 | }else{ | ||
| 236 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 237 | } | ||
| 238 | } | ||
| 239 | $outhead.="</tr>"; | ||
| 240 | $utotalarr = array("RM"=>'Net Total'); | ||
| 241 | |||
| 242 | $reportRowNo = 1; | ||
| 243 | foreach($reportarray as $uid=>$uarr) | ||
| 244 | { | ||
| 245 | if(array_key_exists('TOS',$uarr) && array_key_exists('RM Code',$uarr)) | ||
| 246 | { | ||
| 247 | $outstr.="<tr>"; | ||
| 248 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 249 | if($head < 1){ | ||
| 250 | $data_str = $reportRowNo; $reportRowNo++; | ||
| 251 | }elseif($head < 5) { | ||
| 252 | // if($head < 6) { | ||
| 253 | $data_str = $uarr[$reporthead[$head]]; | ||
| 254 | } | ||
| 255 | elseif($head < 6) { | ||
| 256 | $data_str = $uarr[$reporthead[$head]]; | ||
| 257 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 258 | } | ||
| 259 | else { | ||
| 260 | $data_str = secToDuration(round($uarr[$reporthead[$head]])); | ||
| 261 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 262 | } | ||
| 263 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 264 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 265 | }else{ | ||
| 266 | $outstr.="<td>".$data_str."</td>"; | ||
| 267 | } | ||
| 268 | } | ||
| 269 | $outstr.="</tr>"; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | $outstr.="<tr>"; | ||
| 273 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 274 | { | ||
| 275 | if($head < 6) { | ||
| 276 | $data_str = $utotalarr[$reporthead[$head]]; | ||
| 277 | } | ||
| 278 | else { | ||
| 279 | $data_str = secToDuration($utotalarr[$reporthead[$head]]); | ||
| 280 | } | ||
| 281 | if($head == 12 || $head == 16 || $head == 20 || $head == 24){ | ||
| 282 | $outstr.="<td class='warning'>".$data_str."</td>"; | ||
| 283 | }else{ | ||
| 284 | $outstr.="<td>".$data_str."</td>"; | ||
| 285 | } | ||
| 286 | } | ||
| 287 | $outstr.="</tr>"; | ||
| 288 | } else { | ||
| 289 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 290 | } | ||
| 291 | |||
| 292 | if(Input::has("dllogxls")) | ||
| 293 | { | ||
| 294 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 295 | |||
| 296 | $inputFileType = "Excel5"; | ||
| 297 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 298 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 299 | $baseRow = 2; | ||
| 300 | |||
| 301 | |||
| 302 | $highestColumn = sizeof($reporthead); | ||
| 303 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 304 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 305 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 306 | } | ||
| 307 | |||
| 308 | foreach($reportarray as $uid=>$uarr) | ||
| 309 | { | ||
| 310 | $row = $baseRow++; | ||
| 311 | $col = 0; | ||
| 312 | |||
| 313 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 314 | $excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]])); | ||
| 315 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 316 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | $row++; | ||
| 321 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 322 | $excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]])); | ||
| 323 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 324 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 325 | } | ||
| 326 | |||
| 327 | header('Content-Type: application/vnd.ms-excel'); | ||
| 328 | header('Content-Disposition: attachment;filename="AgentTime.xls"'); | ||
| 329 | header('Cache-Control: max-age=0'); | ||
| 330 | |||
| 331 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 332 | $objWriter->save('php://output'); | ||
| 333 | |||
| 334 | return ; | ||
| 335 | } | ||
| 336 | |||
| 337 | function secToDuration($sec) { | ||
| 338 | return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60); | ||
| 339 | } | ||
| 340 | ?> | ||
| 341 | |||
| 342 | <style>#logtable.td{vertical-align:top;padding:20px;}#logtable.tr{height:28px;overflow-y:hidden;} | ||
| 343 | /*#logtable.table thead tr{ | ||
| 344 | display:block; | ||
| 345 | } | ||
| 346 | |||
| 347 | #logtable.table tbody{ | ||
| 348 | display:block; | ||
| 349 | height:500px; | ||
| 350 | overflow:auto;//set tbody to auto | ||
| 351 | }*/ | ||
| 352 | </style> | ||
| 353 | |||
| 354 | <div class=innerAll> | ||
| 355 | <h4 style="float:left;width:50%;margin:10px 0;">Login Report <small>(Agent Time Average Report)</small></h4> | ||
| 356 | <div style="float:right;width:50%"> | ||
| 357 | <!-- <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button> --> | ||
| 358 | </div> | ||
| 359 | <div style="clear:both"></div> | ||
| 360 | <hr style="margin-bottom: 5px;"> | ||
| 361 | <div> | ||
| 362 | Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;"> | ||
| 363 | |||
| 364 | Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 365 | <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 366 | <?php | ||
| 367 | foreach (range(0,23) as $hour) { | ||
| 368 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 369 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 370 | } | ||
| 371 | ?> | ||
| 372 | </select> | ||
| 373 | To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' /> | ||
| 374 | <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 375 | <?php | ||
| 376 | foreach (range(0,23) as $hour) { | ||
| 377 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 378 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 379 | } | ||
| 380 | ?></select> | ||
| 381 | Campaign | ||
| 382 | <select id="campaign" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 383 | <?php foreach($oclientlst as $c){$s="";if($c==$campaign)$s='selected';echo "<option value='$c' $s>$c</option>";} ?> | ||
| 384 | </select> | ||
| 385 | </div> | ||
| 386 | |||
| 387 | <div style="clear:both"></div> | ||
| 388 | <hr style="margin:5px;"> | ||
| 389 | |||
| 390 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 391 | <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;'> | ||
| 392 | <thead><?php echo $outhead; ?></thead> | ||
| 393 | <tbody id="logTableData"><?php echo $outstr; ?></tbody> | ||
| 394 | </table> | ||
| 395 | </div> | ||
| 396 | |||
| 397 | <div id=dialoglog></div> | ||
| 398 | </div> | ||
| 399 | |||
| 400 | <script> | ||
| 401 | $(document).ready(function() { | ||
| 402 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 403 | { | ||
| 404 | $('#dialoglog').dialog({ | ||
| 405 | autoOpen: false, | ||
| 406 | width: '70%', | ||
| 407 | buttons: { | ||
| 408 | "Ok": function() { | ||
| 409 | $(this).dialog("close"); | ||
| 410 | }, | ||
| 411 | "Cancel": function() { | ||
| 412 | $(this).dialog("close"); | ||
| 413 | } | ||
| 414 | } | ||
| 415 | }); | ||
| 416 | } | ||
| 417 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logTableData') },"2000"); | ||
| 418 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 419 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 420 | }); | ||
| 421 | |||
| 422 | function dataString() | ||
| 423 | { | ||
| 424 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+$("#campaign").val(); | ||
| 425 | } | ||
| 426 | function statusLogReloadFun(sortby) | ||
| 427 | { | ||
| 428 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 429 | var searchStr = dataString(); | ||
| 430 | doAjax('dialer/agenttimeAverage?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 431 | } | ||
| 432 | function dlAgentlogXls() | ||
| 433 | { | ||
| 434 | var searchStr = dataString(); | ||
| 435 | window.open('dialer/agenttimeAverage?dllogxls=1&'+searchStr); | ||
| 436 | return false; | ||
| 437 | } | ||
| 438 | </script> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\Dialline; | ||
| 4 | use App\Models\Sipid; | ||
| 5 | use App\Models\User; | ||
| 6 | use App\Models\UserLog; | ||
| 7 | use App\Models\Kqueue; | ||
| 8 | use App\Jobs\KHRMSLib; | ||
| 9 | |||
| 10 | $selectedvals=explode(":",Input::get("selectedvals",":::::")); | ||
| 11 | $hdfcnodes=array(); | ||
| 12 | $offline=array(); | ||
| 13 | $arr=Config::get("app.hdfcnodes"); | ||
| 14 | foreach($arr as $server=>$arrline) | ||
| 15 | { | ||
| 16 | $tvals=explode(":",$arrline); | ||
| 17 | |||
| 18 | if($selectedvals[0]=="")$hdfcnodes[]=$server; | ||
| 19 | else if($selectedvals[0]==$tvals[0]) | ||
| 20 | { | ||
| 21 | if($selectedvals[1]=="")$hdfcnodes[]=$server; | ||
| 22 | else if($selectedvals[1]==$tvals[1]) | ||
| 23 | { | ||
| 24 | if($selectedvals[2]=="")$hdfcnodes[]=$server; | ||
| 25 | else if($selectedvals[2]==$tvals[2]) | ||
| 26 | { | ||
| 27 | if($selectedvals[3]=="")$hdfcnodes[]=$server; | ||
| 28 | else if($selectedvals[3]==$tvals[3]) | ||
| 29 | { | ||
| 30 | if($selectedvals[4]=="")$hdfcnodes[]=$server; | ||
| 31 | else if($selectedvals[4]==$tvals[4]) | ||
| 32 | { | ||
| 33 | $hdfcnodes[]=$server; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | $wakka = new KHRMSLib(); | ||
| 44 | $dashboarduser=Auth::user(); | ||
| 45 | $nowts=time(); | ||
| 46 | $chart=array('ts'=>date('H:i:s',time()-($dashboarduser->timezone*60)),'Online'=>0,'NoCall'=>0,'InCall'=>0,'CallWait'=>0,'CmdList'=>0); | ||
| 47 | $alist=array(); | ||
| 48 | $sipidsfound=array(); | ||
| 49 | |||
| 50 | $userarr=array();$i=1; | ||
| 51 | $reporthead=array("#","ID","User","Campaign","Station","Status","CRMId","Number","Type","State","Duration"); | ||
| 52 | $reportarray=array(); | ||
| 53 | |||
| 54 | foreach($hdfcnodes as $ci=>$server) | ||
| 55 | { | ||
| 56 | $conn = array( | ||
| 57 | 'driver' => 'mysql', | ||
| 58 | 'host' => $server, | ||
| 59 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 60 | 'username' => env('DB_USERNAME', 'root'), | ||
| 61 | 'password' => env('DB_PASSWORD', ''), | ||
| 62 | 'charset' => 'utf8', | ||
| 63 | 'collation' => 'utf8_unicode_ci', | ||
| 64 | 'prefix' => '', | ||
| 65 | 'options' => array( | ||
| 66 | PDO::ATTR_TIMEOUT => 5, | ||
| 67 | ), | ||
| 68 | ); | ||
| 69 | Config::set("database.connections.conn$ci", $conn); | ||
| 70 | |||
| 71 | try | ||
| 72 | { | ||
| 73 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | $allusers=User::on("conn$ci")->where("status","=","Active")->get(); | ||
| 81 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 82 | |||
| 83 | $newcalls=Dialline::on("conn$ci")->where('status','!=','Free')->where('conf','=','')->orderBy('updated_at')->get(); | ||
| 84 | $acalls=Dialline::on("conn$ci")->where('status','!=','Free')->where('conf','!=','')->orderBy('updated_at')->get(); | ||
| 85 | $sipids=Sipid::on("conn$ci")->whereIn("user",$uidlist)->where("status","=","1")->get(); | ||
| 86 | |||
| 87 | foreach($newcalls as $newcall) | ||
| 88 | { | ||
| 89 | $tcall=CRMCall::on("conn$ci")->where('dialline_id','=',$newcall->id)->orderBy('id','DESC')->first(); | ||
| 90 | $un="";$uid="";$us=""; | ||
| 91 | if($tcall->user_id>0) | ||
| 92 | { | ||
| 93 | $tuser=User::on("conn$ci")->find($tcall->user_id); | ||
| 94 | $un=$tuser->username; | ||
| 95 | $uid=userchatbox($tuser).$tuser->id; | ||
| 96 | |||
| 97 | $userlog=UserLog::on("conn$ci")->where('user_id','=',$tuser->id)->orderBy("id","DESC")->first(); | ||
| 98 | $stend=$userlog->getLastStatus(); | ||
| 99 | $us="$stend[0]-$stend[1]"; | ||
| 100 | |||
| 101 | $chart['Online']++; | ||
| 102 | $chart['InCall']++; | ||
| 103 | } | ||
| 104 | else $chart['CallWait']++; | ||
| 105 | |||
| 106 | $obj=array(); | ||
| 107 | $obj["#"]=$i++; | ||
| 108 | $obj["ID"]=$uid; | ||
| 109 | $obj["User"]=$un; | ||
| 110 | $obj["Campaign"]=$tcall->client; | ||
| 111 | $obj["Station"]=$tcall->sipid_id.userSpyStr($tcall->sipid_id); | ||
| 112 | $obj["Status"]=$us; | ||
| 113 | $obj["CRMId"]=$tcall->crm_id; | ||
| 114 | $obj["Number"]=$tcall->number; | ||
| 115 | $obj["Type"]=$tcall->type; | ||
| 116 | $obj["State"]=$tcall->state; | ||
| 117 | $obj["Duration"]=$nowts-strtotime($tcall->created_at); | ||
| 118 | |||
| 119 | $reportarray[$newcall->id]=$obj; | ||
| 120 | if(!empty($tcall->sipid_id))$sipidsfound[]=$tcall->sipid_id; | ||
| 121 | } | ||
| 122 | foreach($acalls as $acall) | ||
| 123 | { | ||
| 124 | $tcall=CRMCall::on("conn$ci")->where('dialline_id','=',$acall->id)->orderBy('id','DESC')->first(); | ||
| 125 | |||
| 126 | $tsipid=substr($acall->conf,4); | ||
| 127 | $tsip=Sipid::on("conn$ci")->find($tsipid); | ||
| 128 | $clidata=json_decode($tsip->clients,true); | ||
| 129 | |||
| 130 | $tuser=User::on("conn$ci")->find($tsip->user); | ||
| 131 | |||
| 132 | $userlog=UserLog::on("conn$ci")->where('user_id','=',$tuser->id)->orderBy("id","DESC")->first(); | ||
| 133 | $stend=$userlog->getLastStatus(); | ||
| 134 | |||
| 135 | $obj=array(); | ||
| 136 | $obj["#"]=$i++; | ||
| 137 | $obj["ID"]=userchatbox($tuser).$tsip->user; | ||
| 138 | $obj["User"]=$tuser->username; | ||
| 139 | $obj["Campaign"]=substr($clidata['r'],0,20); | ||
| 140 | $obj["Station"]=$tsip->id.userSpyStr($tsip->id); | ||
| 141 | $obj["Status"]="$stend[0]-$stend[1]"; | ||
| 142 | $obj["CRMId"]=$tcall->crm_id; | ||
| 143 | $obj["Number"]=$tcall->number; | ||
| 144 | $obj["Type"]=$tcall->type; | ||
| 145 | $obj["State"]=$tcall->state; | ||
| 146 | $obj["Duration"]=$nowts-strtotime($tcall->created_at); | ||
| 147 | |||
| 148 | $reportarray[$acall->id]=$obj; | ||
| 149 | $sipidsfound[]=$tsipid; | ||
| 150 | |||
| 151 | $chart['Online']++; | ||
| 152 | $chart['InCall']++; | ||
| 153 | } | ||
| 154 | foreach($sipids as $sipid) | ||
| 155 | { | ||
| 156 | if(!in_array($sipid->id,$sipidsfound)) | ||
| 157 | { | ||
| 158 | $clidata=json_decode($sipid->clients,true); | ||
| 159 | |||
| 160 | $tuser=User::on("conn$ci")->find($sipid->user); | ||
| 161 | $userlog=UserLog::on("conn$ci")->where('user_id','=',$tuser->id)->orderBy("id","DESC")->first(); | ||
| 162 | $stend=$userlog->getLastStatus(); | ||
| 163 | |||
| 164 | $obj=array(); | ||
| 165 | $obj["#"]=$i++; | ||
| 166 | $obj["ID"]=userchatbox($tuser).$sipid->user; | ||
| 167 | $obj["User"]=$tuser->username; | ||
| 168 | $obj["Campaign"]=substr($clidata['r'],0,20); | ||
| 169 | $obj["Station"]=$sipid->id.userSpyStr($sipid->id); | ||
| 170 | $obj["Status"]="$stend[0]-$stend[1]"; | ||
| 171 | $obj["CRMId"]=""; | ||
| 172 | $obj["Number"]=""; | ||
| 173 | $obj["Type"]=""; | ||
| 174 | $obj["State"]=""; | ||
| 175 | $obj["Duration"]=""; | ||
| 176 | |||
| 177 | $reportarray[]=$obj; | ||
| 178 | |||
| 179 | $chart['Online']++; | ||
| 180 | $chart['NoCall']++; | ||
| 181 | } | ||
| 182 | } | ||
| 183 | |||
| 184 | $chart['CmdList']=-1*Kqueue::on("conn$ci")->count(); | ||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | }catch(Exception $e) | ||
| 191 | { | ||
| 192 | $offline[]=$server; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | |||
| 197 | if(Input::get('chartvals')==1) | ||
| 198 | { | ||
| 199 | echo json_encode($chart); | ||
| 200 | return; | ||
| 201 | } | ||
| 202 | |||
| 203 | $highestColumn = sizeof($reporthead); | ||
| 204 | $outhead="<tr>";$outstr=""; | ||
| 205 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 206 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 207 | } | ||
| 208 | $outhead.="</tr>"; | ||
| 209 | foreach($reportarray as $uid=>$uarr) | ||
| 210 | { | ||
| 211 | $outstr.="<tr>"; | ||
| 212 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 213 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 214 | } | ||
| 215 | $outstr.="</tr>"; | ||
| 216 | } | ||
| 217 | |||
| 218 | |||
| 219 | function userchatbox($tuser) | ||
| 220 | { | ||
| 221 | |||
| 222 | } | ||
| 223 | function userSpyStr($sipid) | ||
| 224 | { | ||
| 225 | |||
| 226 | } | ||
| 227 | //charts | ||
| 228 | ?> | ||
| 229 | |||
| 230 | |||
| 231 | <div class=innerAll> | ||
| 232 | |||
| 233 | |||
| 234 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 235 | <script> | ||
| 236 | $(document).ready(function() | ||
| 237 | { | ||
| 238 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 239 | { | ||
| 240 | $('#dialoglog').dialog({ | ||
| 241 | autoOpen: false, | ||
| 242 | width: '70%', | ||
| 243 | buttons: { | ||
| 244 | "Ok": function() { | ||
| 245 | $(this).dialog("close"); | ||
| 246 | }, | ||
| 247 | "Cancel": function() { | ||
| 248 | $(this).dialog("close"); | ||
| 249 | } | ||
| 250 | } | ||
| 251 | }); | ||
| 252 | } | ||
| 253 | }); | ||
| 254 | </script> | ||
| 255 | <div style="float:left;width:50%"> | ||
| 256 | <h5>Dialer : Live</h5> | ||
| 257 | </div> | ||
| 258 | <div style="float:left;width:50%"> | ||
| 259 | <button class="pull-right btn btn-sm btn-default" onclick='liveLogReloadFun(10);return false;' title='Reload' style='margin-top:-8px'><i class='fa fa-refresh'></i> Reload</button> | ||
| 260 | </div> | ||
| 261 | <div style="clear:both"></div> | ||
| 262 | <hr> | ||
| 263 | |||
| 264 | <div class=col-md-12> | ||
| 265 | |||
| 266 | |||
| 267 | <div id=liveuserlogschart1{!!$nowts!!} style='min-height:300px;width:100%'></div> | ||
| 268 | <script> | ||
| 269 | var livechart001=''; | ||
| 270 | $(function () { | ||
| 271 | livechart001=$('#liveuserlogschart1{!!$nowts!!}').highcharts({ | ||
| 272 | title: { | ||
| 273 | text: '', | ||
| 274 | x: -20 //center | ||
| 275 | }, | ||
| 276 | subtitle: { | ||
| 277 | text: '', | ||
| 278 | x: -20 | ||
| 279 | }, | ||
| 280 | xAxis: { | ||
| 281 | categories: [<?php $ccc=array();for($c=60;$c>0;$c--){echo "'",date('H:i:s',time()-($c*10)-($dashboarduser->timezone*60))."',";$ccc[]="0";}$ccc="[".implode(",",$ccc)."]"; ?>], | ||
| 282 | labels:{ | ||
| 283 | enabled:false//default is true | ||
| 284 | }, | ||
| 285 | }, | ||
| 286 | yAxis: { | ||
| 287 | title: { | ||
| 288 | text: '' | ||
| 289 | }, | ||
| 290 | plotLines: [{ | ||
| 291 | value: 0, | ||
| 292 | width: 1, | ||
| 293 | color: '#808080' | ||
| 294 | }] | ||
| 295 | }, | ||
| 296 | tooltip: { | ||
| 297 | valueSuffix: '' | ||
| 298 | }, | ||
| 299 | legend: { | ||
| 300 | |||
| 301 | }, | ||
| 302 | series: [{ | ||
| 303 | name: 'Online', | ||
| 304 | data: {!!Input::get('Online',$ccc)!!} | ||
| 305 | }, { | ||
| 306 | name: 'NoCall', | ||
| 307 | data: {!!Input::get('NoCall',$ccc)!!} | ||
| 308 | }, { | ||
| 309 | name: 'InCall', | ||
| 310 | data: {!!Input::get('InCall',$ccc)!!} | ||
| 311 | }, { | ||
| 312 | name: 'CallWait', | ||
| 313 | data: {!!Input::get('CallWait',$ccc)!!} | ||
| 314 | }, { | ||
| 315 | name: 'CmdList',visible: false, | ||
| 316 | data: {!!Input::get('CmdList',$ccc)!!} | ||
| 317 | }] | ||
| 318 | }); | ||
| 319 | }); | ||
| 320 | |||
| 321 | function liveLogReloadFun(delay) | ||
| 322 | { | ||
| 323 | var tchart=livechart001.highcharts(); | ||
| 324 | var sdata=''; | ||
| 325 | sdata+='&Online='+JSON.stringify(tchart.series[0].yData); | ||
| 326 | sdata+='&NoCall='+JSON.stringify(tchart.series[1].yData); | ||
| 327 | sdata+='&InCall='+JSON.stringify(tchart.series[2].yData); | ||
| 328 | sdata+='&CallWait='+JSON.stringify(tchart.series[3].yData); | ||
| 329 | sdata+='&CmdList='+JSON.stringify(tchart.series[4].yData); | ||
| 330 | |||
| 331 | setTimeout(function(){ | ||
| 332 | if($("#liveuserlogschart1{!!$nowts!!}").length) | ||
| 333 | doAjax('dialer/aliveusers',sdata+'&selectedvals='+getarvalval(),'rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 334 | },delay); | ||
| 335 | } | ||
| 336 | function liveLogReloadChartFun(delay) | ||
| 337 | { | ||
| 338 | setTimeout(function(){ | ||
| 339 | if($("#liveuserlogschart1{!!$nowts!!}").length) | ||
| 340 | doAjax('dialer/aliveusers','chartvals=1'+'&selectedvals='+getarvalval(),'__FD__','ajax_dialer_reports','singlethis','GET',function(res) | ||
| 341 | { | ||
| 342 | var resobj=JSON.parse(res.responseText); | ||
| 343 | |||
| 344 | var tchart=livechart001.highcharts(); | ||
| 345 | var shift = tchart.series[0].data.length > 60; | ||
| 346 | |||
| 347 | // add the point | ||
| 348 | tchart.series[0].addPoint([resobj['ts'],resobj['Online']], true, shift); | ||
| 349 | tchart.series[1].addPoint([resobj['ts'],resobj['NoCall']], true, shift); | ||
| 350 | tchart.series[2].addPoint([resobj['ts'],resobj['InCall']], true, shift); | ||
| 351 | tchart.series[3].addPoint([resobj['ts'],resobj['CallWait']],true,shift); | ||
| 352 | tchart.series[4].addPoint([resobj['ts'],resobj['CmdList']],true,shift); | ||
| 353 | |||
| 354 | // call it again after one second | ||
| 355 | setTimeout(liveLogReloadChartFun, 5000); | ||
| 356 | |||
| 357 | |||
| 358 | }); | ||
| 359 | },delay); | ||
| 360 | } | ||
| 361 | liveLogReloadChartFun(10); | ||
| 362 | </script> | ||
| 363 | |||
| 364 | </div> | ||
| 365 | |||
| 366 | <div style='clear:both'></div> | ||
| 367 | |||
| 368 | |||
| 369 | |||
| 370 | <div style='clear:both'></div> | ||
| 371 | |||
| 372 | <div style='overflow:auto'> | ||
| 373 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 374 | <thead> | ||
| 375 | <?php echo $outhead; ?> | ||
| 376 | </thead> | ||
| 377 | <?php echo $outstr; ?> | ||
| 378 | </table> | ||
| 379 | </div> | ||
| 380 | |||
| 381 | <div id=dialoglog></div> | ||
| 382 | |||
| 383 | |||
| 384 | |||
| 385 | |||
| 386 | |||
| 387 | </div> | ||
| 388 | <!-- | ||
| 389 | |||
| 390 | <?php | ||
| 391 | //if($dashboarduser->moduleACL("Admin",false,false,true))print_r(Config::get('app.sqllog')); | ||
| 392 | foreach($arr as $server=>$arrline) | ||
| 393 | { | ||
| 394 | if(in_array($server,$hdfcnodes))echo "$server => $arrline\n"; | ||
| 395 | } | ||
| 396 | |||
| 397 | ?> | ||
| 398 | |||
| 399 | --> |
| 1 | <?php | ||
| 2 | $dashboarduser=Auth::user(); | ||
| 3 | $timeoffset=$dashboarduser->timezone*60; | ||
| 4 | ?> | ||
| 5 | <div class="container-fluid"> | ||
| 6 | <div class="layout-app"> | ||
| 7 | <div class="row"> | ||
| 8 | <div class="col-md-12"> | ||
| 9 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 10 | <div class="innerAll"> | ||
| 11 | <div> | ||
| 12 | <h4 id='tcampaign_select' value=<?php if(!empty($client)) echo $client; ?>>Appointment <?php if(!empty($client)) echo ": ".$client; ?></h4></div> | ||
| 13 | <hr style="margin-bottom: 10px;" /> | ||
| 14 | |||
| 15 | <table class='table' | ||
| 16 | <thead> | ||
| 17 | <tr> | ||
| 18 | <th></th> | ||
| 19 | <th></th> | ||
| 20 | <?php if(empty($client)) echo "<th>Campaign</th>" ?> | ||
| 21 | <th>Cust_ID</th> | ||
| 22 | <th>Name</th> | ||
| 23 | <th>Number</th> | ||
| 24 | <!-- <th>Type</th>--> | ||
| 25 | <th>LastCall</th> | ||
| 26 | <!-- <th>Disposition</th> ---> | ||
| 27 | <th>Appointment Date</th> | ||
| 28 | <!--- <th>Status</th> ---> | ||
| 29 | |||
| 30 | <!-- <th>Count</th> --> | ||
| 31 | <!--<th></th>--> | ||
| 32 | <!-- <th>DID</th> --> | ||
| 33 | </tr> | ||
| 34 | </thead> | ||
| 35 | <tbody> | ||
| 36 | <?php | ||
| 37 | if($count > 0){ | ||
| 38 | foreach ($appointment as $key => $value) { //echo "<pre>";print_r($value);exit;?> | ||
| 39 | <tr> | ||
| 40 | <td></td> | ||
| 41 | <td></td> | ||
| 42 | <?php if(empty($client)) echo "<td>$value->client</td>" ?> | ||
| 43 | <td><?php echo $value->cust_id; ?></td> | ||
| 44 | <td><?php echo $value->customer_name; ?></td> | ||
| 45 | <td><a href=# class='' onclick='dialerQuickOpen("<?php echo $value->id; ?>","<?php echo $value->mobile; ?>","Manual","",0);return false;'><?php echo $value->mobile; ?></a></td> | ||
| 46 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_lastcall)-$timeoffset); ?></td> | ||
| 47 | <!--<td><?php //echo $value->dialer_status; ?></td>--> | ||
| 48 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_appointment)-$timeoffset); ?></td> | ||
| 49 | <!--<td><?php //echo $value->status; ?></td>--> | ||
| 50 | </tr> | ||
| 51 | <?php } | ||
| 52 | }else{ ?> | ||
| 53 | <td colspan="9" align="center">No Record Available</td> | ||
| 54 | <?php } ?> | ||
| 55 | </table> | ||
| 56 | |||
| 57 | <div id="campaignDetailsArea"></div> | ||
| 58 | </div> | ||
| 59 | </div> | ||
| 60 | </div> | ||
| 61 | </div> | ||
| 62 | |||
| 63 | </div> | ||
| 64 | </div> |
| 1 | <div class="layout-app"><!-- row-app --> | ||
| 2 | <div class="row row-app"> | ||
| 3 | |||
| 4 | <!-- col --> | ||
| 5 | <div class="col-md-2 col-sm-3"> | ||
| 6 | |||
| 7 | <!-- col-separator --> | ||
| 8 | <div class="col-separator col-separator-first box col-unscrollable"> | ||
| 9 | |||
| 10 | <!-- col-table --> | ||
| 11 | <div class="col-table" style='padding-left: 13px;padding-right: 13px;'> | ||
| 12 | |||
| 13 | <h4 class="innerAll margin-none border-bottom" style='background: #fff;'>Dialer Reports</h4> | ||
| 14 | |||
| 15 | <!-- col-table-row --> | ||
| 16 | <div class="col-table-row"> | ||
| 17 | |||
| 18 | <!-- col-app --> | ||
| 19 | <div class="col-app col-unscrollable"> | ||
| 20 | |||
| 21 | <!-- col-app --> | ||
| 22 | <div class="col-app"> | ||
| 23 | |||
| 24 | <ul class="list-group list-group-1 margin-none borders-none" style='padding-right: 26px;'> | ||
| 25 | |||
| 26 | |||
| 27 | <li class="list-group-item"> | ||
| 28 | <a href="#" onclick="areportsFun('aliveusers');return false"><i class="fa fa-circle-o"></i> Live</a> | ||
| 29 | </li> | ||
| 30 | <li class="list-group-item"> | ||
| 31 | <a href="#" onclick="areportsFun('acalllog');return false"><i class="fa fa-circle-o"></i> Call</a> | ||
| 32 | </li> | ||
| 33 | <li class="list-group-item"> | ||
| 34 | <a href="#" onclick="areportsFun('aagentreport');return false"><i class="fa fa-circle-o"></i> Login</a> | ||
| 35 | </li> | ||
| 36 | <li class="list-group-item"> | ||
| 37 | <a href="#" onclick="areportsFun('acampreport');return false"><i class="fa fa-circle-o"></i> Time</a> | ||
| 38 | </li> | ||
| 39 | <li class="list-group-item"> | ||
| 40 | <a href="#" onclick="areportsFun('astatusreport');return false"><i class="fa fa-circle-o"></i> Status</a> | ||
| 41 | </li> | ||
| 42 | |||
| 43 | <li class="list-group-item"></li> | ||
| 44 | <div class="col-separator-h"></div> | ||
| 45 | |||
| 46 | <h5 class="innerAll margin-none border-bottom" style='background: #fff;'>Filters</h5> | ||
| 47 | <li class="list-group-item"> | ||
| 48 | <select class=form-control id=arval0 onchange='arvalChange(0);'><option value=''></option><option value='COP'>COP</option><option value='Prime'>Prime</option></select> | ||
| 49 | <select class=form-control id=arval1 onchange='arvalChange(1);'><option value=''></option></select> | ||
| 50 | <select class=form-control id=arval2 onchange='arvalChange(2);'><option value=''></option></select> | ||
| 51 | <select class=form-control id=arval3 onchange='arvalChange(3);'><option value=''></option></select> | ||
| 52 | <select class=form-control id=arval4 onchange='arvalChange(4);'><option value=''></option></select> | ||
| 53 | </li> | ||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | </ul> | ||
| 58 | |||
| 59 | |||
| 60 | </div> | ||
| 61 | <!-- // END col-app --> | ||
| 62 | |||
| 63 | </div> | ||
| 64 | <!-- // END col-app --> | ||
| 65 | |||
| 66 | </div> | ||
| 67 | <!-- // END col-table-row --> | ||
| 68 | |||
| 69 | </div> | ||
| 70 | <!-- // END col-table --> | ||
| 71 | |||
| 72 | </div> | ||
| 73 | <!-- // END col-separator.box --> | ||
| 74 | |||
| 75 | </div> | ||
| 76 | <!-- // END col --> | ||
| 77 | |||
| 78 | <!-- col --> | ||
| 79 | <div class="col-md-10 col-sm-9" style='border-right:13px solid #eaeaea'> | ||
| 80 | |||
| 81 | <!-- col-separator.box --> | ||
| 82 | <div class="col-separator col-unscrollable box"> | ||
| 83 | |||
| 84 | <!-- col-table --> | ||
| 85 | <div class="col-table"> | ||
| 86 | |||
| 87 | <!-- <h4 class="innerAll margin-none border-bottom">My Sessions</h4> --> | ||
| 88 | |||
| 89 | <!-- col-table-row --> | ||
| 90 | <div class="col-table-row" style='background: #fff;'> | ||
| 91 | |||
| 92 | <!-- col-app --> | ||
| 93 | <div class="col-app col-unscrollable"> | ||
| 94 | |||
| 95 | <!-- col-app --> | ||
| 96 | <div class="col-app" style='position:relative'> | ||
| 97 | |||
| 98 | <div class="" id=rightmainreportdiv> | ||
| 99 | |||
| 100 | </div> | ||
| 101 | |||
| 102 | </div> | ||
| 103 | <!-- // END col-app --> | ||
| 104 | |||
| 105 | </div> | ||
| 106 | <!-- // END col-app.col-unscrollable --> | ||
| 107 | |||
| 108 | </div> | ||
| 109 | <!-- // END col-table-row --> | ||
| 110 | |||
| 111 | </div> | ||
| 112 | <!-- // END col-table --> | ||
| 113 | |||
| 114 | </div> | ||
| 115 | <!-- // END col-separator.box --> | ||
| 116 | |||
| 117 | </div> | ||
| 118 | <!-- // END col --> | ||
| 119 | |||
| 120 | </div> | ||
| 121 | <!-- // END row-app --> | ||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | </div> | ||
| 127 | <script> | ||
| 128 | function areportsFun(report) | ||
| 129 | { | ||
| 130 | doAjax('dialer/'+report,'selectedvals='+getarvalval(),'rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 131 | } | ||
| 132 | |||
| 133 | |||
| 134 | var arvalvalue="::::::"; | ||
| 135 | function arvalChange(x) | ||
| 136 | { | ||
| 137 | <?php echo "var arr=JSON.parse('".json_encode(Config::get("app.hdfcnodes"))."');"; ?> | ||
| 138 | |||
| 139 | var selectopts=['']; | ||
| 140 | for(i=4;i>x;i--)updateJSSelect("arval"+i,selectopts); | ||
| 141 | |||
| 142 | for (var server in arr) | ||
| 143 | { | ||
| 144 | tvals=arr[server].split(":"); | ||
| 145 | if($("#arval"+x).val()==tvals[x])if(jQuery.inArray(tvals[x+1], selectopts)<0)selectopts[selectopts.length]=tvals[x+1]; | ||
| 146 | } | ||
| 147 | x++;updateJSSelect("arval"+x,selectopts); | ||
| 148 | } | ||
| 149 | function getarvalval() | ||
| 150 | { | ||
| 151 | arvalvalue="";for(i=0;i<5;i++)arvalvalue+=$("#arval"+i).val()+':'; | ||
| 152 | return arvalvalue; | ||
| 153 | } | ||
| 154 | </script> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | $selectedvals=explode(":",Input::get("selectedvals",":::::")); | ||
| 9 | $hdfcnodes=array(); | ||
| 10 | $offline=array(); | ||
| 11 | $arr=Config::get("app.hdfcnodes"); | ||
| 12 | foreach($arr as $server=>$arrline) | ||
| 13 | { | ||
| 14 | $tvals=explode(":",$arrline); | ||
| 15 | |||
| 16 | if($selectedvals[0]=="")$hdfcnodes[]=$server; | ||
| 17 | else if($selectedvals[0]==$tvals[0]) | ||
| 18 | { | ||
| 19 | if($selectedvals[1]=="")$hdfcnodes[]=$server; | ||
| 20 | else if($selectedvals[1]==$tvals[1]) | ||
| 21 | { | ||
| 22 | if($selectedvals[2]=="")$hdfcnodes[]=$server; | ||
| 23 | else if($selectedvals[2]==$tvals[2]) | ||
| 24 | { | ||
| 25 | if($selectedvals[3]=="")$hdfcnodes[]=$server; | ||
| 26 | else if($selectedvals[3]==$tvals[3]) | ||
| 27 | { | ||
| 28 | if($selectedvals[4]=="")$hdfcnodes[]=$server; | ||
| 29 | else if($selectedvals[4]==$tvals[4]) | ||
| 30 | { | ||
| 31 | $hdfcnodes[]=$server; | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | |||
| 41 | $wakka = new KHRMSLib(); | ||
| 42 | $dashboarduser=Auth::user(); | ||
| 43 | |||
| 44 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 45 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | $i=1; | ||
| 50 | $reporthead=array("#","UserId","UserName","Count","Total"); | ||
| 51 | $reportarray=array(); | ||
| 52 | |||
| 53 | |||
| 54 | foreach($hdfcnodes as $ci=>$server) | ||
| 55 | { | ||
| 56 | $conn = array( | ||
| 57 | 'driver' => 'mysql', | ||
| 58 | 'host' => $server, | ||
| 59 | 'database' => env('DB_DATABASE', 'kstych_flexydial'), | ||
| 60 | 'username' => env('DB_USERNAME', 'root'), | ||
| 61 | 'password' => env('DB_PASSWORD', ''), | ||
| 62 | 'charset' => 'utf8', | ||
| 63 | 'collation' => 'utf8_unicode_ci', | ||
| 64 | 'prefix' => '', | ||
| 65 | 'options' => array( | ||
| 66 | PDO::ATTR_TIMEOUT => 5, | ||
| 67 | ), | ||
| 68 | ); | ||
| 69 | Config::set("database.connections.conn$ci", $conn); | ||
| 70 | |||
| 71 | try | ||
| 72 | { | ||
| 73 | DB::connection("conn$ci")->getDatabaseName(); | ||
| 74 | |||
| 75 | $alist=CRMCall::on("conn$ci")->where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 76 | $alist=$alist->get(); | ||
| 77 | $userarr=array(); | ||
| 78 | foreach($alist as $aline) | ||
| 79 | { | ||
| 80 | if(!isset($userarr[$aline->user_id."conn$ci"]))$userarr[$aline->user_id."conn$ci"]=User::on("conn$ci")->find($aline->user_id."conn$ci"); | ||
| 81 | $tuser=$userarr[$aline->user_id."conn$ci"]; | ||
| 82 | |||
| 83 | if(!isset($reportarray[$aline->user_id."conn$ci"]))$reportarray[$aline->user_id."conn$ci"]=array("#"=>$i++,"UserId"=>$tuser->id,"UserName"=>$tuser->username,"Count"=>0,"Total"=>0,"Wait"=>0,"Call"=>0,"Talk"=>0,"Dispo"=>0); | ||
| 84 | |||
| 85 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 86 | |||
| 87 | $reportarray[$aline->user_id."conn$ci"]["Count"]++; | ||
| 88 | $reportarray[$aline->user_id."conn$ci"]["Total"]+=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 89 | |||
| 90 | $ststr=$aline->userstatus."-".$aline->usersubstatus; | ||
| 91 | if(!in_array($ststr,$reporthead))$reporthead[]=$ststr; | ||
| 92 | |||
| 93 | $reportarray[$aline->user_id."conn$ci"][$ststr]++; | ||
| 94 | } | ||
| 95 | |||
| 96 | |||
| 97 | }catch(Exception $e) | ||
| 98 | { | ||
| 99 | $offline[]=$server; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | |||
| 105 | if(Input::has("dllogxls")) | ||
| 106 | { | ||
| 107 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 108 | |||
| 109 | $inputFileType = "Excel5"; | ||
| 110 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 111 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 112 | $baseRow = 3; | ||
| 113 | |||
| 114 | |||
| 115 | $highestColumn = sizeof($reporthead); | ||
| 116 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 117 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 118 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 119 | } | ||
| 120 | |||
| 121 | foreach($reportarray as $uid=>$uarr) | ||
| 122 | { | ||
| 123 | $row = $baseRow++; | ||
| 124 | $col = 0; | ||
| 125 | |||
| 126 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 127 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 128 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | |||
| 132 | |||
| 133 | header('Content-Type: application/vnd.ms-excel'); | ||
| 134 | header('Content-Disposition: attachment;filename="StatusLog.xls"'); | ||
| 135 | header('Cache-Control: max-age=0'); | ||
| 136 | |||
| 137 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 138 | $objWriter->save('php://output'); | ||
| 139 | |||
| 140 | return ; | ||
| 141 | } | ||
| 142 | |||
| 143 | |||
| 144 | |||
| 145 | $highestColumn = sizeof($reporthead); | ||
| 146 | $outhead="<tr>";$outstr=""; | ||
| 147 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 148 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 149 | } | ||
| 150 | $outhead.="</tr>"; | ||
| 151 | foreach($reportarray as $uid=>$uarr) | ||
| 152 | { | ||
| 153 | $outstr.="<tr>"; | ||
| 154 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 155 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 156 | } | ||
| 157 | $outstr.="</tr>"; | ||
| 158 | } | ||
| 159 | |||
| 160 | |||
| 161 | |||
| 162 | |||
| 163 | //charts | ||
| 164 | $cat1=array(); | ||
| 165 | $cat1arr=array(); | ||
| 166 | foreach($reportarray as $uid=>$uarr) | ||
| 167 | { | ||
| 168 | $cat1[]="'$uarr[UserName]'"; | ||
| 169 | |||
| 170 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 171 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 172 | |||
| 173 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]],1); | ||
| 174 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 178 | $cat1arrstr=""; | ||
| 179 | foreach($cat1arr as $name=>$data) | ||
| 180 | { | ||
| 181 | $extra="";if($name=="InboundDROP-InboundDROP")$extra=",visible: false"; | ||
| 182 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 183 | $cat1arrstr.=implode(",",$data); | ||
| 184 | $cat1arrstr.="] $extra },\n"; | ||
| 185 | } | ||
| 186 | |||
| 187 | |||
| 188 | $cat2=array(); | ||
| 189 | foreach($reportarray as $uid=>$uarr) | ||
| 190 | { | ||
| 191 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 192 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]],1); | ||
| 193 | } | ||
| 194 | } | ||
| 195 | ?> | ||
| 196 | |||
| 197 | |||
| 198 | <div class=innerAll> | ||
| 199 | |||
| 200 | |||
| 201 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 202 | <script> | ||
| 203 | $(document).ready(function() | ||
| 204 | { | ||
| 205 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 206 | { | ||
| 207 | $('#dialoglog').dialog({ | ||
| 208 | autoOpen: false, | ||
| 209 | width: '70%', | ||
| 210 | buttons: { | ||
| 211 | "Ok": function() { | ||
| 212 | $(this).dialog("close"); | ||
| 213 | }, | ||
| 214 | "Cancel": function() { | ||
| 215 | $(this).dialog("close"); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | }); | ||
| 219 | } | ||
| 220 | |||
| 221 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 222 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 223 | }); | ||
| 224 | </script> | ||
| 225 | <div style="float:left;width:50%"> | ||
| 226 | |||
| 227 | Search <input id=filter name="filter" type="text"> | ||
| 228 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 229 | |||
| 230 | </div> | ||
| 231 | <div style="float:left;width:50%"> | ||
| 232 | |||
| 233 | |||
| 234 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 235 | |||
| 236 | </div> | ||
| 237 | <div style="clear:both"></div> | ||
| 238 | <hr> | ||
| 239 | |||
| 240 | <div class=col-md-12> | ||
| 241 | |||
| 242 | |||
| 243 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 244 | <script> | ||
| 245 | $(function () { | ||
| 246 | $('#userlogschart1').highcharts({ | ||
| 247 | chart: { | ||
| 248 | type: 'column' | ||
| 249 | }, | ||
| 250 | title: { | ||
| 251 | text: '' | ||
| 252 | }, | ||
| 253 | xAxis: { | ||
| 254 | labels:{ | ||
| 255 | enabled:false//default is true | ||
| 256 | }, | ||
| 257 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 258 | }, | ||
| 259 | yAxis: { | ||
| 260 | min: 0, | ||
| 261 | title: { | ||
| 262 | text: '' | ||
| 263 | }, | ||
| 264 | stackLabels: { | ||
| 265 | enabled: false, | ||
| 266 | // style: { | ||
| 267 | // fontWeight: '', | ||
| 268 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 269 | // } | ||
| 270 | } | ||
| 271 | }, | ||
| 272 | // legend: { | ||
| 273 | // align: 'right', | ||
| 274 | // x: -30, | ||
| 275 | // verticalAlign: 'top', | ||
| 276 | // y: 25, | ||
| 277 | // floating: true, | ||
| 278 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 279 | // borderColor: '#CCC', | ||
| 280 | // borderWidth: 1, | ||
| 281 | // shadow: false | ||
| 282 | // }, | ||
| 283 | tooltip: { | ||
| 284 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 285 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 286 | }, | ||
| 287 | plotOptions: { | ||
| 288 | column: { | ||
| 289 | stacking: 'normal', | ||
| 290 | dataLabels: { | ||
| 291 | enabled: false, | ||
| 292 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 293 | // style: { | ||
| 294 | // textShadow: '0 0 3px black' | ||
| 295 | // } | ||
| 296 | } | ||
| 297 | } | ||
| 298 | }, | ||
| 299 | series: [<?php echo $cat1arrstr; ?>] | ||
| 300 | }); | ||
| 301 | }); | ||
| 302 | |||
| 303 | |||
| 304 | |||
| 305 | |||
| 306 | function statusLogReloadFun(sortby) | ||
| 307 | { | ||
| 308 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 309 | |||
| 310 | doAjax('dialer/astatusreport?logdate='+$("#modfrom").val()+sortstr+'&selectedvals='+getarvalval(),'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 311 | } | ||
| 312 | function dlAgentlogXls() | ||
| 313 | { | ||
| 314 | window.open('dialer/astatusreport?dllogxls=1&logdate='+$("#modfrom").val()+'&selectedvals='+getarvalval());return false; | ||
| 315 | } | ||
| 316 | </script> | ||
| 317 | |||
| 318 | </div> | ||
| 319 | |||
| 320 | <div style='clear:both'></div> | ||
| 321 | |||
| 322 | <div class=col-md-12> | ||
| 323 | |||
| 324 | |||
| 325 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 326 | <script> | ||
| 327 | $(function () { | ||
| 328 | $('#userlogschart2').highcharts({ | ||
| 329 | chart: { | ||
| 330 | type: 'column' | ||
| 331 | }, | ||
| 332 | title: { | ||
| 333 | text: '' | ||
| 334 | }, | ||
| 335 | subtitle: { | ||
| 336 | text: '' | ||
| 337 | }, | ||
| 338 | xAxis: { | ||
| 339 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 340 | crosshair: true, | ||
| 341 | labels:{ | ||
| 342 | enabled:false//default is true | ||
| 343 | }, | ||
| 344 | }, | ||
| 345 | yAxis: { | ||
| 346 | min: 0, | ||
| 347 | title: { | ||
| 348 | text: '' | ||
| 349 | } | ||
| 350 | }, | ||
| 351 | tooltip: { | ||
| 352 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 353 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 354 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 355 | footerFormat: '</table>', | ||
| 356 | shared: true, | ||
| 357 | useHTML: true | ||
| 358 | }, | ||
| 359 | plotOptions: { | ||
| 360 | column: { | ||
| 361 | pointPadding: 0.2, | ||
| 362 | borderWidth: 0 | ||
| 363 | } | ||
| 364 | }, | ||
| 365 | legend : { | ||
| 366 | floating: true, | ||
| 367 | align: 'right', | ||
| 368 | x: -30, | ||
| 369 | verticalAlign: 'top', | ||
| 370 | }, | ||
| 371 | series: [{ | ||
| 372 | name: 'Count', | ||
| 373 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 374 | |||
| 375 | },] | ||
| 376 | }); | ||
| 377 | }); | ||
| 378 | |||
| 379 | </script> | ||
| 380 | |||
| 381 | </div> | ||
| 382 | |||
| 383 | |||
| 384 | |||
| 385 | <div style='clear:both'></div> | ||
| 386 | |||
| 387 | <div style='overflow:auto'> | ||
| 388 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 389 | <thead> | ||
| 390 | <?php echo $outhead; ?> | ||
| 391 | </thead> | ||
| 392 | <?php echo $outstr; ?> | ||
| 393 | </table> | ||
| 394 | </div> | ||
| 395 | |||
| 396 | <div id=dialoglog></div> | ||
| 397 | |||
| 398 | |||
| 399 | |||
| 400 | |||
| 401 | |||
| 402 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCallArchive; | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\User; | ||
| 5 | use App\Jobs\KHRMSLib; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | $userdialmode=$dashboarduser->dialmode_assign; | ||
| 10 | $userdialmode=explode(",",$userdialmode); | ||
| 11 | $timeoffset=$dashboarduser->timezone*60; | ||
| 12 | //echo $timeoffset; | ||
| 13 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :7; | ||
| 14 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:22; | ||
| 15 | $key =(isset($_GET['key'])) ? $_GET['key'] : "All"; | ||
| 16 | $value =(isset($_GET['value'])) ? $_GET['value'] : ""; | ||
| 17 | |||
| 18 | |||
| 19 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") : strtotime(date("Y-m-d")." 07:00:00"); | ||
| 20 | //echo $logdate; | ||
| 21 | $logdateto =(isset($_GET['logdate']))? strtotime($_GET['logdate']." ".$logtimeto.":00:00") : strtotime(date("Y-m-d")." 22:00:00"); | ||
| 22 | |||
| 23 | //echo $logdateto; | ||
| 24 | |||
| 25 | $prevlogdate = strtotime(date('Y-m-d', strtotime('-7 day'))); | ||
| 26 | if(Input::get("getCallRec")=="1") | ||
| 27 | { | ||
| 28 | if($logdate < $prevlogdate){ | ||
| 29 | $calllog=CRMCallArchive::find(Input::get("calllog")); | ||
| 30 | }else{ | ||
| 31 | $calllog=CRMCall::find(Input::get("calllog")); | ||
| 32 | } | ||
| 33 | |||
| 34 | $tdata=json_decode($calllog->data,true); | ||
| 35 | echo '<audio controls src="dialer/playrecfile?calllog='.$calllog->id.'" />'; | ||
| 36 | |||
| 37 | return; | ||
| 38 | } | ||
| 39 | |||
| 40 | if($logdate < $prevlogdate) | ||
| 41 | { | ||
| 42 | if($key =='userstatus') | ||
| 43 | { | ||
| 44 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where($key,'like',$value.'%'); | ||
| 45 | }else if($key=='fullname' || $key=='username') | ||
| 46 | { | ||
| 47 | $users=User::where($key,'like','%'.$value.'%')->get(); | ||
| 48 | |||
| 49 | foreach ($users as $user) { | ||
| 50 | //echo $user->id; | ||
| 51 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where('user_id','=',$user->id); | ||
| 52 | } | ||
| 53 | }else if($key != 'All') | ||
| 54 | { | ||
| 55 | //echo $key; | ||
| 56 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where($key,'like','%'.$value.'%'); | ||
| 57 | }else | ||
| 58 | { | ||
| 59 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 60 | } | ||
| 61 | |||
| 62 | } | ||
| 63 | else | ||
| 64 | { | ||
| 65 | if($key =='userstatus') | ||
| 66 | { | ||
| 67 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where($key,'like',$value.'%'); | ||
| 68 | }else if($key=='fullname' || $key=='username') | ||
| 69 | { | ||
| 70 | $users=User::where($key,'like','%'.$value.'%')->get(); | ||
| 71 | |||
| 72 | foreach ($users as $user) { | ||
| 73 | //echo $user->id; | ||
| 74 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where('user_id','=',$user->id); | ||
| 75 | } | ||
| 76 | }else if($key != 'All') | ||
| 77 | { | ||
| 78 | //echo $key; | ||
| 79 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset))->where($key,'like','%'.$value.'%'); | ||
| 80 | }else | ||
| 81 | { | ||
| 82 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 83 | } | ||
| 84 | |||
| 85 | |||
| 86 | //$alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate+$timeoffset))->where('created_at','<=',date("Y-m-d H:i:s",$logdateto+$timeoffset)); | ||
| 87 | //echo "2"; | ||
| 88 | } | ||
| 89 | |||
| 90 | |||
| 91 | /*if($key =='userstatus') | ||
| 92 | { | ||
| 93 | $alist-> where($key,'like',$value.'%'); | ||
| 94 | }else if($key=='fullname' || $key=='username') | ||
| 95 | { | ||
| 96 | $users=User::where($key,'like','%'.$value.'%')->get(); | ||
| 97 | |||
| 98 | foreach ($users as $user) { | ||
| 99 | //echo $user->id; | ||
| 100 | $alist->where('user_id','=',$user->id); | ||
| 101 | } | ||
| 102 | }else if($key != 'All') | ||
| 103 | { | ||
| 104 | //echo $key; | ||
| 105 | $alist->where($key,'like','%'.$value.'%'); | ||
| 106 | }else | ||
| 107 | { | ||
| 108 | $alist; | ||
| 109 | }*/ | ||
| 110 | |||
| 111 | //if(!$dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 112 | if($dashboarduser->usertype != 'Admin') | ||
| 113 | { | ||
| 114 | $uidlist=array($dashboarduser->id); | ||
| 115 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 116 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 117 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 118 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 119 | })->get(); | ||
| 120 | // ->where(function ($query) { | ||
| 121 | // $query->where('status', '=', 'Active'); | ||
| 122 | // })->get(); | ||
| 123 | |||
| 124 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 125 | |||
| 126 | |||
| 127 | $roclientstr=array();$didlinesstr=array(); | ||
| 128 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 129 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 130 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 131 | { | ||
| 132 | $roclientstr[]="$tclnt"; | ||
| 133 | |||
| 134 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 135 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 136 | } | ||
| 137 | |||
| 138 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 139 | $query//->orWhereIn('client',$roclientstr) | ||
| 140 | ->orWhereIn('user_id',$uidlist) | ||
| 141 | ->orWhereIn('did',$didlinesstr); | ||
| 142 | }); | ||
| 143 | |||
| 144 | } | ||
| 145 | |||
| 146 | if(Input::get('sort')=='cpu')$alist=$alist->orderBy("callSec","DESC"); | ||
| 147 | else $alist=$alist->orderBy("id","DESC"); | ||
| 148 | $alist=$alist->get(); | ||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | $userarr=array(); | ||
| 153 | $i=sizeof($alist);if(!empty($_GET['sort']))$i=1; | ||
| 154 | $totaltime=0;$ttlovr10=0;$ttlovr5=0;$ttlovr1=0;$ttlovr0=0;$outstr="";$usrcnt=0;$ttlin0=0; | ||
| 155 | $totaltimeIn=0;$ttlovr10In=0;$ttlovr5In=0;$ttlovr1In=0;$ttlovr0In=0;$usrcntIn=0;$ttloverin0=0; | ||
| 156 | $actionarr=array();$actionarrIn=array(); | ||
| 157 | |||
| 158 | $callarraid=''; | ||
| 159 | $crm_id=''; | ||
| 160 | foreach($alist as $aline) | ||
| 161 | { | ||
| 162 | |||
| 163 | $callarraid.=$aline->id.","; | ||
| 164 | if($aline->crm_id>0)$crm_id.=$aline->crm_id.","; | ||
| 165 | } | ||
| 166 | |||
| 167 | $callarraid=substr($callarraid,0,-1); | ||
| 168 | $callarraid=explode(",", $callarraid); | ||
| 169 | |||
| 170 | $crm_id=substr($crm_id,0,-1); | ||
| 171 | $crm_id=explode(",", $crm_id); | ||
| 172 | |||
| 173 | $alist_remark=DB::table('full_remark')->select('fullremark','call_id')->whereIn('call_id',$callarraid)->get(); | ||
| 174 | foreach($alist_remark as $aline) | ||
| 175 | { | ||
| 176 | $remarkval[$aline->call_id]=$aline->fullremark; | ||
| 177 | |||
| 178 | } | ||
| 179 | $clientcodearr=DB::table('records')->select('cust_id','id')->whereIn('id',$crm_id)->get(); | ||
| 180 | foreach ($clientcodearr as $clientid) | ||
| 181 | { | ||
| 182 | $clientcodeval[$clientid->id]=$clientid->cust_id; | ||
| 183 | //$currentstatusval[$clientid->id]=$clientid->currentstatus; | ||
| 184 | //$legalstatusval[$clientid->id]=$clientid->legalstatus; | ||
| 185 | } | ||
| 186 | |||
| 187 | if(Input::has("dllogxls")) | ||
| 188 | { | ||
| 189 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 190 | |||
| 191 | $inputFileType = "Excel5"; | ||
| 192 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 193 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 194 | $baseRow = 3; | ||
| 195 | |||
| 196 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 197 | $fieldsarr[$tcol++]='#'; | ||
| 198 | $fieldsarr[$tcol++]='Start'; | ||
| 199 | $fieldsarr[$tcol++]='Length'; | ||
| 200 | $fieldsarr[$tcol++]='User'; | ||
| 201 | $fieldsarr[$tcol++]='Name'; | ||
| 202 | $fieldsarr[$tcol++]='Dispo'; | ||
| 203 | $fieldsarr[$tcol++]='SubDispo'; | ||
| 204 | $fieldsarr[$tcol++]='CB'; | ||
| 205 | $fieldsarr[$tcol++]='Number'; | ||
| 206 | $fieldsarr[$tcol++]='ClientCode'; | ||
| 207 | $fieldsarr[$tcol++]='CurrentStatus'; | ||
| 208 | $fieldsarr[$tcol++]='LegalStatus'; | ||
| 209 | $fieldsarr[$tcol++]='Campaign'; | ||
| 210 | $fieldsarr[$tcol++]='Department'; | ||
| 211 | |||
| 212 | $fieldsarr[$tcol++]='State'; | ||
| 213 | $fieldsarr[$tcol++]='HSource'; | ||
| 214 | $fieldsarr[$tcol++]='Type'; | ||
| 215 | $fieldsarr[$tcol++]='Status'; | ||
| 216 | |||
| 217 | $fieldsarr[$tcol++]='StatusCode'; | ||
| 218 | $fieldsarr[$tcol++]='StatusStr'; | ||
| 219 | $fieldsarr[$tcol++]='DialLine'; | ||
| 220 | $fieldsarr[$tcol++]='DID'; | ||
| 221 | $fieldsarr[$tcol++]='WaitSec'; | ||
| 222 | $fieldsarr[$tcol++]='CallSec'; | ||
| 223 | $fieldsarr[$tcol++]='TalkSec'; | ||
| 224 | $fieldsarr[$tcol++]='DispoSec'; | ||
| 225 | $fieldsarr[$tcol++]='Remarks'; | ||
| 226 | |||
| 227 | $highestColumn = sizeof($fieldsarr); | ||
| 228 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 229 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 230 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]); | ||
| 231 | } | ||
| 232 | |||
| 233 | |||
| 234 | $ii=1; | ||
| 235 | foreach($alist as $aline) | ||
| 236 | { | ||
| 237 | $row = $baseRow++; | ||
| 238 | $col = 0; | ||
| 239 | |||
| 240 | |||
| 241 | $clientcode="";$currentstatus="";$legalstatus=""; | ||
| 242 | if($aline->crm_id>0) | ||
| 243 | { | ||
| 244 | /*$user=$wakka->getPerson($aline->crm_id); | ||
| 245 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 246 | $currentstatus=$user["peopledata"]["currentstatus"]; | ||
| 247 | $legalstatus=$user["peopledata"]["legalstatus"];*/ | ||
| 248 | |||
| 249 | $clientcode=$clientcodeval[$aline->crm_id]; | ||
| 250 | // $currentstatus=$currentstatusval[$aline->crm_id]; | ||
| 251 | // $legalstatus=$legalstatusval[$aline->crm_id]; | ||
| 252 | } | ||
| 253 | $tpostdata=json_decode($aline->data,true); | ||
| 254 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-$timeoffset); | ||
| 255 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 256 | //$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 257 | $length=gmdate("H:i:s",round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000)); | ||
| 258 | $fullremarkvalue=''; | ||
| 259 | $fullremarkvalue=$remarkval[$aline->id]; | ||
| 260 | if($fullremarkvalue=="") | ||
| 261 | { | ||
| 262 | $fullremarkvalue=$aline->userremarks; | ||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 267 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 268 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 269 | |||
| 270 | $recstr=''; | ||
| 271 | if($dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 272 | { | ||
| 273 | if(isset($tpostdata['recFolder']))$recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> </a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> </a><span id='recspan_".$aline->id."'</span>"; | ||
| 274 | } | ||
| 275 | |||
| 276 | |||
| 277 | |||
| 278 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++); | ||
| 279 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($fulldate); | ||
| 280 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($length); | ||
| 281 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($username); | ||
| 282 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($dispname); | ||
| 283 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->userstatus); | ||
| 284 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->usersubstatus); | ||
| 285 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(($aline->usercallback!="0000-00-00 00:00:00"?date("Y-m-d H:i:s",strtotime($aline->usercallback)-($timeoffset)):"")); | ||
| 286 | |||
| 287 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->number); | ||
| 288 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($clientcode); | ||
| 289 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($currentstatus); | ||
| 290 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($legalstatus); | ||
| 291 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->client); | ||
| 292 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->department); | ||
| 293 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->state); | ||
| 294 | |||
| 295 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->hsource); | ||
| 296 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->type); | ||
| 297 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->status); | ||
| 298 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->statuscode); | ||
| 299 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->substatus); | ||
| 300 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->dialline_id); | ||
| 301 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->did); | ||
| 302 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(gmdate("H:i:s",round($aline->waitSec/1000,2))); | ||
| 303 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(gmdate("H:i:s",round($aline->callSec/1000,2))); | ||
| 304 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(gmdate("H:i:s",round($talktime/1000,2))); | ||
| 305 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(gmdate("H:i:s",round($aline->dispoSec/1000,2))); | ||
| 306 | /*$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->userremarks);*/ | ||
| 307 | /*$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->fullremark);*/ | ||
| 308 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($fullremarkvalue); | ||
| 309 | |||
| 310 | $userdata=json_decode($aline->userdata,true); | ||
| 311 | $extravals=$extrahdrarr; | ||
| 312 | if(!empty($userdata)) | ||
| 313 | { | ||
| 314 | foreach($userdata as $key=>$val) | ||
| 315 | { | ||
| 316 | if(!isset($extrahdrarr[$key])) | ||
| 317 | { | ||
| 318 | $extrahdrarr[$key]=""; | ||
| 319 | $extravals[$key]=""; | ||
| 320 | |||
| 321 | $colstr=PHPExcel_Cell::stringFromColumnIndex(sizeof($fieldsarr)+sizeof($extrahdrarr)); | ||
| 322 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $key); | ||
| 323 | } | ||
| 324 | $extravals[$key]=$val; | ||
| 325 | } | ||
| 326 | foreach($extravals as $key=>$val) | ||
| 327 | { | ||
| 328 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($val); | ||
| 329 | } | ||
| 330 | } | ||
| 331 | } | ||
| 332 | |||
| 333 | |||
| 334 | header('Content-Type: application/vnd.ms-excel'); | ||
| 335 | header('Content-Disposition: attachment;filename="CallLog.xls"'); | ||
| 336 | header('Cache-Control: max-age=0'); | ||
| 337 | |||
| 338 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 339 | $objWriter->save('php://output'); | ||
| 340 | |||
| 341 | return ; | ||
| 342 | } | ||
| 343 | |||
| 344 | |||
| 345 | |||
| 346 | foreach($alist as $aline) | ||
| 347 | { | ||
| 348 | $clientcode=""; | ||
| 349 | |||
| 350 | if($aline->crm_id>0) | ||
| 351 | { | ||
| 352 | /*$user=$wakka->getPerson($aline->crm_id); | ||
| 353 | $clientcode=$user["peopledata"]["clientcode"];*/ | ||
| 354 | |||
| 355 | $clientcode=$clientcodeval[$aline->crm_id]; | ||
| 356 | } | ||
| 357 | $tpostdata=json_decode($aline->data,true); | ||
| 358 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($timeoffset)); | ||
| 359 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 360 | //$length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 361 | |||
| 362 | $length=gmdate("H:i:s",round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2)); | ||
| 363 | |||
| 364 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 365 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 366 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 367 | |||
| 368 | $recstr=''; | ||
| 369 | if($dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 370 | { | ||
| 371 | if(isset($tpostdata['recFolder']))$recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> </a> <a href='dialer/playrecfile?calllog=$aline->id&out=wav' title=''><i class='fa fa-download'></i> </a><span id='recspan_".$aline->id."'</span>"; | ||
| 372 | } | ||
| 373 | |||
| 374 | $outstr.="<tr><td>".$i."</td> | ||
| 375 | <td title='$fulldate'>".$fulldate."</td> | ||
| 376 | <td>".$length."</td> | ||
| 377 | <td>".$username."</td> | ||
| 378 | <td>".$dispname."</td> | ||
| 379 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 380 | <td>".$aline->usersubstatus."</td> | ||
| 381 | <td>".($aline->usercallback!="0000-00-00 00:00:00"?date("Y-m-d H:i:s",strtotime($aline->usercallback)+($dashboarduser->timezone*60)):"")."</td>"; | ||
| 382 | |||
| 383 | //onclick call disable for the manual mode is not assign to user code by prashant Jadhav | ||
| 384 | |||
| 385 | if(in_array('Manual',$userdialmode)) | ||
| 386 | { | ||
| 387 | /*$outstr.="<td><a href=# class='' onclick='dialerQuickOpen(\"$aline->crm_id\",\"$aline->number\",\"Manual\",\"\",0);return false;'>".$aline->number."</a></td>";*/ | ||
| 388 | $outstr.="<td>$aline->number</td>"; | ||
| 389 | } | ||
| 390 | else | ||
| 391 | { | ||
| 392 | $outstr.="<td><a href=# class='' return false;'>".$aline->number."</a></td>"; | ||
| 393 | } | ||
| 394 | $outstr.="<td>$clientcode</td> | ||
| 395 | <td>".$aline->client."</td> | ||
| 396 | <td>".$aline->department."</td> | ||
| 397 | <td>".$aline->state."</td> | ||
| 398 | <td>".$aline->hsource."</td> | ||
| 399 | <td>".$aline->type."</td> | ||
| 400 | <td>".$aline->status."</td> | ||
| 401 | <td>".$aline->substatus."</td> | ||
| 402 | <td>".$aline->dialline_id."</td> | ||
| 403 | <td>".$aline->did."</td> | ||
| 404 | <td>".gmdate("H:i:s",round($aline->waitSec/1000,2))."</td> | ||
| 405 | <td>".gmdate("H:i:s",round($aline->callSec/1000,2))."</td> | ||
| 406 | <td>".gmdate("H:i:s",round($talktime/1000,2))."</td> | ||
| 407 | <td>".gmdate("H:i:s",round($aline->dispoSec/1000,2))."</td> | ||
| 408 | <td>$recstr</td> | ||
| 409 | </tr>"; | ||
| 410 | |||
| 411 | |||
| 412 | if($aline->type=='Inbound') | ||
| 413 | { | ||
| 414 | if($talktime>120000)$ttlovr10In++; | ||
| 415 | else if($talktime>60000)$ttlovr5In++; | ||
| 416 | else if($talktime>30000)$ttlovr1In++; | ||
| 417 | else if($talktime>1000)$ttlovr0In++; | ||
| 418 | else $ttloverin0++; | ||
| 419 | |||
| 420 | $totaltimeIn+=round($talktime/1000,2); | ||
| 421 | $usrcntIn++; | ||
| 422 | |||
| 423 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 424 | if(!isset($actionarrIn[$turl]))$actionarrIn[$turl]=array('cnt'=>0,'time'=>0); | ||
| 425 | $actionarrIn[$turl]['cnt']++; | ||
| 426 | $actionarrIn[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 427 | } | ||
| 428 | else | ||
| 429 | { | ||
| 430 | if($talktime>120000)$ttlovr10++; | ||
| 431 | else if($talktime>60000)$ttlovr5++; | ||
| 432 | else if($talktime>30000)$ttlovr1++; | ||
| 433 | else if($talktime>1000)$ttlovr0++; | ||
| 434 | else $ttlin0++; | ||
| 435 | |||
| 436 | |||
| 437 | |||
| 438 | $totaltime+=round($talktime/1000,2); | ||
| 439 | $usrcnt++; | ||
| 440 | |||
| 441 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 442 | if(!isset($actionarr[$turl]))$actionarr[$turl]=array('cnt'=>0,'time'=>0); | ||
| 443 | $actionarr[$turl]['cnt']++; | ||
| 444 | $actionarr[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 445 | } | ||
| 446 | |||
| 447 | |||
| 448 | |||
| 449 | if(!empty($_GET['sort']))$i++;else $i--; | ||
| 450 | } | ||
| 451 | ?> | ||
| 452 | |||
| 453 | |||
| 454 | |||
| 455 | <div class=innerAll> | ||
| 456 | |||
| 457 | |||
| 458 | |||
| 459 | |||
| 460 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 461 | <script> | ||
| 462 | function showExtraPost(varstr) | ||
| 463 | { | ||
| 464 | doAjax("hr?action=LiveUsers","getpostdata="+varstr,"dialoglog"); | ||
| 465 | |||
| 466 | $('#dialoglog').dialog('open'); | ||
| 467 | return false; | ||
| 468 | } | ||
| 469 | |||
| 470 | $(document).ready(function() | ||
| 471 | { | ||
| 472 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 473 | { | ||
| 474 | $('#dialoglog').dialog({ | ||
| 475 | autoOpen: false, | ||
| 476 | width: '70%', | ||
| 477 | buttons: { | ||
| 478 | "Ok": function() { | ||
| 479 | $(this).dialog("close"); | ||
| 480 | }, | ||
| 481 | "Cancel": function() { | ||
| 482 | $(this).dialog("close"); | ||
| 483 | } | ||
| 484 | } | ||
| 485 | }); | ||
| 486 | } | ||
| 487 | |||
| 488 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 489 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 490 | }); | ||
| 491 | </script> | ||
| 492 | <div> | ||
| 493 | |||
| 494 | <select id="crmCol" style="border:1px solid #efefef;"> | ||
| 495 | <option>All</option> | ||
| 496 | <option value="userstatus">Disposition</option> | ||
| 497 | <option value="usersubstatus">Sub-Disposition</option> | ||
| 498 | <option value="number">Number</option> | ||
| 499 | <option value="client">Campaign</option> | ||
| 500 | <option value="did">DID</option> | ||
| 501 | <option value="type">Type</option> | ||
| 502 | <option value="fullname">Name</option> | ||
| 503 | <option value="username">User</option> | ||
| 504 | |||
| 505 | </select> | ||
| 506 | <input id=filter name="filter" type="text"> | ||
| 507 | <script type="text/javascript"> | ||
| 508 | document.getElementById('crmCol').value = "<?php echo $key;?>"; | ||
| 509 | document.getElementById('filter').value = "<?php echo $value;?>"; | ||
| 510 | </script> | ||
| 511 | |||
| 512 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' /> | ||
| 513 | Time From:<select id="modtime" style="border:1px solid #efefef;"> | ||
| 514 | <?php | ||
| 515 | foreach (range(0,23) as $hour) { | ||
| 516 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 517 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 518 | } | ||
| 519 | ?> | ||
| 520 | </select> | ||
| 521 | To: <select id="modtimeto" style="border:1px solid #efefef;"> | ||
| 522 | <?php | ||
| 523 | foreach (range(0,23) as $hour) { | ||
| 524 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 525 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 526 | } | ||
| 527 | ?> | ||
| 528 | </select> | ||
| 529 | <button id="load" onclick='callLogReloadFun("");return false;' value='Submit'>Submit</button> | ||
| 530 | |||
| 531 | </div> | ||
| 532 | <div style="float:right;width:30%"> | ||
| 533 | |||
| 534 | <?php if(Auth::user()->username=='admin'){ ?> | ||
| 535 | <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> | ||
| 536 | <?php } ?> | ||
| 537 | </div> | ||
| 538 | <div style="clear:both"></div> | ||
| 539 | <hr> | ||
| 540 | |||
| 541 | <?php | ||
| 542 | $categories=array();$avgarr=array();$cntarr=array(); | ||
| 543 | foreach($actionarr as $act=>$actarr) | ||
| 544 | { | ||
| 545 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 546 | { | ||
| 547 | //echo "<label>$act</label> ".round($actarr['time']/$actarr['cnt'],2)." [".round($actarr[time],1)."/$actarr[cnt]]<br>"; | ||
| 548 | |||
| 549 | $categories[]="'$act'"; | ||
| 550 | $avgarr[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 551 | $cntarr[]=$actarr['cnt']; | ||
| 552 | } | ||
| 553 | } | ||
| 554 | |||
| 555 | array_multisort($cntarr,$avgarr,$categories); | ||
| 556 | |||
| 557 | |||
| 558 | |||
| 559 | $categoriesIn=array();$avgarrIn=array();$cntarrIn=array(); | ||
| 560 | foreach($actionarrIn as $act=>$actarr) | ||
| 561 | { | ||
| 562 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 563 | { | ||
| 564 | //echo "<label>$act</label> ".round($actarr['time']/$actarr['cnt'],2)." [".round($actarr[time],1)."/$actarr[cnt]]<br>"; | ||
| 565 | |||
| 566 | $categoriesIn[]="'$act'"; | ||
| 567 | $avgarrIn[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 568 | $cntarrIn[]=$actarr['cnt']; | ||
| 569 | } | ||
| 570 | } | ||
| 571 | |||
| 572 | array_multisort($cntarrIn,$avgarrIn,$categoriesIn); | ||
| 573 | ?> | ||
| 574 | |||
| 575 | |||
| 576 | <div class=col-md-3> | ||
| 577 | <br> | ||
| 578 | <h5>Stats - Outbound</h5><hr><br> | ||
| 579 | |||
| 580 | <ul style="list-style:none"> | ||
| 581 | <li class="notify_alert"> | ||
| 582 | <span><a href=# onclick="return false;">Total CallTime</a></span> | ||
| 583 | <span class="label label-small label-default pull-right" >{!!round($totaltime,2)!!}</span> | ||
| 584 | </li> | ||
| 585 | <li class="notify_alert"> | ||
| 586 | <span><a href=# onclick="return false;">Total Calls</a></span> | ||
| 587 | <span class="label label-small label-default pull-right" >{!!$usrcnt!!}</span> | ||
| 588 | </li> | ||
| 589 | <li class="notify_alert"> | ||
| 590 | <span><a href=# onclick="return false;">Average CallTime</a></span> | ||
| 591 | <span class="label label-small label-default pull-right" >{!!($usrcnt>0)?round($totaltime/$usrcnt,2):'0'!!}</span> | ||
| 592 | </li> | ||
| 593 | |||
| 594 | <li class="notify_alert"> | ||
| 595 | <span><a href=# onclick="return false;">Calls > 2 Min</a></span> | ||
| 596 | <span class="label label-small label-default pull-right" >{!!$ttlovr10!!}</span> | ||
| 597 | </li> | ||
| 598 | <li class="notify_alert"> | ||
| 599 | <span><a href=# onclick="return false;">Calls > 60 to 120 sec</a></span> | ||
| 600 | <span class="label label-small label-default pull-right" >{!!$ttlovr5!!}</span> | ||
| 601 | </li> | ||
| 602 | <li class="notify_alert"> | ||
| 603 | <span><a href=# onclick="return false;">Calls 31 to 60 sec</a></span> | ||
| 604 | <span class="label label-small label-default pull-right" >{!!$ttlovr1!!}</span> | ||
| 605 | </li> | ||
| 606 | <li class="notify_alert"> | ||
| 607 | <span><a href=# onclick="return false;">Calls 1 to 30 sec</a></span> | ||
| 608 | <span class="label label-small label-default pull-right" >{!!$ttlovr0!!}</span> | ||
| 609 | </li> | ||
| 610 | <li class="notify_alert"> | ||
| 611 | <span><a href=# onclick="return false;">Calls < 1 sec</a></span> | ||
| 612 | <span class="label label-small label-default pull-right" >{!!$ttlin0!!}</span> | ||
| 613 | </li> | ||
| 614 | |||
| 615 | |||
| 616 | </ul> | ||
| 617 | |||
| 618 | </div> | ||
| 619 | <!-- div class=col-md-10> | ||
| 620 | |||
| 621 | |||
| 622 | <div id=userlogschart1 style='min-height:300px;height:<?php echo sizeof($categories)*18; ?>px;width:100%'></div> | ||
| 623 | <script> | ||
| 624 | $(function () { | ||
| 625 | var categories = [<?php echo implode(",",$categories); ?>]; | ||
| 626 | $(document).ready(function () { | ||
| 627 | var userchart1=new Highcharts.Chart({ | ||
| 628 | chart: { | ||
| 629 | renderTo: 'userlogschart1', | ||
| 630 | type: 'bar' | ||
| 631 | }, | ||
| 632 | title: { | ||
| 633 | text: 'User Actions by Avg time and Usages' | ||
| 634 | }, | ||
| 635 | xAxis: [{ | ||
| 636 | categories: categories, | ||
| 637 | reversed: false, | ||
| 638 | labels: { | ||
| 639 | step: 1 | ||
| 640 | } | ||
| 641 | }, { // mirror axis on right side | ||
| 642 | opposite: true, | ||
| 643 | reversed: false, | ||
| 644 | categories: categories, | ||
| 645 | linkedTo: 0, | ||
| 646 | labels: { | ||
| 647 | //step: 1 | ||
| 648 | formatter: function () { | ||
| 649 | return ''; | ||
| 650 | } | ||
| 651 | } | ||
| 652 | }], | ||
| 653 | yAxis: { | ||
| 654 | // title: { | ||
| 655 | // text: null | ||
| 656 | // }, | ||
| 657 | // labels: { | ||
| 658 | // formatter: function () { | ||
| 659 | // return (Math.abs(this.value) / 1000000) + 'M'; | ||
| 660 | // } | ||
| 661 | // }, | ||
| 662 | // min: -4000000, | ||
| 663 | // max: 4000000 | ||
| 664 | }, | ||
| 665 | |||
| 666 | plotOptions: { | ||
| 667 | series: { | ||
| 668 | stacking: 'normal' | ||
| 669 | } | ||
| 670 | }, | ||
| 671 | |||
| 672 | tooltip: { | ||
| 673 | formatter: function () { | ||
| 674 | return '<b>' + this.series.name + ' ' + this.point.category + '</b><br/>' + | ||
| 675 | 'Val: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0); | ||
| 676 | } | ||
| 677 | }, | ||
| 678 | |||
| 679 | series: [{ | ||
| 680 | name: 'Avg Time', | ||
| 681 | data: [<?php echo implode(",",$avgarr); ?>] | ||
| 682 | }, { | ||
| 683 | name: 'Count', | ||
| 684 | data: [<?php echo implode(",",$cntarr); ?>] | ||
| 685 | }] | ||
| 686 | }); | ||
| 687 | }); | ||
| 688 | |||
| 689 | }); | ||
| 690 | |||
| 691 | function callLogReloadFun(sortby) | ||
| 692 | { | ||
| 693 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 694 | |||
| 695 | doAjax('dialer/calllog?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 696 | } | ||
| 697 | function getCallRec(id) | ||
| 698 | { | ||
| 699 | doAjax("dialer/calllog","getCallRec=1&calllog="+id+"&logdate="+$("#modfrom").val(),'recspan_'+id,'rec_ajax','singlefail','GET'); | ||
| 700 | } | ||
| 701 | function dlCalllogXls() | ||
| 702 | { | ||
| 703 | window.open('dialer/calllog?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 704 | } | ||
| 705 | </script> | ||
| 706 | |||
| 707 | </div --> | ||
| 708 | |||
| 709 | <script> | ||
| 710 | function dataString() | ||
| 711 | { | ||
| 712 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logtimeto='+$("#modtimeto").val()+'&key='+$("#crmCol").val()+'&value='+$("#filter").val(); | ||
| 713 | } | ||
| 714 | |||
| 715 | function callLogReloadFun(sortby) | ||
| 716 | { | ||
| 717 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 718 | var searchStr = dataString(); | ||
| 719 | doAjax('dialer/calllog?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 720 | } | ||
| 721 | function getCallRec(id) | ||
| 722 | { | ||
| 723 | doAjax("dialer/calllog","getCallRec=1&calllog="+id+"&logdate="+$("#modfrom").val(),'recspan_'+id,'rec_ajax','singlefail','GET'); | ||
| 724 | } | ||
| 725 | function dlCalllogXls() | ||
| 726 | { | ||
| 727 | var searchStr = dataString(); | ||
| 728 | window.open('dialer/calllog?dllogxls=1&'+searchStr);return false; | ||
| 729 | |||
| 730 | } | ||
| 731 | |||
| 732 | </script> | ||
| 733 | |||
| 734 | <div style='clear:both'></div> | ||
| 735 | |||
| 736 | |||
| 737 | <div class=col-md-3> | ||
| 738 | <br> | ||
| 739 | <h5>Stats - Inbound</h5><hr><br> | ||
| 740 | |||
| 741 | <ul style="list-style:none"> | ||
| 742 | <li class="notify_alert"> | ||
| 743 | <span><a href=# onclick="return false;">Total CallTime</a></span> | ||
| 744 | <span class="label label-small label-default pull-right" >{!!round($totaltimeIn,2)!!}</span> | ||
| 745 | </li> | ||
| 746 | <li class="notify_alert"> | ||
| 747 | <span><a href=# onclick="return false;">Total Calls</a></span> | ||
| 748 | <span class="label label-small label-default pull-right" >{!!$usrcntIn!!}</span> | ||
| 749 | </li> | ||
| 750 | <li class="notify_alert"> | ||
| 751 | <span><a href=# onclick="return false;">Average CallTime</a></span> | ||
| 752 | <span class="label label-small label-default pull-right" >{!!($usrcntIn>0)?round($totaltimeIn/$usrcntIn,2):'0'!!}</span> | ||
| 753 | </li> | ||
| 754 | |||
| 755 | <li class="notify_alert"> | ||
| 756 | <span><a href=# onclick="return false;">Calls > 2 Min </a></span> | ||
| 757 | <span class="label label-small label-default pull-right" >{!!$ttlovr10In!!}</span> | ||
| 758 | </li> | ||
| 759 | <li class="notify_alert"> | ||
| 760 | <span><a href=# onclick="return false;">Calls 61 to 120 sec</a></span> | ||
| 761 | <span class="label label-small label-default pull-right" >{!!$ttlovr5In!!}</span> | ||
| 762 | </li> | ||
| 763 | <li class="notify_alert"> | ||
| 764 | <span><a href=# onclick="return false;">Calls 31 to 60 sec</a></span> | ||
| 765 | <span class="label label-small label-default pull-right" >{!!$ttlovr1In!!}</span> | ||
| 766 | </li> | ||
| 767 | <li class="notify_alert"> | ||
| 768 | <span><a href=# onclick="return false;">Calls 1 sec to 30 sec</a></span> | ||
| 769 | <span class="label label-small label-default pull-right" >{!!$ttlovr0In!!}</span> | ||
| 770 | </li> | ||
| 771 | <li class="notify_alert"> | ||
| 772 | <span><a href=# onclick="return false;">Calls < 1 sec</a></span> | ||
| 773 | <span class="label label-small label-default pull-right" >{!!$ttloverin0!!}</span> | ||
| 774 | </li> | ||
| 775 | </ul> | ||
| 776 | |||
| 777 | </div> | ||
| 778 | <!-- div class=col-md-10> | ||
| 779 | |||
| 780 | |||
| 781 | <div id=userlogschart2 style='min-height:300px;height:<?php echo sizeof($categoriesIn)*18; ?>px;width:100%'></div> | ||
| 782 | <script> | ||
| 783 | $(function () { | ||
| 784 | var categories = [<?php echo implode(",",$categoriesIn); ?>]; | ||
| 785 | $(document).ready(function () { | ||
| 786 | var userchart1=new Highcharts.Chart({ | ||
| 787 | chart: { | ||
| 788 | renderTo: 'userlogschart2', | ||
| 789 | type: 'bar' | ||
| 790 | }, | ||
| 791 | title: { | ||
| 792 | text: 'User Actions by Avg time and Usages' | ||
| 793 | }, | ||
| 794 | xAxis: [{ | ||
| 795 | categories: categories, | ||
| 796 | reversed: false, | ||
| 797 | labels: { | ||
| 798 | step: 1 | ||
| 799 | } | ||
| 800 | }, { // mirror axis on right side | ||
| 801 | opposite: true, | ||
| 802 | reversed: false, | ||
| 803 | categories: categories, | ||
| 804 | linkedTo: 0, | ||
| 805 | labels: { | ||
| 806 | //step: 1 | ||
| 807 | formatter: function () { | ||
| 808 | return ''; | ||
| 809 | } | ||
| 810 | } | ||
| 811 | }], | ||
| 812 | yAxis: { | ||
| 813 | // title: { | ||
| 814 | // text: null | ||
| 815 | // }, | ||
| 816 | // labels: { | ||
| 817 | // formatter: function () { | ||
| 818 | // return (Math.abs(this.value) / 1000000) + 'M'; | ||
| 819 | // } | ||
| 820 | // }, | ||
| 821 | // min: -4000000, | ||
| 822 | // max: 4000000 | ||
| 823 | }, | ||
| 824 | |||
| 825 | plotOptions: { | ||
| 826 | series: { | ||
| 827 | stacking: 'normal' | ||
| 828 | } | ||
| 829 | }, | ||
| 830 | |||
| 831 | tooltip: { | ||
| 832 | formatter: function () { | ||
| 833 | return '<b>' + this.series.name + ' ' + this.point.category + '</b><br/>' + | ||
| 834 | 'Val: ' + Highcharts.numberFormat(Math.abs(this.point.y), 0); | ||
| 835 | } | ||
| 836 | }, | ||
| 837 | |||
| 838 | series: [{ | ||
| 839 | name: 'Avg Time', | ||
| 840 | data: [<?php echo implode(",",$avgarrIn); ?>] | ||
| 841 | }, { | ||
| 842 | name: 'Count', | ||
| 843 | data: [<?php echo implode(",",$cntarrIn); ?>] | ||
| 844 | }] | ||
| 845 | }); | ||
| 846 | }); | ||
| 847 | |||
| 848 | }); | ||
| 849 | |||
| 850 | </script> | ||
| 851 | |||
| 852 | </div --> | ||
| 853 | |||
| 854 | <div style='clear:both'></div> | ||
| 855 | |||
| 856 | <div style='overflow:auto'> | ||
| 857 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 858 | <thead> | ||
| 859 | <tr> | ||
| 860 | <th>#</th> | ||
| 861 | <th>Start</th> | ||
| 862 | <th onclick='callLogReloadFun("");return false;'>Length</th> | ||
| 863 | <th>User</th> | ||
| 864 | <th>Name</th> | ||
| 865 | <th>Dispo</th> | ||
| 866 | <th>SubDispo</th> | ||
| 867 | <th>CB</th> | ||
| 868 | <th style='width:120px'>Number</th> | ||
| 869 | <th>ClientCode</th> | ||
| 870 | <th>Campaign</th> | ||
| 871 | <th>Department</th> | ||
| 872 | <th>State</th> | ||
| 873 | <th>HSource</th> | ||
| 874 | <th>Type</th> | ||
| 875 | <th>Status</th> | ||
| 876 | |||
| 877 | <th>StatusStr</th> | ||
| 878 | <th>DialLine</th> | ||
| 879 | <th>DID</th> | ||
| 880 | <th>WaitSec</th> | ||
| 881 | <th>CallSec</th> | ||
| 882 | <th>TalkSec</th> | ||
| 883 | <th>DispoSec</th> | ||
| 884 | <th>Recording</th> | ||
| 885 | </tr> | ||
| 886 | </thead> | ||
| 887 | <?php echo $outstr; ?> | ||
| 888 | </table> | ||
| 889 | </div> | ||
| 890 | <?php | ||
| 891 | function convert($size) | ||
| 892 | { | ||
| 893 | $unit=array('b','kb','mb','gb','tb','pb'); | ||
| 894 | return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | ||
| 895 | } | ||
| 896 | |||
| 897 | echo "<br>".convert(memory_get_peak_usage(true)); // 123 kb | ||
| 898 | |||
| 899 | |||
| 900 | ?> | ||
| 901 | <div id=dialoglog></div> | ||
| 902 | |||
| 903 | |||
| 904 | |||
| 905 | |||
| 906 | |||
| 907 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | use App\Models\SupervisonComments; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | |||
| 10 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 11 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 12 | |||
| 13 | if(isset($_GET['logtodate']))$logtodate=strtotime($_GET['logtodate']." 23:59:59"); | ||
| 14 | else $logtodate=strtotime(date('Y-m-d')." 23:59:59"); | ||
| 15 | |||
| 16 | $userarr=array();$i=1; | ||
| 17 | $reporthead=array("id","created_at","updated_at","clientcode","supvisor_id","supvisor_recommends","agent","agent_comments"); | ||
| 18 | |||
| 19 | $reportarray=DB::table('supervisor_comments')->select('*')->where('updated_at','>=',date("Y-m-d H:i:s",$logdate))->where('updated_at','<=',date("Y-m-d H:i:s",$logtodate))->get(); | ||
| 20 | |||
| 21 | if(Input::has("dllogxls")) | ||
| 22 | { | ||
| 23 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 24 | |||
| 25 | $inputFileType = "Excel5"; | ||
| 26 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 27 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 28 | $baseRow = 2; | ||
| 29 | |||
| 30 | $highestColumn = sizeof($reporthead); | ||
| 31 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 32 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 33 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 34 | } | ||
| 35 | |||
| 36 | foreach($reportarray as $uid=>$uarr) | ||
| 37 | { | ||
| 38 | $row = $baseRow++; | ||
| 39 | $col = 0; | ||
| 40 | |||
| 41 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 42 | if($reporthead[$head]=="created_at") | ||
| 43 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 44 | |||
| 45 | if($reporthead[$head]=="updated_at") | ||
| 46 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 47 | |||
| 48 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 49 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$reporthead[$head]); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | header('Content-Type: application/vnd.ms-excel'); | ||
| 55 | header('Content-Disposition: attachment;filename="CallManagement.xls"'); | ||
| 56 | header('Cache-Control: max-age=0'); | ||
| 57 | |||
| 58 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 59 | $objWriter->save('php://output'); | ||
| 60 | |||
| 61 | return ; | ||
| 62 | } | ||
| 63 | |||
| 64 | ?> | ||
| 65 | |||
| 66 | |||
| 67 | <div class=innerAll> | ||
| 68 | |||
| 69 | |||
| 70 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 71 | <script> | ||
| 72 | $(document).ready(function() | ||
| 73 | { | ||
| 74 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 75 | { | ||
| 76 | $('#dialoglog').dialog({ | ||
| 77 | autoOpen: false, | ||
| 78 | width: '70%', | ||
| 79 | buttons: { | ||
| 80 | "Ok": function() { | ||
| 81 | $(this).dialog("close"); | ||
| 82 | }, | ||
| 83 | "Cancel": function() { | ||
| 84 | $(this).dialog("close"); | ||
| 85 | } | ||
| 86 | } | ||
| 87 | }); | ||
| 88 | } | ||
| 89 | |||
| 90 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 91 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 92 | |||
| 93 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 94 | }); | ||
| 95 | </script> | ||
| 96 | <div style="float:left;width:50%"> | ||
| 97 | |||
| 98 | From : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' /> | ||
| 99 | To : <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logtodate); ?>' /> | ||
| 100 | |||
| 101 | </div> | ||
| 102 | <div style="float:right;width:50%"> | ||
| 103 | |||
| 104 | |||
| 105 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 106 | |||
| 107 | </div> | ||
| 108 | <div style="clear:both"></div> | ||
| 109 | <hr> | ||
| 110 | |||
| 111 | <div class=col-md-12> | ||
| 112 | |||
| 113 | |||
| 114 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 115 | </div> | ||
| 116 | |||
| 117 | <script> | ||
| 118 | function dlAgentlogXls() | ||
| 119 | { | ||
| 120 | window.open('dialer/callmanagement?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val());return false; | ||
| 121 | } | ||
| 122 | </script> | ||
| 123 | |||
| 124 | <div style='clear:both'></div> | ||
| 125 | |||
| 126 | <div class=col-md-12> | ||
| 127 | |||
| 128 | |||
| 129 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 130 | |||
| 131 | </div> | ||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | <div style='clear:both'></div> | ||
| 136 | |||
| 137 | <div style='overflow:auto'> | ||
| 138 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 139 | <thead> | ||
| 140 | <?php /*echo $outhead;*/ ?> | ||
| 141 | </thead> | ||
| 142 | <?php /*echo $outstr;*/ ?> | ||
| 143 | </table> | ||
| 144 | </div> | ||
| 145 | |||
| 146 | <div id=dialoglog></div> | ||
| 147 | |||
| 148 | |||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | </div> |
| 1 | <?php | ||
| 2 | $reportTitle = 'Campaign Wise Report'; | ||
| 3 | $returnblade = 'campaignreport'; | ||
| 4 | |||
| 5 | $view_path = Config::get('view.paths'); | ||
| 6 | include_once($view_path[0].'/layout/module/dialer/reporthead.blade.php'); | ||
| 7 | |||
| 8 | $alist1=$alist; | ||
| 9 | |||
| 10 | //$alist=$alist->whereIn('c.userstatus',array('Interested', 'Reprised', 'No contact', 'Not Interested', 'Not Eligible', 'FollowUp')); | ||
| 11 | $alist=$alist->get(); | ||
| 12 | //$alist1=$alist1->whereIn('c.userstatus',array('Not Interested', 'Not Eligible')); | ||
| 13 | $alist1=$alist1->groupBy('c.userstatus', 'c.id'); | ||
| 14 | $alist1=$alist1->get(); | ||
| 15 | |||
| 16 | $i=1; | ||
| 17 | $reporthead=array("#","Campaign","Data Received","Callable Data","Data Utilised","Attempts","Intensity","Contacts","Not Interested","Not Eligible","FollowUp","Reprised","No contact","Lead Count","Lead Value","Contacts%","Not Interested%","Not Eligible%"); | ||
| 18 | $reporthead1=array("Campaign Name", "Grand Total"); | ||
| 19 | $reportarray=$reportarray1=array(); | ||
| 20 | if(count($alist)) | ||
| 21 | foreach($alist as $aline) | ||
| 22 | { | ||
| 23 | $arraykey = $aline->client; | ||
| 24 | |||
| 25 | if(!isset($reportarray[$arraykey]))$reportarray[$arraykey]=array("#"=>$i++,"Campaign"=>$aline->client,"Data Received"=>0,"Callable Data"=>0,"Data Utilised"=>0,"Attempts"=>0,"Intensity"=>0,"Contacts"=>0,"Not Interested"=>0,"Not Eligible"=>0,"FollowUp"=>0,"Lead Count"=>0,"Lead Value"=>0,"Contacts%"=>0,"Not Interested%"=>0,"Not Eligible%"=>0,"Customer_lists"=>array()); | ||
| 26 | |||
| 27 | if(!is_null($aline->crm_id)) { | ||
| 28 | $reportarray[$arraykey]["Customer_lists"][] = $aline->crm_id; | ||
| 29 | } | ||
| 30 | $reportarray[$arraykey]["Callable Data"] = count(array_unique($reportarray[$arraykey]["Customer_lists"])); | ||
| 31 | $reportarray[$arraykey]["Data Utilised"] = count(array_unique($reportarray[$arraykey]["Customer_lists"])); | ||
| 32 | $reportarray[$arraykey]["Attempts"]++; | ||
| 33 | |||
| 34 | if(stristr($aline->dialer_status,'Not Contactable') == ""){print_r($aline->dialer_status);echo "<br>"; | ||
| 35 | $reportarray[$arraykey]["Contacts"] = array(); | ||
| 36 | $reportarray[$arraykey]["Contacts"][] = $aline->crm_id; | ||
| 37 | $reportarray[$arraykey]["Contacts"]=count(array_unique($reportarray[$arraykey]["Contacts"])); | ||
| 38 | } | ||
| 39 | |||
| 40 | $reportarray[$arraykey][$aline->dialer_status]++; | ||
| 41 | |||
| 42 | if($aline->dialer_status == 'Interested') { | ||
| 43 | //$ststr=str_replace('Top up ', '', $aline->usersubstatus); | ||
| 44 | //$reportarray[$arraykey][$aline->usersubstatus]++; | ||
| 45 | $reportarray[$arraykey]['Lead Count']++; | ||
| 46 | } | ||
| 47 | |||
| 48 | $ststr= $aline->client; | ||
| 49 | $reportarray[$arraykey][$ststr]++; | ||
| 50 | |||
| 51 | /* if($aline->userstatus == 'Interested') { | ||
| 52 | $ststr=str_replace('Top up ', '', $aline->usersubstatus); | ||
| 53 | $reportarray[$arraykey][$ststr]++; | ||
| 54 | } */ | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | } | ||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | $highestColumn = sizeof($reporthead); | ||
| 63 | if(count($reportarray)) { | ||
| 64 | $outhead="<tr>";$outstr=""; | ||
| 65 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 66 | if($reporthead[$head] == '#' && false) { | ||
| 67 | $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>"; | ||
| 68 | $outhead.="<td>".$mode_str."</td>"; | ||
| 69 | } | ||
| 70 | else { | ||
| 71 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | $outhead.="</tr>"; | ||
| 75 | $utotalarr = array("Campaign"=>'Total'); | ||
| 76 | foreach($reportarray as $uid=>$uarr) | ||
| 77 | { | ||
| 78 | $outstr.="<tr>"; | ||
| 79 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 80 | if($head < 2) { | ||
| 81 | $data_str = $uarr[$reporthead[$head]]; | ||
| 82 | } | ||
| 83 | elseif($head == 6) { | ||
| 84 | $data_str = ($uarr[$reporthead[4]] > 0) ? number_format(@($uarr[$reporthead[5]]/$uarr[$reporthead[4]]), 2 ) : ''; | ||
| 85 | } | ||
| 86 | elseif($head == 15) { | ||
| 87 | $data_str = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[7]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 88 | } | ||
| 89 | elseif($head == 16) { | ||
| 90 | $data_str = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[8]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 91 | } | ||
| 92 | elseif($head == 17) { | ||
| 93 | $data_str = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[9]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 94 | } | ||
| 95 | elseif($head < 50) { | ||
| 96 | $data_str = $uarr[$reporthead[$head]]; | ||
| 97 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 98 | } | ||
| 99 | else { | ||
| 100 | $data_str = '<span class="summation" style="display:block;">'.$uarr[$reporthead[$head]].'</span>'; | ||
| 101 | $data_str .= '<span class="percent" style="display:none;">'.number_format(@($uarr[$reporthead[$head]]/$uarr['Attempts']) * 100, 2 ).'%</span>'; | ||
| 102 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 103 | } | ||
| 104 | $outstr.="<td>".$data_str."</td>"; | ||
| 105 | } | ||
| 106 | $outstr.="</tr>"; | ||
| 107 | } | ||
| 108 | |||
| 109 | $outstr.="<tr>"; | ||
| 110 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 111 | { | ||
| 112 | if($head == 6) { | ||
| 113 | $data_str = number_format(@($utotalarr[$reporthead[5]]/$utotalarr[$reporthead[4]]), 2 ); | ||
| 114 | } | ||
| 115 | elseif($head == 15) { | ||
| 116 | $data_str = number_format(@($utotalarr[$reporthead[7]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%'; | ||
| 117 | } | ||
| 118 | elseif($head == 16) { | ||
| 119 | $data_str = number_format(@($utotalarr[$reporthead[8]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%'; | ||
| 120 | } | ||
| 121 | elseif($head == 17) { | ||
| 122 | $data_str = number_format(@($utotalarr[$reporthead[9]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%'; | ||
| 123 | } | ||
| 124 | elseif($head < 50) { | ||
| 125 | $data_str = $utotalarr[$reporthead[$head]]; | ||
| 126 | } | ||
| 127 | else { | ||
| 128 | $data_str = '<span class="summation" style="display:block;">'.$utotalarr[$reporthead[$head]].'</span>'; | ||
| 129 | $data_str .= '<span class="percent" style="display:none;">'.number_format(@($utotalarr[$reporthead[$head]]/$utotalarr['Attempts']) * 100, 2 ).'%</span>'; | ||
| 130 | } | ||
| 131 | $outstr.="<td>".$data_str."</td>"; | ||
| 132 | } | ||
| 133 | $outstr.="</tr>"; | ||
| 134 | } | ||
| 135 | else { | ||
| 136 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 137 | } | ||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | $i=1; | ||
| 142 | $reporthead1=array("Campaign Name", "Grand Total"); | ||
| 143 | $reportarray1=array(); | ||
| 144 | if(count($alist1)) | ||
| 145 | |||
| 146 | foreach($alist1 as $aline) | ||
| 147 | { | ||
| 148 | $arrayheadkey = $aline->userstatus . ' Reason'; | ||
| 149 | if(!isset($reportarray1[$arrayheadkey]))$reportarray1[$arrayheadkey]=array("Campaign Name"=>$arrayheadkey,"Grand Total"=>0); | ||
| 150 | $ststr = $aline->client; $reportarray1[$arrayheadkey][$ststr]++; $reportarray1[$arrayheadkey]["Grand Total"]++; | ||
| 151 | |||
| 152 | $tuser=$userarr[$aline->user_id]; | ||
| 153 | $arraykey = ($aline->userstatus == 'Not Interested') ? 'NI-' . $aline->usersubstatus : 'NE-' . $aline->usersubstatus; | ||
| 154 | if(!isset($reportarray1[$arraykey]))$reportarray1[$arraykey]=array("Campaign Name"=>$arraykey,"Grand Total"=>0); | ||
| 155 | $ststr = $aline->usersubstatus; $reportarray1[$arraykey][$ststr]++; $reportarray1[$arraykey]["Grand Total"]++; | ||
| 156 | |||
| 157 | $ststr=$aline->client; | ||
| 158 | if(!in_array($ststr,$reporthead1))$reporthead1[]=$ststr; | ||
| 159 | $reportarray1[$arraykey][$ststr]++; | ||
| 160 | } | ||
| 161 | |||
| 162 | $highestColumn1 = sizeof($reporthead1); | ||
| 163 | if(count($reportarray1)) { | ||
| 164 | $outhead1="<tr>";$outstr1=""; | ||
| 165 | for ($head = 0; $head < $highestColumn1; $head++){ | ||
| 166 | if($reporthead1[$head] == '#' && false) { | ||
| 167 | $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>"; | ||
| 168 | $outhead1.="<td>".$mode_str."</td>"; | ||
| 169 | } | ||
| 170 | else { | ||
| 171 | $outhead1.="<td>".$reporthead1[$head]."</td>"; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | $outhead1.="</tr>"; | ||
| 175 | //$utotalarr = array("Campaign Name"=>'Not Interested Reason'); | ||
| 176 | foreach($reportarray1 as $uid=>$uarr) | ||
| 177 | { | ||
| 178 | $outstr.="<tr>"; | ||
| 179 | for ($head = 0; $head < $highestColumn1; $head++){ | ||
| 180 | if($head < 1) { | ||
| 181 | $data_str = $uarr[$reporthead1[$head]]; | ||
| 182 | } | ||
| 183 | elseif($head < 50) { | ||
| 184 | $data_str = $uarr[$reporthead1[$head]]; | ||
| 185 | $utotalarr[$reporthead1[$head]] += $uarr[$reporthead1[$head]]; | ||
| 186 | } | ||
| 187 | else { | ||
| 188 | $data_str = '<span class="summation" style="display:block;">'.$uarr[$reporthead1[$head]].'</span>'; | ||
| 189 | $data_str .= '<span class="percent" style="display:none;">'.number_format(@($uarr[$reporthead1[$head]]/$uarr['Total']) * 100, 2 ).'%</span>'; | ||
| 190 | $utotalarr[$reporthead1[$head]] += $uarr[$reporthead1[$head]]; | ||
| 191 | } | ||
| 192 | $outstr1.="<td>".$data_str."</td>"; | ||
| 193 | } | ||
| 194 | $outstr1.="</tr>"; | ||
| 195 | } | ||
| 196 | |||
| 197 | $outstr1.="<tr>"; | ||
| 198 | } | ||
| 199 | /* else { | ||
| 200 | $outhead1.="<tr><td>No Records Found.</td></tr>"; | ||
| 201 | } */ | ||
| 202 | |||
| 203 | if(Input::has("dllogxls")) | ||
| 204 | { | ||
| 205 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 206 | |||
| 207 | $inputFileType = "Excel5"; | ||
| 208 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 209 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 210 | $baseRow = 2; | ||
| 211 | |||
| 212 | |||
| 213 | $highestColumn = sizeof($reporthead); | ||
| 214 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 215 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 216 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 217 | } | ||
| 218 | |||
| 219 | foreach($reportarray as $uid=>$uarr) | ||
| 220 | { | ||
| 221 | $row = $baseRow++; | ||
| 222 | $col = 0; | ||
| 223 | |||
| 224 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 225 | $printval = ($head != 6) ? $uarr[$reporthead[$head]] : (($uarr[$reporthead[4]] > 0) ? number_format(@($uarr[$reporthead[5]]/$uarr[$reporthead[4]]), 2 ) : ''); | ||
| 226 | if($head == 15) { | ||
| 227 | $printval = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[7]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 228 | } | ||
| 229 | if($head == 16) { | ||
| 230 | $printval = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[8]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 231 | } | ||
| 232 | if($head == 17) { | ||
| 233 | $printval = ($uarr[$reporthead[4]] != 0) ? number_format(@($uarr[$reporthead[9]]/$uarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 234 | } | ||
| 235 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 236 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $printval); | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | $row++; | ||
| 241 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 242 | $printval = ($head != 6) ? $utotalarr[$reporthead[$head]] : (($utotalarr[$reporthead[4]] > 0) ? number_format(@($utotalarr[$reporthead[5]]/$utotalarr[$reporthead[4]]), 2 ) : ''); | ||
| 243 | if($head == 15) { | ||
| 244 | $printval = ($utotalarr[$reporthead[4]] != 0) ? number_format(@($utotalarr[$reporthead[7]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 245 | } | ||
| 246 | if($head == 16) { | ||
| 247 | $printval = ($utotalarr[$reporthead[4]] != 0) ? number_format(@($utotalarr[$reporthead[8]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 248 | } | ||
| 249 | if($head == 17) { | ||
| 250 | $printval = ($utotalarr[$reporthead[4]] != 0) ? number_format(@($utotalarr[$reporthead[9]]/$utotalarr[$reporthead[4]]) * 100, 2 ) . '%' : ''; | ||
| 251 | } | ||
| 252 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 253 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $printval); | ||
| 254 | } | ||
| 255 | |||
| 256 | $baseRow = $row+3; | ||
| 257 | |||
| 258 | $highestColumn1 = sizeof($reporthead1); | ||
| 259 | for ($head = 0; $head < $highestColumn1; $head++){ | ||
| 260 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 261 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$baseRow, $reporthead1[$head]); | ||
| 262 | } | ||
| 263 | $baseRow++; | ||
| 264 | foreach($reportarray1 as $uid=>$uarr) | ||
| 265 | { | ||
| 266 | $row = $baseRow++; | ||
| 267 | $col = 0; | ||
| 268 | |||
| 269 | for ($head = 0; $head < $highestColumn1; $head++){ | ||
| 270 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 271 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead1[$head]]); | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 275 | header('Content-Type: application/vnd.ms-excel'); | ||
| 276 | header('Content-Disposition: attachment;filename="Campaignreport.xls"'); | ||
| 277 | header('Cache-Control: max-age=0'); | ||
| 278 | |||
| 279 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 280 | $objWriter->save('php://output'); | ||
| 281 | |||
| 282 | return ; | ||
| 283 | } | ||
| 284 | ?> | ||
| 285 | |||
| 286 | @include('layout.module.dialer.searchform') | ||
| 287 | |||
| 288 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 289 | <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;'> | ||
| 290 | <thead><?php echo $outhead; ?></thead> | ||
| 291 | <?php echo $outstr; ?> | ||
| 292 | </table> | ||
| 293 | </div> | ||
| 294 | |||
| 295 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 296 | <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;'> | ||
| 297 | <thead><?php echo $outhead1; ?></thead> | ||
| 298 | <?php echo $outstr1; ?> | ||
| 299 | </table> | ||
| 300 | </div> | ||
| 301 | </div> |
| 1 | <div class="layout-app"><!-- row-app --> | ||
| 2 | <div class="row row-app"> | ||
| 3 | |||
| 4 | <!-- col --> | ||
| 5 | <div class="col-md-2 col-sm-3"> | ||
| 6 | |||
| 7 | <!-- col-separator --> | ||
| 8 | <div class="col-separator col-separator-first box col-unscrollable"> | ||
| 9 | |||
| 10 | <!-- col-table --> | ||
| 11 | <div class="col-table" style='padding-left: 13px;padding-right: 13px;'> | ||
| 12 | |||
| 13 | <h4 class="innerAll margin-none border-bottom" style='background: #fff;'>Campaign Admin</h4> | ||
| 14 | |||
| 15 | <!-- col-table-row --> | ||
| 16 | <div class="col-table-row"> | ||
| 17 | |||
| 18 | <!-- col-app --> | ||
| 19 | <div class="col-app col-unscrollable"> | ||
| 20 | |||
| 21 | <!-- col-app --> | ||
| 22 | <div class="col-app"> | ||
| 23 | |||
| 24 | <ul class="list-group list-group-1 margin-none borders-none" style='padding-right: 26px;'> | ||
| 25 | |||
| 26 | <li class="list-group-item"> | ||
| 27 | <a href="#" onclick="doAjax('dialer/camplist','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> List Campaigns</a> | ||
| 28 | </li> | ||
| 29 | <li class="list-group-item"> | ||
| 30 | <a href="#" onclick="doAjax('dialer/campchurn','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Churn Rules</a> | ||
| 31 | </li> | ||
| 32 | |||
| 33 | <?php if(Auth::user()->moduleACL("Dialer",true,true,true)){ ?> | ||
| 34 | |||
| 35 | <?php } ?> | ||
| 36 | |||
| 37 | |||
| 38 | </ul> | ||
| 39 | |||
| 40 | |||
| 41 | </div> | ||
| 42 | <!-- // END col-app --> | ||
| 43 | |||
| 44 | </div> | ||
| 45 | <!-- // END col-app --> | ||
| 46 | |||
| 47 | </div> | ||
| 48 | <!-- // END col-table-row --> | ||
| 49 | |||
| 50 | </div> | ||
| 51 | <!-- // END col-table --> | ||
| 52 | |||
| 53 | </div> | ||
| 54 | <!-- // END col-separator.box --> | ||
| 55 | |||
| 56 | </div> | ||
| 57 | <!-- // END col --> | ||
| 58 | |||
| 59 | <!-- col --> | ||
| 60 | <div class="col-md-10 col-sm-9" style='border-right:13px solid #eaeaea'> | ||
| 61 | |||
| 62 | <!-- col-separator.box --> | ||
| 63 | <div class="col-separator col-unscrollable box"> | ||
| 64 | |||
| 65 | <!-- col-table --> | ||
| 66 | <div class="col-table"> | ||
| 67 | |||
| 68 | <!-- <h4 class="innerAll margin-none border-bottom">My Sessions</h4> --> | ||
| 69 | |||
| 70 | <!-- col-table-row --> | ||
| 71 | <div class="col-table-row" style='background: #fff;'> | ||
| 72 | |||
| 73 | <!-- col-app --> | ||
| 74 | <div class="col-app col-unscrollable"> | ||
| 75 | |||
| 76 | <!-- col-app --> | ||
| 77 | <div class="col-app" style='position:relative'> | ||
| 78 | |||
| 79 | <div class="" id=rightmainreportdiv> | ||
| 80 | <script> | ||
| 81 | //doAjax('dialer/campaign_list','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 82 | </script> | ||
| 83 | </div> | ||
| 84 | |||
| 85 | </div> | ||
| 86 | <!-- // END col-app --> | ||
| 87 | |||
| 88 | </div> | ||
| 89 | <!-- // END col-app.col-unscrollable --> | ||
| 90 | |||
| 91 | </div> | ||
| 92 | <!-- // END col-table-row --> | ||
| 93 | |||
| 94 | </div> | ||
| 95 | <!-- // END col-table --> | ||
| 96 | |||
| 97 | </div> | ||
| 98 | <!-- // END col-separator.box --> | ||
| 99 | |||
| 100 | </div> | ||
| 101 | <!-- // END col --> | ||
| 102 | |||
| 103 | </div> | ||
| 104 | <!-- // END row-app --> | ||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | $wakka = new KHRMSLib(); | ||
| 7 | $dashboarduser=Auth::user(); | ||
| 8 | |||
| 9 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 10 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 11 | |||
| 12 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 13 | |||
| 14 | //if(!$dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 15 | if($dashboarduser->usertype != 'Admin') | ||
| 16 | { | ||
| 17 | $uidlist=array($dashboarduser->id); | ||
| 18 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 19 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 20 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 21 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 22 | })->get(); | ||
| 23 | // ->where(function ($query) { | ||
| 24 | // $query->where('status', '=', 'Active'); | ||
| 25 | // })->get(); | ||
| 26 | |||
| 27 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 28 | |||
| 29 | |||
| 30 | $roclientstr=array();$didlinesstr=array(); | ||
| 31 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 32 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 33 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 34 | { | ||
| 35 | $roclientstr[]="$tclnt"; | ||
| 36 | |||
| 37 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 38 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 39 | } | ||
| 40 | |||
| 41 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 42 | $query//->orWhereIn('client',$roclientstr) | ||
| 43 | ->orWhereIn('user_id',$uidlist) | ||
| 44 | ->orWhereIn('did',$didlinesstr); | ||
| 45 | }); | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | $alist=$alist->get(); | ||
| 50 | //$total=0; | ||
| 51 | $userarr=array();$i=1; | ||
| 52 | $reporthead=array("#","UserId","User","Name","Count","Total","Wait","Call","Talk","Dispo"); | ||
| 53 | $reportarray=array(); | ||
| 54 | foreach($alist as $aline) | ||
| 55 | { | ||
| 56 | if(!isset($userarr[$aline->user_id]))$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 57 | $tuser=$userarr[$aline->user_id]; | ||
| 58 | |||
| 59 | if(!isset($reportarray[$aline->user_id]))$reportarray[$aline->user_id]=array("#"=>$i++,"UserId"=>$tuser->id,"User"=>$tuser->username,"Name"=>$tuser->fullname,"Count"=>0,"Total"=>0,"Wait"=>0,"Call"=>0,"Talk"=>0,"Dispo"=>0); | ||
| 60 | |||
| 61 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 62 | //$total+=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 63 | |||
| 64 | $reportarray[$aline->user_id]["Count"]++; | ||
| 65 | $reportarray[$aline->user_id]["Total"]+=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 66 | |||
| 67 | //$reportarray[$aline->user_id]["Total"]=gmdate("H:i:s",$reportarray[$aline->user_id]["Total"]+round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2)); | ||
| 68 | |||
| 69 | //$reportarray[$aline->user_id]["Total"]=gmdate("H:i:s",$total); | ||
| 70 | |||
| 71 | //$reportarray[$aline->user_id]["Total"]+=gmdate("H:i:s",round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2)); | ||
| 72 | |||
| 73 | $reportarray[$aline->user_id]["Wait"]+=round($aline->waitSec/1000,2); | ||
| 74 | $reportarray[$aline->user_id]["Call"]+=round($aline->callSec/1000,2); | ||
| 75 | $reportarray[$aline->user_id]["Talk"]+=round($talktime/1000,2); | ||
| 76 | $reportarray[$aline->user_id]["Dispo"]+=round($aline->dispoSec/1000,2); | ||
| 77 | } | ||
| 78 | |||
| 79 | if(Input::has("dllogxls")) | ||
| 80 | { | ||
| 81 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 82 | |||
| 83 | $inputFileType = "Excel5"; | ||
| 84 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 85 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 86 | $baseRow = 3; | ||
| 87 | |||
| 88 | |||
| 89 | $highestColumn = sizeof($reporthead); | ||
| 90 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 91 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 92 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 93 | } | ||
| 94 | |||
| 95 | foreach($reportarray as $uid=>$uarr) | ||
| 96 | { | ||
| 97 | $row = $baseRow++; | ||
| 98 | $col = 0; | ||
| 99 | |||
| 100 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 101 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 102 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | |||
| 107 | header('Content-Type: application/vnd.ms-excel'); | ||
| 108 | header('Content-Disposition: attachment;filename="TimeLog.xls"'); | ||
| 109 | header('Cache-Control: max-age=0'); | ||
| 110 | |||
| 111 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 112 | $objWriter->save('php://output'); | ||
| 113 | |||
| 114 | return ; | ||
| 115 | } | ||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | $highestColumn = sizeof($reporthead); | ||
| 120 | $outhead="<tr>";$outstr=""; | ||
| 121 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 122 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 123 | } | ||
| 124 | $outhead.="</tr>"; | ||
| 125 | |||
| 126 | |||
| 127 | foreach($reportarray as $uid=>$uarr) | ||
| 128 | { | ||
| 129 | if(!empty($uarr['UserId'])){ | ||
| 130 | $outstr.="<tr>"; | ||
| 131 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 132 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 133 | } | ||
| 134 | $outstr.="</tr>"; | ||
| 135 | }else{ | ||
| 136 | $outstr.="<tr>"; | ||
| 137 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 138 | if($reporthead[$head]=='UserId'){ | ||
| 139 | $outstr.="<td>Inbound</td>"; | ||
| 140 | }else{ | ||
| 141 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | $outstr.="</tr>"; | ||
| 145 | |||
| 146 | } | ||
| 147 | } | ||
| 148 | /* | ||
| 149 | foreach($reportarray as $uid=>$uarr) | ||
| 150 | { | ||
| 151 | $outstr.="<tr>"; | ||
| 152 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 153 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 154 | } | ||
| 155 | $outstr.="</tr>"; | ||
| 156 | } | ||
| 157 | |||
| 158 | */ | ||
| 159 | |||
| 160 | |||
| 161 | //charts | ||
| 162 | $cat1=array(); | ||
| 163 | $cat1arr=array(); | ||
| 164 | foreach($reportarray as $uid=>$uarr) | ||
| 165 | { | ||
| 166 | $cat1[]="'$uarr[UserName]'"; | ||
| 167 | |||
| 168 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 169 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 170 | |||
| 171 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]]/60,1); | ||
| 172 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 173 | } | ||
| 174 | } | ||
| 175 | |||
| 176 | $cat1arrstr=""; | ||
| 177 | foreach($cat1arr as $name=>$data) | ||
| 178 | { | ||
| 179 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 180 | $cat1arrstr.=implode(",",$data); | ||
| 181 | $cat1arrstr.="] },\n"; | ||
| 182 | } | ||
| 183 | |||
| 184 | |||
| 185 | $cat2=array(); | ||
| 186 | foreach($reportarray as $uid=>$uarr) | ||
| 187 | { | ||
| 188 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 189 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]]/60,1); | ||
| 190 | } | ||
| 191 | } | ||
| 192 | ?> | ||
| 193 | |||
| 194 | |||
| 195 | <div class=innerAll> | ||
| 196 | |||
| 197 | |||
| 198 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 199 | <script> | ||
| 200 | $(document).ready(function() | ||
| 201 | { | ||
| 202 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 203 | { | ||
| 204 | $('#dialoglog').dialog({ | ||
| 205 | autoOpen: false, | ||
| 206 | width: '70%', | ||
| 207 | buttons: { | ||
| 208 | "Ok": function() { | ||
| 209 | $(this).dialog("close"); | ||
| 210 | }, | ||
| 211 | "Cancel": function() { | ||
| 212 | $(this).dialog("close"); | ||
| 213 | } | ||
| 214 | } | ||
| 215 | }); | ||
| 216 | } | ||
| 217 | |||
| 218 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 219 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 220 | }); | ||
| 221 | </script> | ||
| 222 | <div style="float:left;width:50%"> | ||
| 223 | |||
| 224 | Search <input id=filter name="filter" type="text"> | ||
| 225 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='campLogReloadFun("");' /> | ||
| 226 | |||
| 227 | </div> | ||
| 228 | <div style="float:left;width:50%"> | ||
| 229 | |||
| 230 | |||
| 231 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 232 | |||
| 233 | </div> | ||
| 234 | <div style="clear:both"></div> | ||
| 235 | <hr> | ||
| 236 | |||
| 237 | <!--div class=col-md-12> | ||
| 238 | |||
| 239 | |||
| 240 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 241 | <script> | ||
| 242 | $(function () { | ||
| 243 | $('#userlogschart1').highcharts({ | ||
| 244 | chart: { | ||
| 245 | type: 'column' | ||
| 246 | }, | ||
| 247 | title: { | ||
| 248 | text: '' | ||
| 249 | }, | ||
| 250 | xAxis: { | ||
| 251 | labels:{ | ||
| 252 | enabled:false//default is true | ||
| 253 | }, | ||
| 254 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 255 | }, | ||
| 256 | yAxis: { | ||
| 257 | min: 0, | ||
| 258 | title: { | ||
| 259 | text: '' | ||
| 260 | }, | ||
| 261 | stackLabels: { | ||
| 262 | enabled: false, | ||
| 263 | // style: { | ||
| 264 | // fontWeight: '', | ||
| 265 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 266 | // } | ||
| 267 | } | ||
| 268 | }, | ||
| 269 | // legend: { | ||
| 270 | // align: 'right', | ||
| 271 | // x: -30, | ||
| 272 | // verticalAlign: 'top', | ||
| 273 | // y: 25, | ||
| 274 | // floating: true, | ||
| 275 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 276 | // borderColor: '#CCC', | ||
| 277 | // borderWidth: 1, | ||
| 278 | // shadow: false | ||
| 279 | // }, | ||
| 280 | tooltip: { | ||
| 281 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 282 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 283 | }, | ||
| 284 | plotOptions: { | ||
| 285 | column: { | ||
| 286 | stacking: 'normal', | ||
| 287 | dataLabels: { | ||
| 288 | enabled: false, | ||
| 289 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 290 | // style: { | ||
| 291 | // textShadow: '0 0 3px black' | ||
| 292 | // } | ||
| 293 | } | ||
| 294 | } | ||
| 295 | }, | ||
| 296 | series: [<?php echo $cat1arrstr; ?>] | ||
| 297 | }); | ||
| 298 | }); | ||
| 299 | |||
| 300 | |||
| 301 | |||
| 302 | |||
| 303 | function campLogReloadFun(sortby) | ||
| 304 | { | ||
| 305 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 306 | |||
| 307 | doAjax('dialer/campreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 308 | } | ||
| 309 | function dlAgentlogXls() | ||
| 310 | { | ||
| 311 | window.open('dialer/campreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 312 | } | ||
| 313 | </script> | ||
| 314 | |||
| 315 | </div --> | ||
| 316 | |||
| 317 | <script> | ||
| 318 | function campLogReloadFun(sortby) | ||
| 319 | { | ||
| 320 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 321 | |||
| 322 | doAjax('dialer/campreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 323 | } | ||
| 324 | function dlAgentlogXls() | ||
| 325 | { | ||
| 326 | window.open('dialer/campreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 327 | } | ||
| 328 | </script> | ||
| 329 | |||
| 330 | <div style='clear:both'></div> | ||
| 331 | |||
| 332 | <div class=col-md-12> | ||
| 333 | |||
| 334 | |||
| 335 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 336 | <script> | ||
| 337 | $(function () { | ||
| 338 | $('#userlogschart2').highcharts({ | ||
| 339 | chart: { | ||
| 340 | type: 'column' | ||
| 341 | }, | ||
| 342 | title: { | ||
| 343 | text: '' | ||
| 344 | }, | ||
| 345 | subtitle: { | ||
| 346 | text: '' | ||
| 347 | }, | ||
| 348 | xAxis: { | ||
| 349 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 350 | crosshair: true | ||
| 351 | }, | ||
| 352 | yAxis: { | ||
| 353 | min: 0, | ||
| 354 | title: { | ||
| 355 | text: '' | ||
| 356 | } | ||
| 357 | }, | ||
| 358 | tooltip: { | ||
| 359 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 360 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 361 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 362 | footerFormat: '</table>', | ||
| 363 | shared: true, | ||
| 364 | useHTML: true | ||
| 365 | }, | ||
| 366 | plotOptions: { | ||
| 367 | column: { | ||
| 368 | pointPadding: 0.2, | ||
| 369 | borderWidth: 0 | ||
| 370 | } | ||
| 371 | }, | ||
| 372 | legend : { | ||
| 373 | floating: true, | ||
| 374 | align: 'right', | ||
| 375 | x: -30, | ||
| 376 | verticalAlign: 'top', | ||
| 377 | }, | ||
| 378 | series: [{ | ||
| 379 | name: 'Mins', | ||
| 380 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 381 | |||
| 382 | },] | ||
| 383 | }); | ||
| 384 | }); | ||
| 385 | |||
| 386 | </script> | ||
| 387 | |||
| 388 | </div> | ||
| 389 | |||
| 390 | |||
| 391 | |||
| 392 | <div style='clear:both'></div> | ||
| 393 | |||
| 394 | <div style='overflow:auto'> | ||
| 395 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 396 | <thead> | ||
| 397 | <?php echo $outhead; ?> | ||
| 398 | </thead> | ||
| 399 | <?php echo $outstr; ?> | ||
| 400 | </table> | ||
| 401 | </div> | ||
| 402 | |||
| 403 | <div id=dialoglog></div> | ||
| 404 | |||
| 405 | |||
| 406 | |||
| 407 | |||
| 408 | |||
| 409 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | use App\Models\SupervisonComments; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | |||
| 10 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 11 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 12 | |||
| 13 | if(isset($_GET['logtodate']))$logtodate=strtotime($_GET['logtodate']." 23:59:59"); | ||
| 14 | else $logtodate=strtotime(date('Y-m-d')." 23:59:59"); | ||
| 15 | |||
| 16 | $userarr=array();$i=1; | ||
| 17 | $reporthead=array("id","upload_date","call_id","cust_band","cust_type","source_of_info","service_type","priority","category","sub_category","resolving_branch","cust_city","acknowledge","resolve_class_unit","complainant_name","existing_customer","cust_id","shadow_cust_id","casa_number","docket_number","cust_mobile","contact_number","email","case_reference","logging_branch_name","logging_class_unit","nature_of_complaint","detailed_suggestion","additional_info","cust_name_on_card","card_number","aan","logging_branch_code","resolving_branch_code","status"); | ||
| 18 | |||
| 19 | $reportarray=DB::table('complaint_details')->select('*')->where('upload_date','>=',date("Y-m-d H:i:s",$logdate))->where('upload_date','<=',date("Y-m-d H:i:s",$logtodate))->get(); | ||
| 20 | |||
| 21 | |||
| 22 | //Child Case | ||
| 23 | if(isset($_GET['clogdate']))$clogdate=strtotime($_GET['clogdate']." 00:00:00"); | ||
| 24 | else $clogdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 25 | |||
| 26 | if(isset($_GET['clogtodate']))$clogtodate=strtotime($_GET['clogtodate']." 23:59:59"); | ||
| 27 | else $clogtodate=strtotime(date('Y-m-d')." 23:59:59"); | ||
| 28 | |||
| 29 | $cuserarr=array();$i=1; | ||
| 30 | $creporthead=array("id","upload_date","complaint_id","cust_type","service_type","priority","category","sub_category","resolving_branch","resolve_class_unit","complainant_name","comments","task_desc","additional_info","status"); | ||
| 31 | |||
| 32 | $creportarray=DB::table('comp_child_details')->select('*')->where('upload_date','>=',date("Y-m-d H:i:s",$clogdate))->where('upload_date','<=',date("Y-m-d H:i:s",$clogtodate))->get(); | ||
| 33 | |||
| 34 | if(Input::has("dllogxls")) | ||
| 35 | { | ||
| 36 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 37 | |||
| 38 | $inputFileType = "Excel5"; | ||
| 39 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 40 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 41 | $baseRow = 2; | ||
| 42 | |||
| 43 | $highestColumn = sizeof($reporthead); | ||
| 44 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 45 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 46 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 47 | } | ||
| 48 | |||
| 49 | foreach($reportarray as $uid=>$uarr) | ||
| 50 | { | ||
| 51 | $row = $baseRow++; | ||
| 52 | $col = 0; | ||
| 53 | |||
| 54 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 55 | if($reporthead[$head]=="upload_date") | ||
| 56 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 57 | |||
| 58 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 59 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$reporthead[$head]); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | header('Content-Type: application/vnd.ms-excel'); | ||
| 65 | header('Content-Disposition: attachment;filename="Complaint.xls"'); | ||
| 66 | header('Cache-Control: max-age=0'); | ||
| 67 | |||
| 68 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 69 | $objWriter->save('php://output'); | ||
| 70 | |||
| 71 | return ; | ||
| 72 | } | ||
| 73 | |||
| 74 | if(Input::has("cdllogxls")) | ||
| 75 | { | ||
| 76 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 77 | |||
| 78 | $inputFileType = "Excel5"; | ||
| 79 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 80 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 81 | $baseRow = 2; | ||
| 82 | |||
| 83 | $highestColumn = sizeof($creporthead); | ||
| 84 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 85 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 86 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $creporthead[$head]); | ||
| 87 | } | ||
| 88 | |||
| 89 | foreach($creportarray as $uid=>$uarr) | ||
| 90 | { | ||
| 91 | $row = $baseRow++; | ||
| 92 | $col = 0; | ||
| 93 | |||
| 94 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 95 | if($creporthead[$head]=="upload_date") | ||
| 96 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$creporthead[$head])+330*60); | ||
| 97 | |||
| 98 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 99 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$creporthead[$head]); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | header('Content-Type: application/vnd.ms-excel'); | ||
| 105 | header('Content-Disposition: attachment;filename="Childcase.xls"'); | ||
| 106 | header('Cache-Control: max-age=0'); | ||
| 107 | |||
| 108 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 109 | $objWriter->save('php://output'); | ||
| 110 | |||
| 111 | return ; | ||
| 112 | } | ||
| 113 | |||
| 114 | ?> | ||
| 115 | |||
| 116 | |||
| 117 | <div class=innerAll> | ||
| 118 | |||
| 119 | |||
| 120 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 121 | <script> | ||
| 122 | $(document).ready(function() | ||
| 123 | { | ||
| 124 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 125 | { | ||
| 126 | $('#dialoglog').dialog({ | ||
| 127 | autoOpen: false, | ||
| 128 | width: '70%', | ||
| 129 | buttons: { | ||
| 130 | "Ok": function() { | ||
| 131 | $(this).dialog("close"); | ||
| 132 | }, | ||
| 133 | "Cancel": function() { | ||
| 134 | $(this).dialog("close"); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | }); | ||
| 138 | } | ||
| 139 | |||
| 140 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 141 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 142 | |||
| 143 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 144 | |||
| 145 | $('#cmodfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 146 | |||
| 147 | $('#cmodto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 148 | }); | ||
| 149 | </script> | ||
| 150 | <div style="float:left;width:50%"> | ||
| 151 | |||
| 152 | From : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' /> | ||
| 153 | To : <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logtodate); ?>' /> | ||
| 154 | |||
| 155 | </div> | ||
| 156 | <div style="float:right;width:50%"> | ||
| 157 | |||
| 158 | |||
| 159 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 160 | |||
| 161 | </div> | ||
| 162 | <div style="clear:both"></div> | ||
| 163 | <hr> | ||
| 164 | |||
| 165 | <br> | ||
| 166 | <!-- | ||
| 167 | <div style="float:left;width:50%"> | ||
| 168 | <label>Child Case:</label> | ||
| 169 | From : <input size=10 id='cmodfrom' name='cmodfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' /> | ||
| 170 | To : <input size=10 id='cmodto' name='cmodto' type='text' value='<?php echo date("Y-m-d",$logtodate); ?>' /> | ||
| 171 | |||
| 172 | </div> | ||
| 173 | <div style="float:right;width:50%"> | ||
| 174 | |||
| 175 | |||
| 176 | <button class="pull-right btn btn-sm btn-ino" onclick='cdlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 177 | |||
| 178 | </div>--!> | ||
| 179 | <div style="clear:both"></div> | ||
| 180 | <hr> | ||
| 181 | |||
| 182 | <div class=col-md-12> | ||
| 183 | |||
| 184 | |||
| 185 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 186 | </div> | ||
| 187 | |||
| 188 | <script> | ||
| 189 | function dlAgentlogXls() | ||
| 190 | { | ||
| 191 | window.open('dialer/complaintreport?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val());return false; | ||
| 192 | } | ||
| 193 | function cdlAgentlogXls() | ||
| 194 | { | ||
| 195 | window.open('dialer/complaintreport?cdllogxls=1&clogdate='+$("#cmodfrom").val()+'&clogtodate='+$("#cmodto").val());return false; | ||
| 196 | } | ||
| 197 | </script> | ||
| 198 | |||
| 199 | <div style='clear:both'></div> | ||
| 200 | |||
| 201 | <div class=col-md-12> | ||
| 202 | |||
| 203 | |||
| 204 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 205 | |||
| 206 | </div> | ||
| 207 | |||
| 208 | |||
| 209 | |||
| 210 | <div style='clear:both'></div> | ||
| 211 | |||
| 212 | <div style='overflow:auto'> | ||
| 213 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 214 | <thead> | ||
| 215 | <?php /*echo $outhead;*/ ?> | ||
| 216 | </thead> | ||
| 217 | <?php /*echo $outstr;*/ ?> | ||
| 218 | </table> | ||
| 219 | </div> | ||
| 220 | |||
| 221 | <div id=dialoglog></div> | ||
| 222 | |||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | |||
| 227 | </div> |
| 1 | <?php | ||
| 2 | $dashboarduser=Auth::user(); | ||
| 3 | $timeoffset=$dashboarduser->timezone*60; | ||
| 4 | ?> | ||
| 5 | <div class="container-fluid"> | ||
| 6 | <div class="layout-app"> | ||
| 7 | <div class="row"> | ||
| 8 | <div class="col-md-12"> | ||
| 9 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 10 | <div class="innerAll"> | ||
| 11 | <h4>Follow up <?php if(!empty($client)) echo ": ".$client; ?></h4> | ||
| 12 | <hr style="margin-bottom: 10px;" /> | ||
| 13 | |||
| 14 | <table class='table' | ||
| 15 | <thead> | ||
| 16 | <tr> | ||
| 17 | <th></th> | ||
| 18 | <th></th> | ||
| 19 | <?php if(empty($client)) echo "<th>Campaign</th>" ?> | ||
| 20 | <th>Cust_ID</th> | ||
| 21 | <th>Name</th> | ||
| 22 | <th>Number</th> | ||
| 23 | <!-- <th>Type</th>--> | ||
| 24 | <th>LastCall</th> | ||
| 25 | <!-- <th>Disposition</th> ---> | ||
| 26 | <th>NextFollowup</th> | ||
| 27 | <!--- <th>Status</th> ---> | ||
| 28 | |||
| 29 | <!-- <th>Count</th> --> | ||
| 30 | <!--<th></th>--> | ||
| 31 | <!-- <th>DID</th> --> | ||
| 32 | </tr> | ||
| 33 | </thead> | ||
| 34 | <tbody> | ||
| 35 | <?php | ||
| 36 | if($count > 0){ | ||
| 37 | foreach ($calllog as $key => $value) { //echo "<pre>";print_r($value);exit;?> | ||
| 38 | <tr> | ||
| 39 | <td></td> | ||
| 40 | <td></td> | ||
| 41 | <?php if(empty($client)) echo "<td>$value->client</td>" ?> | ||
| 42 | <td><?php echo $value->cust_id; ?></td> | ||
| 43 | <td><?php echo $value->customer_name; ?></td> | ||
| 44 | <td><a href=# class='' onclick='dialerQuickOpen("<?php echo $value->id; ?>","<?php echo $value->mobile; ?>","Manual","",0);return false;'><?php echo $value->mobile; ?></a></td> | ||
| 45 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_lastcall)-$timeoffset); ?></td> | ||
| 46 | <!--<td><?php //echo $value->dialer_status; ?></td>--> | ||
| 47 | <td><?php echo date("Y-m-d H:i:s",strtotime($value->dialer_callback)-$timeoffset); ?></td> | ||
| 48 | <!--<td><?php //echo $value->status; ?></td>--> | ||
| 49 | </tr> | ||
| 50 | <?php } | ||
| 51 | }else{ ?> | ||
| 52 | <td colspan="9" align="center">No Record Available</td> | ||
| 53 | <?php } ?> | ||
| 54 | </table> | ||
| 55 | |||
| 56 | <div id="campaignDetailsArea"></div> | ||
| 57 | </div> | ||
| 58 | </div> | ||
| 59 | </div> | ||
| 60 | </div> | ||
| 61 | |||
| 62 | </div> | ||
| 63 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\CRMCallArchive; | ||
| 4 | use App\Models\User; | ||
| 5 | use App\Models\UserLog; | ||
| 6 | use App\Jobs\KHRMSLib; | ||
| 7 | |||
| 8 | $wakka = new KHRMSLib(); | ||
| 9 | $dashboarduser=Auth::user(); | ||
| 10 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone; | ||
| 11 | $timeoffset = $timeoffset*60; | ||
| 12 | |||
| 13 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9; | ||
| 14 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20; | ||
| 15 | |||
| 16 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") | ||
| 17 | : strtotime(date("Y-m-d")." 09:00:00"); | ||
| 18 | $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00") | ||
| 19 | : strtotime(date("Y-m-d")." 20:00:00"); | ||
| 20 | |||
| 21 | $oclientlst=$wakka->clientsReadAccess(); sort($oclientlst); | ||
| 22 | |||
| 23 | $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(); | ||
| 24 | |||
| 25 | $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(); | ||
| 26 | |||
| 27 | $total_Accounts_loaded=DB::table('records')->whereIn('client',$oclientlst)->get(); | ||
| 28 | |||
| 29 | |||
| 30 | $breaks=array("AgentBriefing","TeamMeeting","QualityFeedback","LunchBreak","TeaBreak","UtilityBreak","FloorAnnouncements","DownTime"); | ||
| 31 | $reporthead=array("Campaigns","Accounts Loaded","LoggedIn users","Unique accounts dialled","Total accounts Dialled","Disposed Calls","Contacts","RPC","PTP","Preview","Wrap","Idle","Talk","Hold"); | ||
| 32 | $reportarray=array(); | ||
| 33 | |||
| 34 | $campaign_wisearr= array(); | ||
| 35 | $camp_userlist=array(); | ||
| 36 | $uniquenumberarray=array(); | ||
| 37 | $prev_close = 0; | ||
| 38 | foreach ($alist as $key => $value) { | ||
| 39 | |||
| 40 | if (!array_key_exists($value->client, $camp_userlist)) $camp_userlist[$value->client]=[]; | ||
| 41 | |||
| 42 | if (!in_array($value->user_id, $camp_userlist[$value->client])) $camp_userlist[$value->client][]=$value->user_id; | ||
| 43 | |||
| 44 | $campaign_wisearr[$value->client]["LoggedIn users"] = count($camp_userlist[$value->client]); | ||
| 45 | $campaign_wisearr[$value->client]["Campaigns"] = $value->client; | ||
| 46 | $campaign_wisearr[$value->client]["Total accounts Dialled"]++; | ||
| 47 | |||
| 48 | if (!array_key_exists($value->client, $uniquenumberarray)) $uniquenumberarray[$value->client]=[]; | ||
| 49 | if (!in_array($value->number, $uniquenumberarray[$value->client])) $uniquenumberarray[$value->client][]=$value->number; | ||
| 50 | |||
| 51 | $campaign_wisearr[$value->client]["Unique accounts dialled"] = count($uniquenumberarray[$value->client]); | ||
| 52 | |||
| 53 | if($value->userstatus == 'Contacted') { | ||
| 54 | $campaign_wisearr[$value->client]["Disposed Calls"]++; | ||
| 55 | } | ||
| 56 | 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') { | ||
| 57 | $campaign_wisearr[$value->client]["Contacts"]++; | ||
| 58 | } | ||
| 59 | if($value->resultCode == 'PTP' || $value->resultCode == 'CEREP' || $value->resultCode == 'PV') { | ||
| 60 | $campaign_wisearr[$value->client]["PTP"]++; | ||
| 61 | } | ||
| 62 | if($value->resultCode == 'PTP' || $value->resultCode == 'CB' || $value->resultCode == 'CEREP' || $value->resultCode == 'RTP' || $value->resultCode == 'PV') { | ||
| 63 | $campaign_wisearr[$value->client]["RPC"]++; | ||
| 64 | } | ||
| 65 | if($prev_user != $value->user_id || $prev_close <= $value->ts_Wait) | ||
| 66 | { | ||
| 67 | $talktime=$value->talkSec+$value->recstartSec+$value->recendSec; | ||
| 68 | $totaltime=$value->callSec+$talktime+$value->dispoSec; | ||
| 69 | |||
| 70 | $campaign_wisearr[$value->client]["oncall"]+=$totaltime/1000; | ||
| 71 | // $campaign_wisearr[$value->client]["Preview"]+=$value->waitSec/1000; | ||
| 72 | $campaign_wisearr[$value->client]["Hold"]+=$value->callSec/1000; | ||
| 73 | $campaign_wisearr[$value->client]["Talk"]+=$talktime/1000; | ||
| 74 | $campaign_wisearr[$value->client]["Wrap"]+=$value->dispoSec/1000; | ||
| 75 | } | ||
| 76 | |||
| 77 | $prev_close = $value->ts_Close;//-ts_Wait | ||
| 78 | $prev_user = $value->user_id;//-ts_Wait | ||
| 79 | |||
| 80 | } | ||
| 81 | function cmp($a, $b) { | ||
| 82 | return $a["ts"] - $b["ts"]; | ||
| 83 | } | ||
| 84 | |||
| 85 | $userLogin=array(); | ||
| 86 | $checkhead = array_merge($reporthead, $breaks); | ||
| 87 | foreach($userlog as $ulog) | ||
| 88 | { | ||
| 89 | $data=json_decode($ulog->data,true); | ||
| 90 | usort($data, "cmp"); | ||
| 91 | |||
| 92 | $lastSip = end($data); | ||
| 93 | $starttime = strtotime($ulog->startdate.' '.$ulog->starttime); | ||
| 94 | $endtime = round($lastSip['ts']/1000); | ||
| 95 | $userLogin[$ulog->user_id]['duration'] += ($endtime-$starttime); | ||
| 96 | |||
| 97 | $prets=strtotime($ulog->startdate." ".$ulog->starttime)*1000; | ||
| 98 | $previous="Paused-Paused"; | ||
| 99 | foreach($data as $sdata) | ||
| 100 | { | ||
| 101 | $pts=$sdata['ts']; | ||
| 102 | if(isset($sdata['states'])) | ||
| 103 | { | ||
| 104 | foreach($sdata['states'] as $ts=>$states) | ||
| 105 | { | ||
| 106 | $previous = str_replace('Paused-', '', $previous); | ||
| 107 | if(!in_array($previous,$checkhead) && !in_array($previous,array('Progressive-','Manual-','Ready-Incoming','Ready-Predictive','DialNext-'))) { | ||
| 108 | $previous = 'Paused'; | ||
| 109 | } | ||
| 110 | |||
| 111 | $reportarray[$ulog->user_id][$previous]+=round($ts-$prets,2)/1000; | ||
| 112 | $prets=$ts; | ||
| 113 | $previous=$states[0].'-'.$states[1]; | ||
| 114 | } | ||
| 115 | $previous = str_replace('Paused-', '', $previous); | ||
| 116 | $reportarray[$ulog->user_id][$previous]+=round($pts-$prets,2)/1000; | ||
| 117 | $prets=$pts; | ||
| 118 | } | ||
| 119 | } | ||
| 120 | } | ||
| 121 | if(count($userLogin)) foreach ($userLogin as $userid => $value) | ||
| 122 | { | ||
| 123 | $break_time=0; | ||
| 124 | foreach ($breaks as $break) { | ||
| 125 | $break_time+=$reportarray[$userid][$break]; | ||
| 126 | } | ||
| 127 | $reportarray[$userid]["Duration"]=$value['duration']; | ||
| 128 | $reportarray[$userid]["Total"]=$value['duration']-$break_time-$reportarray[$userid]['Paused']; | ||
| 129 | $reportarray[$userid]["Preview"]=$reportarray[$userid]["Total"]-$reportarray[$userid]['oncall']; | ||
| 130 | $reportarray[$userid]["Breaks"]=$break_time; | ||
| 131 | $reportarray[$userid]["Idle"]=$reportarray[$userid]['Paused']; | ||
| 132 | } | ||
| 133 | |||
| 134 | $i=1; | ||
| 135 | foreach ($camp_userlist as $campaign => $campaignUserCountArr) { | ||
| 136 | |||
| 137 | // $campaign_wisearr[$campaign]['#']= $i++; | ||
| 138 | |||
| 139 | foreach ($campaignUserCountArr as $eachCampaignUserCount) { | ||
| 140 | |||
| 141 | if(array_key_exists($eachCampaignUserCount, $reportarray)) { | ||
| 142 | $campaign_wisearr[$campaign]['Duration'] += $reportarray[$eachCampaignUserCount]['Duration']; | ||
| 143 | $campaign_wisearr[$campaign]['Idle'] += $reportarray[$eachCampaignUserCount]['Idle']; | ||
| 144 | $campaign_wisearr[$campaign]['Breaks'] += $reportarray[$eachCampaignUserCount]['Breaks']; | ||
| 145 | $campaign_wisearr[$campaign]['Preview'] += $reportarray[$eachCampaignUserCount]['Preview']; | ||
| 146 | $campaign_wisearr[$campaign]['Total'] += $reportarray[$eachCampaignUserCount]['Total']; | ||
| 147 | |||
| 148 | } | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | foreach ($total_Accounts_loaded as $key => $value) { | ||
| 153 | $campaign_wisearr[$value->client]["Campaigns"] = $value->client; | ||
| 154 | $campaign_wisearr[$value->client]['Accounts Loaded']++; | ||
| 155 | } | ||
| 156 | |||
| 157 | $highestColumn = sizeof($reporthead); | ||
| 158 | if(count($campaign_wisearr)) { | ||
| 159 | $outhead="<tr>";$outstr=""; | ||
| 160 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 161 | if($reporthead[$head] == '#') { | ||
| 162 | $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>"; | ||
| 163 | $outhead.="<td>".$mode_str."</td>"; | ||
| 164 | } | ||
| 165 | else { | ||
| 166 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | $outhead.="</tr>"; | ||
| 170 | $utotalarr = array("Campaigns"=>'Total'); | ||
| 171 | |||
| 172 | foreach($campaign_wisearr as $uid=>$uarr) | ||
| 173 | { | ||
| 174 | |||
| 175 | $outstr.="<tr>"; | ||
| 176 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 177 | if($head < 1) { | ||
| 178 | $data_str = $uarr[$reporthead[$head]]; | ||
| 179 | } | ||
| 180 | elseif($head < 9) { | ||
| 181 | $data_str = $uarr[$reporthead[$head]]; | ||
| 182 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 183 | } | ||
| 184 | else { | ||
| 185 | $data_str = secToDuration(round($uarr[$reporthead[$head]])); | ||
| 186 | $utotalarr[$reporthead[$head]] += $uarr[$reporthead[$head]]; | ||
| 187 | } | ||
| 188 | $outstr.="<td>".$data_str."</td>"; | ||
| 189 | } | ||
| 190 | $outstr.="</tr>"; | ||
| 191 | } | ||
| 192 | $outstr.="<tr>"; | ||
| 193 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 194 | { | ||
| 195 | if($head < 9) { | ||
| 196 | $data_str = $utotalarr[$reporthead[$head]]; | ||
| 197 | } | ||
| 198 | else { | ||
| 199 | $data_str = secToDuration($utotalarr[$reporthead[$head]]); | ||
| 200 | } | ||
| 201 | $outstr.="<td>".$data_str."</td>"; | ||
| 202 | } | ||
| 203 | $outstr.="</tr>"; | ||
| 204 | } | ||
| 205 | else | ||
| 206 | { | ||
| 207 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 208 | } | ||
| 209 | |||
| 210 | if(Input::has("dllogxls")) | ||
| 211 | { | ||
| 212 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 213 | |||
| 214 | $inputFileType = "Excel5"; | ||
| 215 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 216 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 217 | $baseRow = 2; | ||
| 218 | |||
| 219 | |||
| 220 | $highestColumn = sizeof($reporthead); | ||
| 221 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 222 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 223 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 224 | } | ||
| 225 | |||
| 226 | foreach($campaign_wisearr as $uid=>$uarr) | ||
| 227 | { | ||
| 228 | $row = $baseRow++; | ||
| 229 | $col = 0; | ||
| 230 | |||
| 231 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 232 | $excelval = ($head < 6) ? $uarr[$reporthead[$head]] : secToDuration(round($uarr[$reporthead[$head]])); | ||
| 233 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 234 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 238 | $row++; | ||
| 239 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 240 | $excelval = ($head < 6) ? $utotalarr[$reporthead[$head]] : secToDuration(round($utotalarr[$reporthead[$head]])); | ||
| 241 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 242 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $excelval); | ||
| 243 | } | ||
| 244 | |||
| 245 | header('Content-Type: application/vnd.ms-excel'); | ||
| 246 | header('Content-Disposition: attachment;filename="Campaignlevel.xls"'); | ||
| 247 | header('Cache-Control: max-age=0'); | ||
| 248 | |||
| 249 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 250 | $objWriter->save('php://output'); | ||
| 251 | |||
| 252 | return ; | ||
| 253 | } | ||
| 254 | |||
| 255 | function secToDuration($sec) { | ||
| 256 | return sprintf("%02d%s%02d%s%02d", floor($sec/3600), ':', ($sec/60)%60, ':', $sec%60); | ||
| 257 | } | ||
| 258 | ?> | ||
| 259 | |||
| 260 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 261 | |||
| 262 | <div class=innerAll> | ||
| 263 | <h4 style="float:left;width:50%;margin:10px 0;">Campaign Level Report</h4> | ||
| 264 | <div style="float:right;width:50%"> | ||
| 265 | <button class='pull-right btn btn-sm btn-default' onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button> | ||
| 266 | </div> | ||
| 267 | <div style="clear:both"></div> | ||
| 268 | <hr style="margin-bottom: 5px;"> | ||
| 269 | <div> | ||
| 270 | Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;"> | ||
| 271 | Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 272 | <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 273 | <?php | ||
| 274 | foreach (range(0,23) as $hour) { | ||
| 275 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 276 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 277 | } | ||
| 278 | ?></select> | ||
| 279 | To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' /> | ||
| 280 | <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 281 | <?php | ||
| 282 | foreach (range(0,23) as $hour) { | ||
| 283 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 284 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 285 | } | ||
| 286 | ?></select> | ||
| 287 | </div> | ||
| 288 | |||
| 289 | <div style="clear:both"></div> | ||
| 290 | <hr style="margin:5px;"> | ||
| 291 | |||
| 292 | <div style="overflow: auto; margin-top: 10px;"> | ||
| 293 | <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;'> | ||
| 294 | <thead><?php echo $outhead; ?></thead> | ||
| 295 | <?php echo $outstr; ?> | ||
| 296 | </table> | ||
| 297 | </div> | ||
| 298 | |||
| 299 | <div id=dialoglog></div> | ||
| 300 | </div> | ||
| 301 | |||
| 302 | <script> | ||
| 303 | $(document).ready(function() { | ||
| 304 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 305 | { | ||
| 306 | $('#dialoglog').dialog({ | ||
| 307 | autoOpen: false, | ||
| 308 | width: '70%', | ||
| 309 | buttons: { | ||
| 310 | "Ok": function() { | ||
| 311 | $(this).dialog("close"); | ||
| 312 | }, | ||
| 313 | "Cancel": function() { | ||
| 314 | $(this).dialog("close"); | ||
| 315 | } | ||
| 316 | } | ||
| 317 | }); | ||
| 318 | } | ||
| 319 | |||
| 320 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 321 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 322 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 323 | }); | ||
| 324 | |||
| 325 | function dataString() | ||
| 326 | { | ||
| 327 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign=All';//+$("#campaign").val(); | ||
| 328 | } | ||
| 329 | function statusLogReloadFun(sortby) | ||
| 330 | { | ||
| 331 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 332 | var searchStr = dataString(); | ||
| 333 | doAjax('dialer/campaignlevel?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 334 | } | ||
| 335 | function dlAgentlogXls() | ||
| 336 | { | ||
| 337 | var searchStr = dataString(); | ||
| 338 | window.open('dialer/campaignlevel?dllogxls=1&'+searchStr); | ||
| 339 | return false; | ||
| 340 | } | ||
| 341 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | $wakka = new KHRMSLib(); | ||
| 7 | $dashboarduser=Auth::user(); | ||
| 8 | |||
| 9 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 10 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 11 | |||
| 12 | if(isset($_GET['logtodate']))$logtodate=strtotime($_GET['logtodate']." 23:59:59"); | ||
| 13 | else $logtodate=strtotime(date('Y-m-d')." 23:59:59"); | ||
| 14 | |||
| 15 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 16 | |||
| 17 | //if(!$dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 18 | if($dashboarduser->usertype != 'Admin') | ||
| 19 | { | ||
| 20 | $uidlist=array($dashboarduser->id); | ||
| 21 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 22 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 23 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 24 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 25 | })->get(); | ||
| 26 | // ->where(function ($query) { | ||
| 27 | // $query->where('status', '=', 'Active'); | ||
| 28 | // })->get(); | ||
| 29 | |||
| 30 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 31 | |||
| 32 | |||
| 33 | $roclientstr=array();$didlinesstr=array(); | ||
| 34 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 35 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 36 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 37 | { | ||
| 38 | $roclientstr[]="$tclnt"; | ||
| 39 | |||
| 40 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 41 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 42 | } | ||
| 43 | |||
| 44 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 45 | $query->orWhereIn('client',$roclientstr) | ||
| 46 | ->orWhereIn('user_id',$uidlist) | ||
| 47 | ->orWhereIn('did',$didlinesstr); | ||
| 48 | }); | ||
| 49 | |||
| 50 | } | ||
| 51 | |||
| 52 | $alist=$alist->get(); | ||
| 53 | |||
| 54 | $userarr=array();$i=1; | ||
| 55 | $reporthead=array("id","created_at","updated_at","user_id","cust_id","call_id","name","number","question_time","question","primary_question","primary_response","primary_text","followup1_question","followup1_response","followup1_text","followup2_question","followup2_response","followup2_text","followup3_question","followup3_response","followup3_text","followup4_question","followup4_response","followup4_text","followup5_question","followup5_response","followup5_text","followup6_question","followup6_response","followup6_text","followup7_question","followup7_response","followup7_text"); | ||
| 56 | //$reportarray=DB::table('questionaire_details')->select('*')->get(); | ||
| 57 | |||
| 58 | $reportarray=DB::table('questionaire_details')->select('*')->where('updated_at','>=',date("Y-m-d H:i:s",$logdate))->where('updated_at','<=',date("Y-m-d H:i:s",$logtodate))->get(); | ||
| 59 | |||
| 60 | |||
| 61 | if(Input::has("dllogxls")) | ||
| 62 | { | ||
| 63 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 64 | |||
| 65 | $inputFileType = "Excel5"; | ||
| 66 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 67 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 68 | $baseRow = 2; | ||
| 69 | |||
| 70 | |||
| 71 | $highestColumn = sizeof($reporthead); | ||
| 72 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 73 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 74 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 75 | } | ||
| 76 | |||
| 77 | foreach($reportarray as $uid=>$uarr) | ||
| 78 | { | ||
| 79 | $row = $baseRow++; | ||
| 80 | $col = 0; | ||
| 81 | |||
| 82 | if($urr->auth_question!='') | ||
| 83 | { | ||
| 84 | $urr->auth_question = (array)json_decode($urr->auth_question); | ||
| 85 | } | ||
| 86 | |||
| 87 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 88 | |||
| 89 | if($reporthead[$head]=="created_at") | ||
| 90 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 91 | |||
| 92 | if($reporthead[$head]=="updated_at") | ||
| 93 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 94 | |||
| 95 | if($reporthead[$head]=="question_time") | ||
| 96 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 97 | |||
| 98 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 99 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$reporthead[$head]); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | header('Content-Type: application/vnd.ms-excel'); | ||
| 105 | header('Content-Disposition: attachment;filename="QAireLog.xls"'); | ||
| 106 | header('Cache-Control: max-age=0'); | ||
| 107 | |||
| 108 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 109 | $objWriter->save('php://output'); | ||
| 110 | |||
| 111 | return ; | ||
| 112 | } | ||
| 113 | |||
| 114 | ?> | ||
| 115 | |||
| 116 | |||
| 117 | <div class=innerAll> | ||
| 118 | |||
| 119 | |||
| 120 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 121 | <script> | ||
| 122 | $(document).ready(function() | ||
| 123 | { | ||
| 124 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 125 | { | ||
| 126 | $('#dialoglog').dialog({ | ||
| 127 | autoOpen: false, | ||
| 128 | width: '70%', | ||
| 129 | buttons: { | ||
| 130 | "Ok": function() { | ||
| 131 | $(this).dialog("close"); | ||
| 132 | }, | ||
| 133 | "Cancel": function() { | ||
| 134 | $(this).dialog("close"); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | }); | ||
| 138 | } | ||
| 139 | |||
| 140 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 141 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 142 | |||
| 143 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 144 | }); | ||
| 145 | </script> | ||
| 146 | <div style="float:left;width:50%"> | ||
| 147 | |||
| 148 | From : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' /> | ||
| 149 | To : <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logtodate); ?>' /> | ||
| 150 | |||
| 151 | </div> | ||
| 152 | <div style="float:right;width:50%"> | ||
| 153 | |||
| 154 | |||
| 155 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 156 | |||
| 157 | </div> | ||
| 158 | <div style="clear:both"></div> | ||
| 159 | <hr> | ||
| 160 | |||
| 161 | <div class=col-md-12> | ||
| 162 | |||
| 163 | |||
| 164 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 165 | </div> | ||
| 166 | |||
| 167 | <script> | ||
| 168 | function dlAgentlogXls() | ||
| 169 | { | ||
| 170 | //window.open('dialer/questionnaire?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 171 | |||
| 172 | window.open('dialer/questionnaire?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val());return false; | ||
| 173 | } | ||
| 174 | </script> | ||
| 175 | |||
| 176 | <div style='clear:both'></div> | ||
| 177 | |||
| 178 | <div class=col-md-12> | ||
| 179 | |||
| 180 | |||
| 181 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 182 | |||
| 183 | </div> | ||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | <div style='clear:both'></div> | ||
| 188 | |||
| 189 | <div style='overflow:auto'> | ||
| 190 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 191 | <thead> | ||
| 192 | <?php /*echo $outhead;*/ ?> | ||
| 193 | </thead> | ||
| 194 | <?php /*echo $outstr;*/ ?> | ||
| 195 | </table> | ||
| 196 | </div> | ||
| 197 | |||
| 198 | <div id=dialoglog></div> | ||
| 199 | |||
| 200 | |||
| 201 | |||
| 202 | |||
| 203 | |||
| 204 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | use App\Models\SupervisonComments; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | |||
| 10 | //$agents=array(); | ||
| 11 | $sup_status=""; | ||
| 12 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 13 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 14 | |||
| 15 | if(isset($_GET['logtodate']))$logtodate=strtotime($_GET['logtodate']." 23:59:59"); | ||
| 16 | else $logtodate=strtotime(date('Y-m-d')." 23:59:59"); | ||
| 17 | |||
| 18 | if(isset($_GET['agents'])) $agents=$_GET['agents']; | ||
| 19 | else $agents=""; | ||
| 20 | |||
| 21 | if(isset($_GET['sup_status'])) $sup_status=$_GET['sup_status']; | ||
| 22 | else $sup_status=""; | ||
| 23 | |||
| 24 | |||
| 25 | /*$pb_code=implode(",",$agents); | ||
| 26 | echo "-----".$$pb_code;*/ | ||
| 27 | |||
| 28 | $userarr=array();$i=1; | ||
| 29 | $reportarray=array(); | ||
| 30 | $reporthead=array("id","date","pb_name","pb_code","pb_code","pb_landline_contact_no","supervisor_mail_id","group_id","group_id_name","cust_id","cust_name","relationship_with_group_id","cust_id_next","cust_name_next","relationship_with_group_id_next","new_group_addition_to_group","racing_from","supervisor_status","supervisor_update","Submit"); | ||
| 31 | |||
| 32 | if($agents=="" && $sup_status=="") | ||
| 33 | { | ||
| 34 | |||
| 35 | $reportarray=DB::table('potentialcustomer_details')->select('*')->where('date','>=',date("Y-m-d H:i:s",$logdate))->where('date','<=',date("Y-m-d H:i:s",$logtodate))->get(); | ||
| 36 | |||
| 37 | }else if($agents!="" && $sup_status==""){ | ||
| 38 | |||
| 39 | $reportarray=DB::table('potentialcustomer_details')->select('*')->where('date','>=',date("Y-m-d H:i:s",$logdate))->where('date','<=',date("Y-m-d H:i:s",$logtodate))->where('pb_code','=',$agents)->get(); | ||
| 40 | |||
| 41 | }else if($agents=="" && $sup_status!="") | ||
| 42 | { | ||
| 43 | |||
| 44 | /* $reportarray=DB::table('potentialcustomer_details')->select('*')->where('date','>=','"'.date("Y-m-d H:i:s",$logdate).'"')->where('date','<=','"'.date("Y-m-d H:i:s",$logtodate).'"')->where('supervisor_statu','=','"'.$sup_status.'"')->get();*/ | ||
| 45 | |||
| 46 | $reportarray = DB::select(DB::raw("SELECT * FROM potentialcustomer_details where date >='".date("Y-m-d H:i:s",$logdate)."' and date <= '".date("Y-m-d H:i:s",$logtodate)."' and supervisor_status='".$sup_status."' ")); | ||
| 47 | |||
| 48 | |||
| 49 | }else{ | ||
| 50 | /*$reportarray=DB::table('potentialcustomer_details')->select('*')->where('date','>=',date("Y-m-d H:i:s",$logdate))->where('date','<=',date("Y-m-d H:i:s",$logtodate))->where('pb_code','=',$agents)->where('supervisor_status','=','"'.$sup_status.'"')->get();*/ | ||
| 51 | |||
| 52 | $reportarray = DB::select(DB::raw("SELECT * FROM potentialcustomer_details where date >='".date("Y-m-d H:i:s",$logdate)."' and date <= '".date("Y-m-d H:i:s",$logtodate)."' and pb_code = '".$agents."' and supervisor_status='".$sup_status."' ")); | ||
| 53 | } | ||
| 54 | |||
| 55 | //echo $reportarray;die(); | ||
| 56 | /* $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 57 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 58 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 59 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 60 | })->get(); | ||
| 61 | |||
| 62 | foreach($allusers as $alluser){ | ||
| 63 | $usrData = json_decode($alluser->data); | ||
| 64 | |||
| 65 | $usrHRMSData = unserialize($usrData->hrmsdata); | ||
| 66 | |||
| 67 | if($usrHRMSData['clientsownerlist']&&$usrHRMSData['clientsownerlist']!='null') | ||
| 68 | $client[] = $usrHRMSData['clientsownerlist']; | ||
| 69 | |||
| 70 | $username[] = $alluser->username; | ||
| 71 | //print_r($username); | ||
| 72 | }*/ | ||
| 73 | |||
| 74 | if(Input::has("dllogxls")) | ||
| 75 | { | ||
| 76 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 77 | |||
| 78 | $inputFileType = "Excel5"; | ||
| 79 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 80 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 81 | $baseRow = 2; | ||
| 82 | |||
| 83 | $highestColumn = sizeof($reporthead); | ||
| 84 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 85 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 86 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 87 | } | ||
| 88 | |||
| 89 | foreach($reportarray as $uid=>$uarr) | ||
| 90 | { | ||
| 91 | $row = $baseRow++; | ||
| 92 | $col = 0; | ||
| 93 | |||
| 94 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 95 | if($reporthead[$head]=="date") | ||
| 96 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 97 | |||
| 98 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 99 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$reporthead[$head]); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | |||
| 104 | header('Content-Type: application/vnd.ms-excel'); | ||
| 105 | header('Content-Disposition: attachment;filename="PotentialCustomers.xls"'); | ||
| 106 | header('Cache-Control: max-age=0'); | ||
| 107 | |||
| 108 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 109 | $objWriter->save('php://output'); | ||
| 110 | |||
| 111 | return ; | ||
| 112 | } | ||
| 113 | //echo "<pre><br>".print_r($reportarray)."</pre>"; | ||
| 114 | $highestColumn = sizeof($reporthead); | ||
| 115 | $supervisorstatus=""; | ||
| 116 | //echo $highestColumn; | ||
| 117 | if(count($reportarray)) { | ||
| 118 | $outhead="<tr>";$outstr="";$id=""; | ||
| 119 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 120 | |||
| 121 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 122 | } | ||
| 123 | $outhead.="</tr>"; | ||
| 124 | |||
| 125 | foreach($reportarray as $uid=>$uarr) | ||
| 126 | { | ||
| 127 | |||
| 128 | |||
| 129 | $outstr.="<tr>"; | ||
| 130 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 131 | if($reporthead[$head]=="date"){ | ||
| 132 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 133 | } | ||
| 134 | if($reporthead[$head]=="id"){ | ||
| 135 | $id=$uarr->$reporthead[$head]; | ||
| 136 | } | ||
| 137 | |||
| 138 | |||
| 139 | if($reporthead[$head]=="supervisor_status"){ | ||
| 140 | $supervisorstatus=$uarr->$reporthead[$head]; | ||
| 141 | $outstr.="<td><select id='".$id."_action_taken'><option value=".$supervisorstatus.">".$supervisorstatus."</option><option value='Pending'>Pending</option><option value='Action Taken'>Action Taken</option><option value='Rejected'>Rejected</option></select></td>"; | ||
| 142 | }else if($reporthead[$head]=="Submit"){ | ||
| 143 | $outstr.="<td><input type='button' id='".$id."_save' value='Save' onclick='updatesupervisorfeedback($id);'></td>"; | ||
| 144 | }else { | ||
| 145 | $outstr.="<td>".$uarr->$reporthead[$head]."</td>"; | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | $outstr.="</tr>"; | ||
| 150 | } | ||
| 151 | } | ||
| 152 | else { | ||
| 153 | $outhead.="<tr><td>No Records Found.</td></tr>"; | ||
| 154 | } | ||
| 155 | |||
| 156 | ?> | ||
| 157 | |||
| 158 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 159 | <script> | ||
| 160 | $(document).ready(function() | ||
| 161 | { | ||
| 162 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 163 | { | ||
| 164 | $('#dialoglog').dialog({ | ||
| 165 | autoOpen: false, | ||
| 166 | width: '70%', | ||
| 167 | buttons: { | ||
| 168 | "Ok": function() { | ||
| 169 | $(this).dialog("close"); | ||
| 170 | }, | ||
| 171 | "Cancel": function() { | ||
| 172 | $(this).dialog("close"); | ||
| 173 | } | ||
| 174 | } | ||
| 175 | }); | ||
| 176 | } | ||
| 177 | |||
| 178 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 179 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 180 | |||
| 181 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 182 | }); | ||
| 183 | </script> | ||
| 184 | <div class=innerAll> | ||
| 185 | <h4 style="float:left;width:50%;margin:10px 0;">Racing Customer</h4> | ||
| 186 | <div style="float:right;width:50%"> | ||
| 187 | |||
| 188 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i>Download</button> | ||
| 189 | |||
| 190 | </div> | ||
| 191 | <div style="clear:both"></div> | ||
| 192 | <hr style="margin-bottom: 5px;"> | ||
| 193 | <div> | ||
| 194 | |||
| 195 | Date:From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");'/> | ||
| 196 | To<input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logtodate); ?>' onchange='statusLogReloadFun("");'/> | ||
| 197 | PB Code: | ||
| 198 | <select id='usrname' class=select2multi style="width: 20%;" > | ||
| 199 | <?php | ||
| 200 | $companyarr=$wakka->LoadAll("select * from hrms_masters where mtype='company'"); | ||
| 201 | foreach($companyarr as $tcompany) | ||
| 202 | { | ||
| 203 | $seltxt=''; | ||
| 204 | if(strstr(",".$clientslist.",",",$tcompany[mkey],"))$seltxt='selected="selected"'; | ||
| 205 | echo "<option value='$agents'>$agents</option> <option value='$tcompany[mkey]' $seltxt>$tcompany[mkey]</option>"; | ||
| 206 | } | ||
| 207 | ?> | ||
| 208 | |||
| 209 | </select> | ||
| 210 | Supervisor Status:<select class=select2multi id='sup_status' style="width: 20%;"> | ||
| 211 | <option value=''></option> | ||
| 212 | <option value='Pending'>Pending</option> | ||
| 213 | <option value='Action Taken'>Action Taken</option> | ||
| 214 | <option value='Rejected'>Rejected</option> | ||
| 215 | </select> | ||
| 216 | |||
| 217 | |||
| 218 | <button class="pull-right btn btn-sm btn-default" onclick='statusLogReloadFun("");return false;' title='Search' style='margin-top:-1px'><i class='fa fa-search'></i>Search</button> | ||
| 219 | |||
| 220 | </div> | ||
| 221 | |||
| 222 | <div id=createtaskdiv></div> | ||
| 223 | <hr style="margin:5px;"> | ||
| 224 | <div style='overflow:auto;margin-top: 10px;'> | ||
| 225 | <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;> | ||
| 226 | <thead><?php echo $outhead; ?></thead> | ||
| 227 | <?php echo $outstr; ?> | ||
| 228 | </table> | ||
| 229 | </div> | ||
| 230 | <div id=dialoglog></div> | ||
| 231 | </div> | ||
| 232 | <script> | ||
| 233 | |||
| 234 | function dlAgentlogXls() | ||
| 235 | { | ||
| 236 | var agents=$('#usrname').val(); | ||
| 237 | var sup_status=$('#sup_status').val(); | ||
| 238 | if(agents=="" && sup_status=="" ){ | ||
| 239 | window.open('dialer/raicingcustomerreport?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val());return false; | ||
| 240 | }else if(sup_status=="" && agents!=""){ | ||
| 241 | window.open('dialer/raicingcustomerreport?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&agents='+agents);return false; | ||
| 242 | }else if(sup_status!="" && agents==""){ | ||
| 243 | window.open('dialer/raicingcustomerreport?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&sup_status='+sup_status);return false; | ||
| 244 | }else{ | ||
| 245 | window.open('dialer/raicingcustomerreport?dllogxls=1&logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&agents='+agents+'&sup_status='+sup_status);return false; | ||
| 246 | } | ||
| 247 | |||
| 248 | } | ||
| 249 | function dataString() | ||
| 250 | { | ||
| 251 | |||
| 252 | var agents=$('#usrname').val(); | ||
| 253 | var sup_status=$('#sup_status').val(); | ||
| 254 | |||
| 255 | if(agents=="" && sup_status=="" ) | ||
| 256 | { | ||
| 257 | return 'logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val() | ||
| 258 | } | ||
| 259 | else if(sup_status=="" && agents!="") | ||
| 260 | { | ||
| 261 | return 'logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&agents='+agents; | ||
| 262 | }else if(sup_status!="" && agents==""){ | ||
| 263 | return 'logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&sup_status='+sup_status; | ||
| 264 | } | ||
| 265 | else | ||
| 266 | { | ||
| 267 | return 'logdate='+$("#modfrom").val()+'&logtodate='+$("#modto").val()+'&agents='+agents+'&sup_status='+sup_status; | ||
| 268 | } | ||
| 269 | |||
| 270 | } | ||
| 271 | function statusLogReloadFun(sortby) | ||
| 272 | { | ||
| 273 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 274 | var searchStr = dataString(); | ||
| 275 | doAjax('dialer/raicingcustomerreport?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 276 | } | ||
| 277 | function updatesupervisorfeedback(id) | ||
| 278 | { | ||
| 279 | var supervisorstatus=$('#'+id+'_action_taken').val(); | ||
| 280 | var postdata='id='+id; | ||
| 281 | postdata+='&supervisorstatus='+supervisorstatus; | ||
| 282 | doAjax('racingcustupdate',postdata,'createtaskdiv','ajaxMutex_recSaveData','singlethis','POST'); | ||
| 283 | } | ||
| 284 | </script> | ||
| 285 | |||
| 286 | |||
| 287 | |||
| 288 | |||
| 289 | |||
| 290 | |||
| 291 | |||
| 292 |
| 1 | <?php | ||
| 2 | use App\Models\User; | ||
| 3 | use App\Models\Sipid; | ||
| 4 | use App\Models\UserLog; | ||
| 5 | |||
| 6 | if(Input::has("dlfailed")) | ||
| 7 | { | ||
| 8 | |||
| 9 | return; | ||
| 10 | } | ||
| 11 | if(Input::has("process")) | ||
| 12 | { | ||
| 13 | echo "simpleNotification('success','topRight','Processing Started');"; | ||
| 14 | return; | ||
| 15 | } | ||
| 16 | if(Input::has("archivesearch")) | ||
| 17 | { | ||
| 18 | $searchresultH="<br><table class='footable table' cellpadding='0' cellspacing='0' style='border-bottom:black 2px solid;margin-bottom:20px'><thead><tr> | ||
| 19 | <td class='table_hrm_heading_green'>Status</td> | ||
| 20 | <td class='table_hrm_heading_green'>Name</td> | ||
| 21 | <td class='table_hrm_heading_green'>Values<span style='float:right'><a href=# onclick='return false;'>Close</a></span></td> | ||
| 22 | </tr></thead>"; | ||
| 23 | $searchresultF='</table><div style="clear:both"></div><div id=divworking></div><div style="clear:both"></div>'; | ||
| 24 | |||
| 25 | $searchresult=""; | ||
| 26 | //for | ||
| 27 | $searchresult.=" | ||
| 28 | <tr class='recSearchResTbl' style='cursor:pointer' onclick='recArchiveOpen(this);'> | ||
| 29 | <td></td> | ||
| 30 | <td></td> | ||
| 31 | <td></td> | ||
| 32 | </tr>"; | ||
| 33 | |||
| 34 | echo $searchresultH.$searchresult.$searchresultF; | ||
| 35 | return; | ||
| 36 | } | ||
| 37 | if(Input::has("savesettings")) | ||
| 38 | { | ||
| 39 | echo "simpleNotification('success','topRight','Settings Saved');"; | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | ?> | ||
| 43 | |||
| 44 | <div class="layout-app"><!-- row-app --> | ||
| 45 | <div class="row row-app"> | ||
| 46 | |||
| 47 | <div class="col-md-12"> | ||
| 48 | |||
| 49 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | <div class="col-app"> | ||
| 54 | |||
| 55 | <div class="row-app"> | ||
| 56 | |||
| 57 | <div class="col-md-9"> | ||
| 58 | <div class="col-separator"> | ||
| 59 | |||
| 60 | <!-- col-app --> | ||
| 61 | <div class="box col-unscrollable"> | ||
| 62 | |||
| 63 | <div class="widget widget-tabs widget-tabs-social-account widget-tabs-responsive"> | ||
| 64 | <div class="widget-body"> | ||
| 65 | <div class="tab-content"> | ||
| 66 | <div id="tabAccount" class="tab-pane active widget-body-regular padding-none border-none reset-components"> | ||
| 67 | <div class="widget widget-tabs border-bottom-none"> | ||
| 68 | |||
| 69 | <div class="widget-head"> | ||
| 70 | <ul> | ||
| 71 | <li class="active"><a data-toggle="tab" href="#tab_pageZ" class="glyphicons search" title=''><i></i> Files</a></li> | ||
| 72 | <li><a data-toggle="tab" href="#tab_page0" class="glyphicons list" title=''><i></i> Staging</a></li> | ||
| 73 | <li><a data-toggle="tab" href="#tab_page1" class="glyphicons file" title=''><i></i> Processing</a></li> | ||
| 74 | <li><a data-toggle="tab" href="#tab_page2" class="glyphicons nameplate" title=''><i></i> Archive</a></li> | ||
| 75 | <li><a data-toggle="tab" href="#tab_page3" class="glyphicons cogwheel" title=''><i></i> Settings</a></li> | ||
| 76 | </ul> | ||
| 77 | </div> | ||
| 78 | |||
| 79 | |||
| 80 | <div class="widget-body padding-none"> | ||
| 81 | <div class="tab-content"> | ||
| 82 | |||
| 83 | <div class="tab-pane innerAll active" id="tab_pageZ" style='min-height:500px'> | ||
| 84 | <?php | ||
| 85 | |||
| 86 | ?> | ||
| 87 | <br> | ||
| 88 | <h4>Files</h4> | ||
| 89 | <hr><br> | ||
| 90 | <div id=recfiles_search></div><div class="clearfix"></div><br><br> | ||
| 91 | |||
| 92 | |||
| 93 | </div> | ||
| 94 | |||
| 95 | <div class="tab-pane innerAll" id="tab_page0"> | ||
| 96 | |||
| 97 | <div class=col-md-6> | ||
| 98 | <button class="btn btn-default" onclick='window.open("dialer/recarchive?dlfailed=1")'>Download</button> <button class="btn btn-default" onclick='doAjax("dialer/recarchive?process=1","","","recarchive_process","singlefail","GET");return false;'>Process</button><br> | ||
| 99 | </div> | ||
| 100 | <div class=col-md-6> | ||
| 101 | <form method=post enctype="multipart/form-data" action='dialer?action=recarchive&type=stageupload' target='empblkuploaddiv'> | ||
| 102 | <input type=hidden name=_token value={!!csrf_token()!!}> | ||
| 103 | <input type=hidden name=empbulkaction value='upload'> | ||
| 104 | <div class="fileupload fileupload-new margin-none" data-provides="fileupload"> | ||
| 105 | <div class="input-group"> | ||
| 106 | <div class="form-control col-md-3"><i class="fa fa-file fileupload-exists"></i> <span class="fileupload-preview"></span></div> | ||
| 107 | <span class="input-group-btn"> | ||
| 108 | <span class="btn btn-default btn-file"><span class="fileupload-new">Select file</span><span class="fileupload-exists">Change</span><input type="file" name=empbulkfile id=empbulkfile class="margin-none"></span><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a><span class="btn btn-default" onclick='document.forms[0].submit();'>Upload</span> | ||
| 109 | </span> | ||
| 110 | </div> | ||
| 111 | </div> | ||
| 112 | </form> | ||
| 113 | <iframe id='empblkuploaddiv' name='empblkuploaddiv' style='width:1px;height:1px;visibility:hidden;display:none'></iframe> | ||
| 114 | </div> | ||
| 115 | <div class="clearfix"></div> | ||
| 116 | <?php | ||
| 117 | $tabarr=array(); | ||
| 118 | $tabledata=""; | ||
| 119 | |||
| 120 | ?> | ||
| 121 | <br> | ||
| 122 | <h4>Staged Records</h4> | ||
| 123 | <hr><br> | ||
| 124 | <!-- Table --> | ||
| 125 | <table class="{!!sizeof($tabarr)>10?'dynamicTable':''!!} tableTools table table-striped table-bordered table-condensed table-white" style='margin-bottom:20px!important'> | ||
| 126 | <thead> | ||
| 127 | <tr> | ||
| 128 | <th>Id</th> | ||
| 129 | <th>CRMID</th> | ||
| 130 | <th>ClientId</th> | ||
| 131 | <th>Mobile</th> | ||
| 132 | <th>Client</th> | ||
| 133 | <th>DateSubmitted</th> | ||
| 134 | <th>Status</th> | ||
| 135 | <th>Actions</th> | ||
| 136 | </tr> | ||
| 137 | </thead> | ||
| 138 | |||
| 139 | <tbody> | ||
| 140 | {!!$tabledata!!} | ||
| 141 | </tbody> | ||
| 142 | </table> | ||
| 143 | <!-- // Table END --> | ||
| 144 | |||
| 145 | |||
| 146 | </div> | ||
| 147 | <div class="tab-pane innerAll" id="tab_page1"> | ||
| 148 | <?php | ||
| 149 | $tabarr2=array(); | ||
| 150 | $tabledata2=""; | ||
| 151 | |||
| 152 | ?> | ||
| 153 | <br> | ||
| 154 | <h4>Processing Records</h4> | ||
| 155 | <hr><br> | ||
| 156 | <!-- Table --> | ||
| 157 | <table class="{!!sizeof($tabarr2)>10?'dynamicTable':''!!} tableTools table table-striped table-bordered table-condensed table-white" style='margin-bottom:20px!important'> | ||
| 158 | <thead> | ||
| 159 | <tr> | ||
| 160 | <th>Id</th> | ||
| 161 | <th>CRMID</th> | ||
| 162 | <th>ClientId</th> | ||
| 163 | <th>Mobile</th> | ||
| 164 | <th>Client</th> | ||
| 165 | <th>DateSubmitted</th> | ||
| 166 | <th>Status</th> | ||
| 167 | <th>Actions</th> | ||
| 168 | </tr> | ||
| 169 | </thead> | ||
| 170 | |||
| 171 | <tbody> | ||
| 172 | {!!$tabledata2!!} | ||
| 173 | </tbody> | ||
| 174 | </table> | ||
| 175 | <!-- // Table END --> | ||
| 176 | </div> | ||
| 177 | <div class="tab-pane innerAll" id="tab_page2" style='min-height:500px'> | ||
| 178 | <?php | ||
| 179 | |||
| 180 | ?> | ||
| 181 | <br> | ||
| 182 | <h4>Archived Records</h4> | ||
| 183 | <hr><br> | ||
| 184 | <div id=recarchive_search></div><div class="clearfix"></div><br><br> | ||
| 185 | |||
| 186 | |||
| 187 | </div> | ||
| 188 | <div class="tab-pane innerAll" id="tab_page3"> | ||
| 189 | <textarea class=form-control rows=20>Server=10.0.0.1 | ||
| 190 | Server=10.0.0.2 | ||
| 191 | Server=10.0.0.3 | ||
| 192 | Server=10.0.0.4 | ||
| 193 | Server=10.0.0.5</textarea> | ||
| 194 | <br> | ||
| 195 | <button class="btn btn-default" onclick='doAjax("dialer/recarchive?savesettings=1","","","recarchive_process","singlefail","GET");return false;'>Save</button> | ||
| 196 | |||
| 197 | </div> | ||
| 198 | |||
| 199 | |||
| 200 | </div> | ||
| 201 | </div> | ||
| 202 | |||
| 203 | </div> | ||
| 204 | </div> | ||
| 205 | </div> | ||
| 206 | </div> | ||
| 207 | </div> | ||
| 208 | |||
| 209 | </div> | ||
| 210 | <!-- // END col-app.col-unscrollable --> | ||
| 211 | |||
| 212 | |||
| 213 | </div> | ||
| 214 | <!-- // END col-separator --> | ||
| 215 | </div> | ||
| 216 | <!-- // END col --> | ||
| 217 | |||
| 218 | <!-- col --> | ||
| 219 | <div class="col-md-3"> | ||
| 220 | |||
| 221 | <!-- col-separator --> | ||
| 222 | <div class="col-separator col-separator-last" style='margin-right:25px;padding-right:0px'> | ||
| 223 | |||
| 224 | <!-- Heading --> | ||
| 225 | <h5 class="innerAll margin-none bg-primary"> | ||
| 226 | <i class="fa fa-fw fa-book"></i> Application Stats | ||
| 227 | <!-- <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;"><i class="fa fa-plus fa-fw"></i>Add New</a> --> | ||
| 228 | </h5> | ||
| 229 | |||
| 230 | |||
| 231 | |||
| 232 | <!-- Listing --> | ||
| 233 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 234 | <div class="media"> | ||
| 235 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 236 | <a href="#" class="pull-left"> | ||
| 237 | <img src="assets/images/people/avatar.jpg" class="media-object" width="39"/> | ||
| 238 | </a> | ||
| 239 | </div> | ||
| 240 | <a class="pull-right innerAll" href="#"> | ||
| 241 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 242 | </a> | ||
| 243 | <div class="media-body"> | ||
| 244 | <h5>Nodes Active 5/5</h5> | ||
| 245 | <div class="media-body" title=""> | ||
| 246 | <div class="progress progress-small margin-none"> | ||
| 247 | <div class="progress-bar progress-bar-primary" style="width: 100%"></div> | ||
| 248 | </div> | ||
| 249 | </div> | ||
| 250 | </div> | ||
| 251 | </div> | ||
| 252 | </div> | ||
| 253 | <!-- Listing ends--> | ||
| 254 | <!-- Listing --> | ||
| 255 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 256 | <div class="media"> | ||
| 257 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 258 | <a href="#" class="pull-left"> | ||
| 259 | <img src="assets/images/people/avatar.jpg" class="media-object" width="39"/> | ||
| 260 | </a> | ||
| 261 | </div> | ||
| 262 | <a class="pull-right innerAll" href="#"> | ||
| 263 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 264 | </a> | ||
| 265 | <div class="media-body"> | ||
| 266 | <h5>Processing 0/0</h5> | ||
| 267 | <div class="media-body" title=""> | ||
| 268 | <div class="progress progress-small margin-none"> | ||
| 269 | <div class="progress-bar progress-bar-primary" style="width: 0%"></div> | ||
| 270 | </div> | ||
| 271 | </div> | ||
| 272 | </div> | ||
| 273 | </div> | ||
| 274 | </div> | ||
| 275 | <!-- Listing ends--> | ||
| 276 | |||
| 277 | <!-- Listing --> | ||
| 278 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 279 | <div class="media"> | ||
| 280 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 281 | <a href="#" class="pull-left"> | ||
| 282 | <img src="assets/images/people/author_file.jpg" class="media-object" width="39"/> | ||
| 283 | </a> | ||
| 284 | </div> | ||
| 285 | <a class="pull-right innerAll" href="#"> | ||
| 286 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 287 | </a> | ||
| 288 | <div class="media-body"> | ||
| 289 | <?php ?> | ||
| 290 | <h5>Space Usages</h5> | ||
| 291 | <div class="media-body" title=''> | ||
| 292 | <div class="progress progress-small margin-none"> | ||
| 293 | <div class="progress-bar progress-bar-primary" style="width: 50%"></div> | ||
| 294 | </div> | ||
| 295 | </div> | ||
| 296 | </div> | ||
| 297 | </div> | ||
| 298 | </div> | ||
| 299 | <!-- Listing ends--> | ||
| 300 | |||
| 301 | |||
| 302 | |||
| 303 | <!-- Listing --> | ||
| 304 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 305 | <div class="media"> | ||
| 306 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 307 | <a href="#" class="pull-left"> | ||
| 308 | <img src="assets/images/people/author_content.jpg" class="media-object" width="39"/> | ||
| 309 | </a> | ||
| 310 | </div> | ||
| 311 | <a class="pull-right innerAll" href="#"> | ||
| 312 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 313 | </a> | ||
| 314 | <div class="media-body"> | ||
| 315 | <?php | ||
| 316 | |||
| 317 | |||
| 318 | ?> | ||
| 319 | <h5> Errors</h5> | ||
| 320 | <div class="media-body" title=''> | ||
| 321 | <div class="progress progress-small margin-none"> | ||
| 322 | <div class="progress-bar progress-bar-primary" style="width: 0%"></div> | ||
| 323 | </div> | ||
| 324 | </div> | ||
| 325 | </div> | ||
| 326 | </div> | ||
| 327 | </div> | ||
| 328 | <!-- Listing ends--> | ||
| 329 | |||
| 330 | |||
| 331 | |||
| 332 | </div> | ||
| 333 | <!-- // END col-separator --> | ||
| 334 | <div class="clearfix"></div> | ||
| 335 | </div> | ||
| 336 | <!-- // END col-table --> | ||
| 337 | |||
| 338 | </div> | ||
| 339 | <!-- // END col-separator.box --> | ||
| 340 | |||
| 341 | </div> | ||
| 342 | <!-- // END col --> | ||
| 343 | |||
| 344 | |||
| 345 | </div> | ||
| 346 | </div> | ||
| 347 | |||
| 348 | </div> | ||
| 349 | </div><!-- // END row-app --> | ||
| 350 | |||
| 351 | <script> | ||
| 352 | function createRecSearchRecordDiv(divid) | ||
| 353 | { | ||
| 354 | if(currentsearchdivid!="")$("#"+currentsearchdivid).html(""); | ||
| 355 | currentsearchdivid=divid; | ||
| 356 | |||
| 357 | var searchRecordDivHTMLLI="ID,FirstName,LastName,Client,Mobile,ClientCode,InternalID".split(","); | ||
| 358 | |||
| 359 | searchRecordPreselectList=["","ID","FirstName","Mobile","ClientCode"]; | ||
| 360 | |||
| 361 | var searchRecordDivHTML=""; | ||
| 362 | for(i=1;i<=4;i++) | ||
| 363 | { | ||
| 364 | searchRecordDivHTML+="<div class=col-md-3>"; | ||
| 365 | searchRecordDivHTML+="<div class='widget row widget-heading-simple widget-body-gray' >"; | ||
| 366 | searchRecordDivHTML+="<div class='widget-body'><div class='input-group'>"; | ||
| 367 | searchRecordDivHTML+="<div class='input-group-btn'>"; | ||
| 368 | searchRecordDivHTML+="<div class='dropdown'>"; | ||
| 369 | searchRecordDivHTML+="<button class='btn btn-default dropdown-toggle rounded-left' data-toggle='dropdown'><span id=maintextsearch_"+i+"_span>"+searchRecordPreselectList[i]+"</span> <span class='caret'></span></button>"; | ||
| 370 | searchRecordDivHTML+="<ul class='dropdown-menu pull-left'>"; | ||
| 371 | |||
| 372 | for(j=0;j<searchRecordDivHTMLLI.length;j++)searchRecordDivHTML+="<li><a href='#' onclick='$(\"#maintextsearch_"+i+"_span\").html($(this).html());return false;'>"+searchRecordDivHTMLLI[j]+"</a></li>"; | ||
| 373 | |||
| 374 | searchRecordDivHTML+="</ul>"; | ||
| 375 | searchRecordDivHTML+="</div>"; | ||
| 376 | searchRecordDivHTML+="</div>"; | ||
| 377 | searchRecordDivHTML+="<input class='form-control' id='maintextsearch_"+i+"_txt' type='text' onkeyup='recArchiveTextSearchStart();' />"; | ||
| 378 | searchRecordDivHTML+="</div></div>"; | ||
| 379 | searchRecordDivHTML+="</div>"; | ||
| 380 | searchRecordDivHTML+="</div>"; | ||
| 381 | } | ||
| 382 | searchRecordDivHTML+="<div style='clear:both'></div>"; | ||
| 383 | searchRecordDivHTML+="<div id=searchresults></div>"; | ||
| 384 | |||
| 385 | $("#"+divid).html(searchRecordDivHTML); | ||
| 386 | |||
| 387 | } | ||
| 388 | var recArchivesearchTimer=null; | ||
| 389 | function recArchiveTextSearchStart() | ||
| 390 | { | ||
| 391 | clearTimeout(recArchivesearchTimer); | ||
| 392 | searchTimer = setTimeout(recArchivemainTextSearch, 1500); | ||
| 393 | } | ||
| 394 | function recArchivemainTextSearch() | ||
| 395 | { | ||
| 396 | var searchStr=''; | ||
| 397 | searchStr+='&maintextsearch_1_txt='+$('#maintextsearch_1_txt').val()+'&maintextsearch_1_span='+$("#maintextsearch_1_span").html(); | ||
| 398 | searchStr+='&maintextsearch_2_txt='+$('#maintextsearch_2_txt').val()+'&maintextsearch_2_span='+$("#maintextsearch_2_span").html(); | ||
| 399 | searchStr+='&maintextsearch_3_txt='+$('#maintextsearch_3_txt').val()+'&maintextsearch_3_span='+$("#maintextsearch_3_span").html(); | ||
| 400 | searchStr+='&maintextsearch_4_txt='+$('#maintextsearch_4_txt').val()+'&maintextsearch_4_span='+$("#maintextsearch_4_span").html(); | ||
| 401 | |||
| 402 | doAjax("dialer/recarchive?archivesearch=1", "searchstring="+searchStr, "searchresults", "searchMutex", "searchxhr","GET"); | ||
| 403 | } | ||
| 404 | |||
| 405 | |||
| 406 | |||
| 407 | createRecSearchRecordDiv("recfiles_search"); | ||
| 408 | // createRecSearchRecordDiv("recarchive_search"); | ||
| 409 | </script> |
| 1 | <?php | ||
| 2 | use App\Models\User; | ||
| 3 | use App\Models\Sipid; | ||
| 4 | use App\Models\UserLog; | ||
| 5 | use App\Models\CRMCall; | ||
| 6 | use App\Jobs\KHRMSLib; | ||
| 7 | |||
| 8 | $wakka = new KHRMSLib(); | ||
| 9 | $dashboarduser=Auth::user(); | ||
| 10 | |||
| 11 | if(Input::has("qcstage")) | ||
| 12 | { | ||
| 13 | $stage=Input::get("qcstage"); | ||
| 14 | if($stage=="list") | ||
| 15 | { | ||
| 16 | |||
| 17 | $qcyear=Input::get("qcyearselect",date("Y")); | ||
| 18 | $qcmonth=Input::get("qcmonthselect",date("m")); | ||
| 19 | $logdate="$qcyear-$qcmonth"; | ||
| 20 | |||
| 21 | $mcallcnt=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Hangup')->count(); | ||
| 22 | $qccallcnt=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Hangup-QC')->count(); | ||
| 23 | |||
| 24 | |||
| 25 | $per3=(3*$mcallcnt/100)>$qccallcnt?((3*$mcallcnt/100)-$qccallcnt):0; | ||
| 26 | $hcalls=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Hangup')->orderBy(DB::raw('RAND()'))->take(ceil($per3))->get(); | ||
| 27 | |||
| 28 | $acallcnt=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Archive')->count(); | ||
| 29 | $aqccallcnt=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Archive-QC')->count(); | ||
| 30 | |||
| 31 | $per3=(3*$acallcnt/100)>$aqccallcnt?((3*$acallcnt/100)-$aqccallcnt):0; | ||
| 32 | $acalls=CRMCall::where('created_at','>=',$logdate."-01 00:00:00")->where('created_at','<=',$logdate."-31 23:59:59")->where('state','=','Archive')->orderBy(DB::raw('RAND()'))->take(ceil($per3))->get(); | ||
| 33 | |||
| 34 | $alist=$acalls->merge($hcalls); | ||
| 35 | ?> | ||
| 36 | |||
| 37 | |||
| 38 | <div class="col-table-row"> | ||
| 39 | |||
| 40 | <div class="col-app col-unscrollable"> | ||
| 41 | |||
| 42 | <div class="col-app"> | ||
| 43 | |||
| 44 | <div class="row-app"> | ||
| 45 | |||
| 46 | <div class="col-md-9"> | ||
| 47 | <div class="col-separator"> | ||
| 48 | |||
| 49 | <!-- Category Heading --> | ||
| 50 | <div class="heading-buttons bg-gray border-bottom innerR half"> | ||
| 51 | <span class=pull-right> | ||
| 52 | <a href="#" class="btn btn-sm btn-inverse pull-right" onclick='reloadQCdata();return false;'><i class="fa fa-user fa-refresh"></i> Reload</a> | ||
| 53 | <select id=qcyearselect class='form-control pull-right' style='width:100px'> | ||
| 54 | <option value="{!!$qcyear!!}">{!!$qcyear!!}</option> | ||
| 55 | </select> | ||
| 56 | |||
| 57 | <select id=qcmonthselect class='form-control pull-right' style='width:100px'> | ||
| 58 | <option value="{!!$qcmonth!!}">{!!$qcmonth!!}</option> | ||
| 59 | </select> | ||
| 60 | </span> | ||
| 61 | <h4 class="innerTB margin-bottom-none">QC List</h4> | ||
| 62 | <div class="clearfix"></div> | ||
| 63 | </div> | ||
| 64 | <!-- End Category Heading --> | ||
| 65 | <div class=innerAll> | ||
| 66 | |||
| 67 | |||
| 68 | <div style='overflow:auto'> | ||
| 69 | <?php | ||
| 70 | $outstr=""; | ||
| 71 | foreach($alist as $aline) | ||
| 72 | { | ||
| 73 | $clientcode=""; | ||
| 74 | if($aline->crm_id>0) | ||
| 75 | { | ||
| 76 | $user=$wakka->getPerson($aline->crm_id); | ||
| 77 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 78 | } | ||
| 79 | $tpostdata=json_decode($aline->data,true); | ||
| 80 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 81 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 82 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 83 | |||
| 84 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 85 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 86 | |||
| 87 | $recstr=''; | ||
| 88 | if($dashboarduser->moduleACL("Admin",false,false,true)) | ||
| 89 | { | ||
| 90 | if(isset($tpostdata['recFolder']))$recstr="<a href=# onclick='getCallRec(".$aline->id.");return false;' title='Size : ".round($aline->recsize/1024,0)." KB'><i class='fa fa-play-circle'></i> </a> <a href='dialer/playrecfile?calllog=$aline->id' title=''><i class='fa fa-download'></i> </a><span id='recspan_".$aline->id."'</span>"; | ||
| 91 | } | ||
| 92 | |||
| 93 | $outstr.="<tr><td>".$i."</td> | ||
| 94 | <td title='$fulldate'>".explode(" ",$fulldate)[1]."</td> | ||
| 95 | <td>$length</td> | ||
| 96 | <td>".$dispname."</td> | ||
| 97 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 98 | <td>".$aline->usersubstatus."</td> | ||
| 99 | <td>".($aline->usercallback!="0000-00-00 00:00:00"?date("Y-m-d H:i:s",strtotime($aline->usercallback)-($dashboarduser->timezone*60)):"")."</td> | ||
| 100 | <td><a href=# class='' onclick='dialerQuickOpen(\"$aline->crm_id\",\"$aline->number\",\"Progressive\",\"\",0);return false;'>".$aline->number."</a></td> | ||
| 101 | <td>$clientcode</td> | ||
| 102 | <td>".$aline->client."</td> | ||
| 103 | <td>".$aline->department."</td> | ||
| 104 | <td>".$aline->state."</td> | ||
| 105 | <td>".$aline->hsource."</td> | ||
| 106 | <td>".$aline->type."</td> | ||
| 107 | <td>".$aline->status."</td> | ||
| 108 | <td>".$aline->statuscode."</td> | ||
| 109 | <td>".$aline->substatus."</td> | ||
| 110 | <td>".$aline->dialline_id."</td> | ||
| 111 | <td>".$aline->did."</td> | ||
| 112 | <td>".round($aline->waitSec/1000,2)."</td> | ||
| 113 | <td>".round($aline->callSec/1000,2)."</td> | ||
| 114 | <td>".round($talktime/1000,2)."</td> | ||
| 115 | <td>".round($aline->dispoSec/1000,2)."</td> | ||
| 116 | <td>$recstr</td> | ||
| 117 | </tr>"; | ||
| 118 | |||
| 119 | |||
| 120 | if($aline->type=='Inbound') | ||
| 121 | { | ||
| 122 | if($talktime>120000)$ttlovr10In++; | ||
| 123 | else if($talktime>60000)$ttlovr5In++; | ||
| 124 | else if($talktime>30000)$ttlovr1In++; | ||
| 125 | else if($talktime>1000)$ttlovr0In++; | ||
| 126 | |||
| 127 | $totaltimeIn+=round($talktime/1000,2); | ||
| 128 | $usrcntIn++; | ||
| 129 | |||
| 130 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 131 | if(!isset($actionarrIn[$turl]))$actionarrIn[$turl]=array('cnt'=>0,'time'=>0); | ||
| 132 | $actionarrIn[$turl]['cnt']++; | ||
| 133 | $actionarrIn[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 134 | } | ||
| 135 | else | ||
| 136 | { | ||
| 137 | if($talktime>120000)$ttlovr10++; | ||
| 138 | else if($talktime>60000)$ttlovr5++; | ||
| 139 | else if($talktime>30000)$ttlovr1++; | ||
| 140 | else if($talktime>1000)$ttlovr0++; | ||
| 141 | |||
| 142 | $totaltime+=round($talktime/1000,2); | ||
| 143 | $usrcnt++; | ||
| 144 | |||
| 145 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 146 | if(!isset($actionarr[$turl]))$actionarr[$turl]=array('cnt'=>0,'time'=>0); | ||
| 147 | $actionarr[$turl]['cnt']++; | ||
| 148 | $actionarr[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 149 | } | ||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | if(!empty($_GET['sort']))$i++;else $i--; | ||
| 154 | } | ||
| 155 | |||
| 156 | ?> | ||
| 157 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 158 | <thead> | ||
| 159 | <tr> | ||
| 160 | <th>#</th> | ||
| 161 | <th>Start</th> | ||
| 162 | <th onclick='callLogReloadFun("");return false;'>Length</th> | ||
| 163 | <th>User</th> | ||
| 164 | <th>Dispo</th> | ||
| 165 | <th>SubDispo</th> | ||
| 166 | <th>CB</th> | ||
| 167 | <th style='width:120px'>Number</th> | ||
| 168 | <th>ClientCode</th> | ||
| 169 | <th>Data</th> | ||
| 170 | <th>SubData</th> | ||
| 171 | <th>State</th> | ||
| 172 | <th>HSource</th> | ||
| 173 | <th>Type</th> | ||
| 174 | <th>Status</th> | ||
| 175 | <th>StatusCode</th> | ||
| 176 | <th>StatusStr</th> | ||
| 177 | <th>DialLine</th> | ||
| 178 | <th>DID</th> | ||
| 179 | <th>WaitSec</th> | ||
| 180 | <th>CallSec</th> | ||
| 181 | <th>TalkSec</th> | ||
| 182 | <th>DispoSec</th> | ||
| 183 | <th>Recording</th> | ||
| 184 | </tr> | ||
| 185 | </thead> | ||
| 186 | <?php echo $outstr; ?> | ||
| 187 | </table> | ||
| 188 | </div> | ||
| 189 | |||
| 190 | </div><div class="clearfix"></div> | ||
| 191 | |||
| 192 | |||
| 193 | <div class="col-separator-h"></div> | ||
| 194 | |||
| 195 | |||
| 196 | |||
| 197 | |||
| 198 | </div> | ||
| 199 | <!-- // END col-separator --> | ||
| 200 | </div> | ||
| 201 | <!-- // END col --> | ||
| 202 | |||
| 203 | <!-- col --> | ||
| 204 | <div class="col-md-3"> | ||
| 205 | |||
| 206 | <!-- col-separator --> | ||
| 207 | <div class="col-separator" style='margin-right:0px'> | ||
| 208 | |||
| 209 | <!-- Heading --> | ||
| 210 | <h5 class="innerAll margin-none bg-primary"> | ||
| 211 | <i class="fa fa-fw fa-book"></i> Stats | ||
| 212 | <!-- <a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;"><i class="fa fa-plus fa-fw"></i>Add New</a> --> | ||
| 213 | </h5> | ||
| 214 | |||
| 215 | |||
| 216 | |||
| 217 | <!-- Listing --> | ||
| 218 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 219 | <div class="media"> | ||
| 220 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 221 | <a href="#" class="pull-left"> | ||
| 222 | <img src="assets/images/people/avatar.jpg" class="media-object" width="39"/> | ||
| 223 | </a> | ||
| 224 | </div> | ||
| 225 | <a class="pull-right innerAll" href="#"> | ||
| 226 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 227 | </a> | ||
| 228 | <div class="media-body"> | ||
| 229 | <?php $totalusers=User::where('status','!=','Disabled')->count();$totalactive=\App\Models\User::where('status','=','Active')->where('usertype','!=','')->count();$totalactivemtd=\App\Models\User::where('status','=','Active')->where('usertype','!=','')->where('updated_at','>',date('Y-m-01 00:00:00'))->count(); ?> | ||
| 230 | <h5>Users {!!$totalactivemtd!!} MTD/{!!$totalactive!!} Active</h5> | ||
| 231 | <div class="media-body" title="{!!$totalactivemtd!!}/{!!$totalactive!!} MTD Active/Total Active, {!!round($totalactivemtd*100/$totalactive,1)!!}%"> | ||
| 232 | <div class="progress progress-small margin-none"> | ||
| 233 | <div class="progress-bar progress-bar-primary" style="width: {!!round($totalactivemtd*100/$totalactive,1)!!}%"></div> | ||
| 234 | </div> | ||
| 235 | </div> | ||
| 236 | </div> | ||
| 237 | </div> | ||
| 238 | </div> | ||
| 239 | <!-- Listing ends--> | ||
| 240 | <!-- Listing --> | ||
| 241 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 242 | <div class="media"> | ||
| 243 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 244 | <a href="#" class="pull-left"> | ||
| 245 | <img src="assets/images/people/avatar.jpg" class="media-object" width="39"/> | ||
| 246 | </a> | ||
| 247 | </div> | ||
| 248 | <a class="pull-right innerAll" href="#"> | ||
| 249 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 250 | </a> | ||
| 251 | <div class="media-body"> | ||
| 252 | <h5>Total Users {!!$totalactivemtd!!}/{!!$totalactive!!}/{!!$totalusers!!}</h5> | ||
| 253 | <div class="media-body" title="{!!$totalactive!!}/{!!$totalusers!!} Active/Total , {!!round($totalactive*100/$totalusers,1)!!}%"> | ||
| 254 | <div class="progress progress-small margin-none"> | ||
| 255 | <div class="progress-bar progress-bar-primary" style="width: {!!round($totalactive*100/$totalusers,1)!!}%"></div> | ||
| 256 | </div> | ||
| 257 | </div> | ||
| 258 | </div> | ||
| 259 | </div> | ||
| 260 | </div> | ||
| 261 | <!-- Listing ends--> | ||
| 262 | |||
| 263 | <!-- Listing --> | ||
| 264 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 265 | <div class="media"> | ||
| 266 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 267 | <a href="#" class="pull-left"> | ||
| 268 | <img src="assets/images/people/author_file.jpg" class="media-object" width="39"/> | ||
| 269 | </a> | ||
| 270 | </div> | ||
| 271 | <a class="pull-right innerAll" href="#"> | ||
| 272 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 273 | </a> | ||
| 274 | <div class="media-body"> | ||
| 275 | <?php ?> | ||
| 276 | <h5>100 MB Space Usages</h5> | ||
| 277 | <div class="media-body" title='100 GB Limit'> | ||
| 278 | <div class="progress progress-small margin-none"> | ||
| 279 | <div class="progress-bar progress-bar-primary" style="width: 50%"></div> | ||
| 280 | </div> | ||
| 281 | </div> | ||
| 282 | </div> | ||
| 283 | </div> | ||
| 284 | </div> | ||
| 285 | <!-- Listing ends--> | ||
| 286 | |||
| 287 | |||
| 288 | |||
| 289 | <!-- Listing --> | ||
| 290 | <div class="bg-gray-hover innerAll border-bottom"> | ||
| 291 | <div class="media"> | ||
| 292 | <div style="height:39px; width:39px; overflow:hidden" class="pull-left"> | ||
| 293 | <a href="#" class="pull-left"> | ||
| 294 | <img src="assets/images/people/author_content.jpg" class="media-object" width="39"/> | ||
| 295 | </a> | ||
| 296 | </div> | ||
| 297 | <a class="pull-right innerAll" href="#"> | ||
| 298 | <!-- <span class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></span> --> | ||
| 299 | </a> | ||
| 300 | <div class="media-body"> | ||
| 301 | <?php | ||
| 302 | |||
| 303 | |||
| 304 | ?> | ||
| 305 | <h5> Units Viewed Unique Users</h5> | ||
| 306 | <div class="media-body" title='50% , 50 Total Units'> | ||
| 307 | <div class="progress progress-small margin-none"> | ||
| 308 | <div class="progress-bar progress-bar-primary" style="width: 50%"></div> | ||
| 309 | </div> | ||
| 310 | </div> | ||
| 311 | </div> | ||
| 312 | </div> | ||
| 313 | </div> | ||
| 314 | <!-- Listing ends--> | ||
| 315 | |||
| 316 | |||
| 317 | |||
| 318 | </div> | ||
| 319 | <!-- // END col-separator --> | ||
| 320 | <div class="clearfix"></div> | ||
| 321 | </div> | ||
| 322 | <!-- // END col-table --> | ||
| 323 | |||
| 324 | </div> | ||
| 325 | <!-- // END col-separator.box --> | ||
| 326 | |||
| 327 | </div> | ||
| 328 | <!-- // END col --> | ||
| 329 | |||
| 330 | </div> | ||
| 331 | <!-- // END row-app --> | ||
| 332 | |||
| 333 | </div> | ||
| 334 | |||
| 335 | <?php | ||
| 336 | } | ||
| 337 | |||
| 338 | if($stage=="settings") | ||
| 339 | { | ||
| 340 | ?> | ||
| 341 | <h5>QC Settings</h5> | ||
| 342 | <?php | ||
| 343 | } | ||
| 344 | |||
| 345 | return; | ||
| 346 | } | ||
| 347 | ?> | ||
| 348 | |||
| 349 | |||
| 350 | |||
| 351 | |||
| 352 | |||
| 353 | <div class="layout-app"><!-- row-app --> | ||
| 354 | <div class="row row-app"> | ||
| 355 | |||
| 356 | <!-- col --> | ||
| 357 | <div class="col-md-2 col-sm-3"> | ||
| 358 | |||
| 359 | <!-- col-separator --> | ||
| 360 | <div class="col-separator col-separator-first box col-unscrollable"> | ||
| 361 | |||
| 362 | <!-- col-table --> | ||
| 363 | <div class="col-table" style='padding-left: 13px;padding-right: 13px;'> | ||
| 364 | |||
| 365 | <h4 class="innerAll margin-none border-bottom" style='background: #fff;'>Dialer Reports</h4> | ||
| 366 | |||
| 367 | <!-- col-table-row --> | ||
| 368 | <div class="col-table-row"> | ||
| 369 | |||
| 370 | <!-- col-app --> | ||
| 371 | <div class="col-app col-unscrollable"> | ||
| 372 | |||
| 373 | <!-- col-app --> | ||
| 374 | <div class="col-app"> | ||
| 375 | |||
| 376 | <ul class="list-group list-group-1 margin-none borders-none" style='padding-right: 26px;'> | ||
| 377 | |||
| 378 | <!-- <li class="list-group-item"> | ||
| 379 | <a href="#" onclick="doAjax('dialer/recqc?qcstage=dashboard','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Dashboard</a> | ||
| 380 | </li>--> | ||
| 381 | <li class="list-group-item"> | ||
| 382 | <a href="#" onclick="doAjax('dialer/recqc?qcstage=list','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> QC List</a> | ||
| 383 | </li> | ||
| 384 | |||
| 385 | <?php if(Auth::user()->moduleACL("Dialer",true,true,true)){ ?> | ||
| 386 | <li class="list-group-item"> | ||
| 387 | <a href="#" onclick="doAjax('dialer/recqc?qcstage=settings','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> QC Settings</a> | ||
| 388 | </li> | ||
| 389 | <?php } ?> | ||
| 390 | |||
| 391 | |||
| 392 | </ul> | ||
| 393 | |||
| 394 | |||
| 395 | </div> | ||
| 396 | <!-- // END col-app --> | ||
| 397 | |||
| 398 | </div> | ||
| 399 | <!-- // END col-app --> | ||
| 400 | |||
| 401 | </div> | ||
| 402 | <!-- // END col-table-row --> | ||
| 403 | |||
| 404 | </div> | ||
| 405 | <!-- // END col-table --> | ||
| 406 | |||
| 407 | </div> | ||
| 408 | <!-- // END col-separator.box --> | ||
| 409 | |||
| 410 | </div> | ||
| 411 | <!-- // END col --> | ||
| 412 | |||
| 413 | <!-- col --> | ||
| 414 | <div class="col-md-10 col-sm-9" style='border-right:13px solid #eaeaea'> | ||
| 415 | |||
| 416 | <!-- col-separator.box --> | ||
| 417 | <div class="col-separator col-unscrollable box"> | ||
| 418 | |||
| 419 | <!-- col-table --> | ||
| 420 | <div class="col-table"> | ||
| 421 | |||
| 422 | <!-- <h4 class="innerAll margin-none border-bottom">My Sessions</h4> --> | ||
| 423 | |||
| 424 | <!-- col-table-row --> | ||
| 425 | <div class="col-table-row" style='background: #fff;'> | ||
| 426 | |||
| 427 | <!-- col-app --> | ||
| 428 | <div class="col-app col-unscrollable"> | ||
| 429 | |||
| 430 | <!-- col-app --> | ||
| 431 | <div class="col-app" style='position:relative'> | ||
| 432 | |||
| 433 | <div class="" id=rightmainreportdiv> | ||
| 434 | <script> | ||
| 435 | doAjax('dialer/recqc?qcstage=list','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 436 | </script> | ||
| 437 | </div> | ||
| 438 | |||
| 439 | </div> | ||
| 440 | <!-- // END col-app --> | ||
| 441 | |||
| 442 | </div> | ||
| 443 | <!-- // END col-app.col-unscrollable --> | ||
| 444 | |||
| 445 | </div> | ||
| 446 | <!-- // END col-table-row --> | ||
| 447 | |||
| 448 | </div> | ||
| 449 | <!-- // END col-table --> | ||
| 450 | |||
| 451 | </div> | ||
| 452 | <!-- // END col-separator.box --> | ||
| 453 | |||
| 454 | </div> | ||
| 455 | <!-- // END col --> | ||
| 456 | |||
| 457 | </div> | ||
| 458 | <!-- // END row-app --> | ||
| 459 | |||
| 460 | |||
| 461 | |||
| 462 | |||
| 463 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCallArchive; | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\User; | ||
| 5 | use App\Jobs\KHRMSLib; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | |||
| 10 | |||
| 11 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 12 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 13 | |||
| 14 | $prevlogdate = strtotime(date('Y-m-d', strtotime('-7 day'))); | ||
| 15 | |||
| 16 | $i=0; | ||
| 17 | if($logdate < $prevlogdate) | ||
| 18 | { | ||
| 19 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('type','!=','Inbound'); | ||
| 20 | |||
| 21 | } | ||
| 22 | else | ||
| 23 | { | ||
| 24 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('type','!=','Inbound'); | ||
| 25 | |||
| 26 | } | ||
| 27 | |||
| 28 | |||
| 29 | if($dashboarduser->usertype != 'Admin') | ||
| 30 | { | ||
| 31 | $uidlist=array($dashboarduser->id); | ||
| 32 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 33 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 34 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 35 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 36 | })->get(); | ||
| 37 | |||
| 38 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 39 | |||
| 40 | |||
| 41 | $roclientstr=array();$didlinesstr=array(); | ||
| 42 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 43 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 44 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 45 | { | ||
| 46 | $roclientstr[]="$tclnt"; | ||
| 47 | |||
| 48 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 49 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 50 | } | ||
| 51 | |||
| 52 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 53 | $query//->orWhereIn('client',$roclientstr) | ||
| 54 | ->orWhereIn('user_id',$uidlist) | ||
| 55 | ->orWhereIn('did',$didlinesstr); | ||
| 56 | }); | ||
| 57 | |||
| 58 | } | ||
| 59 | |||
| 60 | if(Input::get('sort')=='cpu')$alist=$alist->orderBy("callSec","DESC"); | ||
| 61 | else $alist=$alist->orderBy("id","DESC"); | ||
| 62 | $alist=$alist->get(); | ||
| 63 | /* | ||
| 64 | |||
| 65 | |||
| 66 | $userarr=array(); | ||
| 67 | $i=sizeof($alist);if(!empty($_GET['sort']))$i=1; | ||
| 68 | $totaltime=0;$ttlovr10=0;$ttlovr5=0;$ttlovr1=0;$ttlovr0=0;$outstr="";$usrcnt=0; | ||
| 69 | $totaltimeIn=0;$ttlovr10In=0;$ttlovr5In=0;$ttlovr1In=0;$ttlovr0In=0;$usrcntIn=0; | ||
| 70 | $actionarr=array();$actionarrIn=array(); | ||
| 71 | |||
| 72 | |||
| 73 | */ | ||
| 74 | if(Input::has("dllogxls")) | ||
| 75 | { | ||
| 76 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 77 | |||
| 78 | $inputFileType = "Excel5"; | ||
| 79 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 80 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 81 | $baseRow = 3; | ||
| 82 | |||
| 83 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 84 | $fieldsarr[$tcol++]='#'; | ||
| 85 | $fieldsarr[$tcol++]='Date'; | ||
| 86 | $fieldsarr[$tcol++]='User_id'; | ||
| 87 | $fieldsarr[$tcol++]='Disposition'; | ||
| 88 | $fieldsarr[$tcol++]='ClientCode'; | ||
| 89 | $fieldsarr[$tcol++]='Services'; | ||
| 90 | /*$fieldsarr[$tcol++]='SubDispo'; | ||
| 91 | $fieldsarr[$tcol++]='CB'; | ||
| 92 | $fieldsarr[$tcol++]='Number'; | ||
| 93 | $fieldsarr[$tcol++]='ClientCode'; | ||
| 94 | $fieldsarr[$tcol++]='CurrentStatus'; | ||
| 95 | $fieldsarr[$tcol++]='LegalStatus'; | ||
| 96 | $fieldsarr[$tcol++]='Data'; | ||
| 97 | $fieldsarr[$tcol++]='SubData'; | ||
| 98 | |||
| 99 | $fieldsarr[$tcol++]='State'; | ||
| 100 | $fieldsarr[$tcol++]='HSource'; | ||
| 101 | $fieldsarr[$tcol++]='Type'; | ||
| 102 | $fieldsarr[$tcol++]='Status'; | ||
| 103 | $fieldsarr[$tcol++]='StatusCode'; | ||
| 104 | $fieldsarr[$tcol++]='StatusStr'; | ||
| 105 | $fieldsarr[$tcol++]='DialLine'; | ||
| 106 | $fieldsarr[$tcol++]='DID'; | ||
| 107 | $fieldsarr[$tcol++]='WaitSec'; | ||
| 108 | $fieldsarr[$tcol++]='CallSec'; | ||
| 109 | $fieldsarr[$tcol++]='TalkSec'; | ||
| 110 | $fieldsarr[$tcol++]='DispoSec'; | ||
| 111 | $fieldsarr[$tcol++]='Remarks';*/ | ||
| 112 | |||
| 113 | $highestColumn = sizeof($fieldsarr); | ||
| 114 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 115 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 116 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]); | ||
| 117 | } | ||
| 118 | |||
| 119 | $ii=1; | ||
| 120 | foreach($alist as $aline) | ||
| 121 | { | ||
| 122 | $row = $baseRow++; | ||
| 123 | $col = 0; | ||
| 124 | |||
| 125 | |||
| 126 | $clientcode="";$currentstatus="";$legalstatus=""; | ||
| 127 | if($aline->crm_id>0) | ||
| 128 | { | ||
| 129 | $user=$wakka->getPerson($aline->crm_id); | ||
| 130 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 131 | $currentstatus=$user["peopledata"]["currentstatus"]; | ||
| 132 | $legalstatus=$user["peopledata"]["legalstatus"]; | ||
| 133 | } | ||
| 134 | $tpostdata=json_decode($aline->data,true); | ||
| 135 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 136 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 137 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 143 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 144 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 145 | |||
| 146 | |||
| 147 | $userdata=json_decode($aline->userdata,true); | ||
| 148 | if(!empty($userdata)){ | ||
| 149 | foreach ($userdata as $key=>$val) { | ||
| 150 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++); | ||
| 151 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($Date); | ||
| 152 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($User_id); | ||
| 153 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($Disposition); | ||
| 154 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ClientCode); | ||
| 155 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($val); | ||
| 156 | } | ||
| 157 | }else{ | ||
| 158 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++); | ||
| 159 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($Date); | ||
| 160 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($User_id); | ||
| 161 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($Disposition); | ||
| 162 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ClientCode); | ||
| 163 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit(); | ||
| 164 | } | ||
| 165 | |||
| 166 | } | ||
| 167 | |||
| 168 | |||
| 169 | header('Content-Type: application/vnd.ms-excel'); | ||
| 170 | header('Content-Disposition: attachment;filename="Relationship.xls"'); | ||
| 171 | header('Cache-Control: max-age=0'); | ||
| 172 | |||
| 173 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 174 | $objWriter->save('php://output'); | ||
| 175 | |||
| 176 | return ; | ||
| 177 | } | ||
| 178 | |||
| 179 | |||
| 180 | |||
| 181 | foreach($alist as $aline) | ||
| 182 | { | ||
| 183 | $clientcode=""; | ||
| 184 | $userdata=json_decode($aline->userdata,true); | ||
| 185 | |||
| 186 | |||
| 187 | if($aline->crm_id>0) | ||
| 188 | { | ||
| 189 | $user=$wakka->getPerson($aline->crm_id); | ||
| 190 | $clientcode=$user["peopledata"]["clientcode"]; | ||
| 191 | } | ||
| 192 | $tpostdata=json_decode($aline->data,true); | ||
| 193 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 194 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 195 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 196 | |||
| 197 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 198 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 199 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 200 | |||
| 201 | if(!empty($userdata)){ | ||
| 202 | foreach ($userdata as $key=>$val) { | ||
| 203 | $outstr.="<tr><td>".$i++."</td> | ||
| 204 | <td title='$fulldate'>".explode(" ",$fulldate)[0]."</td> | ||
| 205 | <td>".$username."</td> | ||
| 206 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 207 | <td>$clientcode</td> | ||
| 208 | <td>$val</td> | ||
| 209 | </tr>"; | ||
| 210 | } | ||
| 211 | }else{ | ||
| 212 | $outstr.="<tr><td>".$i++."</td> | ||
| 213 | <td title='$fulldate'>".explode(" ",$fulldate)[0]."</td> | ||
| 214 | <td>".$username."</td> | ||
| 215 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 216 | <td>$clientcode</td> | ||
| 217 | <td></td> | ||
| 218 | </tr>"; | ||
| 219 | } | ||
| 220 | |||
| 221 | |||
| 222 | |||
| 223 | |||
| 224 | if($aline->type=='Inbound') | ||
| 225 | { | ||
| 226 | if($talktime>120000)$ttlovr10In++; | ||
| 227 | else if($talktime>60000)$ttlovr5In++; | ||
| 228 | else if($talktime>30000)$ttlovr1In++; | ||
| 229 | else if($talktime>1000)$ttlovr0In++; | ||
| 230 | |||
| 231 | $totaltimeIn+=round($talktime/1000,2); | ||
| 232 | $usrcntIn++; | ||
| 233 | |||
| 234 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 235 | if(!isset($actionarrIn[$turl]))$actionarrIn[$turl]=array('cnt'=>0,'time'=>0); | ||
| 236 | $actionarrIn[$turl]['cnt']++; | ||
| 237 | $actionarrIn[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 238 | } | ||
| 239 | else | ||
| 240 | { | ||
| 241 | if($talktime>120000)$ttlovr10++; | ||
| 242 | else if($talktime>60000)$ttlovr5++; | ||
| 243 | else if($talktime>30000)$ttlovr1++; | ||
| 244 | else if($talktime>1000)$ttlovr0++; | ||
| 245 | |||
| 246 | $totaltime+=round($talktime/1000,2); | ||
| 247 | $usrcnt++; | ||
| 248 | |||
| 249 | $turl=$aline->status." - ".$aline->statuscode." - ".$aline->substatus; | ||
| 250 | if(!isset($actionarr[$turl]))$actionarr[$turl]=array('cnt'=>0,'time'=>0); | ||
| 251 | $actionarr[$turl]['cnt']++; | ||
| 252 | $actionarr[$turl]['time']+=round(($aline->callSec+$talktime)/1000,2); | ||
| 253 | } | ||
| 254 | |||
| 255 | } | ||
| 256 | ?> | ||
| 257 | |||
| 258 | |||
| 259 | |||
| 260 | <div class=innerAll> | ||
| 261 | |||
| 262 | |||
| 263 | |||
| 264 | |||
| 265 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 266 | <script> | ||
| 267 | function showExtraPost(varstr) | ||
| 268 | { | ||
| 269 | doAjax("hr?action=LiveUsers","getpostdata="+varstr,"dialoglog"); | ||
| 270 | |||
| 271 | $('#dialoglog').dialog('open'); | ||
| 272 | return false; | ||
| 273 | } | ||
| 274 | |||
| 275 | $(document).ready(function() | ||
| 276 | { | ||
| 277 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 278 | { | ||
| 279 | $('#dialoglog').dialog({ | ||
| 280 | autoOpen: false, | ||
| 281 | width: '70%', | ||
| 282 | buttons: { | ||
| 283 | "Ok": function() { | ||
| 284 | $(this).dialog("close"); | ||
| 285 | }, | ||
| 286 | "Cancel": function() { | ||
| 287 | $(this).dialog("close"); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | }); | ||
| 291 | } | ||
| 292 | |||
| 293 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 294 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 295 | }); | ||
| 296 | </script> | ||
| 297 | <div style="float:left;width:50%"> | ||
| 298 | |||
| 299 | Search <input id=filter name="filter" type="text"> | ||
| 300 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='callLogReloadFun("");' /> | ||
| 301 | |||
| 302 | </div> | ||
| 303 | <div style="float:left;width:50%"> | ||
| 304 | |||
| 305 | |||
| 306 | <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> | ||
| 307 | |||
| 308 | </div> | ||
| 309 | <div style="clear:both"></div> | ||
| 310 | <hr> | ||
| 311 | |||
| 312 | <?php | ||
| 313 | $categories=array();$avgarr=array();$cntarr=array(); | ||
| 314 | foreach($actionarr as $act=>$actarr) | ||
| 315 | { | ||
| 316 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 317 | { | ||
| 318 | |||
| 319 | $categories[]="'$act'"; | ||
| 320 | $avgarr[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 321 | $cntarr[]=$actarr['cnt']; | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 325 | array_multisort($cntarr,$avgarr,$categories); | ||
| 326 | |||
| 327 | |||
| 328 | |||
| 329 | $categoriesIn=array();$avgarrIn=array();$cntarrIn=array(); | ||
| 330 | foreach($actionarrIn as $act=>$actarr) | ||
| 331 | { | ||
| 332 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 333 | { | ||
| 334 | |||
| 335 | $categoriesIn[]="'$act'"; | ||
| 336 | $avgarrIn[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 337 | $cntarrIn[]=$actarr['cnt']; | ||
| 338 | } | ||
| 339 | } | ||
| 340 | |||
| 341 | array_multisort($cntarrIn,$avgarrIn,$categoriesIn); | ||
| 342 | ?> | ||
| 343 | |||
| 344 | |||
| 345 | |||
| 346 | <div class=col-md-10> | ||
| 347 | |||
| 348 | <script> | ||
| 349 | |||
| 350 | |||
| 351 | function callLogReloadFun(sortby) | ||
| 352 | { | ||
| 353 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 354 | |||
| 355 | doAjax('dialer/calllog?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 356 | } | ||
| 357 | function getCallRec(id) | ||
| 358 | { | ||
| 359 | doAjax("dialer/calllog","getCallRec=1&calllog="+id,'recspan_'+id,'rec_ajax','singlefail','GET'); | ||
| 360 | } | ||
| 361 | function dlCalllogXls() | ||
| 362 | { | ||
| 363 | window.open('dialer/relationship?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 364 | } | ||
| 365 | </script> | ||
| 366 | |||
| 367 | </div> | ||
| 368 | |||
| 369 | <div style='clear:both'></div> | ||
| 370 | |||
| 371 | <div class=col-md-10> | ||
| 372 | |||
| 373 | <script> | ||
| 374 | |||
| 375 | </script> | ||
| 376 | |||
| 377 | </div> | ||
| 378 | |||
| 379 | <div style='clear:both'></div> | ||
| 380 | |||
| 381 | <div style='overflow:auto'> | ||
| 382 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 383 | <thead> | ||
| 384 | <tr> | ||
| 385 | <th>#</th> | ||
| 386 | <th>Date</th> | ||
| 387 | <th>User_id</th> | ||
| 388 | <th>Disposition</th> | ||
| 389 | <th>ClientCode</th> | ||
| 390 | <th>Services</th> | ||
| 391 | </tr> | ||
| 392 | </thead> | ||
| 393 | <?php echo $outstr; ?> | ||
| 394 | </table> | ||
| 395 | </div> | ||
| 396 | <?php | ||
| 397 | function convert($size) | ||
| 398 | { | ||
| 399 | $unit=array('b','kb','mb','gb','tb','pb'); | ||
| 400 | return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | ||
| 401 | } | ||
| 402 | |||
| 403 | echo "<br>".convert(memory_get_peak_usage(true)); // 123 kb | ||
| 404 | |||
| 405 | |||
| 406 | ?> | ||
| 407 | <div id=dialoglog></div> | ||
| 408 | |||
| 409 | |||
| 410 | |||
| 411 | |||
| 412 | |||
| 413 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCallArchive; | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | use App\Models\User; | ||
| 5 | use App\Jobs\KHRMSLib; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | |||
| 10 | |||
| 11 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 12 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 13 | |||
| 14 | $prevlogdate = strtotime(date('Y-m-d', strtotime('-7 day'))); | ||
| 15 | |||
| 16 | $i=0; | ||
| 17 | if($logdate < $prevlogdate) | ||
| 18 | { | ||
| 19 | $alist=CRMCallArchive::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('type','!=','Inbound'); | ||
| 20 | |||
| 21 | } | ||
| 22 | else | ||
| 23 | { | ||
| 24 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60))->where('type','!=','Inbound'); | ||
| 25 | } | ||
| 26 | |||
| 27 | |||
| 28 | if($dashboarduser->usertype != 'Admin') | ||
| 29 | { | ||
| 30 | $uidlist=array($dashboarduser->id); | ||
| 31 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 32 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 33 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 34 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 35 | })->get(); | ||
| 36 | |||
| 37 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 38 | |||
| 39 | |||
| 40 | $roclientstr=array();$didlinesstr=array(); | ||
| 41 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 42 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 43 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 44 | { | ||
| 45 | $roclientstr[]="$tclnt"; | ||
| 46 | |||
| 47 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 48 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 49 | } | ||
| 50 | |||
| 51 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 52 | $query//->orWhereIn('client',$roclientstr) | ||
| 53 | ->orWhereIn('user_id',$uidlist) | ||
| 54 | ->orWhereIn('did',$didlinesstr); | ||
| 55 | }); | ||
| 56 | |||
| 57 | } | ||
| 58 | |||
| 59 | if(Input::get('sort')=='cpu')$alist=$alist->orderBy("callSec","DESC"); | ||
| 60 | else $alist=$alist->orderBy("id","DESC"); | ||
| 61 | $alist=$alist->get(); | ||
| 62 | /* | ||
| 63 | |||
| 64 | |||
| 65 | $userarr=array(); | ||
| 66 | $i=sizeof($alist);if(!empty($_GET['sort']))$i=1; | ||
| 67 | $totaltime=0;$ttlovr10=0;$ttlovr5=0;$ttlovr1=0;$ttlovr0=0;$outstr="";$usrcnt=0; | ||
| 68 | $totaltimeIn=0;$ttlovr10In=0;$ttlovr5In=0;$ttlovr1In=0;$ttlovr0In=0;$usrcntIn=0; | ||
| 69 | $actionarr=array();$actionarrIn=array(); | ||
| 70 | |||
| 71 | |||
| 72 | */ | ||
| 73 | $callarraid=''; | ||
| 74 | $crm_id=''; | ||
| 75 | foreach($alist as $aline) | ||
| 76 | { | ||
| 77 | if($aline->crm_id>0)$crm_id.=$aline->crm_id.","; | ||
| 78 | } | ||
| 79 | $crm_id=substr($crm_id,0,-1); | ||
| 80 | $crm_id=explode(",", $crm_id); | ||
| 81 | $clientcodearr=DB::table('records')->select('clientcode','id','currentstatus','legalstatus')->whereIn('id',$crm_id)->get(); | ||
| 82 | foreach ($clientcodearr as $clientid) | ||
| 83 | { | ||
| 84 | $clientcodeval[$clientid->id]=$clientid->clientcode; | ||
| 85 | } | ||
| 86 | |||
| 87 | if(Input::has("dllogxls")) | ||
| 88 | { | ||
| 89 | |||
| 90 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 91 | |||
| 92 | |||
| 93 | $inputFileType = "Excel5"; | ||
| 94 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 95 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 96 | $baseRow = 3; | ||
| 97 | |||
| 98 | $tcol=0;$fieldsarr=array();$extrahdrarr=array(); | ||
| 99 | $fieldsarr[$tcol++]='#'; | ||
| 100 | $fieldsarr[$tcol++]='Date'; | ||
| 101 | $fieldsarr[$tcol++]='User_id'; | ||
| 102 | $fieldsarr[$tcol++]='Disposition'; | ||
| 103 | $fieldsarr[$tcol++]='ClientCode'; | ||
| 104 | $fieldsarr[$tcol++]='Services'; | ||
| 105 | |||
| 106 | |||
| 107 | $highestColumn = sizeof($fieldsarr); | ||
| 108 | for ($head = 0; $head < $highestColumn; $head++) | ||
| 109 | { | ||
| 110 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 111 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $fieldsarr[$head]); | ||
| 112 | } | ||
| 113 | |||
| 114 | $ii=1; | ||
| 115 | foreach($alist as $aline) | ||
| 116 | { | ||
| 117 | //$row = $baseRow++; | ||
| 118 | $col = 0; | ||
| 119 | |||
| 120 | |||
| 121 | $clientcode=""; | ||
| 122 | $tpostdata=json_decode($aline->data,true); | ||
| 123 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 124 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 125 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 126 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 127 | |||
| 128 | $val=''; | ||
| 129 | |||
| 130 | $userdata=json_decode($aline->userdata,true); | ||
| 131 | //echo "<pre>".print_r($userdata)."<br>"; | ||
| 132 | if(!empty($userdata)) | ||
| 133 | { | ||
| 134 | foreach ($userdata as $key=>$val) | ||
| 135 | { | ||
| 136 | |||
| 137 | if($val!="") | ||
| 138 | { | ||
| 139 | $row = $baseRow++; | ||
| 140 | $col=0; | ||
| 141 | $clientcode=""; | ||
| 142 | if($aline->crm_id>0) | ||
| 143 | { | ||
| 144 | //$user=$wakka->getPerson($aline->crm_id); | ||
| 145 | //$clientcode=$user["peopledata"]["clientcode"]; | ||
| 146 | $clientcode=$clientcodeval[$aline->crm_id]; | ||
| 147 | } | ||
| 148 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($ii++); | ||
| 149 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($fulldate); | ||
| 150 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($username); | ||
| 151 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($aline->userstatus); | ||
| 152 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($clientcode); | ||
| 153 | $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col++,$row)->setValueExplicit($val); | ||
| 154 | } | ||
| 155 | |||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | } | ||
| 160 | |||
| 161 | |||
| 162 | header('Content-Type: application/vnd.ms-excel'); | ||
| 163 | header('Content-Disposition: attachment;filename="Relationship.xls"'); | ||
| 164 | header('Cache-Control: max-age=0'); | ||
| 165 | |||
| 166 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 167 | $objWriter->save('php://output'); | ||
| 168 | |||
| 169 | return ; | ||
| 170 | } | ||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | foreach($alist as $aline) | ||
| 175 | { | ||
| 176 | $clientcode=""; | ||
| 177 | $userdata=json_decode($aline->userdata,true); | ||
| 178 | |||
| 179 | |||
| 180 | if($aline->crm_id>0) | ||
| 181 | { | ||
| 182 | //$user=$wakka->getPerson($aline->crm_id); | ||
| 183 | //$clientcode=$user["peopledata"]["clientcode"]; | ||
| 184 | $clientcode=$clientcodeval[$aline->crm_id]; | ||
| 185 | } | ||
| 186 | $tpostdata=json_decode($aline->data,true); | ||
| 187 | $fulldate=date("Y-m-d H:i:s",strtotime($aline->created_at)-($dashboarduser->timezone*60)); | ||
| 188 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 189 | $length=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 190 | |||
| 191 | if(!isset($userarr[$aline->user_id])&&$aline->user_id>0)$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 192 | $dispname="";if(isset($userarr[$aline->user_id]))$dispname=$userarr[$aline->user_id]->dispname(); | ||
| 193 | $username="";if(isset($userarr[$aline->user_id]))$username=$userarr[$aline->user_id]->username; | ||
| 194 | |||
| 195 | if(!empty($userdata)){ | ||
| 196 | foreach ($userdata as $key=>$val) | ||
| 197 | { | ||
| 198 | if($val!="") | ||
| 199 | { | ||
| 200 | $outstr.="<tr><td>".$i++."</td> | ||
| 201 | <td title='$fulldate'>".explode(" ",$fulldate)[0]."</td> | ||
| 202 | <td>".$username."</td> | ||
| 203 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 204 | <td>$clientcode</td> | ||
| 205 | <td>$val</td> | ||
| 206 | </tr>"; | ||
| 207 | } | ||
| 208 | |||
| 209 | } | ||
| 210 | } | ||
| 211 | /*else | ||
| 212 | { | ||
| 213 | $outstr.="<tr><td>".$i++."</td> | ||
| 214 | <td title='$fulldate'>".explode(" ",$fulldate)[0]."</td> | ||
| 215 | <td>".$username."</td> | ||
| 216 | <td title='".str_replace("'"," ",$aline->userremarks)."'>".$aline->userstatus."</td> | ||
| 217 | <td>$clientcode</td> | ||
| 218 | <td></td> | ||
| 219 | </tr>"; | ||
| 220 | }*/ | ||
| 221 | } | ||
| 222 | ?> | ||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | <div class=innerAll> | ||
| 227 | |||
| 228 | |||
| 229 | |||
| 230 | |||
| 231 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 232 | <script> | ||
| 233 | function showExtraPost(varstr) | ||
| 234 | { | ||
| 235 | doAjax("hr?action=LiveUsers","getpostdata="+varstr,"dialoglog"); | ||
| 236 | |||
| 237 | $('#dialoglog').dialog('open'); | ||
| 238 | return false; | ||
| 239 | } | ||
| 240 | |||
| 241 | $(document).ready(function() | ||
| 242 | { | ||
| 243 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 244 | { | ||
| 245 | $('#dialoglog').dialog({ | ||
| 246 | autoOpen: false, | ||
| 247 | width: '70%', | ||
| 248 | buttons: { | ||
| 249 | "Ok": function() { | ||
| 250 | $(this).dialog("close"); | ||
| 251 | }, | ||
| 252 | "Cancel": function() { | ||
| 253 | $(this).dialog("close"); | ||
| 254 | } | ||
| 255 | } | ||
| 256 | }); | ||
| 257 | } | ||
| 258 | |||
| 259 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 260 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 261 | }); | ||
| 262 | </script> | ||
| 263 | <div style="float:left;width:50%"> | ||
| 264 | |||
| 265 | Search <input id=filter name="filter" type="text"> | ||
| 266 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='callLogReloadFun("");' /> | ||
| 267 | |||
| 268 | </div> | ||
| 269 | <div style="float:left;width:50%"> | ||
| 270 | |||
| 271 | |||
| 272 | <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> | ||
| 273 | |||
| 274 | </div> | ||
| 275 | <div style="clear:both"></div> | ||
| 276 | <hr> | ||
| 277 | |||
| 278 | <?php | ||
| 279 | /*$categories=array();$avgarr=array();$cntarr=array(); | ||
| 280 | foreach($actionarr as $act=>$actarr) | ||
| 281 | { | ||
| 282 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 283 | { | ||
| 284 | |||
| 285 | $categories[]="'$act'"; | ||
| 286 | $avgarr[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 287 | $cntarr[]=$actarr['cnt']; | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | array_multisort($cntarr,$avgarr,$categories); | ||
| 292 | |||
| 293 | |||
| 294 | |||
| 295 | $categoriesIn=array();$avgarrIn=array();$cntarrIn=array(); | ||
| 296 | foreach($actionarrIn as $act=>$actarr) | ||
| 297 | { | ||
| 298 | if($actarr['cnt']>sizeof($alist)/150) | ||
| 299 | { | ||
| 300 | |||
| 301 | $categoriesIn[]="'$act'"; | ||
| 302 | $avgarrIn[]=-round($actarr['time']/$actarr['cnt'],2); | ||
| 303 | $cntarrIn[]=$actarr['cnt']; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | |||
| 307 | array_multisort($cntarrIn,$avgarrIn,$categoriesIn);*/ | ||
| 308 | ?> | ||
| 309 | |||
| 310 | |||
| 311 | |||
| 312 | <div class=col-md-10> | ||
| 313 | |||
| 314 | <script> | ||
| 315 | |||
| 316 | |||
| 317 | function callLogReloadFun(sortby) | ||
| 318 | { | ||
| 319 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 320 | |||
| 321 | doAjax('dialer/relationshipreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 322 | } | ||
| 323 | |||
| 324 | function dlCalllogXls() | ||
| 325 | { | ||
| 326 | window.open('dialer/relationshipreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 327 | } | ||
| 328 | </script> | ||
| 329 | |||
| 330 | </div> | ||
| 331 | |||
| 332 | <div style='clear:both'></div> | ||
| 333 | |||
| 334 | <div class=col-md-10> | ||
| 335 | |||
| 336 | <script> | ||
| 337 | |||
| 338 | </script> | ||
| 339 | |||
| 340 | </div> | ||
| 341 | |||
| 342 | <div style='clear:both'></div> | ||
| 343 | |||
| 344 | <div style='overflow:auto'> | ||
| 345 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 346 | <thead> | ||
| 347 | <tr> | ||
| 348 | <th>#</th> | ||
| 349 | <th>Date</th> | ||
| 350 | <th>User_id</th> | ||
| 351 | <th>Disposition</th> | ||
| 352 | <th>ClientCode</th> | ||
| 353 | <th>Services</th> | ||
| 354 | </tr> | ||
| 355 | </thead> | ||
| 356 | <?php echo $outstr; ?> | ||
| 357 | </table> | ||
| 358 | </div> | ||
| 359 | <?php | ||
| 360 | function convert($size) | ||
| 361 | { | ||
| 362 | $unit=array('b','kb','mb','gb','tb','pb'); | ||
| 363 | return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; | ||
| 364 | } | ||
| 365 | |||
| 366 | echo "<br>".convert(memory_get_peak_usage(true)); // 123 kb | ||
| 367 | |||
| 368 | |||
| 369 | ?> | ||
| 370 | <div id=dialoglog></div> | ||
| 371 | |||
| 372 | |||
| 373 | |||
| 374 | |||
| 375 | |||
| 376 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\CRMCallArchive; | ||
| 4 | use App\Models\User; | ||
| 5 | use App\Jobs\KHRMSLib; | ||
| 6 | |||
| 7 | $wakka = new KHRMSLib(); | ||
| 8 | $dashboarduser=Auth::user(); | ||
| 9 | $timeoffset = $dashboarduser->timezone; //-330; //$dashboarduser->timezone;\ | ||
| 10 | //$timeoffset = $timeoffset*60; | ||
| 11 | $timeoffset = 0; | ||
| 12 | |||
| 13 | $logtime =(isset($_GET['logtime'])) ? $_GET['logtime'] :9; | ||
| 14 | $logtimeto =(isset($_GET['logtimeto']))? $_GET['logtimeto']:20; | ||
| 15 | $logdate =(isset($_GET['logdate'])) ? strtotime($_GET['logdate']." ".$logtime.":00:00") | ||
| 16 | : strtotime(date("Y-m-d")." 09:00:00"); | ||
| 17 | $logdateto =(isset($_GET['logdateto']))? strtotime($_GET['logdateto']." ".$logtimeto.":00:00") | ||
| 18 | : strtotime(date("Y-m-d")." 20:00:00"); | ||
| 19 | $campaign =explode('||', (isset($_GET['campaign'])) ? $_GET['campaign'] : "All"); | ||
| 20 | $state =explode('||', (isset($_GET['state'])) ? $_GET['state'] : "All"); | ||
| 21 | $product =explode('||', (isset($_GET['product'])) ? $_GET['product'] : "All"); | ||
| 22 | $bucket =explode('||', (isset($_GET['bucket'])) ? $_GET['bucket'] : "All"); | ||
| 23 | |||
| 24 | $clientlist =$wakka->clientsReadAccess(); $clientlist; $clientlist[0] = 'All'; | ||
| 25 | |||
| 26 | $alist=DB::table('crmcalls_archive AS c')->leftJoin('records', 'c.crm_id', '=', 'records.id')->where('c.user_id','!=',0); | ||
| 27 | $alist=$alist ->where('c.created_at','>=',date("Y-m-d H:i:s",$logdate)) | ||
| 28 | ->where('c.created_at','<=',date("Y-m-d H:i:s",$logdateto)); | ||
| 29 | |||
| 30 | $displayAdv = 'none'; | ||
| 31 | if(!in_array('All', $campaign)) { | ||
| 32 | $displayAdv = 'block'; | ||
| 33 | $alist =$alist->whereIn('c.client',$campaign); | ||
| 34 | } | ||
| 35 | |||
| 36 | $userarr=array(); | ||
| 37 | $allusers = DB::table('users as u1')->leftjoin('users AS u2', 'u2.username', '=', 'u1.supervisor') | ||
| 38 | ->select('u1.id','u1.username','u1.fullname AS telecaller', 'u2.fullname AS sepervisor'); | ||
| 39 | |||
| 40 | if($dashboarduser->usertype != 'Admin') | ||
| 41 | { | ||
| 42 | $uidlist=array($dashboarduser->id); | ||
| 43 | $allusers=$allusers->where(function ($query) use($dashboarduser) { | ||
| 44 | $query->where('u1.supervisor','=',$dashboarduser->username) | ||
| 45 | ->orWhere('u1.lteam2','=',$dashboarduser->username) | ||
| 46 | ->orWhere('u1.lteam','=',$dashboarduser->username); | ||
| 47 | })->get(); | ||
| 48 | |||
| 49 | foreach($allusers as $tuser) | ||
| 50 | { | ||
| 51 | $uidlist[]=$tuser->id; | ||
| 52 | $userarr[$tuser->id] = $tuser; | ||
| 53 | } | ||
| 54 | $alist=$alist->whereIn('c.user_id',$uidlist); | ||
| 55 | |||
| 56 | /*$roclientstr=array();$didlinesstr=array(); | ||
| 57 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 58 | |||
| 59 | if(!empty($clientlist))foreach($clientlist as $tclnt)if($tclnt!="") | ||
| 60 | { | ||
| 61 | $roclientstr[]="$tclnt"; | ||
| 62 | |||
| 63 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 64 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 65 | } | ||
| 66 | |||
| 67 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 68 | $query->orWhereIn('c.client',$roclientstr) | ||
| 69 | ->orWhereIn('c.did',$didlinesstr); | ||
| 70 | });*/ | ||
| 71 | } | ||
| 72 | else { | ||
| 73 | $allusers=$allusers->get(); | ||
| 74 | foreach($allusers as $tuser) | ||
| 75 | { | ||
| 76 | $userarr[$tuser->id] = $tuser; | ||
| 77 | } | ||
| 78 | } |
| 1 | <div class="layout-app"> | ||
| 2 | |||
| 3 | <!-- row-app --> | ||
| 4 | <div class="row row-app"> | ||
| 5 | |||
| 6 | <!-- col --> | ||
| 7 | <div class="col-md-2 col-sm-3"> | ||
| 8 | |||
| 9 | <!-- col-separator --> | ||
| 10 | <div class="col-separator col-separator-first box col-unscrollable"> | ||
| 11 | |||
| 12 | <!-- col-table --> | ||
| 13 | <div class="col-table" style='padding-left: 13px;padding-right: 13px;'> | ||
| 14 | |||
| 15 | <h4 class="innerAll margin-none border-bottom" style='background: #fff;'>Dialer Reports</h4> | ||
| 16 | |||
| 17 | <!-- col-table-row --> | ||
| 18 | <div class="col-table-row"> | ||
| 19 | |||
| 20 | <!-- col-app --> | ||
| 21 | <div class="col-app col-unscrollable"> | ||
| 22 | |||
| 23 | <!-- col-app --> | ||
| 24 | <div class="col-app"> | ||
| 25 | |||
| 26 | <ul class="list-group list-group-1 margin-none borders-none" style='padding-right: 26px;'> | ||
| 27 | <li class="list-group-item"> | ||
| 28 | <a href="#" onclick="doAjax('report/liveusers','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Live</a> | ||
| 29 | </li> | ||
| 30 | |||
| 31 | <li class="list-group-item"> | ||
| 32 | <a href="#" onclick="doAjax('report/calllog','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Call</a> | ||
| 33 | </li> | ||
| 34 | |||
| 35 | <li class="list-group-item"> | ||
| 36 | <a href="#" onclick="doAjax('report/agenttime','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Login</a> | ||
| 37 | </li> | ||
| 38 | <li class="list-group-item"> | ||
| 39 | <a href="#" onclick="doAjax('report/agenttimeAverage','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Login Average</a> | ||
| 40 | </li> | ||
| 41 | <li class="list-group-item"> | ||
| 42 | <a href="#" onclick="doAjax('report/campreport','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Time</a> | ||
| 43 | </li> | ||
| 44 | <li class="list-group-item"> | ||
| 45 | <a href="#" onclick="doAjax('report/statusreport','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i> Status</a> | ||
| 46 | </li> | ||
| 47 | |||
| 48 | <li class="list-group-item"> | ||
| 49 | <a href="#" onclick="doAjax('report/relationshipreport','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET');return false"><i class="fa fa-circle-o"></i>Relationship</a> | ||
| 50 | </li> | ||
| 51 | </ul> | ||
| 52 | </div> | ||
| 53 | <!-- // END col-app --> | ||
| 54 | |||
| 55 | </div> | ||
| 56 | <!-- // END col-app --> | ||
| 57 | |||
| 58 | </div> | ||
| 59 | <!-- // END col-table-row --> | ||
| 60 | |||
| 61 | </div> | ||
| 62 | <!-- // END col-table --> | ||
| 63 | |||
| 64 | </div> | ||
| 65 | <!-- // END col-separator.box --> | ||
| 66 | |||
| 67 | </div> | ||
| 68 | <!-- // END col --> | ||
| 69 | |||
| 70 | <!-- col --> | ||
| 71 | <div class="col-md-10 col-sm-9" style='border-right:13px solid #eaeaea'> | ||
| 72 | |||
| 73 | <!-- col-separator.box --> | ||
| 74 | <div class="col-separator col-unscrollable box"> | ||
| 75 | |||
| 76 | <!-- col-table --> | ||
| 77 | <div class="col-table"> | ||
| 78 | |||
| 79 | <!-- col-table-row --> | ||
| 80 | <div class="col-table-row" style='background: #fff;'> | ||
| 81 | |||
| 82 | <!-- col-app --> | ||
| 83 | <div class="col-app col-unscrollable"> | ||
| 84 | |||
| 85 | <!-- col-app --> | ||
| 86 | <div class="col-app" style='position:relative'> | ||
| 87 | |||
| 88 | <div class="" id=rightmainreportdiv> | ||
| 89 | <script> | ||
| 90 | |||
| 91 | doAjax('report/liveusers','','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 92 | |||
| 93 | </script> | ||
| 94 | </div> | ||
| 95 | |||
| 96 | </div> | ||
| 97 | <!-- // END col-app --> | ||
| 98 | |||
| 99 | </div> | ||
| 100 | <!-- // END col-app.col-unscrollable --> | ||
| 101 | |||
| 102 | </div> | ||
| 103 | <!-- // END col-table-row --> | ||
| 104 | |||
| 105 | </div> | ||
| 106 | <!-- // END col-table --> | ||
| 107 | |||
| 108 | </div> | ||
| 109 | <!-- // END col-separator.box --> | ||
| 110 | |||
| 111 | </div> | ||
| 112 | <!-- // END col --> | ||
| 113 | |||
| 114 | </div> | ||
| 115 | <!-- // END row-app --> | ||
| 116 | </div> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | use App\Jobs\KHRMSLib; | ||
| 3 | use App\Models\CRMCall; | ||
| 4 | |||
| 5 | $wakka=new KHRMSLib(); | ||
| 6 | $roclientlst=$wakka->clientsReadAccess(); | ||
| 7 | if(isset($_GET['pbcode']))$pbcode=$_GET['pbcode']; | ||
| 8 | else $pbcode=''; | ||
| 9 | |||
| 10 | $alist=DB::table('p11086_cop_rlp_pb_base_uat') | ||
| 11 | ->select(DB::Raw("*")) | ||
| 12 | ->where('pbcode','=',$pbcode) | ||
| 13 | ->get(); | ||
| 14 | //print_r($alist); | ||
| 15 | |||
| 16 | ?> | ||
| 17 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 18 | |||
| 19 | <div class="layout-app"><!-- row-app --> | ||
| 20 | <div class="row row-app"> | ||
| 21 | |||
| 22 | <div class="col-md-12"> | ||
| 23 | |||
| 24 | <div class="col-separator col-separator-first col-unscrollable box"> | ||
| 25 | <div style='clear:both;margin:2% 0 0 1%;border: 2px solid #F5F5F5;padding:2%;border-radius: 5px;'> | ||
| 26 | <center><h4>RLP PB WISE</center> | ||
| 27 | |||
| 28 | <br> | ||
| 29 | <div class='container'> | ||
| 30 | |||
| 31 | PB CODE:<select id='pb_code' class=select2multi style="width:20%;" onclick="pbcodeSelect();"> | ||
| 32 | <?php foreach($roclientlst as $c){$s="";if($c==$pbcode)$s='selected';echo "<option value='$c' $s>$c</option>";} ?> | ||
| 33 | </select> | ||
| 34 | </div> | ||
| 35 | </div> | ||
| 36 | </div> | ||
| 37 | <div style='overflow:auto;margin-top: 10px;'> | ||
| 38 | <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;> | ||
| 39 | <thead> | ||
| 40 | <tr> | ||
| 41 | <th>Product</th> | ||
| 42 | <th>Opportunity</th> | ||
| 43 | <th>Contacted</th> | ||
| 44 | <th>Pitched</th> | ||
| 45 | <th>LG</th> | ||
| 46 | </tr> | ||
| 47 | </thead> | ||
| 48 | <tr> | ||
| 49 | <td>AL</td> | ||
| 50 | <td><?php echo $alist[0]->al_qm_opp + $alist[0]->al_upg_opp + $alist[0]->al_al_cnc_opp + $alist[0]->al_pa_opp + $alist[0]->al_zip_opp ?></td> | ||
| 51 | <td><?php echo $alist[0]->al_called_opp ?></td> | ||
| 52 | <td><?php echo $alist[0]->al_pitch ?></td> | ||
| 53 | <td><?php echo $alist[0]->al_lg ?></td> | ||
| 54 | </tr> | ||
| 55 | <tr> | ||
| 56 | <td>PL/BL</td> | ||
| 57 | <td><?php echo $alist[0]->pl_10sec_opp+$alist[0]->pl_pa_opp+$alist[0]->pl_pq_opp+$alist[0]->bl_10sec_opp+$alist[0]->bl_pq_opp ?></td> | ||
| 58 | <td><?php echo $alist[0]->pl_called_opp ?></td> | ||
| 59 | <td><?php echo $alist[0]->pl_pitch ?></td> | ||
| 60 | <td><?php echo $alist[0]->pl_lg ?></td> | ||
| 61 | </tr> | ||
| 62 | <tr> | ||
| 63 | <td>Retail Assets</td> | ||
| 64 | <td><?php echo $alist[0]->twl_pa_opp+$alist[0]->hl_pq_opp+$alist[0]->hl_bt_opp+$alist[0]->gl_pitch+$alist[0]->las_opp+$alist[0]->lap_opp ?></td> | ||
| 65 | <td><?php echo $alist[0]->twl_called_opp+$alist[0]->hl_called_opp+$alist[0]->las_called_opp+$alist[0]->lap_called_opp ?></td> | ||
| 66 | <td><?php echo $alist[0]->twl_pitch+$alist[0]->hl_pitch+$alist[0]->gl_pitch+$alist[0]->las_pitch ?></td> | ||
| 67 | <td><?php echo $alist[0]->twl_lg+$alist[0]->hl_lg+$alist[0]->gl_lg+$alist[0]->las_lg+$alist[0]->lap_lg ?></td> | ||
| 68 | </tr> | ||
| 69 | <tr> | ||
| 70 | <td>HSL</td> | ||
| 71 | <td><?php echo $alist[0]->hsl_opp ?></td> | ||
| 72 | <td><?php echo $alist[0]->hsl_called_opp ?></td> | ||
| 73 | <td><?php echo $alist[0]->hsl_pitch ?></td> | ||
| 74 | <td></td> | ||
| 75 | </tr> | ||
| 76 | <tr> | ||
| 77 | <td>Credit Card- New Sourcing</td> | ||
| 78 | <td><?php echo $alist[0]->cc_eli_new_opp ?></td> | ||
| 79 | <td><?php echo $alist[0]->cc_activation_opp ?></td> | ||
| 80 | <td><?php echo $alist[0]->cc_pitch ?></td> | ||
| 81 | <td><?php echo $alist[0]->cc_lg ?></td> | ||
| 82 | </tr> | ||
| 83 | <tr> | ||
| 84 | <td>Credit Card- LTD Activation on Carded</td> | ||
| 85 | <td><?php echo $alist[0]->cc_activation_opp ?></td> | ||
| 86 | <td><?php echo $alist[0]->cc_activation_called_opp ?></td> | ||
| 87 | <td></td> | ||
| 88 | <td</td> | ||
| 89 | </tr> | ||
| 90 | <tr> | ||
| 91 | <td>Insurance LI</td> | ||
| 92 | <td><?php echo $alist[0]->li_opp ?></td> | ||
| 93 | <td><?php echo $alist[0]->li_called_opp ?></td> | ||
| 94 | <td></td> | ||
| 95 | <td></td> | ||
| 96 | </tr> | ||
| 97 | <tr> | ||
| 98 | <td>FD</td> | ||
| 99 | <td><?php echo $alist[0]->fd_opp ?></td> | ||
| 100 | <td><?php echo $alist[0]->fd_called_opp ?></td> | ||
| 101 | <td><?php echo $alist[0]->fd_pitch ?></td> | ||
| 102 | <td></td> | ||
| 103 | </tr> | ||
| 104 | <tr> | ||
| 105 | <td>LTD Activation-Savings Account</td> | ||
| 106 | <td><?php echo $alist[0]->ltd_act_saving_opp ?></td> | ||
| 107 | <td><?php echo $alist[0]->ltd_act_saving_opp ?></td> | ||
| 108 | <td></td> | ||
| 109 | <td></td> | ||
| 110 | </tr> | ||
| 111 | <tr> | ||
| 112 | <td>NB/MB Activations</td> | ||
| 113 | <td><?php echo $alist[0]->mb_opp ?></td> | ||
| 114 | <td><?php echo $alist[0]->mb_called_opp ?></td> | ||
| 115 | <td><?php echo $alist[0]->mb_pitch ?></td> | ||
| 116 | <td><?php echo $alist[0]->nb_mb_lg ?></td> | ||
| 117 | </tr> | ||
| 118 | <tr> | ||
| 119 | <td>Aadhar Seeding</td> | ||
| 120 | <td><?php echo $alist[0]->aadhaar_opp ?></td> | ||
| 121 | <td><?php echo $alist[0]->aadhaar_called_opp ?></td> | ||
| 122 | <td><?php echo $alist[0]->aadhaar_pitch ?></td> | ||
| 123 | <td><?php echo $alist[0]->aadhaar_activation ?></td> | ||
| 124 | </tr> | ||
| 125 | <tr> | ||
| 126 | <td>Digital Activation</td> | ||
| 127 | <td><?php echo $alist[0]->digi2_score_opp ?></td> | ||
| 128 | <td><?php echo $alist[0]->digi2_score_called_opp ?></td> | ||
| 129 | <td></td> | ||
| 130 | <td></td> | ||
| 131 | </tr> | ||
| 132 | <tr> | ||
| 133 | <td>BillPayments</td> | ||
| 134 | <td><?php echo $alist[0]->digi_billpay_opp ?></td> | ||
| 135 | <td><?php echo $alist[0]->digi_billpay_called_opp ?></td> | ||
| 136 | <td><?php echo $alist[0]->bill_pay_pitch ?></td> | ||
| 137 | <td></td> | ||
| 138 | </tr> | ||
| 139 | <tr> | ||
| 140 | <td>Financial Transactions</td> | ||
| 141 | <td><?php echo $alist[0]->digi_basic_banking_opp ?></td> | ||
| 142 | <td><?php echo $alist[0]->digi_basic_banking_called_opp ?></td> | ||
| 143 | <td></td> | ||
| 144 | <td></td> | ||
| 145 | </tr> | ||
| 146 | <tr> | ||
| 147 | <td>Digital 2.0 Score(Ecom Shopping Inactive)</td> | ||
| 148 | <td><?php echo $alist[0]->digi_ecom_shopping_opp ?></td> | ||
| 149 | <td><?php echo $alist[0]->digi_ecom_shopping_called_opp ?></td> | ||
| 150 | <td></td> | ||
| 151 | <td> </td> | ||
| 152 | </tr> | ||
| 153 | <tr> | ||
| 154 | <td>Digital 2.0 Score(Investment Inactive)</td> | ||
| 155 | <td><?php echo $alist[0]->digi_investment_opp ?></td> | ||
| 156 | <td><?php echo $alist[0]->digi_investment_called_opp ?></td> | ||
| 157 | <td><?php echo $alist[0]->invest_pitch ?></td> | ||
| 158 | <td></td> | ||
| 159 | </tr> | ||
| 160 | <tr> | ||
| 161 | <td>Reduction in Physical Transactions</td> | ||
| 162 | <td><?php echo $alist[0]->invest_pitch ?></td> | ||
| 163 | <td><?php echo $alist[0]->invest_pitch ?></td> | ||
| 164 | <td></td> | ||
| 165 | <td></td> | ||
| 166 | </tr> | ||
| 167 | <tr> | ||
| 168 | <td>% of Groups Contacted</td> | ||
| 169 | <td> </td> | ||
| 170 | <td> </td> | ||
| 171 | <td> </td> | ||
| 172 | <td> </td> | ||
| 173 | </tr> | ||
| 174 | <tr> | ||
| 175 | <td>Movement of Groups to higher engagement</td> | ||
| 176 | <td> </td> | ||
| 177 | <td> </td> | ||
| 178 | <td> </td> | ||
| 179 | <td></td> | ||
| 180 | </tr> | ||
| 181 | <tr> | ||
| 182 | <td>CASA Growth</td> | ||
| 183 | <td> </td> | ||
| 184 | <td> </td> | ||
| 185 | <td> </td> | ||
| 186 | <td> </td> | ||
| 187 | </tr> | ||
| 188 | <tr> | ||
| 189 | <td>Mutual Fund</td> | ||
| 190 | <td> </td> | ||
| 191 | <td> </td> | ||
| 192 | <td> </td> | ||
| 193 | <td> </td> | ||
| 194 | </tr> | ||
| 195 | </table> | ||
| 196 | </div> | ||
| 197 | <div id=dialoglog></div> | ||
| 198 | </div> | ||
| 199 | </div> | ||
| 200 | </div> | ||
| 201 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 202 | <script> | ||
| 203 | $(document).ready(function() | ||
| 204 | { | ||
| 205 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 206 | { | ||
| 207 | $('#dialoglog').dialog({ | ||
| 208 | autoOpen: false, | ||
| 209 | width: '70%', | ||
| 210 | buttons: { | ||
| 211 | "Ok": function() { | ||
| 212 | $(this).dialog("close"); | ||
| 213 | }, | ||
| 214 | "Cancel": function() { | ||
| 215 | $(this).dialog("close"); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | }); | ||
| 219 | } | ||
| 220 | |||
| 221 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 222 | |||
| 223 | }); | ||
| 224 | function pbcodeSelect() | ||
| 225 | { | ||
| 226 | var pbcode=$('#pb_code').val(); | ||
| 227 | doAjax('rlp?pbcode='+pbcode,'','content','ajax_rlp','singlethis','GET'); | ||
| 228 | } | ||
| 229 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <style> | ||
| 2 | #logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;} | ||
| 3 | .select2-container-multi{height: 90px; overflow-y: auto;border: 1px solid #efefef;border-radius: 3px !important;} | ||
| 4 | .select2-container-active{height: 90px; overflow-y: auto;border: 1px solid #5897fb;border-radius: 3px !important;} | ||
| 5 | .select2-container-multi.select2-container-active.select2-choices{border:none !important; box-shadow: none !important;} | ||
| 6 | .select2-choices{border:none !important; box-shadow: none !important;} | ||
| 7 | .select2-drop,.select2-drop-active{border-color: #5897fb;margin-top: -9px;} | ||
| 8 | </style> | ||
| 9 | |||
| 10 | <?php | ||
| 11 | if($param) { | ||
| 12 | $clientlist = array_filter($clientlist, function($var) use ($param) { return (strpos(trim($var), $param) !== 0) ? false : true; }); | ||
| 13 | } | ||
| 14 | ?> | ||
| 15 | |||
| 16 | <div class=innerAll> | ||
| 17 | |||
| 18 | <h4 style="float:left;width:50%;margin:10px 0;">{{ $reportTitle }}</h4> | ||
| 19 | <div style="float:right;width:50%" id="download_btn"> | ||
| 20 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download'><i class='fa fa-download'></i> Download</button> | ||
| 21 | </div> | ||
| 22 | <div style="clear:both"></div> | ||
| 23 | <hr style="margin-bottom: 5px;"> | ||
| 24 | <div> | ||
| 25 | Search <input id=filter name="filter" type="text" style="border:1px solid #efefef; padding: 2px 10px;"> | ||
| 26 | Date: From <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 27 | <select id="modtime" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 28 | <?php | ||
| 29 | foreach (range(0,23) as $hour) { | ||
| 30 | $selected = ($hour == $logtime) ? "selected" : ""; | ||
| 31 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 32 | } | ||
| 33 | ?></select> | ||
| 34 | To <input size=10 id='modto' name='modto' type='text' value='<?php echo date("Y-m-d",$logdateto); ?>' onchange='statusLogReloadFun("");' /> | ||
| 35 | <select id="modtimeto" style="border:1px solid #efefef;" onchange='statusLogReloadFun("");'> | ||
| 36 | <?php | ||
| 37 | foreach (range(0,23) as $hour) { | ||
| 38 | $selected = ($hour == $logtimeto) ? "selected" : ""; | ||
| 39 | echo "<option value='$hour' $selected>".str_pad($hour, 2, "0", STR_PAD_LEFT) . ":00</option>"; | ||
| 40 | } | ||
| 41 | ?></select> | ||
| 42 | <button class="pull-right btn btn-sm btn-default" onclick='$("#advance").toggle();' title='Advance Search'><i class='fa fa-search'></i> Advance Search</button> | ||
| 43 | |||
| 44 | <div style="clear:both"></div> | ||
| 45 | <div style="margin-top: 5px; display:{{ $displayAdv }};" id="advance"> | ||
| 46 | <div style="width: 80%;" class="pull-left"> | ||
| 47 | Campaign | ||
| 48 | <select id="campaignbox" multiple="multiple" style="width:25%" class=select2multi> | ||
| 49 | <?php foreach($clientlist as $c) | ||
| 50 | { $s=""; | ||
| 51 | if($param) { | ||
| 52 | $s='selected'; | ||
| 53 | echo "<option value='$c' $s>$c</option>"; | ||
| 54 | } else { | ||
| 55 | if(in_array($c, $campaign))$s='selected'; | ||
| 56 | echo "<option value='$c' $s>$c</option>"; | ||
| 57 | } | ||
| 58 | }?> | ||
| 59 | </select> | ||
| 60 | </div> | ||
| 61 | <div style="margin-top: 5px;" class="pull-right"> | ||
| 62 | <button class="pull-right btn btn-sm btn-default" onclick='statusLogReloadFun("");' title='Search'><i class='fa fa-search'></i> Search</button> | ||
| 63 | </div> | ||
| 64 | </div> | ||
| 65 | </div> | ||
| 66 | |||
| 67 | <div style="clear:both"></div> | ||
| 68 | <hr style="margin:5px;"> | ||
| 69 | <script> | ||
| 70 | $(document).ready(function() { | ||
| 71 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 72 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 73 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 74 | }); | ||
| 75 | |||
| 76 | function dataString() | ||
| 77 | { | ||
| 78 | var campaignStr = ''; | ||
| 79 | $('#campaignbox :selected') .each(function(i, sel){ | ||
| 80 | if(campaignStr != '') campaignStr = campaignStr + '||' + $(sel).val(); | ||
| 81 | else campaignStr = $(sel).val(); | ||
| 82 | }); | ||
| 83 | return 'logdate='+$("#modfrom").val()+'&logtime='+$("#modtime").val()+'&logdateto='+$("#modto").val()+'&logtimeto='+$("#modtimeto").val()+'&campaign='+campaignStr; | ||
| 84 | } | ||
| 85 | function statusLogReloadFun(sortby) | ||
| 86 | { | ||
| 87 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 88 | var searchStr = dataString(); | ||
| 89 | doAjax('dialer/{{ $returnblade }}?'+searchStr+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 90 | } | ||
| 91 | function dlAgentlogXls() | ||
| 92 | { | ||
| 93 | var searchStr = dataString(); | ||
| 94 | window.open('dialer/{{ $returnblade }}?dllogxls=1&'+searchStr); | ||
| 95 | return false; | ||
| 96 | } | ||
| 97 | function breakupXls(report,userId,column) | ||
| 98 | { | ||
| 99 | var searchStr = dataString(); | ||
| 100 | window.open('dialer/breakupxls?report='+report+'&userId='+userId+'&column='+column+'&'+searchStr); | ||
| 101 | return false; | ||
| 102 | } | ||
| 103 | |||
| 104 | function displayMode(mode) { | ||
| 105 | if(mode == 'percent') { | ||
| 106 | $(".summation").hide(); | ||
| 107 | $(".percent").show(); | ||
| 108 | } | ||
| 109 | else { | ||
| 110 | $(".percent").hide(); | ||
| 111 | $(".summation").show(); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | </script> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | $wakka = new KHRMSLib(); | ||
| 7 | $dashboarduser=Auth::user(); | ||
| 8 | |||
| 9 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 10 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 11 | |||
| 12 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 13 | |||
| 14 | //if(!$dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 15 | if($dashboarduser->usertype != 'Admin') | ||
| 16 | { | ||
| 17 | $uidlist=array($dashboarduser->id); | ||
| 18 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 19 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 20 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 21 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 22 | })->get(); | ||
| 23 | // ->where(function ($query) { | ||
| 24 | // $query->where('status', '=', 'Active'); | ||
| 25 | // })->get(); | ||
| 26 | |||
| 27 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 28 | |||
| 29 | |||
| 30 | $roclientstr=array();$didlinesstr=array(); | ||
| 31 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 32 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 33 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 34 | { | ||
| 35 | $roclientstr[]="$tclnt"; | ||
| 36 | |||
| 37 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 38 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 39 | } | ||
| 40 | |||
| 41 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 42 | $query->orWhereIn('client',$roclientstr) | ||
| 43 | ->orWhereIn('user_id',$uidlist) | ||
| 44 | ->orWhereIn('did',$didlinesstr); | ||
| 45 | }); | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | $alist=$alist->get(); | ||
| 50 | |||
| 51 | $userarr=array();$i=1; | ||
| 52 | $reporthead=array("#","UserId","User","Name","Count","Total"); | ||
| 53 | $reportarray=array(); | ||
| 54 | foreach($alist as $aline) | ||
| 55 | { | ||
| 56 | if(!isset($userarr[$aline->user_id]))$userarr[$aline->user_id]=User::find($aline->user_id); | ||
| 57 | $tuser=$userarr[$aline->user_id]; | ||
| 58 | |||
| 59 | if(!isset($reportarray[$aline->user_id]))$reportarray[$aline->user_id]=array("#"=>$i++,"UserId"=>$tuser->id,"User"=>$tuser->username,"Name"=>$tuser->fullname,"Count"=>0,"Total"=>0,"Wait"=>0,"Call"=>0,"Talk"=>0,"Dispo"=>0); | ||
| 60 | |||
| 61 | $talktime=$aline->talkSec+$aline->recstartSec+$aline->recendSec; | ||
| 62 | |||
| 63 | $reportarray[$aline->user_id]["Count"]++; | ||
| 64 | $reportarray[$aline->user_id]["Total"]+=round(($aline->waitSec+$aline->callSec+$talktime+$aline->dispoSec)/1000,2); | ||
| 65 | |||
| 66 | $ststr=$aline->userstatus."-".$aline->usersubstatus; | ||
| 67 | if(!in_array($ststr,$reporthead))$reporthead[]=$ststr; | ||
| 68 | |||
| 69 | $reportarray[$aline->user_id][$ststr]++; | ||
| 70 | } | ||
| 71 | |||
| 72 | if(Input::has("dllogxls")) | ||
| 73 | { | ||
| 74 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 75 | |||
| 76 | $inputFileType = "Excel5"; | ||
| 77 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 78 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 79 | $baseRow = 3; | ||
| 80 | |||
| 81 | |||
| 82 | $highestColumn = sizeof($reporthead); | ||
| 83 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 84 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 85 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 86 | } | ||
| 87 | |||
| 88 | foreach($reportarray as $uid=>$uarr) | ||
| 89 | { | ||
| 90 | $row = $baseRow++; | ||
| 91 | $col = 0; | ||
| 92 | |||
| 93 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 94 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 95 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | |||
| 100 | header('Content-Type: application/vnd.ms-excel'); | ||
| 101 | header('Content-Disposition: attachment;filename="StatusLog.xls"'); | ||
| 102 | header('Cache-Control: max-age=0'); | ||
| 103 | |||
| 104 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 105 | $objWriter->save('php://output'); | ||
| 106 | |||
| 107 | return ; | ||
| 108 | } | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | $highestColumn = sizeof($reporthead); | ||
| 113 | $outhead="<tr>";$outstr=""; | ||
| 114 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 115 | $outhead.="<td>".$reporthead[$head]."</td>"; | ||
| 116 | } | ||
| 117 | $outhead.="</tr>"; | ||
| 118 | foreach($reportarray as $uid=>$uarr) | ||
| 119 | { | ||
| 120 | if(!empty($uarr['UserId'])){ | ||
| 121 | $outstr.="<tr>"; | ||
| 122 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 123 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 124 | } | ||
| 125 | $outstr.="</tr>"; | ||
| 126 | }else{ | ||
| 127 | $outstr.="<tr>"; | ||
| 128 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 129 | if($reporthead[$head]=='UserId'){ | ||
| 130 | $outstr.="<td>Inbound</td>"; | ||
| 131 | }else{ | ||
| 132 | $outstr.="<td>".$uarr[$reporthead[$head]]."</td>"; | ||
| 133 | } | ||
| 134 | } | ||
| 135 | $outstr.="</tr>"; | ||
| 136 | |||
| 137 | } | ||
| 138 | } | ||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | |||
| 143 | //charts | ||
| 144 | $cat1=array(); | ||
| 145 | $cat1arr=array(); | ||
| 146 | foreach($reportarray as $uid=>$uarr) | ||
| 147 | { | ||
| 148 | $cat1[]="'$uarr[UserName]'"; | ||
| 149 | |||
| 150 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 151 | if(!isset($cat1arr[$reporthead[$head]]))$cat1arr[$reporthead[$head]]=array(); | ||
| 152 | |||
| 153 | $cat1arr[$reporthead[$head]][$uarr["#"]]=round($uarr[$reporthead[$head]],1); | ||
| 154 | if(empty($cat1arr[$reporthead[$head]][$uarr["#"]]))$cat1arr[$reporthead[$head]][$uarr["#"]]=0; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | $cat1arrstr=""; | ||
| 159 | foreach($cat1arr as $name=>$data) | ||
| 160 | { | ||
| 161 | $extra="";if($name=="InboundDROP-InboundDROP")$extra=",visible: false"; | ||
| 162 | $cat1arrstr.="{ name: '$name',\ndata : ["; | ||
| 163 | $cat1arrstr.=implode(",",$data); | ||
| 164 | $cat1arrstr.="] $extra },\n"; | ||
| 165 | } | ||
| 166 | |||
| 167 | |||
| 168 | $cat2=array(); | ||
| 169 | foreach($reportarray as $uid=>$uarr) | ||
| 170 | { | ||
| 171 | for ($head = 5; $head < $highestColumn; $head++){ | ||
| 172 | $cat2["'".$reporthead[$head]."'"]+=round($uarr[$reporthead[$head]],1); | ||
| 173 | } | ||
| 174 | } | ||
| 175 | ?> | ||
| 176 | |||
| 177 | |||
| 178 | <div class=innerAll> | ||
| 179 | |||
| 180 | |||
| 181 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 182 | <script> | ||
| 183 | $(document).ready(function() | ||
| 184 | { | ||
| 185 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 186 | { | ||
| 187 | $('#dialoglog').dialog({ | ||
| 188 | autoOpen: false, | ||
| 189 | width: '70%', | ||
| 190 | buttons: { | ||
| 191 | "Ok": function() { | ||
| 192 | $(this).dialog("close"); | ||
| 193 | }, | ||
| 194 | "Cancel": function() { | ||
| 195 | $(this).dialog("close"); | ||
| 196 | } | ||
| 197 | } | ||
| 198 | }); | ||
| 199 | } | ||
| 200 | |||
| 201 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 202 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 203 | }); | ||
| 204 | </script> | ||
| 205 | <div style="float:left;width:50%"> | ||
| 206 | |||
| 207 | Search <input id=filter name="filter" type="text"> | ||
| 208 | Date : <input size=10 id='modfrom' name='modfrom' type='text' value='<?php echo date("Y-m-d",$logdate); ?>' onchange='statusLogReloadFun("");' /> | ||
| 209 | |||
| 210 | </div> | ||
| 211 | <div style="float:left;width:50%"> | ||
| 212 | |||
| 213 | |||
| 214 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 215 | |||
| 216 | </div> | ||
| 217 | <div style="clear:both"></div> | ||
| 218 | <hr> | ||
| 219 | |||
| 220 | <!--div class=col-md-12> | ||
| 221 | |||
| 222 | |||
| 223 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 224 | <script> | ||
| 225 | $(function () { | ||
| 226 | $('#userlogschart1').highcharts({ | ||
| 227 | chart: { | ||
| 228 | type: 'column' | ||
| 229 | }, | ||
| 230 | title: { | ||
| 231 | text: '' | ||
| 232 | }, | ||
| 233 | xAxis: { | ||
| 234 | labels:{ | ||
| 235 | enabled:false//default is true | ||
| 236 | }, | ||
| 237 | categories: [<?php echo implode(",",$cat1); ?>] | ||
| 238 | }, | ||
| 239 | yAxis: { | ||
| 240 | min: 0, | ||
| 241 | title: { | ||
| 242 | text: '' | ||
| 243 | }, | ||
| 244 | stackLabels: { | ||
| 245 | enabled: false, | ||
| 246 | // style: { | ||
| 247 | // fontWeight: '', | ||
| 248 | // color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray' | ||
| 249 | // } | ||
| 250 | } | ||
| 251 | }, | ||
| 252 | // legend: { | ||
| 253 | // align: 'right', | ||
| 254 | // x: -30, | ||
| 255 | // verticalAlign: 'top', | ||
| 256 | // y: 25, | ||
| 257 | // floating: true, | ||
| 258 | // backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white', | ||
| 259 | // borderColor: '#CCC', | ||
| 260 | // borderWidth: 1, | ||
| 261 | // shadow: false | ||
| 262 | // }, | ||
| 263 | tooltip: { | ||
| 264 | headerFormat: '<b>{point.x}</b><br/>', | ||
| 265 | pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}' | ||
| 266 | }, | ||
| 267 | plotOptions: { | ||
| 268 | column: { | ||
| 269 | stacking: 'normal', | ||
| 270 | dataLabels: { | ||
| 271 | enabled: false, | ||
| 272 | // color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white', | ||
| 273 | // style: { | ||
| 274 | // textShadow: '0 0 3px black' | ||
| 275 | // } | ||
| 276 | } | ||
| 277 | } | ||
| 278 | }, | ||
| 279 | series: [<?php echo $cat1arrstr; ?>] | ||
| 280 | }); | ||
| 281 | }); | ||
| 282 | |||
| 283 | |||
| 284 | |||
| 285 | |||
| 286 | function statusLogReloadFun(sortby) | ||
| 287 | { | ||
| 288 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 289 | |||
| 290 | doAjax('dialer/statusreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 291 | } | ||
| 292 | function dlAgentlogXls() | ||
| 293 | { | ||
| 294 | window.open('dialer/statusreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 295 | } | ||
| 296 | </script> | ||
| 297 | |||
| 298 | </div --> | ||
| 299 | |||
| 300 | <script> | ||
| 301 | function statusLogReloadFun(sortby) | ||
| 302 | { | ||
| 303 | var sortstr='';if(sortby!="")sortstr="&sort="+sortby | ||
| 304 | |||
| 305 | doAjax('dialer/statusreport?logdate='+$("#modfrom").val()+sortstr,'','rightmainreportdiv','ajax_dialer_reports','singlethis','GET'); | ||
| 306 | } | ||
| 307 | function dlAgentlogXls() | ||
| 308 | { | ||
| 309 | window.open('dialer/statusreport?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 310 | } | ||
| 311 | </script> | ||
| 312 | |||
| 313 | <div style='clear:both'></div> | ||
| 314 | |||
| 315 | <div class=col-md-12> | ||
| 316 | |||
| 317 | |||
| 318 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 319 | <script> | ||
| 320 | $(function () { | ||
| 321 | $('#userlogschart2').highcharts({ | ||
| 322 | chart: { | ||
| 323 | type: 'column' | ||
| 324 | }, | ||
| 325 | title: { | ||
| 326 | text: '' | ||
| 327 | }, | ||
| 328 | subtitle: { | ||
| 329 | text: '' | ||
| 330 | }, | ||
| 331 | xAxis: { | ||
| 332 | categories: [<?php echo implode(",",array_keys($cat2)); ?>], | ||
| 333 | crosshair: true, | ||
| 334 | labels:{ | ||
| 335 | enabled:false//default is true | ||
| 336 | }, | ||
| 337 | }, | ||
| 338 | yAxis: { | ||
| 339 | min: 0, | ||
| 340 | title: { | ||
| 341 | text: '' | ||
| 342 | } | ||
| 343 | }, | ||
| 344 | tooltip: { | ||
| 345 | headerFormat: '<span style="font-size:10px">{point.key}</span><table>', | ||
| 346 | pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + | ||
| 347 | '<td style="padding:0"><b>{point.y:.1f}</b></td></tr>', | ||
| 348 | footerFormat: '</table>', | ||
| 349 | shared: true, | ||
| 350 | useHTML: true | ||
| 351 | }, | ||
| 352 | plotOptions: { | ||
| 353 | column: { | ||
| 354 | pointPadding: 0.2, | ||
| 355 | borderWidth: 0 | ||
| 356 | } | ||
| 357 | }, | ||
| 358 | legend : { | ||
| 359 | floating: true, | ||
| 360 | align: 'right', | ||
| 361 | x: -30, | ||
| 362 | verticalAlign: 'top', | ||
| 363 | }, | ||
| 364 | series: [{ | ||
| 365 | name: 'Count', | ||
| 366 | data: [<?php echo implode(",",array_values($cat2)); ?>] | ||
| 367 | |||
| 368 | },] | ||
| 369 | }); | ||
| 370 | }); | ||
| 371 | |||
| 372 | </script> | ||
| 373 | |||
| 374 | </div> | ||
| 375 | |||
| 376 | |||
| 377 | |||
| 378 | <div style='clear:both'></div> | ||
| 379 | |||
| 380 | <div style='overflow:auto'> | ||
| 381 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 382 | <thead> | ||
| 383 | <?php echo $outhead; ?> | ||
| 384 | </thead> | ||
| 385 | <?php echo $outstr; ?> | ||
| 386 | </table> | ||
| 387 | </div> | ||
| 388 | |||
| 389 | <div id=dialoglog></div> | ||
| 390 | |||
| 391 | |||
| 392 | |||
| 393 | |||
| 394 | |||
| 395 | </div> |
| 1 | <?php | ||
| 2 | use App\Models\CRMCall; | ||
| 3 | use App\Models\User; | ||
| 4 | use App\Jobs\KHRMSLib; | ||
| 5 | |||
| 6 | $wakka = new KHRMSLib(); | ||
| 7 | $dashboarduser=Auth::user(); | ||
| 8 | |||
| 9 | if(isset($_GET['logdate']))$logdate=strtotime($_GET['logdate']." 00:00:00"); | ||
| 10 | else $logdate=strtotime(date('Y-m-d')." 00:00:00"); | ||
| 11 | |||
| 12 | $alist=CRMCall::where('created_at','>=',date("Y-m-d H:i:s",$logdate))->where('created_at','<=',date("Y-m-d H:i:s",$logdate+24*60*60)); | ||
| 13 | |||
| 14 | //if(!$dashboarduser->moduleACL("Dialer",false,false,true)) | ||
| 15 | if($dashboarduser->usertype != 'Admin') | ||
| 16 | { | ||
| 17 | $uidlist=array($dashboarduser->id); | ||
| 18 | $allusers=User::where(function ($query) use($dashboarduser) { | ||
| 19 | $query->where('supervisor','=',$dashboarduser->username) | ||
| 20 | ->orWhere('lteam2','=',$dashboarduser->username) | ||
| 21 | ->orWhere('lteam','=',$dashboarduser->username); | ||
| 22 | })->get(); | ||
| 23 | // ->where(function ($query) { | ||
| 24 | // $query->where('status', '=', 'Active'); | ||
| 25 | // })->get(); | ||
| 26 | |||
| 27 | foreach($allusers as $tuser)$uidlist[]=$tuser->id; | ||
| 28 | |||
| 29 | |||
| 30 | $roclientstr=array();$didlinesstr=array(); | ||
| 31 | if($dashboarduser->exten!="")$didlinesstr[]=$dashboarduser->exten; | ||
| 32 | $oclientlst=$wakka->clientsReadAccess(); | ||
| 33 | if(!empty($oclientlst))foreach($oclientlst as $tclnt)if($tclnt!="") | ||
| 34 | { | ||
| 35 | $roclientstr[]="$tclnt"; | ||
| 36 | |||
| 37 | $mastersdata=$wakka->getCompanyMaster($tclnt); | ||
| 38 | if(!empty($mastersdata["DialerDID"]))$didlinesstr[]=$mastersdata["DialerDID"]; | ||
| 39 | } | ||
| 40 | |||
| 41 | $alist=$alist->where(function ($query) use($roclientstr,$uidlist,$didlinesstr){ | ||
| 42 | $query->orWhereIn('client',$roclientstr) | ||
| 43 | ->orWhereIn('user_id',$uidlist) | ||
| 44 | ->orWhereIn('did',$didlinesstr); | ||
| 45 | }); | ||
| 46 | |||
| 47 | } | ||
| 48 | |||
| 49 | $alist=$alist->get(); | ||
| 50 | |||
| 51 | $userarr=array();$i=1; | ||
| 52 | $reporthead=array("id","created_at","updated_at","sup_id","message","status"); | ||
| 53 | $reportarray=DB::table('supervisor_message')->where('sup_id','=',Auth::user()->username)->select('*')->get(); | ||
| 54 | |||
| 55 | if(Input::has("dllogxls")) | ||
| 56 | { | ||
| 57 | include_once(app_path().'/lib/phpexcel/PHPExcel.php'); | ||
| 58 | |||
| 59 | $inputFileType = "Excel5"; | ||
| 60 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); | ||
| 61 | $objPHPExcel = $objReader->load("assets/extras/blank.xls"); | ||
| 62 | $baseRow = 2; | ||
| 63 | |||
| 64 | |||
| 65 | $highestColumn = sizeof($reporthead); | ||
| 66 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 67 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 68 | $objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $reporthead[$head]); | ||
| 69 | } | ||
| 70 | |||
| 71 | foreach($reportarray as $uid=>$uarr) | ||
| 72 | { | ||
| 73 | $row = $baseRow++; | ||
| 74 | $col = 0; | ||
| 75 | |||
| 76 | for ($head = 0; $head < $highestColumn; $head++){ | ||
| 77 | |||
| 78 | if($reporthead[$head]=="created_at") | ||
| 79 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 80 | |||
| 81 | if($reporthead[$head]=="updated_at") | ||
| 82 | $uarr->$reporthead[$head]=date("Y-m-d H:i:s",strtotime($uarr->$reporthead[$head])+330*60); | ||
| 83 | |||
| 84 | $colstr=PHPExcel_Cell::stringFromColumnIndex($head); | ||
| 85 | $objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr->$reporthead[$head]); | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 90 | header('Content-Type: application/vnd.ms-excel'); | ||
| 91 | header('Content-Disposition: attachment;filename="Messages.xls"'); | ||
| 92 | header('Cache-Control: max-age=0'); | ||
| 93 | |||
| 94 | $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType); | ||
| 95 | $objWriter->save('php://output'); | ||
| 96 | |||
| 97 | return ; | ||
| 98 | } | ||
| 99 | |||
| 100 | ?> | ||
| 101 | |||
| 102 | |||
| 103 | <div class=innerAll> | ||
| 104 | |||
| 105 | |||
| 106 | <style>#logtable.td{vertical-align:top;}#logtable.tr{height:28px;overflow-y:hidden;}</style> | ||
| 107 | <script> | ||
| 108 | $(document).ready(function() | ||
| 109 | { | ||
| 110 | if(!$('#dialoglog').hasClass('ui-dialog-content')) | ||
| 111 | { | ||
| 112 | $('#dialoglog').dialog({ | ||
| 113 | autoOpen: false, | ||
| 114 | width: '70%', | ||
| 115 | buttons: { | ||
| 116 | "Ok": function() { | ||
| 117 | $(this).dialog("close"); | ||
| 118 | }, | ||
| 119 | "Cancel": function() { | ||
| 120 | $(this).dialog("close"); | ||
| 121 | } | ||
| 122 | } | ||
| 123 | }); | ||
| 124 | } | ||
| 125 | |||
| 126 | waitKeyUpRun("filter",function() { filter2(document.getElementById('filter'), 'logtable') },"2000"); | ||
| 127 | $('#modfrom').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 128 | |||
| 129 | $('#modto').datepicker({dateFormat: 'yy-mm-dd',inline: true,changeYear: true,selectOtherMonths: true,yearRange: '<?php echo (date('Y')-70).":".(date('Y')+5); ?>'}); | ||
| 130 | }); | ||
| 131 | </script> | ||
| 132 | <div style="float:left;width:50%"> | ||
| 133 | |||
| 134 | |||
| 135 | </div> | ||
| 136 | <div style="float:right;width:50%"> | ||
| 137 | |||
| 138 | |||
| 139 | <button class="pull-right btn btn-sm btn-default" onclick='dlAgentlogXls();return false;' title='Download' style='margin-top:-8px'><i class='fa fa-download'></i> Download</button> | ||
| 140 | |||
| 141 | </div> | ||
| 142 | <div style="clear:both"></div> | ||
| 143 | <hr> | ||
| 144 | |||
| 145 | <div class=col-md-12> | ||
| 146 | |||
| 147 | |||
| 148 | <div id=userlogschart1 style='min-height:300px;width:100%'></div> | ||
| 149 | </div> | ||
| 150 | |||
| 151 | <script> | ||
| 152 | function dlAgentlogXls() | ||
| 153 | { | ||
| 154 | window.open('dialer/supmessages?dllogxls=1&logdate='+$("#modfrom").val());return false; | ||
| 155 | } | ||
| 156 | </script> | ||
| 157 | |||
| 158 | <div style='clear:both'></div> | ||
| 159 | |||
| 160 | <div class=col-md-12> | ||
| 161 | |||
| 162 | |||
| 163 | <div id=userlogschart2 style='min-height:300px;width:100%'></div> | ||
| 164 | |||
| 165 | </div> | ||
| 166 | |||
| 167 | |||
| 168 | |||
| 169 | <div style='clear:both'></div> | ||
| 170 | |||
| 171 | <div style='overflow:auto'> | ||
| 172 | <table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px'> | ||
| 173 | <thead> | ||
| 174 | <?php /*echo $outhead;*/ ?> | ||
| 175 | </thead> | ||
| 176 | <?php /*echo $outstr;*/ ?> | ||
| 177 | </table> | ||
| 178 | </div> | ||
| 179 | |||
| 180 | <div id=dialoglog></div> | ||
| 181 | |||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | </div> |
-
Please register or sign in to post a comment