This commit is contained in:
baodev0
2026-10-08 11:25:28 +07:00
parent 1544629a1f
commit 8651dde6b1
45 changed files with 1543 additions and 357 deletions
+7 -2
View File
@@ -5,6 +5,8 @@ namespace App\Services;
use App\Models\Customer;
use App\Models\Invoice;
use App\Services\Email\EmailTemplateService;
use App\Support\AutoEmailGate;
use App\Support\EmailTemplateShell;
use Carbon\Carbon;
/**
@@ -79,6 +81,10 @@ class InvoiceReminderService
return false;
}
if (! $force && AutoEmailGate::blocks(self::SCENARIO)) {
return false;
}
$customer = $invoice->customer;
if (! $customer?->email) {
return false;
@@ -108,8 +114,7 @@ class InvoiceReminderService
? 'Hoá đơn đã quá hạn ' . $daysLate . ' ngày.'
: ($daysLate === 0 ? 'Hôm nay là hạn thanh toán của hoá đơn này.' : 'Hoá đơn sẽ đến hạn sau ' . abs($daysLate) . ' ngày.'),
'paid_row' => (int) ($invoice->amount_paid ?? 0) > 0
? '<tr><td style="padding: 7px 11px; border-right: 1px solid #e8e8e8;">Đã thanh toán:</td><td style="padding: 7px 11px;"><strong>'
. number_format((int) $invoice->amount_paid, 0, ',', '.') . ' VNĐ</strong></td></tr>'
? EmailTemplateShell::row('Đã thanh toán', number_format((int) $invoice->amount_paid, 0, ',', '.') . ' VNĐ')
: '',
'login_url' => rtrim((string) config('app.frontend_url', ''), '/') . '/dang-nhap',
'support_email' => 'support@tgs.com.vn',