{#- หนังสือรับรองการหักภาษี ณ ที่จ่าย (Sec. 50 bis certificate) for a Purchase Invoice. The Revenue Department's fillable form (approve_wh3_081156.pdf, A4 = 595 x 842 pt) is the page background; every value sits in the rectangle of the corresponding AcroForm field, given here as the PDF's (x0, y0, x1, y1) with the origin at the bottom-left so the numbers can be checked against the form. Two identical copies are printed: copy 1 goes with the payee's tax return, copy 2 is the payee's record. -#} {%- set c = get_withholding_certificate(doc) -%} {%- set rows = { "1": {"date": (327, 533, 403, 546), "pay": (411, 533, 490, 547), "tax": (496, 534, 560, 547)}, "2": {"date": (328, 519, 403, 533), "pay": (410, 520, 489, 534), "tax": (496, 519, 560, 532)}, "3": {"date": (328, 504, 403, 518), "pay": (411, 504, 490, 517), "tax": (496, 504, 560, 517)}, "4a": {"date": (328, 490, 403, 505), "pay": (412, 490, 491, 504), "tax": (496, 490, 560, 503)}, "4b": {"date": (328, 402, 404, 416), "pay": (410, 403, 489, 417), "tax": (497, 403, 562, 416)}, "5": {"date": (327, 216, 403, 230), "pay": (409, 216, 489, 230), "tax": (496, 215, 561, 230)}, "6": {"date": (327, 199, 403, 213), "pay": (409, 199, 489, 213), "tax": (496, 198, 561, 213)}, } -%} {%- set pnd_boxes = { "1": (209, 603, 222, 615), "2": (395, 602, 407, 615), "3": (471, 602, 484, 615), "53": (395, 584, 407, 597), } -%} {#- Left edges of the printed 13-digit ID boxes (12 pt wide, grouped 1-4-5-2-1), measured on the form; the AcroForm comb field does not line up with them. -#} {%- set id_cells = (375, 393, 405, 417, 429, 447.5, 459.5, 471.5, 483.5, 495.5, 513.5, 525.5, 545) -%} {%- macro box(rect, text, align="left", size=10) -%}
{#- Invoice reference in the top-right margin; เล่มที่ / เลขที่ are the certificate book's numbers. -#}
{{ box((400, 821, 560, 835), doc.name, "right", 8) }}
{#- ผู้มีหน้าที่หักภาษี ณ ที่จ่าย: the company -#}
{{ tax_id((375, 744, 558, 759), c.payer) }}
{{ box((54, 729, 316, 745), c.payer.name) }}
{{ box((61, 706, 550, 722), c.payer.address or "", "left", 9) }}
{#- ผู้ถูกหักภาษี ณ ที่จ่าย: the supplier -#}
{{ tax_id((375, 676, 558, 690), c.payee) }}
{{ box((53, 658, 315, 671), c.payee.name) }}
{{ box((59, 627, 550, 643), c.payee.address or "", "left", 9) }}
{{ tick(pnd_boxes[c.pnd]) }}
{%- if c.row == "6" %}
{{ box((96, 197, 325, 214), c.row_note or "", "left", 8) }}
{%- endif %}
{{ amount_row(c.row) }}
{{ box((409, 180, 488, 196), c.amount, "right") }}
{{ box((496, 180, 560, 196), c.tax, "right") }}
{{ box((185, 158, 558, 177), c.tax_in_words) }}
{#- ผู้จ่ายเงิน (1) หัก ณ ที่จ่าย -#}
{{ tick((82, 119, 94, 131)) }}
{{ box((342, 72, 366, 87), c.issued.day, "center") }}
{{ box((364, 71, 428, 87), c.issued.month, "center") }}
{{ box((429, 72, 470, 87), c.issued.year, "center") }}