Files
baodev0 dfb926055d Add feature tests for domain order management
- Implement AdminDomainOrderTest to cover admin functionalities for domain orders including listing, confirming registration, KYC updates, activation, rejection, and refunds.
- Implement ClientDomainOrderTest to cover client functionalities for placing domain orders, including validation for balance, duplicate orders, and domain normalization.
- Ensure proper handling of domain pricing and service statuses throughout the tests.
2026-07-10 14:16:35 +07:00

600 lines
17 KiB
PHP

@php
$companyLogo = $companyLogo ?? setting('setting.logo') ?? '';
$companyName = $companyName ?? 'CÔNG TY CỔ PHẦN GIẢI PHÁP CÔNG NGHỆ THẾ GIỚI SỐ';
$companyAddress = $companyAddress ?? 'Số 128/38 đường Tân Hương, Phường Phú Thọ Hòa, Thành phố Hồ Chí Minh, Việt Nam';
$companyTaxCode = $companyTaxCode ?? '0318443116';
$cfg = array_merge([
'show_logo' => true,
'show_company_info' => true,
'show_customer_info' => true,
'show_items_table' => true,
'show_summary' => true,
'footer_text' => '',
'footer_note' => '',
], $cfg ?? []);
$invoiceDate = $invoice->created_at ?? now();
$taxBase = ($invoice->total ?? 0) - ($invoice->tax ?? 0);
$taxRate = ($taxBase > 0 && ($invoice->tax ?? 0) > 0) ? round($invoice->tax / $taxBase * 100) : 0;
@endphp
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<title>Hóa đơn #{{ $invoice->invoice_number }}</title>
<style>
@font-face {
font-family: "SVN Times New Roman";
font-style: normal;
font-weight: 400;
src: url("{{ public_path('fonts/time-new-roman/SVN-Times-New-Roman.ttf') }}")
format("truetype");
}
@font-face {
font-family: "SVN Times New Roman";
font-style: normal;
font-weight: 700;
src: url("{{ public_path('fonts/time-new-roman/SVN-Times-New-Roman-Bold.ttf') }}")
format("truetype");
}
@font-face {
font-family: "SVN Times New Roman";
font-style: italic;
font-weight: 400;
src: url("{{ public_path('fonts/time-new-roman/SVN-Times-New-Roman-Italic.ttf') }}")
format("truetype");
}
@font-face {
font-family: "SVN Times New Roman";
font-style: italic;
font-weight: 700;
src: url("{{ public_path('fonts/time-new-roman/SVN-Times-New-Roman-Bold-Italic.ttf') }}")
format("truetype");
}
@page {
size: A4 portrait;
margin: 10mm;
}
* {
box-sizing: border-box;
font-family: "SVN Times New Roman", "DejaVu Serif", serif;
}
html,
body {
margin: 0;
padding: 0;
}
body {
color: #111;
font-family: "SVN Times New Roman", "DejaVu Serif", serif;
font-size: 10px;
font-weight: 400;
line-height: 1.45;
padding: 20px;
}
strong,
b,
th,
.bold {
font-family: "SVN Times New Roman", "DejaVu Serif", serif;
font-weight: 700;
}
em,
i,
.italic {
font-family: "SVN Times New Roman", "DejaVu Serif", serif;
font-style: italic;
font-weight: 400;
}
strong em,
strong i,
b em,
b i,
.bold.italic {
font-family: "SVN Times New Roman", "DejaVu Serif", serif;
font-style: italic;
font-weight: 700;
}
.invoice {
min-height: 277mm;
padding: 3mm;
border: 1px solid #efefe;
}
.header-table,
.info-table,
.product-table,
.signature-table {
width: 100%;
border-collapse: collapse;
}
.header-table td {
vertical-align: top;
}
.logo {
width: 145px;
}
.invoice-title {
text-align: center;
}
.invoice-title h1 {
margin: 0;
font-size: 21px;
font-weight: 700;
text-transform: uppercase;
}
.invoice-title h2 {
margin: 2px 0;
font-size: 15px;
font-style: italic;
font-weight: 700;
}
.invoice-title p {
margin: 3px 0;
}
.invoice-number {
width: 190px;
padding-left: 15px;
font-size: 11px;
}
.invoice-number p {
margin: 3px 0;
}
.divider {
margin: 7px 0;
border: 0;
border-top: 1px solid #bbb;
}
.company-name {
margin: 0 0 3px;
font-size: 16px;
font-weight: 700;
text-transform: uppercase;
}
.info-row {
margin: 4px 0;
}
.seller-section {
position: relative;
min-height: 120px;
padding-right: 120px;
}
.qr-code {
position: absolute;
top: 8px;
right: 15px;
width: 90px;
height: 90px;
border: 1px solid #555;
text-align: center;
line-height: 90px;
}
.bank-table {
width: 100%;
margin: 4px 0;
border-collapse: collapse;
}
.bank-table td {
padding: 0;
vertical-align: top;
}
.bank-table-label {
width: 155px;
}
.product-table {
margin-top: 6px;
table-layout: auto;
}
.product-table th,
.product-table td {
border: 1px solid #777;
}
.product-table th {
padding: 4px;
height: 48px;
text-align: center;
vertical-align: middle;
font-weight: 700;
}
.product-table tbody td {
padding: 1px 2px;
height: auto;
line-height: 1.2;
}
.product-table th:first-child,
.product-table td:first-child {
width: 8mm;
padding-left: 1px;
padding-right: 1px;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.italic {
font-style: italic;
}
.bold {
font-weight: 700;
}
.summary-label {
text-align: right;
}
.amount-words {
padding: 5px !important;
}
.signature-table {
margin-top: 12px;
}
.signature-table td {
width: 50%;
height: 130px;
text-align: center;
vertical-align: top;
}
.signature-title {
font-size: 12px;
font-weight: 700;
}
.signature-box {
width: 260px;
margin: 35px auto 0;
padding: 8px;
color: red;
border: 1px solid #65a765;
background: #eef8ee;
text-align: left;
font-weight: 700;
line-height: 1.8;
}
.footer {
text-align: center;
font-size: 9px;
}
.footer p {
margin: 3px 0;
}
.product-table-wrapper {
position: relative;
margin-top: 6px;
}
.product-table-watermark {
position: absolute;
top: 0;
left: 50%;
width: 430px;
height: auto;
opacity: 0.3;
margin-left: -215px;
z-index: 0;
}
.product-table {
position: relative;
z-index: 1;
width: 100%;
margin-top: 0;
table-layout: auto;
border-collapse: collapse;
}
.product-table th,
.product-table td {
background: transparent;
}
</style>
</head>
<body>
<div class="invoice">
<table class="header-table">
<tr>
<td style="width: 25%">
@if(($cfg['show_logo'] ?? true) && $companyLogo)
<img src="{{ $companyLogo }}" alt="{{ $companyName }}" style="width: 80%; height: auto;">
@else
<img src="{{ public_path('images/image.png') }}" alt="{{ $companyName }}" style="width: 80%; height: auto;">
@endif
</td>
<td class="invoice-title">
<h1>HÓA ĐƠN GIÁ TRỊ GIA TĂNG</h1>
<h2>(VAT INVOICE)</h2>
<p>
Ngày <span class="italic">(Date)</span> {{ $invoiceDate?->format('d') ?? '' }}
tháng <span class="italic">(month)</span> {{ $invoiceDate?->format('m') ?? '' }}
năm <span class="italic">(year)</span> {{ $invoiceDate?->format('Y') ?? '' }}
</p>
<p>
Mã CQT <span class="italic">(Code)</span>:
</p>
</td>
<td class="invoice-number">
<p>
Ký hiệu <span class="italic">(Serial)</span>:
<strong>1C26TCP</strong>
</p>
<p>
Số <span class="italic">(No.)</span>:
<strong>{{ $invoice->invoice_number ?? '<Chưa cấp số>' }}</strong>
</p>
</td>
</tr>
</table>
<hr class="divider">
<div class="seller-section">
<h3 class="company-name">
{{ $companyName }}
</h3>
<div class="info-row">
Mã số thuế <span class="italic">(Tax code)</span>: {{ $companyTaxCode }}
</div>
<div class="info-row">
Địa chỉ <span class="italic">(Address)</span>:
{{ $companyAddress }}
</div>
<div class="info-row">
Tên cửa hàng <span class="italic">(Shop name)</span>:
</div>
<table class="bank-table">
<tr>
<td class="bank-table-label">
Số tài khoản <span class="italic">(Bank account)</span>:
</td>
<td>
7379868 Ngân hàng TMCP Á Châu (ACB) Chi nhánh TP. Hồ Chí Minh
</td>
</tr>
<tr>
<td class="bank-table-label"></td>
<td>
797379868 Ngân hàng TMCP Quân Đội (MB) Chi nhánh Phú Nhuận
</td>
</tr>
</table>
<div class="qr-code">
<img src="{{ public_path('images/qr-code-tgs.jpg') }}" alt="QR Code" style="width: 100%; height: auto;">
</div>
</div>
<hr class="divider">
<div class="buyer-section">
<div class="info-row">
Họ tên người mua hàng <span class="italic">(Buyer)</span>:
{{ $customer?->fullname ?? '' }}
</div>
<div class="info-row">
Tên đơn vị <span class="italic">(Company's name)</span>:
{{ $customer?->company ?? '' }}
</div>
<div class="info-row">
Mã số thuế <span class="italic">(Tax code)</span>: {{ $customer?->identity_number ?? '' }}
</div>
<div class="info-row">
Địa chỉ <span class="italic">(Address)</span>:
{{ $customer?->address ?? '' }}
</div>
<div class="info-row">
Hình thức thanh toán <span class="italic">(Payment method)</span>:
{{ $invoice->payment_method ? strtoupper($invoice->payment_method) : 'TM/CK' }}
</div>
</div>
<div class="product-table-wrapper">
<img src="{{ public_path('images/image.png') }}" alt="Watermark" class="product-table-watermark">
<table class="product-table">
<colgroup>
<col style="width: 8mm">
<col>
<col style="width: 13%">
<col style="width: 10%">
<col style="width: 14%">
<col style="width: 16%">
</colgroup>
<thead>
<tr>
<th>STT<br><span class="italic">(No)</span></th>
<th>
Tên hàng hóa, dịch vụ<br>
<span class="italic">(Name of goods and services)</span>
</th>
<th>Đơn vị tính<br><span class="italic">(Unit)</span></th>
<th>Số lượng<br><span class="italic">(Quantity)</span></th>
<th>Đơn giá<br><span class="italic">(Unit price)</span></th>
<th>Thành tiền<br><span class="italic">(Amount)</span></th>
</tr>
</thead>
<tbody>
@foreach($invoiceItems as $i => $item)
<tr>
<td class="text-center">{{ $i + 1 }}</td>
<td>{{ $item->description ?? ($item->product?->name ?? 'Dịch vụ') }}</td>
<td class="text-center">{{ ($item->months && $item->months > 0) ? 'Tháng' : 'Lần' }}</td>
<td class="text-right">{{ number_format($item->quantity ?? 1, 2, ',', '.') }}</td>
<td class="text-right">{{ number_format($item->unit_price, 0, ',', '.') }}</td>
<td class="text-right">{{ number_format($item->total_price, 0, ',', '.') }}</td>
</tr>
@endforeach
@if($cfg['show_summary'] ?? true)
<tr>
<td colspan="5" class="summary-label">
Cộng tiền hàng <span class="italic">(Total amount excl. VAT)</span>:
</td>
<td class="text-right bold">{{ number_format($invoice->sub_total, 0, ',', '.') }}</td>
</tr>
@if($invoice->discount_amount > 0)
<tr>
<td colspan="5" class="summary-label">
Giảm giá <span class="italic">(Discount)</span>:
</td>
<td class="text-right bold">-{{ number_format($invoice->discount_amount, 0, ',', '.') }}</td>
</tr>
@endif
<tr>
<td colspan="2">
Thuế suất GTGT <span class="italic">(VAT rate)</span>:
</td>
<td class="text-center bold">{{ $taxRate > 0 ? $taxRate . '%' : 'Không áp dụng' }}</td>
<td colspan="2" class="summary-label">
Tiền thuế GTGT <span class="italic">(VAT amount)</span>:
</td>
<td class="text-right bold">{{ number_format($invoice->tax, 0, ',', '.') }}</td>
</tr>
<tr>
<td colspan="5" class="summary-label">
Tổng tiền thanh toán <span class="italic">(Total amount)</span>:
</td>
<td class="text-right bold">{{ number_format($invoice->total, 0, ',', '.') }}</td>
</tr>
@endif
<tr>
<td colspan="6" class="amount-words">
Số tiền viết bằng chữ
<span class="italic">(Total amount in words)</span>:
<strong><em>{{ \App\Helpers\NumberToWords::convert((int) $invoice->total) }}.</em></strong>
</td>
</tr>
</tbody>
</table>
</div>
<table class="signature-table">
<tr>
<td>
<div class="signature-title">
Người mua hàng <span class="italic">(Buyer)</span>
</div>
<div class="italic">
(Chữ ký số nếu có)<br>
(Digital signature if any)
</div>
<div style="margin-top: 65px;">
{{ $customer?->fullname ?? '' }}
</div>
</td>
<td>
<div class="signature-title">
Người bán hàng <span class="italic">(Seller)</span>
</div>
<div class="italic">
(Chữ ký điện tử, Chữ ký số)<br>
(E-signature, Digital signature)
</div>
<div class="signature-box">
Signature Valid<br>
<em>Ký bởi (Signed By): {{ $companyName }}</em><br>
<em>Ký ngày (Signing Date):</em>
</div>
</td>
</tr>
</table>
<div class="footer">
<p>
Tra cứu tại Website <span class="italic">(Search in website)</span>:
<u>https://www.portal.tgs.com.vn/tra-cuu</u>
</p>
<p>
Mã tra cứu: <strong>{{ $invoice->invoice_number }}</strong>
</p>
@if($cfg['footer_text'] ?? '')
<p>{{ $cfg['footer_text'] }}</p>
@endif
@if($cfg['footer_note'] ?? '')
<p>{{ $cfg['footer_note'] }}</p>
@endif
<p>
(Cần kiểm tra, đối chiếu khi lập, giao, nhận hóa đơn)
</p>
<p>
Phát hành bởi phần mềm Thế Giới Số Invoice
</p>
</div>
</div>
</body>
</html>