forked from kevinowino869/mitrobill
using Vendor from composer
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
**/
|
||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||
**/
|
||||
_admin();
|
||||
$ui->assign('_title', $_L['Reports']);
|
||||
$ui->assign('_sysfrm_menu', 'reports');
|
||||
@ -16,7 +17,7 @@ $tdate = date('Y-m-d', strtotime('today - 30 days'));
|
||||
//first day of month
|
||||
$first_day_month = date('Y-m-01');
|
||||
//
|
||||
$this_week_start = date('Y-m-d',strtotime( 'previous sunday'));
|
||||
$this_week_start = date('Y-m-d', strtotime('previous sunday'));
|
||||
// 30 days before
|
||||
$before_30_days = date('Y-m-d', strtotime('today - 30 days'));
|
||||
//this month
|
||||
@ -36,51 +37,51 @@ switch ($action) {
|
||||
$dr->order_by_desc('id');
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
$ui->assign('d',$x);
|
||||
$ui->assign('dr',$xy);
|
||||
$ui->assign('mdate',$mdate);
|
||||
$ui->assign('recharged_on',$mdate);
|
||||
$ui->assign('d', $x);
|
||||
$ui->assign('dr', $xy);
|
||||
$ui->assign('mdate', $mdate);
|
||||
$ui->assign('recharged_on', $mdate);
|
||||
run_hook('print_by_date'); #HOOK
|
||||
$ui->display('print-by-date.tpl');
|
||||
break;
|
||||
|
||||
case 'pdf-by-date':
|
||||
$mdate = date('Y-m-d');
|
||||
$mdate = date('Y-m-d');
|
||||
|
||||
$d = ORM::for_table('tbl_transactions');
|
||||
$d->where('recharged_on', $mdate);
|
||||
$d->order_by_desc('id');
|
||||
$x = $d->find_many();
|
||||
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
$dr->where('recharged_on', $mdate);
|
||||
$dr->order_by_desc('id');
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
$title = ' Reports ['.$mdate.']';
|
||||
$title = str_replace('-',' ',$title);
|
||||
$title = ' Reports [' . $mdate . ']';
|
||||
$title = str_replace('-', ' ', $title);
|
||||
|
||||
if ($x) {
|
||||
$html = '
|
||||
<div id="page-wrap">
|
||||
<div id="address">
|
||||
<h3>'.$config['CompanyName'].'</h3>
|
||||
'.$config['address'].'<br>
|
||||
'.$_L['Phone_Number'].': '.$config['phone'].'<br>
|
||||
<h3>' . $config['CompanyName'] . '</h3>
|
||||
' . $config['address'] . '<br>
|
||||
' . $_L['Phone_Number'] . ': ' . $config['phone'] . '<br>
|
||||
</div>
|
||||
<div id="logo"><img id="image" src="system/uploads/logo.png" alt="logo" /></div>
|
||||
</div>
|
||||
<div id="header">'.$_L['All_Transactions_at_Date'].': '. date($config['date_format'], strtotime($mdate)).'</div>
|
||||
<div id="header">' . $_L['All_Transactions_at_Date'] . ': ' . date($config['date_format'], strtotime($mdate)) . '</div>
|
||||
<table id="customers">
|
||||
<tr>
|
||||
<th>'.$_L['Username'].'</th>
|
||||
<th>'.$_L['Plan_Name'].'</th>
|
||||
<th>'.$_L['Type'].'</th>
|
||||
<th>'.$_L['Plan_Price'].'</th>
|
||||
<th>'.$_L['Created_On'].'</th>
|
||||
<th>'.$_L['Expires_On'].'</th>
|
||||
<th>'.$_L['Method'].'</th>
|
||||
<th>'.$_L['Routers'].'</th>
|
||||
<th>' . $_L['Username'] . '</th>
|
||||
<th>' . $_L['Plan_Name'] . '</th>
|
||||
<th>' . $_L['Type'] . '</th>
|
||||
<th>' . $_L['Plan_Price'] . '</th>
|
||||
<th>' . $_L['Created_On'] . '</th>
|
||||
<th>' . $_L['Expires_On'] . '</th>
|
||||
<th>' . $_L['Method'] . '</th>
|
||||
<th>' . $_L['Routers'] . '</th>
|
||||
</tr>';
|
||||
$c = true;
|
||||
foreach ($x as $value) {
|
||||
@ -88,14 +89,14 @@ switch ($action) {
|
||||
$username = $value['username'];
|
||||
$plan_name = $value['plan_name'];
|
||||
$type = $value['type'];
|
||||
$price = $config['currency_code'].' '. number_format($value['price'],0,$config['dec_point'],$config['thousands_sep']);
|
||||
$recharged_on = date( $config['date_format'], strtotime($value['recharged_on']));
|
||||
$expiration = date( $config['date_format'], strtotime($value['expiration']));
|
||||
$time = $value['time'];
|
||||
$method = $value['method'];
|
||||
$routers = $value['routers'];
|
||||
$price = $config['currency_code'] . ' ' . number_format($value['price'], 0, $config['dec_point'], $config['thousands_sep']);
|
||||
$recharged_on = date($config['date_format'], strtotime($value['recharged_on']));
|
||||
$expiration = date($config['date_format'], strtotime($value['expiration']));
|
||||
$time = $value['time'];
|
||||
$method = $value['method'];
|
||||
$routers = $value['routers'];
|
||||
|
||||
$html .= "<tr".(($c = !$c)?' class="alt"':' class=""').">"."
|
||||
$html .= "<tr" . (($c = !$c) ? ' class="alt"' : ' class=""') . ">" . "
|
||||
<td>$username</td>
|
||||
<td>$plan_name</td>
|
||||
<td>$type</td>
|
||||
@ -107,16 +108,13 @@ switch ($action) {
|
||||
</tr>";
|
||||
}
|
||||
$html .= '</table>
|
||||
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
|
||||
<h3 class="sum">'.$config['currency_code'].' '.number_format($xy,2,$config['dec_point'],$config['thousands_sep']).'</h3>';
|
||||
<h4 class="text-uppercase text-bold">' . $_L['Total_Income'] . ':</h4>
|
||||
<h3 class="sum">' . $config['currency_code'] . ' ' . number_format($xy, 2, $config['dec_point'], $config['thousands_sep']) . '</h3>';
|
||||
run_hook('print_pdf_by_date'); #HOOK
|
||||
define('_MPDF_PATH','system/vendors/mpdf/');
|
||||
|
||||
require('system/vendors/mpdf/mpdf.php');
|
||||
|
||||
$mpdf=new mPDF('c','A4','','',20,15,25,25,10,10);
|
||||
$mpdf = new \Mpdf\Mpdf();
|
||||
$mpdf->SetProtection(array('print'));
|
||||
$mpdf->SetTitle($config['CompanyName'].' Reports');
|
||||
$mpdf->SetTitle($config['CompanyName'] . ' Reports');
|
||||
$mpdf->SetAuthor($config['CompanyName']);
|
||||
$mpdf->SetWatermarkText($d['price']);
|
||||
$mpdf->showWatermarkText = true;
|
||||
@ -164,96 +162,95 @@ $style
|
||||
$html
|
||||
EOF;
|
||||
$mpdf->WriteHTML($nhtml);
|
||||
$mpdf->Output(date('Y-m-d')._raid(4).'.pdf', 'D');
|
||||
|
||||
}else{
|
||||
$mpdf->Output(date('Y-m-d') . _raid(4) . '.pdf', 'D');
|
||||
} else {
|
||||
echo 'No Data';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'print-by-period':
|
||||
$fdate = _post('fdate');
|
||||
$fdate = _post('fdate');
|
||||
$tdate = _post('tdate');
|
||||
$stype = _post('stype');
|
||||
|
||||
$d = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
if ($stype != '') {
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
|
||||
$d->where_gte('recharged_on', $fdate);
|
||||
$d->where_lte('recharged_on', $tdate);
|
||||
$d->order_by_desc('id');
|
||||
$x = $d->find_many();
|
||||
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != '') {
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
|
||||
$dr->where_gte('recharged_on', $fdate);
|
||||
$dr->where_lte('recharged_on', $tdate);
|
||||
$xy = $dr->sum('price');
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
$ui->assign('d',$x);
|
||||
$ui->assign('dr',$xy);
|
||||
$ui->assign('fdate',$fdate);
|
||||
$ui->assign('tdate',$tdate);
|
||||
$ui->assign('stype',$stype);
|
||||
$ui->assign('d', $x);
|
||||
$ui->assign('dr', $xy);
|
||||
$ui->assign('fdate', $fdate);
|
||||
$ui->assign('tdate', $tdate);
|
||||
$ui->assign('stype', $stype);
|
||||
run_hook('print_by_period'); #HOOK
|
||||
$ui->display('print-by-period.tpl');
|
||||
break;
|
||||
|
||||
|
||||
case 'pdf-by-period':
|
||||
$fdate = _post('fdate');
|
||||
$fdate = _post('fdate');
|
||||
$tdate = _post('tdate');
|
||||
$stype = _post('stype');
|
||||
|
||||
$d = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
if ($stype != '') {
|
||||
$d->where('type', $stype);
|
||||
}
|
||||
|
||||
$d->where_gte('recharged_on', $fdate);
|
||||
$d->where_lte('recharged_on', $tdate);
|
||||
$d->order_by_desc('id');
|
||||
$x = $d->find_many();
|
||||
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != ''){
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
$dr = ORM::for_table('tbl_transactions');
|
||||
if ($stype != '') {
|
||||
$dr->where('type', $stype);
|
||||
}
|
||||
|
||||
$dr->where_gte('recharged_on', $fdate);
|
||||
$dr->where_lte('recharged_on', $tdate);
|
||||
$xy = $dr->sum('price');
|
||||
$xy = $dr->sum('price');
|
||||
|
||||
$title = ' Reports ['.$mdate.']';
|
||||
$title = str_replace('-',' ',$title);
|
||||
$title = ' Reports [' . $mdate . ']';
|
||||
$title = str_replace('-', ' ', $title);
|
||||
|
||||
if ($x) {
|
||||
$html = '
|
||||
<div id="page-wrap">
|
||||
<div id="address">
|
||||
<h3>'.$config['CompanyName'].'</h3>
|
||||
'.$config['address'].'<br>
|
||||
'.$_L['Phone_Number'].': '.$config['phone'].'<br>
|
||||
<h3>' . $config['CompanyName'] . '</h3>
|
||||
' . $config['address'] . '<br>
|
||||
' . $_L['Phone_Number'] . ': ' . $config['phone'] . '<br>
|
||||
</div>
|
||||
<div id="logo"><img id="image" src="system/uploads/logo.png" alt="logo" /></div>
|
||||
</div>
|
||||
<div id="header">'.$_L['All_Transactions_at_Date'].': '.date( $config['date_format'], strtotime($fdate)).' - ' .date( $config['date_format'], strtotime($tdate)).'</div>
|
||||
<div id="header">' . $_L['All_Transactions_at_Date'] . ': ' . date($config['date_format'], strtotime($fdate)) . ' - ' . date($config['date_format'], strtotime($tdate)) . '</div>
|
||||
<table id="customers">
|
||||
<tr>
|
||||
<th>'.$_L['Username'].'</th>
|
||||
<th>'.$_L['Plan_Name'].'</th>
|
||||
<th>'.$_L['Type'].'</th>
|
||||
<th>'.$_L['Plan_Price'].'</th>
|
||||
<th>'.$_L['Created_On'].'</th>
|
||||
<th>'.$_L['Expires_On'].'</th>
|
||||
<th>'.$_L['Method'].'</th>
|
||||
<th>'.$_L['Routers'].'</th>
|
||||
<th>' . $_L['Username'] . '</th>
|
||||
<th>' . $_L['Plan_Name'] . '</th>
|
||||
<th>' . $_L['Type'] . '</th>
|
||||
<th>' . $_L['Plan_Price'] . '</th>
|
||||
<th>' . $_L['Created_On'] . '</th>
|
||||
<th>' . $_L['Expires_On'] . '</th>
|
||||
<th>' . $_L['Method'] . '</th>
|
||||
<th>' . $_L['Routers'] . '</th>
|
||||
</tr>';
|
||||
$c = true;
|
||||
foreach ($x as $value) {
|
||||
@ -261,14 +258,14 @@ EOF;
|
||||
$username = $value['username'];
|
||||
$plan_name = $value['plan_name'];
|
||||
$type = $value['type'];
|
||||
$price = $config['currency_code'].' '. number_format($value['price'],0,$config['dec_point'],$config['thousands_sep']);
|
||||
$recharged_on = date( $config['date_format'], strtotime($value['recharged_on']));
|
||||
$expiration = date( $config['date_format'], strtotime($value['expiration']));
|
||||
$time = $value['time'];
|
||||
$method = $value['method'];
|
||||
$routers = $value['routers'];
|
||||
$price = $config['currency_code'] . ' ' . number_format($value['price'], 0, $config['dec_point'], $config['thousands_sep']);
|
||||
$recharged_on = date($config['date_format'], strtotime($value['recharged_on']));
|
||||
$expiration = date($config['date_format'], strtotime($value['expiration']));
|
||||
$time = $value['time'];
|
||||
$method = $value['method'];
|
||||
$routers = $value['routers'];
|
||||
|
||||
$html .= "<tr".(($c = !$c)?' class="alt"':' class=""').">"."
|
||||
$html .= "<tr" . (($c = !$c) ? ' class="alt"' : ' class=""') . ">" . "
|
||||
<td>$username</td>
|
||||
<td>$plan_name</td>
|
||||
<td>$type</td>
|
||||
@ -280,17 +277,17 @@ EOF;
|
||||
</tr>";
|
||||
}
|
||||
$html .= '</table>
|
||||
<h4 class="text-uppercase text-bold">'.$_L['Total_Income'].':</h4>
|
||||
<h3 class="sum">'.$config['currency_code'].' '.number_format($xy,2,$config['dec_point'],$config['thousands_sep']).'</h3>';
|
||||
<h4 class="text-uppercase text-bold">' . $_L['Total_Income'] . ':</h4>
|
||||
<h3 class="sum">' . $config['currency_code'] . ' ' . number_format($xy, 2, $config['dec_point'], $config['thousands_sep']) . '</h3>';
|
||||
|
||||
run_hook('pdf_by_period'); #HOOK
|
||||
define('_MPDF_PATH','system/vendors/mpdf/');
|
||||
define('_MPDF_PATH', 'system/vendors/mpdf/');
|
||||
|
||||
require('system/vendors/mpdf/mpdf.php');
|
||||
|
||||
$mpdf=new mPDF('c','A4','','',20,15,25,25,10,10);
|
||||
$mpdf = new mPDF('c', 'A4', '', '', 20, 15, 25, 25, 10, 10);
|
||||
$mpdf->SetProtection(array('print'));
|
||||
$mpdf->SetTitle($config['CompanyName'].' Reports');
|
||||
$mpdf->SetTitle($config['CompanyName'] . ' Reports');
|
||||
$mpdf->SetAuthor($config['CompanyName']);
|
||||
$mpdf->SetWatermarkText($d['price']);
|
||||
$mpdf->showWatermarkText = true;
|
||||
@ -338,9 +335,8 @@ $style
|
||||
$html
|
||||
EOF;
|
||||
$mpdf->WriteHTML($nhtml);
|
||||
$mpdf->Output(date('Y-m-d')._raid(4).'.pdf', 'D');
|
||||
|
||||
}else{
|
||||
$mpdf->Output(date('Y-m-d') . _raid(4) . '.pdf', 'D');
|
||||
} else {
|
||||
echo 'No Data';
|
||||
}
|
||||
|
||||
@ -348,4 +344,4 @@ EOF;
|
||||
|
||||
default:
|
||||
echo 'action not defined';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user