Fix Invoice Print

This commit is contained in:
Ibnu Maksum 2024-10-07 14:49:43 +07:00
parent 277ab87645
commit 9016ecbb98
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 107 additions and 79 deletions

View File

@ -228,11 +228,13 @@ switch ($action) {
$ui->assign('content', $content);
} else {
$id = _post('id');
if(empty($id)) {
$id = $routes['2'];
}
$d = ORM::for_table('tbl_transactions')->where('id', $id)->find_one();
$ui->assign('in', $d);
$ui->assign('date', Lang::dateAndTimeFormat($d['recharged_on'], $d['recharged_time']));
}
run_hook('print_invoice'); #HOOK
$ui->display('invoice-print.tpl');
break;

View File

@ -16,7 +16,8 @@
.invoice {
width: 100%;
max-width: 70mm; /* Maximum width for thermal printing */
max-width: 70mm;
/* Maximum width for thermal printing */
background: white;
border-radius: 8px;
padding: 10px;
@ -43,8 +44,10 @@
.details div {
margin: 5px 0;
font-weight: bold; /* Bold text for details */
color: black; /* Ensure text is black */
font-weight: bold;
/* Bold text for details */
color: black;
/* Ensure text is black */
}
.invoice-info {
@ -57,8 +60,10 @@
.invoice-info td {
padding: 5px;
text-align: left;
color: black; /* Ensure text is black */
font-weight: bold; /* Bold text for table content */
color: black;
/* Ensure text is black */
font-weight: bold;
/* Bold text for table content */
}
.invoice-info th {
@ -68,7 +73,8 @@
.footer {
margin-top: 10px;
text-align: left; /* Align footer text to left */
text-align: left;
/* Align footer text to left */
}
@media print {
@ -79,10 +85,14 @@
}
.invoice {
width: 70mm; /* Fixed width for thermal printer */
padding: 5px; /* Reduced padding for print */
box-shadow: none; /* Remove shadow for clearer print */
border: none; /* Remove border for print */
width: 70mm;
/* Fixed width for thermal printer */
padding: 5px;
/* Reduced padding for print */
box-shadow: none;
/* Remove shadow for clearer print */
border: none;
/* Remove border for print */
}
.details {
@ -96,19 +106,25 @@
.invoice-info th,
.invoice-info td {
padding: 5px; /* Reduced padding */
padding: 5px;
/* Reduced padding */
text-align: left;
font-weight: bold; /* Bold text for print */
color: black; /* Ensure text is black */
border: none; /* Remove borders for print */
font-weight: bold;
/* Bold text for print */
color: black;
/* Ensure text is black */
border: none;
/* Remove borders for print */
}
hr {
border: 1px solid #000; /* Darker line for print */
border: 1px solid #000;
/* Darker line for print */
}
.btn {
display: none; /* Hide buttons when printing */
display: none;
/* Hide buttons when printing */
}
}
</style>
@ -122,6 +138,9 @@
<body {if !$nuxprint} onload="printpage()" {/if}>
<div class="container">
<div class="invoice">
{if $content}
<pre style="border-style: none; background-color: white;">{$content}</pre>
{else}
<div class="header">
<h1>{Lang::pad($_c['CompanyName'], ' ', 2)}</h1>
<p>{Lang::pad($_c['address'], ' ', 2)} | {Lang::pad($_c['phone'], ' ', 2)}</p>
@ -129,7 +148,8 @@
<div class="details">
<div><strong>{Lang::pad(Lang::T('Invoice'), ' ', 2)}:</strong> {$in['invoice']}</div>
<div><strong>{Lang::pad(Lang::T('Date'), ' ', 2)}:</strong> {$date}</div>
<div><strong>{Lang::pad(Lang::T('Sales'), ' ', 2)}:</strong> {Lang::pad($_admin['fullname'], ' ', 2)}</div>
<div><strong>{Lang::pad(Lang::T('Sales'), ' ', 2)}:</strong> {Lang::pad($_admin['fullname'], ' ', 2)}
</div>
</div>
<table class="invoice-info">
@ -179,6 +199,7 @@
</a>
{/if}
</div>
{/if}
</div>
</div>

View File

@ -16,8 +16,13 @@
<i class="glyphicon glyphicon-share"></i> WhatsApp</a>
<a href="{$_url}plan/view/{$in['id']}/send" class="btn btn-info text-black btn-sm"><i
class="glyphicon glyphicon-envelope"></i> {Lang::T("Resend")}</a>
<button type="submit" class="btn btn-info text-black btn-sm"><i class="glyphicon glyphicon-print"></i>
{Lang::T('Print')}</button>
<hr>
<a href="{$_url}plan/print/{$in['id']}" target="_print" class="btn btn-info text-black btn-sm"><i
class="glyphicon glyphicon-print"></i>
{Lang::T('Print')} HTML</a>
<button type="submit" class="btn btn-info text-black btn-sm"><i
class="glyphicon glyphicon-print"></i>
{Lang::T('Print')} Text</button>
<a href="nux://print?text={urlencode($invoice)}"
class="btn btn-success text-black btn-sm hidden-md hidden-lg">
<i class="glyphicon glyphicon-phone"></i>