=== XeVN Loan Schedule Calculator ===
Contributors: kianguyen
Donate link: https://xeisuzuvn.com/donate/
Tags: loan calculator, mortgage, repayment schedule, amortization, vietnam
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Loan repayment schedule calculator using the declining balance method, with a promotional interest period and Excel export.

== Description ==

XeVN Loan Schedule Calculator adds a responsive loan repayment calculator to any page via a shortcode. It uses the **declining balance method** common at Vietnamese banks: the principal is repaid in equal monthly amounts and interest is charged on the remaining balance.

**Features**

* Equal monthly principal, interest on the declining balance
* Two interest rates: a promotional rate for the first N months, then a normal rate
* Summary: loan amount, monthly principal, total interest, total cost
* Full month-by-month schedule, promotional months highlighted
* Export the schedule to Excel (.xlsx)
* Default values, title, currency label, color and disclaimer configurable in Settings → Loan Calculator
* Multiple calculators on the same page, each with its own defaults
* All calculations run in the browser — works with page caching plugins
* Display language switch: site default, Vietnamese or English (built-in Vietnamese)
* Translation ready (translations via translate.wordpress.org)

**Tiếng Việt:** Công cụ tính lịch trả nợ theo phương thức dư nợ giảm dần (gốc trả đều, lãi tính trên dư nợ còn lại), hỗ trợ lãi suất ưu đãi giai đoạn đầu và xuất file Excel. Chèn vào trang bằng shortcode `[xevn_loan_calculator]`. Muốn hiển thị tiếng Việt: vào Settings → Loan Calculator, chọn "Display language" là Tiếng Việt, hoặc dùng `[xevn_loan_calculator lang="vi"]`.

The plugin is completely free. If it is useful to you, please consider [making a donation](https://xeisuzuvn.com/donate/).

**Third-party library**

The Excel export uses [ExcelJS](https://github.com/exceljs/exceljs) 4.4.0 (MIT license), bundled in `assets/vendor/`. It is only loaded when a visitor clicks the export button. The plugin does not contact any external service.

== Installation ==

1. Install the plugin from Plugins → Add New, or upload the `xevn-loan-schedule-calculator` folder to `/wp-content/plugins/`.
2. Activate the plugin.
3. (Optional) Set default values in Settings → Loan Calculator.
4. Add the shortcode `[xevn_loan_calculator]` to any page or post.

== Frequently Asked Questions ==

= Can I set different default values per page? =

Yes. Use shortcode attributes, for example:
`[xevn_loan_calculator price="650000000" down="20" term="84" promo_rate="7.5" promo_months="12" rate="10.5" title="Car loan calculator"]`

= How do I show the calculator in Vietnamese? =

Go to Settings → Loan Calculator and set "Display language" to Vietnamese, or add `lang="vi"` to the shortcode: `[xevn_loan_calculator lang="vi"]`. Use `lang="en"` to force English. With "Site default", community translations from translate.wordpress.org are used when available.

= Which calculation method is used? =

Declining balance: monthly principal = loan amount / number of months; monthly interest = opening balance × (yearly rate / 12). Interest is rounded to the nearest unit; the last month pays off the remaining balance.

= Are the results accurate? =

Results are estimates for reference. Actual figures depend on each lender's policy (day count, disbursement date, fees).

= Does the plugin add links to my site? =

No. A small "Powered by" link is shown only if you enable it in the settings (off by default).

== Screenshots ==

1. Calculator form
2. Summary and repayment schedule
3. Settings page

== Changelog ==

= 1.2.0 =
* New: display language option (Site default / Vietnamese / English) and `lang` shortcode attribute.
* Each calculator on a page can use its own language.
* Fix: button hover color now follows the configured primary color.

= 1.1.1 =
* Removed bundled translation files; translations are delivered by translate.wordpress.org.

= 1.1.0 =
* Renamed to XeVN Loan Schedule Calculator, new shortcode `[xevn_loan_calculator]`.
* Settings page for defaults, currency, color and disclaimer.
* Shortcode attributes for per-page defaults.
* Calculations moved to the browser (no AJAX, cache-friendly).
* ExcelJS bundled locally instead of loading from a CDN.
* Translation ready (translations via translate.wordpress.org).

= 1.0.3 =
* Initial private release.

== Upgrade Notice ==

= 1.2.0 =
Adds a Vietnamese / English display language option.

= 1.1.1 =
Maintenance release.

= 1.1.0 =
The shortcode changed to `[xevn_loan_calculator]`. Update your pages after upgrading.
