Fix PDF export and logo

This commit is contained in:
Ibnu Maksum 2023-08-14 09:25:29 +07:00
parent e3b736e222
commit 759331105d
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
5 changed files with 18 additions and 10 deletions

5
.gitignore vendored
View File

@ -19,4 +19,7 @@ system/plugin/ui/*
!system/plugin/ui/index.html
ui/ui_custom/**
!ui/ui_custom/index.html
!ui/ui_custom/README.md
!ui/ui_custom/README.md
system/uploads/admin.png
system/uploads/logo.png
system/uploads/user.jpg

View File

@ -61,6 +61,12 @@ switch ($action) {
$title = ' Reports [' . $mdate . ']';
$title = str_replace('-', ' ', $title);
if(file_exists('system/uploads/logo.png')){
$logo = 'system/uploads/logo.png';
}else{
$logo = 'system/uploads/logo.default.png';
}
if ($x) {
$html = '
<div id="page-wrap">
@ -69,7 +75,7 @@ switch ($action) {
' . $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 id="logo"><img id="image" src="'.$logo.'" alt="logo" /></div>
</div>
<div id="header">' . $_L['All_Transactions_at_Date'] . ': ' . date($config['date_format'], strtotime($mdate)) . '</div>
<table id="customers">
@ -178,7 +184,6 @@ EOF;
if ($stype != '') {
$d->where('type', $stype);
}
$d->where_gte('recharged_on', $fdate);
$d->where_lte('recharged_on', $tdate);
$d->order_by_desc('id');
@ -207,7 +212,6 @@ EOF;
$fdate = _post('fdate');
$tdate = _post('tdate');
$stype = _post('stype');
$d = ORM::for_table('tbl_transactions');
if ($stype != '') {
$d->where('type', $stype);
@ -229,6 +233,11 @@ EOF;
$title = ' Reports [' . $mdate . ']';
$title = str_replace('-', ' ', $title);
if(file_exists('system/uploads/logo.png')){
$logo = 'system/uploads/logo.png';
}else{
$logo = 'system/uploads/logo.default.png';
}
if ($x) {
$html = '
@ -238,7 +247,7 @@ EOF;
' . $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 id="logo"><img id="image" src="'.$logo.'" 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>
<table id="customers">
@ -281,11 +290,7 @@ EOF;
<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/');
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->SetAuthor($config['CompanyName']);

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB