@things-factory/tax-invoice 10.1.256 → 10.1.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/entity360/tax-invoice-360.d.ts +2 -3
- package/dist-client/entity360/tax-invoice-360.js +20 -41
- package/dist-client/entity360/tax-invoice-360.js.map +1 -1
- package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.d.ts +2 -3
- package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +94 -108
- package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -46,9 +46,8 @@ export declare function registerTaxInvoiceKind(): void;
|
|
|
46
46
|
export declare class TaxInvoiceOverviewSection extends LitElement {
|
|
47
47
|
static styles: import("lit").CSSResult;
|
|
48
48
|
subject?: Entity360Subject;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
private read;
|
|
49
|
+
private invoice;
|
|
50
|
+
get answer(): Entity360DoorAnswer<Invoice | undefined> | undefined;
|
|
52
51
|
render(): import("lit-html").TemplateResult<1>;
|
|
53
52
|
}
|
|
54
53
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import gql from 'graphql-tag';
|
|
3
3
|
import { css, html, LitElement } from 'lit';
|
|
4
|
-
import { customElement, property
|
|
5
|
-
import {
|
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
5
|
+
import { QueryController } from '@operato/graphql';
|
|
6
6
|
import { i18next } from '@operato/i18n';
|
|
7
|
-
import {
|
|
7
|
+
import { entity360Answer, registerEntity360Kind, registerEntity360Section } from '@operato/layout';
|
|
8
8
|
import { CATEGORY, Category, INVOICE_TYPE, PURPOSE } from '../pages/tax-invoice/tax-invoice-list-page';
|
|
9
9
|
/** 1234567890 → 123-45-67890; anything else as it is. */
|
|
10
10
|
export const businessNumber = (value) => (value && /^\d{10}$/.test(value) ? value.replace(/(\d{3})(\d{2})(\d{5})/, '$1-$2-$3') : value || '');
|
|
@@ -33,6 +33,21 @@ export function registerTaxInvoiceKind() {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitElement {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
/* The invoice the 360 shows, through the read door the application configured (ADR-0190). */
|
|
39
|
+
this.invoice = new QueryController(this, gql(`
|
|
40
|
+
query ($id: String!) {
|
|
41
|
+
taxInvoice: ${invoiceQueryField}(id: $id) {
|
|
42
|
+
id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0
|
|
43
|
+
supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName
|
|
44
|
+
buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName
|
|
45
|
+
supplyAmount taxAmount totalAmount
|
|
46
|
+
taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`), { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) });
|
|
50
|
+
}
|
|
36
51
|
static { this.styles = css `
|
|
37
52
|
:host { font-size: var(--ui-t-body, 13px); line-height: 1.5; }
|
|
38
53
|
h4 { font: inherit; font-weight: 600; margin: 12px 0 4px; }
|
|
@@ -100,40 +115,8 @@ let TaxInvoiceOverviewSection = class TaxInvoiceOverviewSection extends LitEleme
|
|
|
100
115
|
white-space: nowrap;
|
|
101
116
|
}
|
|
102
117
|
`; }
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.read();
|
|
106
|
-
}
|
|
107
|
-
async read() {
|
|
108
|
-
const id = this.subject?.id;
|
|
109
|
-
this.answer = undefined;
|
|
110
|
-
if (!id)
|
|
111
|
-
return;
|
|
112
|
-
let response;
|
|
113
|
-
try {
|
|
114
|
-
response = await client.query({
|
|
115
|
-
query: gql(`
|
|
116
|
-
query ($id: String!) {
|
|
117
|
-
taxInvoice: ${invoiceQueryField}(id: $id) {
|
|
118
|
-
id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0
|
|
119
|
-
supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName
|
|
120
|
-
buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName
|
|
121
|
-
supplyAmount taxAmount totalAmount
|
|
122
|
-
taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
`),
|
|
126
|
-
variables: { id },
|
|
127
|
-
fetchPolicy: 'no-cache',
|
|
128
|
-
errorPolicy: 'all'
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
catch (e) {
|
|
132
|
-
response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] };
|
|
133
|
-
}
|
|
134
|
-
if (this.subject?.id !== id)
|
|
135
|
-
return;
|
|
136
|
-
this.answer = readEntity360Door(response, data => data?.taxInvoice);
|
|
118
|
+
get answer() {
|
|
119
|
+
return entity360Answer(this.invoice, data => data?.taxInvoice);
|
|
137
120
|
}
|
|
138
121
|
render() {
|
|
139
122
|
const answer = this.answer;
|
|
@@ -184,10 +167,6 @@ __decorate([
|
|
|
184
167
|
property({ attribute: false }),
|
|
185
168
|
__metadata("design:type", Object)
|
|
186
169
|
], TaxInvoiceOverviewSection.prototype, "subject", void 0);
|
|
187
|
-
__decorate([
|
|
188
|
-
state(),
|
|
189
|
-
__metadata("design:type", Object)
|
|
190
|
-
], TaxInvoiceOverviewSection.prototype, "answer", void 0);
|
|
191
170
|
TaxInvoiceOverviewSection = __decorate([
|
|
192
171
|
customElement('tax-invoice-overview-section')
|
|
193
172
|
], TaxInvoiceOverviewSection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"t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,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;sBACnF,CAAC;;;;;wBAKC,CAAC,CAAC,+BAA+B,CAAC,YAAY,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,sBAAsB,CAAC;oCACvG,CAAC,CAAC,4BAA4B,CAAC,wBAAwB,CAAC,CAAC,yBAAyB,CAAC,wBAAwB,CAAC,CAAC,qBAAqB,CAAC,wBAAwB,CAAC,CAAC,kBAAkB,CAAC;;yBAE3L,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA;qCACV,IAAI,CAAC,UAAU,IAAI,EAAE,8BAA8B,IAAI,CAAC,QAAQ,IAAI,EAAE,YAAY,IAAI,CAAC,aAAa,IAAI,EAAE;oCAC3G,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;sBAC9K,CAAC;6BACM,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,CAAC,CAAC,EAAE;4BACgB,CAAA;IAC1B,CAAC;;AA/E+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;0DAA2B;AACjD;IAAR,KAAK,EAAE;;yDAAkD;AAtE/C,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CAqJrC","sourcesContent":["import gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { readEntity360Door, registerEntity360Kind, registerEntity360Section, type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout'\n\nimport { CATEGORY, Category, INVOICE_TYPE, PURPOSE } from '../pages/tax-invoice/tax-invoice-list-page'\n\n/*\n * A tax invoice's 360 (ADR-0067). The framework draws the invoice itself — parties, amounts, items.\n * An application adds its own sections (what the invoice is bound to) with registerEntity360Section('tax-invoice', …).\n */\n\ntype Invoice = {\n id: string\n category: string\n approvalNo?: string\n originalApprovalNo?: string\n issueDate?: string\n signatureDate?: string\n transmissionDate?: string\n invoiceType?: string\n purpose?: string\n issueChannel?: string\n remark0?: string\n supplierBusinessRegistrationNumber?: string\n supplierBusinessName?: string\n supplierRepresentativeName?: string\n buyerBusinessRegistrationNumber?: string\n buyerBusinessName?: string\n buyerRepresentativeName?: string\n supplyAmount?: number\n taxAmount?: number\n totalAmount?: number\n taxInvoiceItems?: { sequence?: number; supplyDate?: string; itemName?: string; specification?: string; quantity?: number; unitPrice?: number; supplyPrice?: number; taxPrice?: number }[]\n}\n\n/** 1234567890 → 123-45-67890; anything else as it is. */\nexport const businessNumber = (value?: string) => (value && /^\\d{10}$/.test(value) ? value.replace(/(\\d{3})(\\d{2})(\\d{5})/, '$1-$2-$3') : value || '')\n\nconst amount = (value?: number | null) => (value === null || value === undefined ? '' : Number(value).toLocaleString(i18next.language || 'ko'))\n\n/** The other party: the buyer of a sale, the supplier of a purchase. */\nexport const counterpartOf = (value: { category?: string; supplierBusinessName?: string; buyerBusinessName?: string }) =>\n (value.category === Category.EXPORT ? value.buyerBusinessName : value.supplierBusinessName) || ''\n\nlet invoiceQueryField = 'taxInvoice'\n/** Applications may use their own domain-scoped ledger read door without granting framework privileges. */\nexport function configureTaxInvoice360Query(field: string): void {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) throw new Error('Invalid invoice query field')\n invoiceQueryField = field\n}\n\nexport function registerTaxInvoiceKind() {\n registerEntity360Kind({\n kind: 'tax-invoice',\n typenames: ['TaxInvoice'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.tax invoice')} · ${counterpartOf(value) || value.name || value.approvalNo || ''}`,\n context: ({ value }) => [CATEGORY[value.category], value.issueDate, value.approvalNo].filter(Boolean).join(' · ')\n })\n registerEntity360Section('tax-invoice', {\n name: 'overview',\n order: 10,\n render: subject => html`<tax-invoice-overview-section .subject=${subject}></tax-invoice-overview-section>`\n })\n}\n\n@customElement('tax-invoice-overview-section')\nexport class TaxInvoiceOverviewSection extends LitElement {\n static styles = css`\n :host { font-size: var(--ui-t-body, 13px); line-height: 1.5; }\n h4 { font: inherit; font-weight: 600; margin: 12px 0 4px; }\n .info { font-size: var(--ui-t-body, 13px); margin-top: 0; }\n .info th { width: 1%; padding: 6px 8px; background: var(--md-sys-color-surface-container, transparent); font-size: var(--ui-t-small, 11.5px); }\n .info td { padding: 6px 8px; }\n .info { border-top: 1px solid var(--md-sys-color-outline-variant); }\n .items th { padding: 5px 6px; background: var(--md-sys-color-surface-container, transparent); }\n .items td { padding: 7px 6px; }\n\n th, .date { white-space: nowrap; }\n .info td { overflow-wrap: anywhere; }\n .secondary { display: block; color: var(--md-sys-color-on-surface-variant); font-size: var(--ui-t-small, 11.5px); }\n .item-layout { container-type: inline-size; }\n .items { table-layout: fixed; }\n .items-wide { display: none; }\n .items-wide .wide-name { width: 32%; }\n .items-wide .wide-date { width: 90px; }\n .items-wide .wide-spec { width: 8%; }\n @container (min-width: 720px) {\n .items-compact { display: none; }\n .items-wide { display: table; }\n }\n .item-col { width: 58%; }\n .item-name { overflow-wrap: anywhere; }\n .total { font-weight: 600; }\n\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small, 4px) var(--spacing-large, 12px);\n font-size: var(--ui-t-body, 13px);\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n table {\n width: 100%;\n margin-top: var(--spacing-medium, 8px);\n border-collapse: collapse;\n font-size: var(--ui-t-small, 11.5px);\n font-variant-numeric: tabular-nums;\n color: var(--md-sys-color-on-surface);\n }\n th {\n text-align: left;\n font-weight: normal;\n color: var(--md-sys-color-on-surface-variant);\n }\n th,\n td {\n padding: var(--spacing-tiny, 2px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n vertical-align: top;\n }\n .num {\n text-align: right;\n white-space: nowrap;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n @state() answer?: Entity360DoorAnswer<Invoice | undefined>\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('subject')) this.read()\n }\n\n private async read() {\n const id = this.subject?.id\n this.answer = undefined\n if (!id) return\n let response: any\n try {\n response = await client.query({\n query: gql(`\n query ($id: String!) {\n taxInvoice: ${invoiceQueryField}(id: $id) {\n id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0\n supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName\n buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName\n supplyAmount taxAmount totalAmount\n taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }\n }\n }\n `),\n variables: { id },\n fetchPolicy: 'no-cache',\n errorPolicy: 'all'\n } as any)\n } catch (e: any) {\n response = { data: null, errors: e?.graphQLErrors?.length ? e.graphQLErrors : [{ message: e?.message ?? String(e) }] }\n }\n if (this.subject?.id !== id) return\n this.answer = readEntity360Door(response, data => data?.taxInvoice)\n }\n\n render() {\n const answer = this.answer\n const one = answer?.data\n const t = (key: string) => i18next.t(key)\n const items = [...(one?.taxInvoiceItems ?? [])].sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0))\n return html`<ox-entity360-section .heading=${t('title.tax invoice')} .state=${answer?.state ?? 'loading'} .message=${answer?.message ?? ''}>\n ${one\n ? html`\n <table class=\"info\" aria-label=${t('title.tax invoice')}>\n <tbody>\n <tr><th>${t('field.tax invoice category')}</th><td colspan=\"3\">${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType!] ?? one.invoiceType} · ${PURPOSE[one.purpose!] ?? ''}</td></tr>\n <tr><th>${t('field.approval no')}</th><td colspan=\"3\">${one.approvalNo}</td></tr>\n ${one.originalApprovalNo ? html`<tr><th>${t('field.original approval no')}</th><td colspan=\"3\">${one.originalApprovalNo}</td></tr>` : ''}\n <tr><th>${t('field.issue date')}</th><td class=\"date\">${one.issueDate}</td><th>${t('field.signature date')}</th><td class=\"date\">${one.signatureDate ?? '—'}</td></tr>\n <tr><th>${t('field.transmission date')}</th><td class=\"date\">${one.transmissionDate ?? '—'}</td><th>${t('field.issue channel')}</th><td>${one.issueChannel ?? '—'}</td></tr>\n <tr><th>${t('field.tax invoice supplier')}</th><td colspan=\"3\">${one.supplierBusinessName}<span class=\"secondary\">${businessNumber(one.supplierBusinessRegistrationNumber)} · ${one.supplierRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.tax invoice buyer')}</th><td colspan=\"3\">${one.buyerBusinessName}<span class=\"secondary\">${businessNumber(one.buyerBusinessRegistrationNumber)} · ${one.buyerRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.supply amount')}</th><td class=\"num\">${amount(one.supplyAmount)}</td><th>${t('field.tax amount')}</th><td class=\"num\">${amount(one.taxAmount)}</td></tr>\n <tr><th>${t('field.total amount')}</th><td colspan=\"3\" class=\"num total\">${amount(one.totalAmount)}</td></tr>\n ${one.remark0 ? html`<tr><th>${t('field.remark0')}</th><td colspan=\"3\">${one.remark0}</td></tr>` : ''}\n </tbody>\n </table>\n ${items.length ? html`<h4>${t('field.tax invoice item name')} (${items.length})</h4>\n <div class=\"item-layout\"><table class=\"items items-compact\"><colgroup><col class=\"item-col\"/><col/><col/></colgroup>\n <thead><tr><th>${t('field.tax invoice item name')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th></tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td><span class=\"item-name\">${item.itemName ?? ''}</span><span class=\"secondary\">${item.supplyDate ?? ''}${item.specification ? html` · ${item.specification}` : ''}</span><span class=\"secondary\">${t('field.tax invoice quantity')} ${amount(item.quantity)} · ${t('field.tax invoice price')} ${amount(item.unitPrice)}</span></td>\n <td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table>\n <table class=\"items items-wide\">\n <colgroup><col class=\"wide-date\"/><col class=\"wide-name\"/><col class=\"wide-spec\"/><col/><col/><col/><col/></colgroup>\n <thead><tr>\n <th>${t('field.tax invoice supply date')}</th><th>${t('field.tax invoice item name')}</th><th>${t('field.tax invoice ea')}</th>\n <th class=\"num\">${t('field.tax invoice quantity')}</th><th class=\"num\">${t('field.tax invoice price')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th>\n </tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td class=\"date\">${item.supplyDate ?? ''}</td><td class=\"item-name\">${item.itemName ?? ''}</td><td>${item.specification ?? ''}</td>\n <td class=\"num\">${amount(item.quantity)}</td><td class=\"num\">${amount(item.unitPrice)}</td><td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table></div>` : ''}`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tax-invoice-360.js","sourceRoot":"","sources":["../../client/entity360/tax-invoice-360.ts"],"names":[],"mappings":";AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,wBAAwB,EAAmD,MAAM,iBAAiB,CAAA;A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'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { QueryController } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { entity360Answer, registerEntity360Kind, registerEntity360Section, type Entity360DoorAnswer, type Entity360Subject } from '@operato/layout'\n\nimport { CATEGORY, Category, INVOICE_TYPE, PURPOSE } from '../pages/tax-invoice/tax-invoice-list-page'\n\n/*\n * A tax invoice's 360 (ADR-0067). The framework draws the invoice itself — parties, amounts, items.\n * An application adds its own sections (what the invoice is bound to) with registerEntity360Section('tax-invoice', …).\n */\n\ntype Invoice = {\n id: string\n category: string\n approvalNo?: string\n originalApprovalNo?: string\n issueDate?: string\n signatureDate?: string\n transmissionDate?: string\n invoiceType?: string\n purpose?: string\n issueChannel?: string\n remark0?: string\n supplierBusinessRegistrationNumber?: string\n supplierBusinessName?: string\n supplierRepresentativeName?: string\n buyerBusinessRegistrationNumber?: string\n buyerBusinessName?: string\n buyerRepresentativeName?: string\n supplyAmount?: number\n taxAmount?: number\n totalAmount?: number\n taxInvoiceItems?: { sequence?: number; supplyDate?: string; itemName?: string; specification?: string; quantity?: number; unitPrice?: number; supplyPrice?: number; taxPrice?: number }[]\n}\n\n/** 1234567890 → 123-45-67890; anything else as it is. */\nexport const businessNumber = (value?: string) => (value && /^\\d{10}$/.test(value) ? value.replace(/(\\d{3})(\\d{2})(\\d{5})/, '$1-$2-$3') : value || '')\n\nconst amount = (value?: number | null) => (value === null || value === undefined ? '' : Number(value).toLocaleString(i18next.language || 'ko'))\n\n/** The other party: the buyer of a sale, the supplier of a purchase. */\nexport const counterpartOf = (value: { category?: string; supplierBusinessName?: string; buyerBusinessName?: string }) =>\n (value.category === Category.EXPORT ? value.buyerBusinessName : value.supplierBusinessName) || ''\n\nlet invoiceQueryField = 'taxInvoice'\n/** Applications may use their own domain-scoped ledger read door without granting framework privileges. */\nexport function configureTaxInvoice360Query(field: string): void {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(field)) throw new Error('Invalid invoice query field')\n invoiceQueryField = field\n}\n\nexport function registerTaxInvoiceKind() {\n registerEntity360Kind({\n kind: 'tax-invoice',\n typenames: ['TaxInvoice'],\n assistantSubject: true,\n title: ({ value }) => `${i18next.t('title.tax invoice')} · ${counterpartOf(value) || value.name || value.approvalNo || ''}`,\n context: ({ value }) => [CATEGORY[value.category], value.issueDate, value.approvalNo].filter(Boolean).join(' · ')\n })\n registerEntity360Section('tax-invoice', {\n name: 'overview',\n order: 10,\n render: subject => html`<tax-invoice-overview-section .subject=${subject}></tax-invoice-overview-section>`\n })\n}\n\n@customElement('tax-invoice-overview-section')\nexport class TaxInvoiceOverviewSection extends LitElement {\n static styles = css`\n :host { font-size: var(--ui-t-body, 13px); line-height: 1.5; }\n h4 { font: inherit; font-weight: 600; margin: 12px 0 4px; }\n .info { font-size: var(--ui-t-body, 13px); margin-top: 0; }\n .info th { width: 1%; padding: 6px 8px; background: var(--md-sys-color-surface-container, transparent); font-size: var(--ui-t-small, 11.5px); }\n .info td { padding: 6px 8px; }\n .info { border-top: 1px solid var(--md-sys-color-outline-variant); }\n .items th { padding: 5px 6px; background: var(--md-sys-color-surface-container, transparent); }\n .items td { padding: 7px 6px; }\n\n th, .date { white-space: nowrap; }\n .info td { overflow-wrap: anywhere; }\n .secondary { display: block; color: var(--md-sys-color-on-surface-variant); font-size: var(--ui-t-small, 11.5px); }\n .item-layout { container-type: inline-size; }\n .items { table-layout: fixed; }\n .items-wide { display: none; }\n .items-wide .wide-name { width: 32%; }\n .items-wide .wide-date { width: 90px; }\n .items-wide .wide-spec { width: 8%; }\n @container (min-width: 720px) {\n .items-compact { display: none; }\n .items-wide { display: table; }\n }\n .item-col { width: 58%; }\n .item-name { overflow-wrap: anywhere; }\n .total { font-weight: 600; }\n\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: var(--spacing-small, 4px) var(--spacing-large, 12px);\n font-size: var(--ui-t-body, 13px);\n }\n dt {\n color: var(--md-sys-color-on-surface-variant);\n }\n dd {\n margin: 0;\n color: var(--md-sys-color-on-surface);\n overflow-wrap: anywhere;\n font-variant-numeric: tabular-nums;\n }\n table {\n width: 100%;\n margin-top: var(--spacing-medium, 8px);\n border-collapse: collapse;\n font-size: var(--ui-t-small, 11.5px);\n font-variant-numeric: tabular-nums;\n color: var(--md-sys-color-on-surface);\n }\n th {\n text-align: left;\n font-weight: normal;\n color: var(--md-sys-color-on-surface-variant);\n }\n th,\n td {\n padding: var(--spacing-tiny, 2px) var(--spacing-small, 4px);\n border-bottom: 1px solid var(--md-sys-color-outline-variant);\n vertical-align: top;\n }\n .num {\n text-align: right;\n white-space: nowrap;\n }\n `\n\n @property({ attribute: false }) subject?: Entity360Subject\n\n /* The invoice the 360 shows, through the read door the application configured (ADR-0190). */\n private invoice = new QueryController(\n this,\n gql(`\n query ($id: String!) {\n taxInvoice: ${invoiceQueryField}(id: $id) {\n id category approvalNo originalApprovalNo issueDate signatureDate transmissionDate invoiceType purpose issueChannel remark0\n supplierBusinessRegistrationNumber supplierBusinessName supplierRepresentativeName\n buyerBusinessRegistrationNumber buyerBusinessName buyerRepresentativeName\n supplyAmount taxAmount totalAmount\n taxInvoiceItems { sequence supplyDate itemName specification quantity unitPrice supplyPrice taxPrice }\n }\n }\n `),\n { variables: () => (this.subject?.id ? { id: this.subject.id } : undefined) }\n )\n\n get answer(): Entity360DoorAnswer<Invoice | undefined> | undefined {\n return entity360Answer(this.invoice, data => data?.taxInvoice as Invoice | undefined)\n }\n\n render() {\n const answer = this.answer\n const one = answer?.data\n const t = (key: string) => i18next.t(key)\n const items = [...(one?.taxInvoiceItems ?? [])].sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0))\n return html`<ox-entity360-section .heading=${t('title.tax invoice')} .state=${answer?.state ?? 'loading'} .message=${answer?.message ?? ''}>\n ${one\n ? html`\n <table class=\"info\" aria-label=${t('title.tax invoice')}>\n <tbody>\n <tr><th>${t('field.tax invoice category')}</th><td colspan=\"3\">${CATEGORY[one.category] ?? one.category} · ${INVOICE_TYPE[one.invoiceType!] ?? one.invoiceType} · ${PURPOSE[one.purpose!] ?? ''}</td></tr>\n <tr><th>${t('field.approval no')}</th><td colspan=\"3\">${one.approvalNo}</td></tr>\n ${one.originalApprovalNo ? html`<tr><th>${t('field.original approval no')}</th><td colspan=\"3\">${one.originalApprovalNo}</td></tr>` : ''}\n <tr><th>${t('field.issue date')}</th><td class=\"date\">${one.issueDate}</td><th>${t('field.signature date')}</th><td class=\"date\">${one.signatureDate ?? '—'}</td></tr>\n <tr><th>${t('field.transmission date')}</th><td class=\"date\">${one.transmissionDate ?? '—'}</td><th>${t('field.issue channel')}</th><td>${one.issueChannel ?? '—'}</td></tr>\n <tr><th>${t('field.tax invoice supplier')}</th><td colspan=\"3\">${one.supplierBusinessName}<span class=\"secondary\">${businessNumber(one.supplierBusinessRegistrationNumber)} · ${one.supplierRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.tax invoice buyer')}</th><td colspan=\"3\">${one.buyerBusinessName}<span class=\"secondary\">${businessNumber(one.buyerBusinessRegistrationNumber)} · ${one.buyerRepresentativeName ?? ''}</span></td></tr>\n <tr><th>${t('field.supply amount')}</th><td class=\"num\">${amount(one.supplyAmount)}</td><th>${t('field.tax amount')}</th><td class=\"num\">${amount(one.taxAmount)}</td></tr>\n <tr><th>${t('field.total amount')}</th><td colspan=\"3\" class=\"num total\">${amount(one.totalAmount)}</td></tr>\n ${one.remark0 ? html`<tr><th>${t('field.remark0')}</th><td colspan=\"3\">${one.remark0}</td></tr>` : ''}\n </tbody>\n </table>\n ${items.length ? html`<h4>${t('field.tax invoice item name')} (${items.length})</h4>\n <div class=\"item-layout\"><table class=\"items items-compact\"><colgroup><col class=\"item-col\"/><col/><col/></colgroup>\n <thead><tr><th>${t('field.tax invoice item name')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th></tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td><span class=\"item-name\">${item.itemName ?? ''}</span><span class=\"secondary\">${item.supplyDate ?? ''}${item.specification ? html` · ${item.specification}` : ''}</span><span class=\"secondary\">${t('field.tax invoice quantity')} ${amount(item.quantity)} · ${t('field.tax invoice price')} ${amount(item.unitPrice)}</span></td>\n <td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table>\n <table class=\"items items-wide\">\n <colgroup><col class=\"wide-date\"/><col class=\"wide-name\"/><col class=\"wide-spec\"/><col/><col/><col/><col/></colgroup>\n <thead><tr>\n <th>${t('field.tax invoice supply date')}</th><th>${t('field.tax invoice item name')}</th><th>${t('field.tax invoice ea')}</th>\n <th class=\"num\">${t('field.tax invoice quantity')}</th><th class=\"num\">${t('field.tax invoice price')}</th><th class=\"num\">${t('field.supply amount')}</th><th class=\"num\">${t('field.tax amount')}</th>\n </tr></thead>\n <tbody>${items.map(item => html`<tr>\n <td class=\"date\">${item.supplyDate ?? ''}</td><td class=\"item-name\">${item.itemName ?? ''}</td><td>${item.specification ?? ''}</td>\n <td class=\"num\">${amount(item.quantity)}</td><td class=\"num\">${amount(item.unitPrice)}</td><td class=\"num\">${amount(item.supplyPrice)}</td><td class=\"num\">${amount(item.taxPrice)}</td>\n </tr>`)}</tbody>\n </table></div>` : ''}`\n : ''}\n </ox-entity360-section>`\n }\n}\n"]}
|
|
@@ -4,10 +4,9 @@ declare const TaxInvoiceDetailPopup_base: (new (...args: any[]) => LitElement) &
|
|
|
4
4
|
export declare class TaxInvoiceDetailPopup extends TaxInvoiceDetailPopup_base {
|
|
5
5
|
static styles: import("lit").CSSResult[];
|
|
6
6
|
taxInvoiceId: string;
|
|
7
|
-
|
|
7
|
+
private invoice;
|
|
8
|
+
get detail(): any;
|
|
8
9
|
render(): import("lit-html").TemplateResult<1>;
|
|
9
|
-
updated(changed: any): Promise<void>;
|
|
10
|
-
private getTaxInvoiceDetailById;
|
|
11
10
|
private _numberFormat;
|
|
12
11
|
}
|
|
13
12
|
export {};
|
|
@@ -2,8 +2,8 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import '@operato/data-grist';
|
|
3
3
|
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
4
4
|
import { css, html, LitElement } from 'lit';
|
|
5
|
-
import { customElement, property
|
|
6
|
-
import {
|
|
5
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
+
import { QueryController } from '@operato/graphql';
|
|
7
7
|
import { i18next, localize } from '@operato/i18n';
|
|
8
8
|
import gql from 'graphql-tag';
|
|
9
9
|
import { INVOICE_TYPE } from './tax-invoice-list-page';
|
|
@@ -11,7 +11,95 @@ let TaxInvoiceDetailPopup = class TaxInvoiceDetailPopup extends localize(i18next
|
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.taxInvoiceId = '';
|
|
14
|
-
|
|
14
|
+
/* The invoice the popup was opened for (ADR-0190). */
|
|
15
|
+
this.invoice = new QueryController(this, gql `
|
|
16
|
+
query ($id: String!) {
|
|
17
|
+
responses: taxInvoice(id: $id) {
|
|
18
|
+
id
|
|
19
|
+
category
|
|
20
|
+
approvalNo
|
|
21
|
+
originalApprovalNo
|
|
22
|
+
issueDate
|
|
23
|
+
signatureDate
|
|
24
|
+
invoiceType
|
|
25
|
+
purpose
|
|
26
|
+
revisedReason
|
|
27
|
+
remark0
|
|
28
|
+
remark1
|
|
29
|
+
remark2
|
|
30
|
+
supplierBusinessRegistrationCategory
|
|
31
|
+
supplierBusinessRegistrationNumber
|
|
32
|
+
supplierBranchIdentification
|
|
33
|
+
supplierBusinessName
|
|
34
|
+
supplierRepresentativeName
|
|
35
|
+
supplierAddress
|
|
36
|
+
supplierBusinessType
|
|
37
|
+
supplierIndustryType
|
|
38
|
+
supplierDepartment
|
|
39
|
+
supplierContactName
|
|
40
|
+
supplierContactPhone
|
|
41
|
+
supplierContactEmail
|
|
42
|
+
supplierContactCellPhone
|
|
43
|
+
buyerBusinessRegistrationCategory
|
|
44
|
+
buyerBusinessRegistrationNumber
|
|
45
|
+
buyerBranchIdentification
|
|
46
|
+
buyerBusinessName
|
|
47
|
+
buyerRepresentativeName
|
|
48
|
+
buyerAddress
|
|
49
|
+
buyerBusinessType
|
|
50
|
+
buyerIndustryType
|
|
51
|
+
buyer1stDepartment
|
|
52
|
+
buyer1stContactName
|
|
53
|
+
buyer1stContactPhone
|
|
54
|
+
buyer1stContactEmail
|
|
55
|
+
buyer1stContactCellPhone
|
|
56
|
+
buyer2ndDepartment
|
|
57
|
+
buyer2ndContactName
|
|
58
|
+
buyer2ndContactPhone
|
|
59
|
+
buyer2ndContactEmail
|
|
60
|
+
buyer2ndContactCellPhone
|
|
61
|
+
agentBusinessRegistrationCategory
|
|
62
|
+
agentBusinessRegistrationNumber
|
|
63
|
+
agentBranchIdentification
|
|
64
|
+
agentBusinessName
|
|
65
|
+
agentRepresentativeName
|
|
66
|
+
agentAddress
|
|
67
|
+
agentBusinessType
|
|
68
|
+
agentIndustryType
|
|
69
|
+
agentDepartment
|
|
70
|
+
agentContactName
|
|
71
|
+
agentContactPhone
|
|
72
|
+
agentContactEmail
|
|
73
|
+
agentContactCellPhone
|
|
74
|
+
paymentAmountCash
|
|
75
|
+
paymentAmountCheck
|
|
76
|
+
paymentAmountPromissoryNote
|
|
77
|
+
paymentAmountAccountsReceivable
|
|
78
|
+
supplyAmount
|
|
79
|
+
taxAmount
|
|
80
|
+
totalAmount
|
|
81
|
+
createdAt
|
|
82
|
+
updater {
|
|
83
|
+
id
|
|
84
|
+
name
|
|
85
|
+
}
|
|
86
|
+
updatedAt
|
|
87
|
+
|
|
88
|
+
taxInvoiceItems {
|
|
89
|
+
id
|
|
90
|
+
sequence
|
|
91
|
+
supplyDate
|
|
92
|
+
itemName
|
|
93
|
+
specification
|
|
94
|
+
quantity
|
|
95
|
+
unitPrice
|
|
96
|
+
supplyPrice
|
|
97
|
+
taxPrice
|
|
98
|
+
remark
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`, { variables: () => (this.taxInvoiceId ? { id: this.taxInvoiceId } : undefined) });
|
|
15
103
|
}
|
|
16
104
|
static { this.styles = [
|
|
17
105
|
ScrollbarStyles,
|
|
@@ -148,6 +236,9 @@ let TaxInvoiceDetailPopup = class TaxInvoiceDetailPopup extends localize(i18next
|
|
|
148
236
|
}
|
|
149
237
|
`
|
|
150
238
|
]; }
|
|
239
|
+
get detail() {
|
|
240
|
+
return this.invoice.data?.responses || {};
|
|
241
|
+
}
|
|
151
242
|
render() {
|
|
152
243
|
return html `
|
|
153
244
|
<div class="title">
|
|
@@ -342,107 +433,6 @@ let TaxInvoiceDetailPopup = class TaxInvoiceDetailPopup extends localize(i18next
|
|
|
342
433
|
</div>
|
|
343
434
|
`;
|
|
344
435
|
}
|
|
345
|
-
async updated(changed) {
|
|
346
|
-
if (changed.has('taxInvoiceId')) {
|
|
347
|
-
this.detail = await this.getTaxInvoiceDetailById(this.taxInvoiceId);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
async getTaxInvoiceDetailById(id) {
|
|
351
|
-
if (!id)
|
|
352
|
-
return {};
|
|
353
|
-
const response = await client.query({
|
|
354
|
-
query: gql `
|
|
355
|
-
query ($id: String!) {
|
|
356
|
-
responses: taxInvoice(id: $id) {
|
|
357
|
-
id
|
|
358
|
-
category
|
|
359
|
-
approvalNo
|
|
360
|
-
originalApprovalNo
|
|
361
|
-
issueDate
|
|
362
|
-
signatureDate
|
|
363
|
-
invoiceType
|
|
364
|
-
purpose
|
|
365
|
-
revisedReason
|
|
366
|
-
remark0
|
|
367
|
-
remark1
|
|
368
|
-
remark2
|
|
369
|
-
supplierBusinessRegistrationCategory
|
|
370
|
-
supplierBusinessRegistrationNumber
|
|
371
|
-
supplierBranchIdentification
|
|
372
|
-
supplierBusinessName
|
|
373
|
-
supplierRepresentativeName
|
|
374
|
-
supplierAddress
|
|
375
|
-
supplierBusinessType
|
|
376
|
-
supplierIndustryType
|
|
377
|
-
supplierDepartment
|
|
378
|
-
supplierContactName
|
|
379
|
-
supplierContactPhone
|
|
380
|
-
supplierContactEmail
|
|
381
|
-
supplierContactCellPhone
|
|
382
|
-
buyerBusinessRegistrationCategory
|
|
383
|
-
buyerBusinessRegistrationNumber
|
|
384
|
-
buyerBranchIdentification
|
|
385
|
-
buyerBusinessName
|
|
386
|
-
buyerRepresentativeName
|
|
387
|
-
buyerAddress
|
|
388
|
-
buyerBusinessType
|
|
389
|
-
buyerIndustryType
|
|
390
|
-
buyer1stDepartment
|
|
391
|
-
buyer1stContactName
|
|
392
|
-
buyer1stContactPhone
|
|
393
|
-
buyer1stContactEmail
|
|
394
|
-
buyer1stContactCellPhone
|
|
395
|
-
buyer2ndDepartment
|
|
396
|
-
buyer2ndContactName
|
|
397
|
-
buyer2ndContactPhone
|
|
398
|
-
buyer2ndContactEmail
|
|
399
|
-
buyer2ndContactCellPhone
|
|
400
|
-
agentBusinessRegistrationCategory
|
|
401
|
-
agentBusinessRegistrationNumber
|
|
402
|
-
agentBranchIdentification
|
|
403
|
-
agentBusinessName
|
|
404
|
-
agentRepresentativeName
|
|
405
|
-
agentAddress
|
|
406
|
-
agentBusinessType
|
|
407
|
-
agentIndustryType
|
|
408
|
-
agentDepartment
|
|
409
|
-
agentContactName
|
|
410
|
-
agentContactPhone
|
|
411
|
-
agentContactEmail
|
|
412
|
-
agentContactCellPhone
|
|
413
|
-
paymentAmountCash
|
|
414
|
-
paymentAmountCheck
|
|
415
|
-
paymentAmountPromissoryNote
|
|
416
|
-
paymentAmountAccountsReceivable
|
|
417
|
-
supplyAmount
|
|
418
|
-
taxAmount
|
|
419
|
-
totalAmount
|
|
420
|
-
createdAt
|
|
421
|
-
updater {
|
|
422
|
-
id
|
|
423
|
-
name
|
|
424
|
-
}
|
|
425
|
-
updatedAt
|
|
426
|
-
|
|
427
|
-
taxInvoiceItems {
|
|
428
|
-
id
|
|
429
|
-
sequence
|
|
430
|
-
supplyDate
|
|
431
|
-
itemName
|
|
432
|
-
specification
|
|
433
|
-
quantity
|
|
434
|
-
unitPrice
|
|
435
|
-
supplyPrice
|
|
436
|
-
taxPrice
|
|
437
|
-
remark
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
`,
|
|
442
|
-
variables: { id }
|
|
443
|
-
});
|
|
444
|
-
return response.data.responses || {};
|
|
445
|
-
}
|
|
446
436
|
_numberFormat(value) {
|
|
447
437
|
return !value ? '' : new Intl.NumberFormat('en-US').format(value);
|
|
448
438
|
}
|
|
@@ -451,10 +441,6 @@ __decorate([
|
|
|
451
441
|
property({ type: String }),
|
|
452
442
|
__metadata("design:type", String)
|
|
453
443
|
], TaxInvoiceDetailPopup.prototype, "taxInvoiceId", void 0);
|
|
454
|
-
__decorate([
|
|
455
|
-
state(),
|
|
456
|
-
__metadata("design:type", Object)
|
|
457
|
-
], TaxInvoiceDetailPopup.prototype, "detail", void 0);
|
|
458
444
|
TaxInvoiceDetailPopup = __decorate([
|
|
459
445
|
customElement('tax-invoice-detail-popup')
|
|
460
446
|
], TaxInvoiceDetailPopup);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tax-invoice-detail-popup.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice/tax-invoice-detail-popup.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAA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C,EAAU;QAC9C,IAAI,CAAC,EAAE;YAAE,OAAO,EAAE,CAAA;QAElB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuFT;YACD,SAAS,EAAE,EAAE,EAAE,EAAE;SAClB,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAA;IACtC,CAAC;IAEO,aAAa,CAAC,KAAa;QACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;;AAlT2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DAA0B;AAC5C;IAAR,KAAK,EAAE;;qDAAiB;AA1Id,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CA4bjC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport gql from 'graphql-tag'\nimport { INVOICE_TYPE } from './tax-invoice-list-page'\n\n@customElement('tax-invoice-detail-popup')\nexport class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n width: 100%;\n padding: 15px;\n font-size: 14px;\n overflow-y: scroll;\n }\n\n input {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n padding: var(--spacing-small) var(--spacing-medium);\n max-width: 100px;\n font: var(--input-font);\n }\n\n table {\n border: solid;\n border-width: 2px 0;\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n .title table {\n border-color: #d3dbe5;\n width: 100%;\n height: 33px;\n\n th {\n background-color: #e9edf6;\n }\n td {\n padding-left: 10px;\n }\n }\n\n div.body {\n margin-top: 15px;\n font-size: 14px;\n\n div.data {\n display: flex;\n margin-top: 5px;\n\n table {\n flex: 1;\n\n td,\n th {\n padding: 5px;\n min-width: 60px;\n }\n td {\n padding-left: 8px;\n }\n th.target {\n width: 25px;\n writing-mode: vertical-rl;\n min-width: unset;\n }\n\n &.supplier {\n border-color: #f64843;\n\n td,\n th {\n background-color: #fef5f7;\n border: solid 1.5px #f5b1b1;\n }\n th.target {\n background-color: #fedbde;\n }\n }\n &.buyer {\n border-color: #007ed9;\n\n td,\n th {\n background-color: #f7f7ff;\n border: solid 1.5px #a7bcff;\n }\n th.target {\n background-color: #c6daf6;\n }\n }\n }\n }\n\n div.items,\n div.info,\n div.summary {\n margin-top: 15px;\n\n table {\n width: 100%;\n border-color: #000;\n border-width: 2px 0px 0px 0px;\n\n th {\n background-color: #e9edf5;\n }\n th,\n td {\n border: solid 1.5px #c4d2ff;\n padding: 5px;\n text-align: center;\n }\n }\n }\n\n div.summary {\n display: flex;\n\n & > table {\n flex: 6.7;\n }\n & > div {\n flex: 3.2;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1.5px solid #c4d2ff;\n border-top: 2px solid #000;\n }\n }\n }\n `\n ]\n\n @property({ type: String }) taxInvoiceId: string = ''\n @state() detail: any = {}\n\n render() {\n return html`\n <div class=\"title\">\n <table>\n <tr>\n <th>${i18next.t('field.approval no')}</th>\n <td>${this.detail?.approvalNo?.replace(/(\\S{8})(\\S{8})(\\S{8})/g, '$1-$2-$3')}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"body\">\n <div class=\"invoice-type\">* ${INVOICE_TYPE[this.detail.invoiceType]}</div>\n <div class=\"data\">\n <table class=\"supplier\">\n <colgroup>\n <col width=\"150px\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n </colgroup>\n <tr>\n <th rowspan=\"6\" class=\"target\">${i18next.t('field.tax invoice supplier')}</th>\n <th>${i18next.t('field.short business registration number')}</th>\n <td>${this.detail?.supplierBusinessRegistrationNumber?.replace(/(\\d{3})(\\d{2})(\\d{5})/g, '$1-$2-$3')}</td>\n <th>${i18next.t('field.short branch identification')}</th>\n <td>${this.detail.supplierBranchIdentification}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.short tax invoice business name')}</th>\n <td>${this.detail.supplierBusinessName}</td>\n <th>${i18next.t('field.short representative name')}</th>\n <td>${this.detail.supplierRepresentativeName}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.address')}</th>\n <td colspan=\"3\">${this.detail.supplierAddress}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.business type')}</th>\n <td>${this.detail.supplierBusinessType}</td>\n <th>${i18next.t('field.industry type')}</th>\n <td>${this.detail.supplierIndustryType}</td>\n </tr>\n <tr>\n <th rowspan=\"2\">${i18next.t('field.email')}</th>\n <td rowspan=\"2\" colspan=\"3\">${this.detail.supplierContactEmail}</td>\n </tr>\n <tr></tr>\n </table>\n\n <table class=\"buyer\">\n <colgroup>\n <col width=\"150px\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n </colgroup>\n <tr>\n <th rowspan=\"6\" class=\"target\">${i18next.t('field.tax invoice buyer')}</th>\n <th>${i18next.t('field.short business registration number')}</th>\n <td>${this.detail?.buyerBusinessRegistrationNumber?.replace(/(\\d{3})(\\d{2})(\\d{5})/g, '$1-$2-$3')}</td>\n <th>${i18next.t('field.short branch identification')}</th>\n <td>${this.detail.buyerBranchIdentification}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.short tax invoice business name')}</th>\n <td>${this.detail.buyerBusinessName}</td>\n <th>${i18next.t('field.short representative name')}</th>\n <td>${this.detail.buyerRepresentativeName}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.address')}</th>\n <td colspan=\"3\">${this.detail.buyerAddress}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.business type')}</th>\n <td>${this.detail.buyerBusinessType}</td>\n <th>${i18next.t('field.industry type')}</th>\n <td>${this.detail.buyerIndustryType}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.email')}</th>\n <td colspan=\"3\">${this.detail.buyer1stContactEmail}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.email')}</th>\n <td colspan=\"3\">${this.detail.buyer2ndContactEmail}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"info\">\n <table>\n <colgroup>\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"40%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.issue date')}</th>\n <th>${i18next.t('field.supply amount')}</th>\n <th>${i18next.t('field.tax amount')}</th>\n <th>${i18next.t('field.modification reason')}</th>\n <th>${i18next.t('field.remark0')}</th>\n </tr>\n <tr>\n <td>${this.detail.issueDate?.split('T')[0]}</td>\n <td>${this._numberFormat(this.detail.supplyAmount)}</td>\n <td>${this._numberFormat(this.detail.taxAmount)}</td>\n <td>${this.detail.modificationReason}</td>\n <td>${this.detail.remark0}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"items\">\n <table>\n <colgroup>\n <col width=\"4%\" />\n <col width=\"4%\" />\n <col width=\"15%\" />\n <col width=\"9%\" />\n <col width=\"9%\" />\n <col width=\"13%\" />\n <col width=\"13%\" />\n <col width=\"13%\" />\n <col width=\"20%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.tax invoice month')}</th>\n <th>${i18next.t('field.tax invoice day')}</th>\n <th>${i18next.t('field.tax invoice item name')}</th>\n <th>${i18next.t('field.tax invoice ea')}</th>\n <th>${i18next.t('field.tax invoice quantity')}</th>\n <th>${i18next.t('field.tax invoice price')}</th>\n <th>${i18next.t('field.supply amount')}</th>\n <th>${i18next.t('field.tax amount')}</th>\n <th>${i18next.t('field.remark0')}</th>\n </tr>\n\n ${this.detail.taxInvoiceItems?.map(\n item => html`\n <tr>\n <td>${item.supplyDate.split('-')[1]}</td>\n <td>${item.supplyDate.split('-')[2]?.split('T')[0]}</td>\n <td>${item.itemName}</td>\n <td>${item.specification}</td>\n <td>${item.quantity}</td>\n <td>${this._numberFormat(item.unitPrice)}</td>\n <td>${this._numberFormat(item.supplyPrice)}</td>\n <td>${this._numberFormat(item.taxPrice)}</td>\n <td>${item.remark}</td>\n </tr>\n `\n )}\n </table>\n </div>\n\n <div class=\"summary\">\n <table>\n <colgroup>\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.total amount')}</th>\n <th>${i18next.t('field.tax invoice payment cash')}</th>\n <th>${i18next.t('field.tax invoice payment check')}</th>\n <th>${i18next.t('field.tax invoice payment promissory note')}</th>\n <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>\n </tr>\n <tr>\n <td>${this._numberFormat(this.detail.totalAmount)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountCash)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountCheck)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountPromissoryNote)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountAccountsReceivable)}</td>\n </tr>\n </table>\n <div>\n ${i18next.t('text.tax invoice description payment', {\n value: i18next.t(`text.tax invoice description purpose ${this.detail.purpose}`)\n })}\n </div>\n </div>\n </div>\n `\n }\n\n async updated(changed) {\n if (changed.has('taxInvoiceId')) {\n this.detail = await this.getTaxInvoiceDetailById(this.taxInvoiceId)\n }\n }\n\n private async getTaxInvoiceDetailById(id: string) {\n if (!id) return {}\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n responses: taxInvoice(id: $id) {\n id\n category\n approvalNo\n originalApprovalNo\n issueDate\n signatureDate\n invoiceType\n purpose\n revisedReason\n remark0\n remark1\n remark2\n supplierBusinessRegistrationCategory\n supplierBusinessRegistrationNumber\n supplierBranchIdentification\n supplierBusinessName\n supplierRepresentativeName\n supplierAddress\n supplierBusinessType\n supplierIndustryType\n supplierDepartment\n supplierContactName\n supplierContactPhone\n supplierContactEmail\n supplierContactCellPhone\n buyerBusinessRegistrationCategory\n buyerBusinessRegistrationNumber\n buyerBranchIdentification\n buyerBusinessName\n buyerRepresentativeName\n buyerAddress\n buyerBusinessType\n buyerIndustryType\n buyer1stDepartment\n buyer1stContactName\n buyer1stContactPhone\n buyer1stContactEmail\n buyer1stContactCellPhone\n buyer2ndDepartment\n buyer2ndContactName\n buyer2ndContactPhone\n buyer2ndContactEmail\n buyer2ndContactCellPhone\n agentBusinessRegistrationCategory\n agentBusinessRegistrationNumber\n agentBranchIdentification\n agentBusinessName\n agentRepresentativeName\n agentAddress\n agentBusinessType\n agentIndustryType\n agentDepartment\n agentContactName\n agentContactPhone\n agentContactEmail\n agentContactCellPhone\n paymentAmountCash\n paymentAmountCheck\n paymentAmountPromissoryNote\n paymentAmountAccountsReceivable\n supplyAmount\n taxAmount\n totalAmount\n createdAt\n updater {\n id\n name\n }\n updatedAt\n\n taxInvoiceItems {\n id\n sequence\n supplyDate\n itemName\n specification\n quantity\n unitPrice\n supplyPrice\n taxPrice\n remark\n }\n }\n }\n `,\n variables: { id }\n })\n\n return response.data.responses || {}\n }\n\n private _numberFormat(value: number): string {\n return !value ? '' : new Intl.NumberFormat('en-US').format(value)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tax-invoice-detail-popup.js","sourceRoot":"","sources":["../../../client/pages/tax-invoice/tax-invoice-detail-popup.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,eAAe,EA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+CAA+C,CAAC;;;oBAG1D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;oBAC3C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;oBACjD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;oBAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC;oBAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,+BAA+B,CAAC;;;;cAIrE,OAAO,CAAC,CAAC,CAAC,sCAAsC,EAAE;YAClD,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,wCAAwC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;SAChF,CAAC;;;;KAIT,CAAA;IACH,CAAC;IAEO,aAAa,CAAC,KAAa;QACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACnE,CAAC;;AA1S2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DAA0B;AAzI1C,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAobjC","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { QueryController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport gql from 'graphql-tag'\nimport { INVOICE_TYPE } from './tax-invoice-list-page'\n\n@customElement('tax-invoice-detail-popup')\nexport class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n width: 100%;\n padding: 15px;\n font-size: 14px;\n overflow-y: scroll;\n }\n\n input {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n padding: var(--spacing-small) var(--spacing-medium);\n max-width: 100px;\n font: var(--input-font);\n }\n\n table {\n border: solid;\n border-width: 2px 0;\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n .title table {\n border-color: #d3dbe5;\n width: 100%;\n height: 33px;\n\n th {\n background-color: #e9edf6;\n }\n td {\n padding-left: 10px;\n }\n }\n\n div.body {\n margin-top: 15px;\n font-size: 14px;\n\n div.data {\n display: flex;\n margin-top: 5px;\n\n table {\n flex: 1;\n\n td,\n th {\n padding: 5px;\n min-width: 60px;\n }\n td {\n padding-left: 8px;\n }\n th.target {\n width: 25px;\n writing-mode: vertical-rl;\n min-width: unset;\n }\n\n &.supplier {\n border-color: #f64843;\n\n td,\n th {\n background-color: #fef5f7;\n border: solid 1.5px #f5b1b1;\n }\n th.target {\n background-color: #fedbde;\n }\n }\n &.buyer {\n border-color: #007ed9;\n\n td,\n th {\n background-color: #f7f7ff;\n border: solid 1.5px #a7bcff;\n }\n th.target {\n background-color: #c6daf6;\n }\n }\n }\n }\n\n div.items,\n div.info,\n div.summary {\n margin-top: 15px;\n\n table {\n width: 100%;\n border-color: #000;\n border-width: 2px 0px 0px 0px;\n\n th {\n background-color: #e9edf5;\n }\n th,\n td {\n border: solid 1.5px #c4d2ff;\n padding: 5px;\n text-align: center;\n }\n }\n }\n\n div.summary {\n display: flex;\n\n & > table {\n flex: 6.7;\n }\n & > div {\n flex: 3.2;\n display: flex;\n justify-content: center;\n align-items: center;\n border: 1.5px solid #c4d2ff;\n border-top: 2px solid #000;\n }\n }\n }\n `\n ]\n\n @property({ type: String }) taxInvoiceId: string = ''\n /* The invoice the popup was opened for (ADR-0190). */\n private invoice = new QueryController(\n this,\n gql`\n query ($id: String!) {\n responses: taxInvoice(id: $id) {\n id\n category\n approvalNo\n originalApprovalNo\n issueDate\n signatureDate\n invoiceType\n purpose\n revisedReason\n remark0\n remark1\n remark2\n supplierBusinessRegistrationCategory\n supplierBusinessRegistrationNumber\n supplierBranchIdentification\n supplierBusinessName\n supplierRepresentativeName\n supplierAddress\n supplierBusinessType\n supplierIndustryType\n supplierDepartment\n supplierContactName\n supplierContactPhone\n supplierContactEmail\n supplierContactCellPhone\n buyerBusinessRegistrationCategory\n buyerBusinessRegistrationNumber\n buyerBranchIdentification\n buyerBusinessName\n buyerRepresentativeName\n buyerAddress\n buyerBusinessType\n buyerIndustryType\n buyer1stDepartment\n buyer1stContactName\n buyer1stContactPhone\n buyer1stContactEmail\n buyer1stContactCellPhone\n buyer2ndDepartment\n buyer2ndContactName\n buyer2ndContactPhone\n buyer2ndContactEmail\n buyer2ndContactCellPhone\n agentBusinessRegistrationCategory\n agentBusinessRegistrationNumber\n agentBranchIdentification\n agentBusinessName\n agentRepresentativeName\n agentAddress\n agentBusinessType\n agentIndustryType\n agentDepartment\n agentContactName\n agentContactPhone\n agentContactEmail\n agentContactCellPhone\n paymentAmountCash\n paymentAmountCheck\n paymentAmountPromissoryNote\n paymentAmountAccountsReceivable\n supplyAmount\n taxAmount\n totalAmount\n createdAt\n updater {\n id\n name\n }\n updatedAt\n\n taxInvoiceItems {\n id\n sequence\n supplyDate\n itemName\n specification\n quantity\n unitPrice\n supplyPrice\n taxPrice\n remark\n }\n }\n }\n `,\n { variables: () => (this.taxInvoiceId ? { id: this.taxInvoiceId } : undefined) }\n )\n\n get detail(): any {\n return this.invoice.data?.responses || {}\n }\n\n render() {\n return html`\n <div class=\"title\">\n <table>\n <tr>\n <th>${i18next.t('field.approval no')}</th>\n <td>${this.detail?.approvalNo?.replace(/(\\S{8})(\\S{8})(\\S{8})/g, '$1-$2-$3')}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"body\">\n <div class=\"invoice-type\">* ${INVOICE_TYPE[this.detail.invoiceType]}</div>\n <div class=\"data\">\n <table class=\"supplier\">\n <colgroup>\n <col width=\"150px\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n </colgroup>\n <tr>\n <th rowspan=\"6\" class=\"target\">${i18next.t('field.tax invoice supplier')}</th>\n <th>${i18next.t('field.short business registration number')}</th>\n <td>${this.detail?.supplierBusinessRegistrationNumber?.replace(/(\\d{3})(\\d{2})(\\d{5})/g, '$1-$2-$3')}</td>\n <th>${i18next.t('field.short branch identification')}</th>\n <td>${this.detail.supplierBranchIdentification}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.short tax invoice business name')}</th>\n <td>${this.detail.supplierBusinessName}</td>\n <th>${i18next.t('field.short representative name')}</th>\n <td>${this.detail.supplierRepresentativeName}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.address')}</th>\n <td colspan=\"3\">${this.detail.supplierAddress}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.business type')}</th>\n <td>${this.detail.supplierBusinessType}</td>\n <th>${i18next.t('field.industry type')}</th>\n <td>${this.detail.supplierIndustryType}</td>\n </tr>\n <tr>\n <th rowspan=\"2\">${i18next.t('field.email')}</th>\n <td rowspan=\"2\" colspan=\"3\">${this.detail.supplierContactEmail}</td>\n </tr>\n <tr></tr>\n </table>\n\n <table class=\"buyer\">\n <colgroup>\n <col width=\"150px\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n <col width=\"18%\" />\n <col width=\"32%\" />\n </colgroup>\n <tr>\n <th rowspan=\"6\" class=\"target\">${i18next.t('field.tax invoice buyer')}</th>\n <th>${i18next.t('field.short business registration number')}</th>\n <td>${this.detail?.buyerBusinessRegistrationNumber?.replace(/(\\d{3})(\\d{2})(\\d{5})/g, '$1-$2-$3')}</td>\n <th>${i18next.t('field.short branch identification')}</th>\n <td>${this.detail.buyerBranchIdentification}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.short tax invoice business name')}</th>\n <td>${this.detail.buyerBusinessName}</td>\n <th>${i18next.t('field.short representative name')}</th>\n <td>${this.detail.buyerRepresentativeName}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.address')}</th>\n <td colspan=\"3\">${this.detail.buyerAddress}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.business type')}</th>\n <td>${this.detail.buyerBusinessType}</td>\n <th>${i18next.t('field.industry type')}</th>\n <td>${this.detail.buyerIndustryType}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.email')}</th>\n <td colspan=\"3\">${this.detail.buyer1stContactEmail}</td>\n </tr>\n <tr>\n <th>${i18next.t('field.email')}</th>\n <td colspan=\"3\">${this.detail.buyer2ndContactEmail}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"info\">\n <table>\n <colgroup>\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"15%\" />\n <col width=\"40%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.issue date')}</th>\n <th>${i18next.t('field.supply amount')}</th>\n <th>${i18next.t('field.tax amount')}</th>\n <th>${i18next.t('field.modification reason')}</th>\n <th>${i18next.t('field.remark0')}</th>\n </tr>\n <tr>\n <td>${this.detail.issueDate?.split('T')[0]}</td>\n <td>${this._numberFormat(this.detail.supplyAmount)}</td>\n <td>${this._numberFormat(this.detail.taxAmount)}</td>\n <td>${this.detail.modificationReason}</td>\n <td>${this.detail.remark0}</td>\n </tr>\n </table>\n </div>\n\n <div class=\"items\">\n <table>\n <colgroup>\n <col width=\"4%\" />\n <col width=\"4%\" />\n <col width=\"15%\" />\n <col width=\"9%\" />\n <col width=\"9%\" />\n <col width=\"13%\" />\n <col width=\"13%\" />\n <col width=\"13%\" />\n <col width=\"20%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.tax invoice month')}</th>\n <th>${i18next.t('field.tax invoice day')}</th>\n <th>${i18next.t('field.tax invoice item name')}</th>\n <th>${i18next.t('field.tax invoice ea')}</th>\n <th>${i18next.t('field.tax invoice quantity')}</th>\n <th>${i18next.t('field.tax invoice price')}</th>\n <th>${i18next.t('field.supply amount')}</th>\n <th>${i18next.t('field.tax amount')}</th>\n <th>${i18next.t('field.remark0')}</th>\n </tr>\n\n ${this.detail.taxInvoiceItems?.map(\n item => html`\n <tr>\n <td>${item.supplyDate.split('-')[1]}</td>\n <td>${item.supplyDate.split('-')[2]?.split('T')[0]}</td>\n <td>${item.itemName}</td>\n <td>${item.specification}</td>\n <td>${item.quantity}</td>\n <td>${this._numberFormat(item.unitPrice)}</td>\n <td>${this._numberFormat(item.supplyPrice)}</td>\n <td>${this._numberFormat(item.taxPrice)}</td>\n <td>${item.remark}</td>\n </tr>\n `\n )}\n </table>\n </div>\n\n <div class=\"summary\">\n <table>\n <colgroup>\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n <col width=\"20%\" />\n </colgroup>\n <tr>\n <th>${i18next.t('field.total amount')}</th>\n <th>${i18next.t('field.tax invoice payment cash')}</th>\n <th>${i18next.t('field.tax invoice payment check')}</th>\n <th>${i18next.t('field.tax invoice payment promissory note')}</th>\n <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>\n </tr>\n <tr>\n <td>${this._numberFormat(this.detail.totalAmount)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountCash)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountCheck)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountPromissoryNote)}</td>\n <td>${this._numberFormat(this.detail.paymentAmountAccountsReceivable)}</td>\n </tr>\n </table>\n <div>\n ${i18next.t('text.tax invoice description payment', {\n value: i18next.t(`text.tax invoice description purpose ${this.detail.purpose}`)\n })}\n </div>\n </div>\n </div>\n `\n }\n\n private _numberFormat(value: number): string {\n return !value ? '' : new Intl.NumberFormat('en-US').format(value)\n }\n}\n"]}
|