2b54eb6f175c5a0db105e5acd4762b176b258d41.php
4.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
$reportTitle = 'IC4 Trails';
$returnblade = 'ic4trails';
$view_path = Config::get('view.paths');
include_once($view_path[0].'/layout/module/dialer/reporthead.blade.php');
$alist=$alist->select(DB::raw("c.id, c.lan, c.number, c.user_id, c.created_at, c.action_code, c.resultCode, c.rfd, c.nextActionCode, c.nextActionDateTime, c.userremarks, c.upi, c.designation, c.adhar, c.data, c.recsize"));
$alist=$alist->get();
$i=1;
$reporthead=array("Account No.","Number","User Id","Action Date","Action Code","Result Code","RFD","Next Action","Next Action Date & Time","Remarks","UPI","Designation","Adhar");
$reportarray=array();
if (count($alist))
foreach($alist as $aline)
{
$tuser=$userarr[$aline->user_id];
$userData=json_decode($aline->data,true);
$recordingFolder = $userData['recFolder'];
$reportarray[$aline->id]=array(
"Account No."=>$aline->lan,
"Number"=>$aline->number,
"User Id"=>$tuser->username,
"Action Date"=>date('d.m.Y H:i',strtotime($aline->created_at)+(5*60*60)+(30*60)),
"Action Code"=>$aline->action_code,
"Next Action"=>$aline->nextActionCode,
"Result Code"=>$aline->resultCode,
"RFD"=>$aline->rfd,
"Next Action Date & Time"=> ($aline->nextActionDateTime != '0000-00-00 00:00:00') ? date('d.m.Y H:i',strtotime($aline->nextActionDateTime)) : '',
"Remarks" =>$aline->userremarks,
"UPI" =>$aline->upi,
"Designation" =>$aline->designation,
"Adhar" =>$aline->adhar,
"Recording ID"=>$aline->id,
"Recording Folder"=>$recordingFolder,
"Recording Size"=>$aline->recsize
);
}
if(Input::has("dllogxls"))
{
include_once(app_path().'/lib/phpexcel/PHPExcel.php');
$inputFileType = "CSV";
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load("assets/extras/blank.csv");
$baseRow = 2;
$exporthead = array_merge($reporthead, array("Promise Date 1","Promise Amount 1","Promise Date 2","Promise Amount 2","Promise Date 3","Promise Amount 3","Promise Date 4","Promise Amount 4","Promise Date 5","Promise Amount 5") );
$highestColumn = sizeof($exporthead);
for ($head = 0; $head < $highestColumn; $head++){
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr."1", $exporthead[$head]);
}
$highestColumn = sizeof($reporthead);
foreach($reportarray as $uid=>$uarr)
{
$row = $baseRow++;
$col = 0;
for ($head = 0; $head < $highestColumn; $head++){
$colstr=PHPExcel_Cell::stringFromColumnIndex($head);
$objPHPExcel->getActiveSheet()->setCellValue($colstr.$row, $uarr[$reporthead[$head]]);
}
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="ic4trails.csv"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
$objWriter->save('php://output');
return ;
}
$highestColumn = sizeof($reporthead);
$exit = 1;
if(count($reportarray)) {
$outhead="<tr>";$outstr="";
for ($head = 0; $head < $highestColumn; $head++){
$outhead.="<td>".$reporthead[$head]."</td>";
}
$outhead.="</tr>";
$utotalarr = array("Telecaller"=>'Total');
foreach($reportarray as $uid=>$uarr)
{
$outstr.="<tr>";
for ($head = 0; $head < $highestColumn; $head++){
$outstr.="<td>".$uarr[$reporthead[$head]]."</td>";
}
$recstr='';
if($dashboarduser->moduleACL("Dialer",false,false,true))
{
if(isset($uarr['Recording Folder']))$recstr="<a href=# onclick='getCallRec(".$uarr['Recording ID'].");return false;' title='Size : ".round($uarr['Recording Size']/1024,0)." KB'><i class='fa fa-play-circle'></i> </a> ";
if(Auth::user()->usertype != "Telecaller" && isset($uarr['Recording Folder']))
$recstr.="<a href='dialer/playrecfile?calllog=".$uarr['Recording ID']."&out=wav' title=''><i class='fa fa-download'></i> </a><span id='recspan_".$uarr['Recording ID']."'</span>";
}
$outstr.="<td>$recstr</td>";
$outstr.="</tr>";
if($exit=="1000")break;
$exit++;
}
}
else {
$outhead.="<tr><td>No Records Found.</td></tr>";
}
?>
<?php echo $__env->make('layout.module.dialer.searchform', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<div style="overflow: auto; margin-top: 10px;">
<table id=logtable class='footable table table-striped table-bordered table-white table-primary footable-loaded' style='font-size:12px; margin:0; border:1px solid #BBB;'>
<thead><?php echo $outhead; ?></thead>
<?php echo $outstr; ?>
</table>
</div>
</div>
<script>
function getCallRec(id)
{
doAjax("dialer/calllog","getCallRec=1&calllog="+id,'recspan_'+id,'rec_ajax','singlefail','GET');
}
</script>