feat: Withholding Tax Certificate button on Purchase Invoice
Shown while Apply Tax Withholding Amount is ticked on a saved, not cancelled invoice; downloads the certificate PDF in Thai.
This commit is contained in:
@@ -20,6 +20,17 @@ file overrides the upstream Thai for the standard labels the print formats show.
|
|||||||
print formats embed Sarabun (`public/fonts`, OFL) so PDFs render Thai on servers
|
print formats embed Sarabun (`public/fonts`, OFL) so PDFs render Thai on servers
|
||||||
without a Thai system font. Switch a user or the print language to `th` to use it.
|
without a Thai system font. Switch a user or the print language to `th` to use it.
|
||||||
|
|
||||||
|
### Withholding tax certificate
|
||||||
|
|
||||||
|
A Purchase Invoice with *Apply Tax Withholding Amount* gets a **Withholding Tax Certificate**
|
||||||
|
button that downloads the Revenue Department's Sec. 50 bis form (หนังสือรับรองการหักภาษี ณ ที่จ่าย,
|
||||||
|
two copies) as a PDF: the *Withholding Tax Certificate* print format lays the invoice's data
|
||||||
|
over the official form (`public/images`). The row the payment is reported on comes from
|
||||||
|
*Type of Income Paid* on the Tax Withholding Category (set for the shipped categories; pick it
|
||||||
|
for your own), and the ภ.ง.ด. return is ticked from the Supplier's type: ภ.ง.ด.53 for juristic
|
||||||
|
payees, ภ.ง.ด.1ก / 2 / 3 by income type for individuals. เล่มที่ / เลขที่ (certificate book
|
||||||
|
numbers) and ลำดับที่ (the line in the return) are left for the accountant.
|
||||||
|
|
||||||
### Contributing
|
### Contributing
|
||||||
|
|
||||||
This app uses `pre-commit` for code formatting and linting. Please [install pre-commit](https://pre-commit.com/#installation) and enable it for this repository:
|
This app uses `pre-commit` for code formatting and linting. Please [install pre-commit](https://pre-commit.com/#installation) and enable it for this repository:
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ required_apps = ["erpnext"]
|
|||||||
# page_js = {"page" : "public/js/file.js"}
|
# page_js = {"page" : "public/js/file.js"}
|
||||||
|
|
||||||
# include js in doctype views
|
# include js in doctype views
|
||||||
doctype_js = {"Payment Entry": "public/js/payment_entry.js"}
|
doctype_js = {
|
||||||
|
"Payment Entry": "public/js/payment_entry.js",
|
||||||
|
"Purchase Invoice": "public/js/purchase_invoice.js",
|
||||||
|
}
|
||||||
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
|
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
|
||||||
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
|
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
|
||||||
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
|
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
frappe.ui.form.on("Purchase Invoice", {
|
||||||
|
refresh(frm) {
|
||||||
|
frm.events.toggle_withholding_certificate(frm);
|
||||||
|
},
|
||||||
|
|
||||||
|
apply_tds(frm) {
|
||||||
|
frm.events.toggle_withholding_certificate(frm);
|
||||||
|
},
|
||||||
|
|
||||||
|
toggle_withholding_certificate(frm) {
|
||||||
|
const label = __("Withholding Tax Certificate");
|
||||||
|
frm.remove_custom_button(label);
|
||||||
|
if (!frm.doc.apply_tds || frm.is_new() || frm.doc.docstatus === 2) return;
|
||||||
|
// The Withholding Tax Certificate print format renders the Revenue Department's
|
||||||
|
// Sec. 50 bis form (fixtures/print_format.json) as a PDF.
|
||||||
|
frm.add_custom_button(label, () => {
|
||||||
|
if (frm.is_dirty()) {
|
||||||
|
frappe.msgprint(__("Please save the document before generating the certificate."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
doctype: frm.doctype,
|
||||||
|
name: frm.docname,
|
||||||
|
format: "Withholding Tax Certificate",
|
||||||
|
no_letterhead: 1,
|
||||||
|
_lang: "th",
|
||||||
|
});
|
||||||
|
const w = window.open(
|
||||||
|
frappe.urllib.get_full_url(
|
||||||
|
`/api/method/frappe.utils.print_format.download_pdf?${params}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (!w) frappe.msgprint(__("Please enable pop-ups"));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -60,6 +60,8 @@ Withholding Tax Payable,ภาษีหัก ณ ที่จ่ายค้า
|
|||||||
Withholding Tax Receivable,ภาษีถูกหัก ณ ที่จ่าย
|
Withholding Tax Receivable,ภาษีถูกหัก ณ ที่จ่าย
|
||||||
Output VAT,ภาษีขาย
|
Output VAT,ภาษีขาย
|
||||||
Input VAT,ภาษีซื้อ
|
Input VAT,ภาษีซื้อ
|
||||||
|
Withholding Tax Certificate,หนังสือรับรองการหักภาษี ณ ที่จ่าย
|
||||||
|
Please save the document before generating the certificate.,กรุณาบันทึกเอกสารก่อนออกหนังสือรับรองการหักภาษี ณ ที่จ่าย
|
||||||
Type of Income Paid,ประเภทเงินได้พึงประเมินที่จ่าย
|
Type of Income Paid,ประเภทเงินได้พึงประเมินที่จ่าย
|
||||||
Salary and Wages - Sec. 40(1),เงินเดือน ค่าจ้าง ฯลฯ ตามมาตรา 40(1)
|
Salary and Wages - Sec. 40(1),เงินเดือน ค่าจ้าง ฯลฯ ตามมาตรา 40(1)
|
||||||
Fees and Commissions - Sec. 40(2),ค่าธรรมเนียม ค่านายหน้า ฯลฯ ตามมาตรา 40(2)
|
Fees and Commissions - Sec. 40(2),ค่าธรรมเนียม ค่านายหน้า ฯลฯ ตามมาตรา 40(2)
|
||||||
|
|||||||
|
Reference in New Issue
Block a user