diff --git a/system/autoload/Invoice.php b/system/autoload/Invoice.php index 542c9a53..423a626e 100644 --- a/system/autoload/Invoice.php +++ b/system/autoload/Invoice.php @@ -11,13 +11,7 @@ class Invoice throw new Exception("Invoice ID is required"); } - $templatePath = 'pages/Custom_Invoice.html'; - if (!file_exists($templatePath)) { - $templatePath = 'pages/Default_Invoice.html'; - } - - $template = file_get_contents($templatePath); - + $template = Lang::getNotifText('email_invoice'); if (!$template) { throw new Exception("Invoice template not found"); } @@ -94,7 +88,7 @@ class Invoice }, $template); } - public static function sendInvoice($userId, $status = "Unpaid") + public static function sendInvoice($userId, $package, $status = "Unpaid") { global $config; @@ -148,8 +142,21 @@ class Invoice $tax = $config['enable_tax'] ? Package::tax($subtotal) : 0; $total = ($tax > 0) ? $subtotal + $tax : $subtotal + $tax; + $token = User::generateToken($account['id'], 1); + if (!empty($token['token'])) { + $tur = ORM::for_table('tbl_user_recharges') + ->where('customer_id', $account['id']) + ->where('namebp', $package) + ->find_one(); + if ($tur) { + $payLink = '?_route=home&recharge=' . $tur['id'] . '&uid=' . urlencode($token['token']); + } + } else { + $payLink = '?_route=home'; + } + $invoiceData = [ - 'id' => "INV-" . Package::_raid(), + 'invoice' => "INV-" . Package::_raid(), 'fullname' => $account->fullname, 'email' => $account->email, 'address' => $account->address, @@ -163,6 +170,8 @@ class Invoice 'company_name' => $config['CompanyName'], 'company_phone' => $config['phone'], 'logo' => $config['logo'], + 'company_url' => APP_URL, + 'payment_link' => $payLink, ]; if (!isset($invoiceData['bill_rows']) || empty($invoiceData['bill_rows'])) { diff --git a/system/uploads/notifications.default.json b/system/uploads/notifications.default.json index fe557aff..45fd9acb 100644 --- a/system/uploads/notifications.default.json +++ b/system/uploads/notifications.default.json @@ -6,6 +6,7 @@ "reminder_3_day": "Hello *[[name]]*, \r\nyour internet package *[[package]]* will be expired in 3 days.", "reminder_1_day": "Hello *[[name]]*,\r\n your internet package *[[package]]* will be expired tomorrow.", "invoice_paid": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\nUsername : *[[user_name]]*\r\nPassword : ***********\r\n\r\nExpired : *[[expired_date]]*\r\n\r\n====================\r\n[[footer]]", + "email_invoice": "\r\n\r\n\r\n\r\n \r\n Invoice No: [[id]]\r\n\r\n \r\n\r\n\r\n\r\n
\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n\r\n [[bill_rows]]\r\n
\r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n \r\n \r\n Invoice #: [[invoice]]
\r\n Created: [[created_at]]
\r\n Due: [[due_date]]\r\n
\r\n
\r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n [[company_name]]
\r\n [[company_address]]
\r\n [[company_phone]]
\r\n
\r\n [[fullname]]
\r\n [[address]]
\r\n [[email]]
\r\n [[phone]]
\r\n
\r\n
\r\n\r\n
\r\n

Payment Options:

\r\n

Online Portal: pay.phpnuxbill.com
\r\n Bank Transfer: Account # 1234-567890
\r\n Auto Pay: Enabled (Next payment: 2023-11-12)

\r\n
\r\n\r\n \r\n

Thank you for choosing [[company_name]]!
\r\n Late payments may result in service interruption
\r\n Need help? Contact support@[[company_name]].com or call [[company_phone]]

\r\n \r\n
\r\n\r\n\r\n", "invoice_balance": "*[[company_name]]*\r\n[[address]]\r\n[[phone]]\r\n\r\n\r\nINVOICE: *[[invoice]]*\r\nDate : [[date]]\r\n[[payment_gateway]] [[payment_channel]]\r\n\r\n\r\nType : *[[type]]*\r\nPackage : *[[plan_name]]*\r\nPrice : *[[plan_price]]*\r\n\r\n====================\r\n[[footer]]", "welcome_message": "Welcome aboard, [[name]]! \r\nWe're excited to have you as a new [[company]] customer. \r\nYour account is all set up and ready to go.\r\n\r\nHere's a quick overview:\r\n\r\nPortal: [[url]]\r\nYour login is [[Username]]\r\nYour temporary password is [[Password]] (please change this on your first login)\r\n\r\nNeed help? Reach out to our support team at anytime.\r\n\r\nWe're here to ensure you have an amazing experience with our services. Let us know how we can best support you.\r\n\r\nWelcome to the [[company]] family!" diff --git a/ui/ui/admin/settings/notifications.tpl b/ui/ui/admin/settings/notifications.tpl index 03315b94..408ec2fd 100644 --- a/ui/ui/admin/settings/notifications.tpl +++ b/ui/ui/admin/settings/notifications.tpl @@ -162,43 +162,80 @@ {if $_c['enable_balance'] == 'yes'} -
-
- -
- -
-

- [[name]] - {Lang::T('Receiver name')}.
- [[balance]] - {Lang::T('how much balance have been send')}.
- [[current_balance]] - {Lang::T('Current Balance')}. -

+
+
+ +
+
+

+ [[name]] - {Lang::T('Receiver name')}.
+ [[balance]] - {Lang::T('how much balance have been send')}.
+ [[current_balance]] - {Lang::T('Current Balance')}. +

-
-
- -
- -
-

- [[name]] - {Lang::T('Sender name')}.
- [[balance]] - {Lang::T('how much balance have been received')}.
- [[current_balance]] - {Lang::T('Current Balance')}. -

+
+
+
+ +
+
+

+ [[name]] - {Lang::T('Sender name')}.
+ [[balance]] - {Lang::T('how much balance have been received')}.
+ [[current_balance]] - {Lang::T('Current Balance')}. +

+
{/if} -
+ {*
+
+ +
+ +
+

+ [[company_name]] {Lang::T('Your Company Name at Settings')}.
+ [[company_address]] {Lang::T('Your Company Address at Settings')}.
+ [[company_phone]] - {Lang::T('Your Company Phone at Settings')}.
+ [[company_url]] - {Lang::T('Your APP_URL at Settings')}.
+ [[invoice]] - {Lang::T('Invoice number')}.
+ [[created_at]] - {Lang::T('Date invoice created')}.
+ [[payment_gateway]] - {Lang::T('Payment gateway user paid from')}.
+ [[payment_channel]] - {Lang::T('Payment channel user paid from')}.
+ [[bill_rows]] - {Lang::T('Bills table, where bills are listed')}.
+ [[currency]] - {Lang::T('Your currency code at localisation Settings')}.
+ [[status]] - {Lang::T('Invoice status')}.
+ [[fullname]] - {Lang::T('Receiver name')}.
+ [[user_name]] - {Lang::T('Username internet')}.
+ [[email]] - {Lang::T('Customer email')} .
+ [[phone]] - {Lang::T('Customer phone')}.
+ [[address]] - {Lang::T('Customer phone')}.
+ [[expired_date]] - {Lang::T('Expired datetime')}.
+ [[logo]] - {Lang::T('Your company logo at Settings')}.
+ [[due_date]] - {Lang::T('Invoice Due date, 7 Days after invoice created')}.
+ [[payment_link]] - {Lang::T("read documentation")}. +

+
+
*} -
-
- +
+
+ +
-
-{include file="sections/footer.tpl"} +{include file="sections/footer.tpl"} \ No newline at end of file