@things-factory/tax-invoice 6.2.147 → 6.2.152

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.
Files changed (34) hide show
  1. package/client/pages/tax-invoice-send/company-list-popup.ts +3 -0
  2. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +9 -898
  3. package/client/pages/tax-invoice-send/tax-invoice-send.ts +951 -0
  4. package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +3 -0
  5. package/dist-client/pages/tax-invoice-send/company-list-popup.js +3 -0
  6. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -1
  7. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +2 -79
  8. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +8 -796
  9. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  10. package/dist-client/pages/tax-invoice-send/tax-invoice-send.d.ts +112 -0
  11. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js +869 -0
  12. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js.map +1 -0
  13. package/dist-client/route.d.ts +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-server/service/index.js +1 -0
  16. package/dist-server/service/index.js.map +1 -1
  17. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +0 -4
  18. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
  19. package/dist-server/service/tax-invoice/tax-invoice-query.js +18 -6
  20. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -1
  21. package/dist-server/service/tax-invoice/tax-invoice-type.js +4 -0
  22. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
  23. package/dist-server/service/tax-invoice/tax-invoice-util.js +1 -0
  24. package/dist-server/service/tax-invoice/tax-invoice-util.js.map +1 -1
  25. package/dist-server/service/tax-invoice/tax-invoice.js +5 -0
  26. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  27. package/dist-server/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +3 -3
  29. package/server/service/index.ts +1 -0
  30. package/server/service/tax-invoice/tax-invoice-mutation.ts +0 -3
  31. package/server/service/tax-invoice/tax-invoice-query.ts +19 -7
  32. package/server/service/tax-invoice/tax-invoice-type.ts +3 -0
  33. package/server/service/tax-invoice/tax-invoice-util.ts +1 -0
  34. package/server/service/tax-invoice/tax-invoice.ts +4 -0
@@ -0,0 +1,869 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@operato/data-grist';
3
+ import { css, html, LitElement } from 'lit';
4
+ import { CommonGristStyles, ScrollbarStyles } from '@operato/styles';
5
+ import { property, customElement } from 'lit/decorators.js';
6
+ import { client } from '@operato/graphql';
7
+ import { i18next, localize } from '@operato/i18n';
8
+ import gql from 'graphql-tag';
9
+ import { BUSINESS_REGISTRATION_CATEGORY, BusinessRegistrationCategory, Category, INVOICE_TYPE, InvoiceType, PURPOSE, Purpose } from '../tax-invoice/tax-invoice-list-page';
10
+ import { openPopup } from '@operato/layout';
11
+ export const SHORT_INVOICE_TYPE = {
12
+ TAX_INVOICE: {
13
+ [InvoiceType.TAX_INVOICE]: '일반',
14
+ [InvoiceType.SMALL_BUSINESS_TAX_INVOICE]: '영세율',
15
+ [InvoiceType.CONSIGNMENT_TAX_INVOICE]: '위수탁',
16
+ [InvoiceType.SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE]: '위수탁영세율'
17
+ },
18
+ INVOICE: {
19
+ [InvoiceType.INVOICE]: '일반',
20
+ [InvoiceType.CONSIGNMENT_INVOICE]: '위수탁'
21
+ // [InvoiceType.IMPORT_INVOICE]: INVOICE_TYPE[IMPORT_INVOICE],
22
+ }
23
+ };
24
+ export const SHORT_BUSINESS_REGISTRATION_CATEGORY = {
25
+ [BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER]: '사업자',
26
+ [BusinessRegistrationCategory.RESIDENT_REGISTRATION_NUMBER]: '개인',
27
+ [BusinessRegistrationCategory.FOREIGNER_REGISTRATION_NUMBER]: '외국인'
28
+ };
29
+ let TaxInvoiceSend = class TaxInvoiceSend extends localize(i18next)(LitElement) {
30
+ constructor() {
31
+ super(...arguments);
32
+ // 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
33
+ this.today = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date());
34
+ this.isTaxFree = false;
35
+ this.defaultSupplier = {
36
+ supplierBusinessRegistrationCategory: '01',
37
+ supplierBusinessRegistrationNumber: '',
38
+ supplierBranchIdentification: '',
39
+ supplierBusinessName: '',
40
+ supplierRepresentativeName: ''
41
+ };
42
+ this.defaultBuyer = {
43
+ buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
44
+ buyerBusinessRegistrationNumber: '',
45
+ buyerBusinessName: '',
46
+ buyerRepresentativeName: ''
47
+ };
48
+ this.defaultTaxInvoice = {
49
+ invoiceType: InvoiceType.TAX_INVOICE,
50
+ category: Category.EXPORT,
51
+ issueDate: this.today,
52
+ purpose: Purpose.INVOICE,
53
+ supplyAmount: 0,
54
+ taxAmount: 0,
55
+ totalAmount: 0
56
+ };
57
+ this.defaultTaxInvoiceItem = {
58
+ sequence: new Date().getTime(),
59
+ supplyDate: '',
60
+ itemName: '',
61
+ specification: '',
62
+ quantity: 0,
63
+ unitPrice: 0,
64
+ supplyPrice: 0,
65
+ taxPrice: 0
66
+ };
67
+ this.supplier = this.defaultSupplier;
68
+ this.buyer = this.defaultBuyer;
69
+ this.taxInvoice = this.defaultTaxInvoice;
70
+ this.taxInvoiceItems = [Object.assign({}, this.defaultTaxInvoiceItem)];
71
+ }
72
+ render() {
73
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
74
+ return html `
75
+ <div class="invoice-type">
76
+ * ${INVOICE_TYPE[(_a = this.taxInvoice) === null || _a === void 0 ? void 0 : _a.invoiceType]} (${SHORT_BUSINESS_REGISTRATION_CATEGORY[this.buyer.buyerBusinessRegistrationCategory]})
77
+ </div>
78
+
79
+ <div class="title">
80
+ <table>
81
+ <tr>
82
+ <th>${i18next.t('field.short invoice type')}</th>
83
+ <td>
84
+ ${Object.keys(SHORT_INVOICE_TYPE['TAX_INVOICE']).map(key => {
85
+ const disabled = key !== InvoiceType.TAX_INVOICE && key !== InvoiceType.SMALL_BUSINESS_TAX_INVOICE;
86
+ const checked = key === InvoiceType.TAX_INVOICE;
87
+ return html `
88
+ <label for="${'tax_' + key}">${SHORT_INVOICE_TYPE['TAX_INVOICE'][key]}</label>
89
+ <input
90
+ type="radio"
91
+ id="${'tax_' + key}"
92
+ .value="${key}"
93
+ name="invoiceType"
94
+ ?checked=${checked}
95
+ ?disabled=${disabled}
96
+ @change=${this._onInputTaxInvoice}
97
+ />
98
+ `;
99
+ })}
100
+ </td>
101
+ <th>${i18next.t('field.tax invoice buyer registration category')}</th>
102
+ <td>
103
+ ${Object.keys(BUSINESS_REGISTRATION_CATEGORY).map(key => {
104
+ const disabled = key !== BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER;
105
+ const checked = key === BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER;
106
+ return html `
107
+ <label for="${'tax_' + key}">${BUSINESS_REGISTRATION_CATEGORY[key]}</label>
108
+ <input type="radio" id="${'tax_' + key}" value="${key}" name="buyerBusinessRegistrationCategory" ?checked=${checked} ?disabled=${disabled} />
109
+ `;
110
+ })}
111
+ </td>
112
+ </tr>
113
+ </table>
114
+ </div>
115
+
116
+ <div class="body">
117
+ <div class="header">
118
+ <span><button @click=${this._openSupplierPopup}>공급처 선택</button></span>
119
+ <span><button @click=${this._openBuyerPopup}>공급받는자 선택</button></span>
120
+ </div>
121
+
122
+ <div class="data">
123
+ <table class="supplier">
124
+ <colgroup>
125
+ <col width="150px" />
126
+ <col width="18%" />
127
+ <col width="32%" />
128
+ <col width="18%" />
129
+ <col width="32%" />
130
+ </colgroup>
131
+ <tr>
132
+ <th rowspan="6" class="target">${i18next.t('field.tax invoice supplier')}</th>
133
+ <th required>${i18next.t('field.short business registration number')}</th>
134
+ <td>${(_c = (_b = this.supplier) === null || _b === void 0 ? void 0 : _b.supplierBusinessRegistrationNumber) === null || _c === void 0 ? void 0 : _c.replace(/(\S{3})(\S{2})(\S{5})/g, '$1-$2-$3')}</td>
135
+ <th>${i18next.t('field.short branch identification')}</th>
136
+ <td>${(_d = this.supplier) === null || _d === void 0 ? void 0 : _d.supplierBranchIdentification}</td>
137
+ </tr>
138
+ <tr>
139
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
140
+ <td><input type="text" name="supplierBusinessName" .value=${((_e = this.supplier) === null || _e === void 0 ? void 0 : _e.supplierBusinessName) || ''} @input=${this._onInputTaxInvoice} /></td>
141
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
142
+ <td>
143
+ <input type="text" name="supplierRepresentativeName" .value=${((_f = this.supplier) === null || _f === void 0 ? void 0 : _f.supplierRepresentativeName) || ''} @input=${this._onInputTaxInvoice} />
144
+ </td>
145
+ </tr>
146
+ <tr>
147
+ <th>${i18next.t('field.address')}</th>
148
+ <td colspan="3">${(_g = this.supplier) === null || _g === void 0 ? void 0 : _g.supplierAddress}</td>
149
+ </tr>
150
+ <tr>
151
+ <th>${i18next.t('field.business type')}</th>
152
+ <td><input type="text" name="supplierBusinessType" .value=${((_h = this.supplier) === null || _h === void 0 ? void 0 : _h.supplierBusinessType) || ''} @input=${this._onInputTaxInvoice} /></td>
153
+ <th>${i18next.t('field.industry type')}</th>
154
+ <td><input type="text" name="supplierIndustryType" .value=${((_j = this.supplier) === null || _j === void 0 ? void 0 : _j.supplierIndustryType) || ''} @input=${this._onInputTaxInvoice} /></td>
155
+ </tr>
156
+ <tr>
157
+ <th rowspan="2">${i18next.t('field.email')}</th>
158
+ <td rowspan="2" colspan="3">
159
+ <input type="text" name="supplierContactEmail" .value=${((_k = this.supplier) === null || _k === void 0 ? void 0 : _k.supplierContactEmail) || ''} @input=${this._onInputTaxInvoice} />
160
+ </td>
161
+ </tr>
162
+ <tr></tr>
163
+ </table>
164
+
165
+ <table class="buyer">
166
+ <colgroup>
167
+ <col width="150px" />
168
+ <col width="18%" />
169
+ <col width="32%" />
170
+ <col width="18%" />
171
+ <col width="32%" />
172
+ </colgroup>
173
+ <tr>
174
+ <th rowspan="6" class="target">${i18next.t('field.tax invoice buyer')}</th>
175
+ <th required>${i18next.t('field.short business registration number')}</th>
176
+ <td>
177
+ <input
178
+ type="text"
179
+ maxlength="10"
180
+ name="buyerBusinessRegistrationNumber"
181
+ .value=${((_l = this.buyer) === null || _l === void 0 ? void 0 : _l.buyerBusinessRegistrationNumber) || ''}
182
+ @input=${this._onInputTaxInvoice}
183
+ />
184
+ </td>
185
+ <th>${i18next.t('field.short branch identification')}</th>
186
+ <td><input type="text" name="buyerBranchIdentification" .value=${((_m = this.buyer) === null || _m === void 0 ? void 0 : _m.buyerBranchIdentification) || ''} @input=${this._onInputTaxInvoice} /></td>
187
+ </tr>
188
+ <tr>
189
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
190
+ <td><input type="text" name="buyerBusinessName" .value=${((_o = this.buyer) === null || _o === void 0 ? void 0 : _o.buyerBusinessName) || ''} @input=${this._onInputTaxInvoice} /></td>
191
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
192
+ <td><input type="text" name="buyerRepresentativeName" .value=${((_p = this.buyer) === null || _p === void 0 ? void 0 : _p.buyerRepresentativeName) || ''} @input=${this._onInputTaxInvoice} /></td>
193
+ </tr>
194
+ <tr>
195
+ <th>${i18next.t('field.address')}</th>
196
+ <td colspan="3"><input type="text" name="buyerAddress" .value=${((_q = this.buyer) === null || _q === void 0 ? void 0 : _q.buyerAddress) || ''} @input=${this._onInputTaxInvoice} /></td>
197
+ </tr>
198
+ <tr>
199
+ <th>${i18next.t('field.business type')}</th>
200
+ <td><input type="text" name="buyerBusinessType" .value=${((_r = this.buyer) === null || _r === void 0 ? void 0 : _r.buyerBusinessType) || ''} @input=${this._onInputTaxInvoice} /></td>
201
+
202
+ <th>${i18next.t('field.industry type')}</th>
203
+ <td><input type="text" name="buyerIndustryType" .value=${((_s = this.buyer) === null || _s === void 0 ? void 0 : _s.buyerIndustryType) || ''} @input=${this._onInputTaxInvoice} /></td>
204
+ </tr>
205
+ <tr>
206
+ <th>${i18next.t('field.email')}</th>
207
+ <td colspan="3"><input type="text" name="buyer1stContactEmail" .value=${((_t = this.buyer) === null || _t === void 0 ? void 0 : _t.buyer1stContactEmail) || ''} @input=${this._onInputTaxInvoice} /></td>
208
+ </tr>
209
+ <tr>
210
+ <th>${i18next.t('field.email')}</th>
211
+ <td colspan="3"><input type="text" name="buyer2ndContactEmail" .value=${((_u = this.buyer) === null || _u === void 0 ? void 0 : _u.buyer2ndContactEmail) || ''} @input=${this._onInputTaxInvoice} /></td>
212
+ </tr>
213
+ </table>
214
+ </div>
215
+
216
+ <div class="info flex-column">
217
+ <div class="flex-row">
218
+ <div class="title" required>${i18next.t('field.issue date')}</div>
219
+ <div class="value">
220
+ <input type="date" name="issueDate" .value=${this.taxInvoice.issueDate} @input=${this._onInputTaxInvoice} />
221
+ <span class="desc">※ 작성일자는 공급 연월일을 의미함</span>
222
+ </div>
223
+ <div class="title">${i18next.t('field.remark0')}</div>
224
+ <div class="value"><input type="text" name="remark0" .value=${((_v = this.taxInvoice) === null || _v === void 0 ? void 0 : _v.remark0) || ''} @input=${this._onInputTaxInvoice} /></div>
225
+ </div>
226
+ <div class="flex-row">
227
+ <div class="title">${i18next.t('field.total amount')}</div>
228
+ <div class="value">${this._numberFormat((_w = this.taxInvoice) === null || _w === void 0 ? void 0 : _w.totalAmount)}</div>
229
+ <div class="title">${i18next.t('field.supply amount')}</div>
230
+ <div class="value">${this._numberFormat((_x = this.taxInvoice) === null || _x === void 0 ? void 0 : _x.supplyAmount)}</div>
231
+ <div class="title">${i18next.t('field.tax amount')}</div>
232
+ <div class="value">${this._numberFormat((_y = this.taxInvoice) === null || _y === void 0 ? void 0 : _y.taxAmount)}</div>
233
+ </div>
234
+ </div>
235
+
236
+ <div class="items">
237
+ <div class="desc desc-date">
238
+ ※ 아래 '품목'의 '월'은 상단 '작성일자'의 '월'이 자동 반영됩니다. 합계의 '계산' 버튼은 금액을 공급가액과 세액으로 계산할 수 있습니다.
239
+ </div>
240
+ <div class="desc"><button class="btn-add" @click=${this._onAddInvoiceItem}>품목추가</button> 품목은 최대 16개까지 추가, 삭제 가능</div>
241
+
242
+ <table>
243
+ <colgroup>
244
+ <col width="5%" />
245
+ <col width="5%" />
246
+ <col width="14%" />
247
+ <col width="7%" />
248
+ <col width="7%" />
249
+ <col width="12%" />
250
+ <col width="12%" />
251
+ <col width="12%" />
252
+ <col width="16%" />
253
+ <col width="8%" />
254
+ </colgroup>
255
+ <tr>
256
+ <th>${i18next.t('field.tax invoice month')}</th>
257
+ <th required>${i18next.t('field.tax invoice day')}</th>
258
+ <th required>${i18next.t('field.tax invoice item name')}</th>
259
+ <th>${i18next.t('field.tax invoice ea')}</th>
260
+ <th required>${i18next.t('field.tax invoice quantity')}</th>
261
+ <th required>${i18next.t('field.tax invoice price')}</th>
262
+ <th>${i18next.t('field.supply amount')}</th>
263
+ <th>${i18next.t('field.tax amount')}</th>
264
+ <th>${i18next.t('field.remark0')}</th>
265
+ <th>${i18next.t('field.delete')}</th>
266
+ </tr>
267
+
268
+ ${this.taxInvoiceItems.map((item, idx) => html `
269
+ <tr>
270
+ <input type="hidden" name="sequence" value=${item.sequence} />
271
+ <td>${this.taxInvoice.issueDate.split('-')[1]}</td>
272
+ <td><input type="text" numeric maxlength="2" name="supplyDate" @input=${e => this._onInputItem(e, idx)} /></td>
273
+ <td><input type="text" name="itemName" .value=${item.itemName} @input=${e => this._onInputItem(e, idx)} /></td>
274
+ <td><input type="text" name="specification" .value=${item.specification} @input=${e => this._onInputItem(e, idx)} /></td>
275
+ <td><input type="text" numeric name="quantity" .value=${this._numberFormat(item.quantity)} @input=${e => this._onInputItem(e, idx)} /></td>
276
+ <td><input type="text" numeric name="unitPrice" .value=${this._numberFormat(item.unitPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
277
+ <td><input type="text" numeric name="supplyPrice" .value=${this._numberFormat(item.supplyPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
278
+ <td>
279
+ <input
280
+ type="text"
281
+ numeric
282
+ name="taxPrice"
283
+ .value=${this._numberFormat(item.taxPrice)}
284
+ @input=${e => this._onInputItem(e, idx)}
285
+ .disabled=${this.isTaxFree}
286
+ />
287
+ </td>
288
+ <td><input type="text" name="remark" .value=${item.remark || ''} @input=${e => this._onInputItem(e, idx)} /></td>
289
+ <td><button class="btn-delete" @click=${e => this._onRemoveInvoiceItem(e, item.sequence)}>삭제</button></td>
290
+ </tr>
291
+ `)}
292
+ </table>
293
+ </div>
294
+
295
+ <div class="summary">
296
+ <table>
297
+ <colgroup>
298
+ <col width="25%" />
299
+ <col width="25%" />
300
+ <col width="25%" />
301
+ <col width="25%" />
302
+ </colgroup>
303
+ <tr>
304
+ <th>${i18next.t('field.tax invoice payment cash')}</th>
305
+ <th>${i18next.t('field.tax invoice payment check')}</th>
306
+ <th>${i18next.t('field.tax invoice payment promissory note')}</th>
307
+ <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>
308
+ </tr>
309
+ <tr>
310
+ <td><input type="text" numeric name="paymentAmountCash" .value=${((_z = this.taxInvoice) === null || _z === void 0 ? void 0 : _z.paymentAmountCash) || ''} @input=${this._onInputTaxInvoice} /></td>
311
+ <td><input type="text" numeric name="paymentAmountCheck" .value=${((_0 = this.taxInvoice) === null || _0 === void 0 ? void 0 : _0.paymentAmountCheck) || ''} @input=${this._onInputTaxInvoice} /></td>
312
+ <td>
313
+ <input
314
+ type="text"
315
+ numeric
316
+ name="paymentAmountPromissoryNote"
317
+ .value=${((_1 = this.taxInvoice) === null || _1 === void 0 ? void 0 : _1.paymentAmountPromissoryNote) || ''}
318
+ @input=${this._onInputTaxInvoice}
319
+ />
320
+ </td>
321
+ <td>
322
+ <input
323
+ type="text"
324
+ numeric
325
+ name="paymentAmountAccountsReceivable"
326
+ .value=${((_2 = this.taxInvoice) === null || _2 === void 0 ? void 0 : _2.paymentAmountAccountsReceivable) || ''}
327
+ @input=${this._onInputTaxInvoice}
328
+ />
329
+ </td>
330
+ </tr>
331
+ </table>
332
+ <div>
333
+ ${i18next.t('text.prev tax invoice description payment') + ' ('}
334
+ <span class="type-wrapper">
335
+ <div>
336
+ <input type="radio" id="purpose_20" name="purpose" .value=${Purpose.INVOICE} @change=${this._onInputTaxInvoice} checked />
337
+ <label for="purpose_20">${PURPOSE[Purpose.INVOICE]}</label>
338
+ </div>
339
+ <div>
340
+ <input type="radio" id="purpose_10" name="purpose" .value=${Purpose.RECEIPT} @change=${this._onInputTaxInvoice} />
341
+ <label for="purpose_10">${PURPOSE[Purpose.RECEIPT]}</label>
342
+ </div>
343
+ </span>
344
+ ${') ' + i18next.t('text.next tax invoice description payment')}
345
+ </div>
346
+ </div>
347
+ </div>
348
+ `;
349
+ }
350
+ async firstUpdated() {
351
+ this._fetchSupplier();
352
+ }
353
+ async _fetchSupplier() {
354
+ const response = await client.query({
355
+ query: gql `
356
+ query taxInvoiceDefaultCompany {
357
+ response: taxInvoiceDefaultCompany {
358
+ businessRegistrationNumber
359
+ branchIdentification
360
+ businessName
361
+ representativeName
362
+ address
363
+ businessType
364
+ industryType
365
+ department
366
+ contactName
367
+ contactPhone
368
+ contactEmail
369
+ contactCellPhone
370
+ }
371
+ }
372
+ `
373
+ });
374
+ const supplier = response.data.response;
375
+ this.supplier = {
376
+ supplierBusinessRegistrationCategory: supplier.businessRegistrationCategory,
377
+ supplierBusinessRegistrationNumber: supplier.businessRegistrationNumber,
378
+ supplierBranchIdentification: supplier.branchIdentification,
379
+ supplierBusinessName: supplier.businessName,
380
+ supplierRepresentativeName: supplier.representativeName,
381
+ supplierAddress: supplier.address,
382
+ supplierBusinessType: supplier.businessType,
383
+ supplierIndustryType: supplier.industryType,
384
+ supplierDepartment: supplier.department,
385
+ supplierContactName: supplier.contactName,
386
+ supplierContactPhone: supplier.contactPhone,
387
+ supplierContactEmail: supplier.contactEmail,
388
+ supplierContactCellPhone: supplier.contactCellPhone
389
+ };
390
+ }
391
+ _numberFormat(value) {
392
+ return !value ? '' : new Intl.NumberFormat('en-US').format(value) || '';
393
+ }
394
+ // Input 요소의 값이 변경될 때 호출되는 콜백 함수
395
+ _onInputTaxInvoice(event) {
396
+ const target = event.target;
397
+ // 숫자 타입은 다른 문자 입력 제거
398
+ if (target.hasAttribute('numeric')) {
399
+ target.value = target.value.replace(/\D/g, '');
400
+ }
401
+ if (target.name.startsWith('supplier')) {
402
+ this.supplier[target.name] = target.value;
403
+ }
404
+ else if (target.name.startsWith('buyer')) {
405
+ this.buyer[target.name] = target.value;
406
+ }
407
+ else {
408
+ // 날짜 체크가 오늘 날짜를 넘어가면 값 변경 되면 안됨
409
+ if (target.name === 'issueDate' && target.value > this.today) {
410
+ target.value = this.taxInvoice['issueDate'];
411
+ alert('작성일자는 현재일까지 입력하시기 바랍니다.');
412
+ return;
413
+ }
414
+ // 세금이 없는 영세율이 선택 시 모든 아이템의 세금 0원으로 초기화
415
+ if (target.name === 'invoiceType' && target.value === InvoiceType.SMALL_BUSINESS_TAX_INVOICE) {
416
+ this.isTaxFree = true;
417
+ this.taxInvoice = Object.assign(Object.assign({}, this.taxInvoice), { taxAmount: 0 });
418
+ this.taxInvoiceItems = this.taxInvoiceItems.map(item => (Object.assign(Object.assign({}, item), { taxPrice: 0 })));
419
+ }
420
+ // 변경시에는 아이템 변경도 리 렌더가 필요해서 데이터 갱신
421
+ this.taxInvoice[target.name] = target.value;
422
+ this.taxInvoice = Object.assign({}, this.taxInvoice);
423
+ }
424
+ }
425
+ // Input 요소의 값이 변경될 때 호출되는 콜백 함수
426
+ _onInputItem(e, idx) {
427
+ const target = e.target;
428
+ let inputVal = target.value;
429
+ // 숫자 타입은 다른 문자 입력 제거
430
+ if (target.hasAttribute('numeric')) {
431
+ inputVal = Number(inputVal.replace(/\D/g, ''));
432
+ target.value = inputVal;
433
+ }
434
+ // 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
435
+ if (target.name === 'supplyDate') {
436
+ const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.toString().padStart(2, '0');
437
+ if (itemDate > this.taxInvoice.issueDate) {
438
+ alert('품목의 일자는 작성일자보다 클 수 없습니다.');
439
+ target.value = '';
440
+ }
441
+ inputVal = itemDate;
442
+ }
443
+ // 수량, 단가 수정시 공급가액/세액 자동 계산
444
+ if (target.name == 'quantity' || target.name == 'unitPrice') {
445
+ const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity'];
446
+ this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice;
447
+ this.taxInvoiceItems[idx]['taxPrice'] = this.isTaxFree ? 0 : Math.floor(supplyPrice / 10);
448
+ }
449
+ // 인풋에 값 넣기
450
+ this.taxInvoiceItems[idx][target.name] = inputVal;
451
+ // 아이템 금액에 관련된 필드 수정시 합계 계산
452
+ if (['quantity', 'unitPrice', 'supplyPrice', 'taxPrice'].includes(target.name)) {
453
+ this.taxInvoiceItems = [...this.taxInvoiceItems];
454
+ this._setTaxInvoiceSummaryCalc();
455
+ }
456
+ }
457
+ async _openSupplierPopup() {
458
+ const response = await client.query({
459
+ query: gql `
460
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
461
+ responses: taxInvoiceApis(filters: $filters, pagination: $pagination, sortings: $sortings) {
462
+ items {
463
+ id
464
+ name: provider
465
+ businessRegistrationNumber
466
+ branchIdentification
467
+ businessName
468
+ representativeName
469
+ address
470
+ businessType
471
+ industryType
472
+ department
473
+ contactName
474
+ contactPhone
475
+ contactEmail
476
+ contactCellPhone
477
+ }
478
+ }
479
+ }
480
+ `
481
+ });
482
+ const items = response.data.responses.items || [];
483
+ openPopup(html `
484
+ <company-list-popup
485
+ .companyList=${items}
486
+ @selected=${e => {
487
+ this.supplier = {
488
+ supplierBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
489
+ supplierBusinessRegistrationNumber: e.detail.businessRegistrationNumber || '',
490
+ supplierBranchIdentification: e.detail.branchIdentification || '',
491
+ supplierBusinessName: e.detail.businessName || '',
492
+ supplierRepresentativeName: e.detail.representativeName || '',
493
+ supplierAddress: e.detail.address || '',
494
+ supplierBusinessType: e.detail.businessType || '',
495
+ supplierIndustryType: e.detail.industryType || '',
496
+ supplierDepartment: e.detail.department || '',
497
+ supplierContactName: e.detail.contactName || '',
498
+ supplierContactPhone: e.detail.contactPhone || '',
499
+ supplierContactEmail: e.detail.contactEmail || '',
500
+ supplierContactCellPhone: e.detail.contactCellPhone || ''
501
+ };
502
+ history.back();
503
+ }}
504
+ >
505
+ </company-list-popup>
506
+ `, {
507
+ backdrop: true,
508
+ size: 'large',
509
+ title: i18next.t('title.company list popup')
510
+ });
511
+ }
512
+ async _openBuyerPopup() {
513
+ const response = await client.query({
514
+ query: gql `
515
+ query TaxInvoiceBuyerList {
516
+ responses: taxInvoiceBuyerList {
517
+ id
518
+ name
519
+ businessRegistrationNumber
520
+ branchIdentification
521
+ businessName
522
+ representativeName
523
+ address
524
+ businessType
525
+ industryType
526
+ department
527
+ contactName
528
+ contactPhone
529
+ contactEmail
530
+ contactCellPhone
531
+ }
532
+ }
533
+ `
534
+ });
535
+ const items = response.data.responses || [];
536
+ openPopup(html `
537
+ <company-list-popup
538
+ .companyList=${items}
539
+ @selected=${e => {
540
+ this.buyer = {
541
+ buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
542
+ buyerBusinessRegistrationNumber: e.detail.businessRegistrationNumber || '',
543
+ buyerBranchIdentification: e.detail.branchIdentification || '',
544
+ buyerBusinessName: e.detail.businessName || '',
545
+ buyerRepresentativeName: e.detail.representativeName || '',
546
+ buyerAddress: e.detail.address || '',
547
+ buyerBusinessType: e.detail.businessType || '',
548
+ buyerIndustryType: e.detail.industryType || '',
549
+ buyer1stDepartment: e.detail.department || '',
550
+ buyer1stContactName: e.detail.contactName || '',
551
+ buyer1stContactPhone: e.detail.contactPhone || '',
552
+ buyer1stContactEmail: e.detail.contactEmail || '',
553
+ buyer1stContactCellPhone: e.detail.contactCellPhone || ''
554
+ };
555
+ history.back();
556
+ }}
557
+ >
558
+ </company-list-popup>
559
+ `, {
560
+ backdrop: true,
561
+ size: 'large',
562
+ title: i18next.t('title.company list popup')
563
+ });
564
+ }
565
+ _onAddInvoiceItem(e) {
566
+ e.preventDefault();
567
+ if (this.taxInvoiceItems.length >= 16) {
568
+ alert('품목은 최대 16개까지 추가 가능합니다.');
569
+ return;
570
+ }
571
+ this.taxInvoiceItems = [...this.taxInvoiceItems, Object.assign(Object.assign({}, this.defaultTaxInvoiceItem), { sequence: new Date().getTime() })];
572
+ }
573
+ _onRemoveInvoiceItem(e, sequence) {
574
+ e.preventDefault();
575
+ this.taxInvoiceItems = [...this.taxInvoiceItems.filter(item => item.sequence != sequence)];
576
+ this._setTaxInvoiceSummaryCalc();
577
+ }
578
+ _setTaxInvoiceSummaryCalc() {
579
+ const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.supplyPrice), 0) || 0;
580
+ const taxPrice = this.isTaxFree ? 0 : this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.taxPrice), 0) || 0;
581
+ const totalAmount = supplyPrice + taxPrice;
582
+ this.taxInvoice = Object.assign(Object.assign({}, this.taxInvoice), { supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: totalAmount });
583
+ }
584
+ };
585
+ TaxInvoiceSend.styles = [
586
+ ScrollbarStyles,
587
+ CommonGristStyles,
588
+ css `
589
+ :host {
590
+ display: flex;
591
+ flex-direction: column;
592
+ overflow-y: auto;
593
+ overflow-x: hidden;
594
+
595
+ width: 100%;
596
+ min-width: 850px;
597
+ padding: 0 40px 40px 40px;
598
+
599
+ --grid-record-emphasized-background-color: red;
600
+ --grid-record-emphasized-color: yellow;
601
+ }
602
+
603
+ .flex-row {
604
+ display: flex;
605
+ flex-direction: row;
606
+ }
607
+ .flex-column {
608
+ display: flex;
609
+ flex-direction: column;
610
+ }
611
+
612
+ input[type='text'],
613
+ input[type='date'],
614
+ input[type='number'] {
615
+ width: 85%;
616
+ max-width: calc(100% - 12px);
617
+ height: 14px;
618
+ margin: 0;
619
+ padding: 4px 5px 5px;
620
+ line-height: 14px;
621
+ border: 1px solid #bbb;
622
+ background: #fff;
623
+ letter-spacing: 0.5px;
624
+ }
625
+ input[type='date'] {
626
+ width: auto;
627
+ }
628
+ input[readonly],
629
+ input:disabled {
630
+ background-color: #eee;
631
+ }
632
+
633
+ div.invoice-type {
634
+ font-size: 18px;
635
+ margin-top: 15px;
636
+ }
637
+
638
+ table {
639
+ border: solid;
640
+ border-width: 2px 0;
641
+ border-collapse: collapse;
642
+ border-spacing: 0;
643
+ }
644
+
645
+ .title table {
646
+ border-color: #d3dbe5;
647
+ width: 100%;
648
+ height: 33px;
649
+ margin-top: 10px;
650
+ font-size: 12px;
651
+
652
+ th {
653
+ font-size: 13px;
654
+ background-color: #e9edf6;
655
+ min-width: 140px;
656
+ }
657
+ td {
658
+ width: 50%;
659
+ padding-left: 10px;
660
+
661
+ & > * {
662
+ vertical-align: middle;
663
+ }
664
+ & > input {
665
+ margin: 0 5px 0 1px;
666
+ }
667
+ }
668
+ }
669
+
670
+ div.body {
671
+ margin-top: 15px;
672
+ font-size: 14px;
673
+
674
+ div.data {
675
+ display: flex;
676
+ margin-top: 5px;
677
+
678
+ table {
679
+ flex: 1;
680
+
681
+ td,
682
+ th {
683
+ padding: 5px;
684
+ min-width: 60px;
685
+ }
686
+ td {
687
+ padding-left: 8px;
688
+ }
689
+ th.target {
690
+ width: 25px;
691
+ writing-mode: vertical-rl;
692
+ min-width: unset;
693
+ }
694
+
695
+ &.supplier {
696
+ border-color: #f64843;
697
+
698
+ td,
699
+ th {
700
+ background-color: #fef5f7;
701
+ border: solid 1.5px #f5b1b1;
702
+ }
703
+ th.target {
704
+ background-color: #fedbde;
705
+ }
706
+ }
707
+ &.buyer {
708
+ border-color: #007ed9;
709
+
710
+ td,
711
+ th {
712
+ background-color: #f7f7ff;
713
+ border: solid 1.5px #a7bcff;
714
+ }
715
+ th.target {
716
+ background-color: #c6daf6;
717
+ }
718
+ }
719
+ }
720
+ }
721
+
722
+ div.header {
723
+ display: flex;
724
+
725
+ span {
726
+ flex: 1;
727
+ }
728
+ }
729
+
730
+ div.info {
731
+ margin-top: 15px;
732
+ border: solid;
733
+ border-color: #000;
734
+ border-width: 2px 0px 0px 0px;
735
+
736
+ div.flex-row div {
737
+ border: solid #c4d2ff;
738
+ border-width: 0px 1.5px 1.5px 1.5px;
739
+ margin-right: -1px;
740
+ padding: 5px;
741
+ text-align: center;
742
+
743
+ &.title {
744
+ background-color: #e9edf5;
745
+ font-weight: bold;
746
+ flex: 1;
747
+ }
748
+ &.value {
749
+ flex: 3;
750
+ text-align: left;
751
+
752
+ .desc {
753
+ font-size: 11px;
754
+ color: #c90000;
755
+ }
756
+ }
757
+ }
758
+ }
759
+
760
+ div.items,
761
+ div.summary {
762
+ margin-top: 20px;
763
+
764
+ table {
765
+ width: 100%;
766
+ border-color: #000;
767
+ border-width: 2px 0px 0px 0px;
768
+
769
+ th {
770
+ background-color: #e9edf5;
771
+ }
772
+ th,
773
+ td {
774
+ border: solid 1.5px #c4d2ff;
775
+ padding: 5px;
776
+ text-align: center;
777
+ }
778
+ }
779
+ }
780
+
781
+ div.summary {
782
+ display: flex;
783
+
784
+ & > table {
785
+ flex: 6.7;
786
+ }
787
+ & > div {
788
+ flex: 3.2;
789
+ display: flex;
790
+ justify-content: center;
791
+ align-items: center;
792
+ border: 1.5px solid #c4d2ff;
793
+ border-top: 2px solid #000;
794
+ }
795
+
796
+ span.type-wrapper {
797
+ margin: 0 10px;
798
+
799
+ & > div {
800
+ display: flex;
801
+ justify-content: center;
802
+ align-items: center;
803
+ gap: 4px;
804
+
805
+ input[type='radio' i] {
806
+ margin: 0px;
807
+ }
808
+ }
809
+ }
810
+ }
811
+
812
+ div.items {
813
+ div.desc {
814
+ font-weight: 400;
815
+ font-size: 12px;
816
+ margin-bottom: 5px;
817
+ }
818
+ div.desc-date {
819
+ color: #005d98;
820
+ }
821
+ button {
822
+ font-size: 13px;
823
+ height: 25px;
824
+ cursor: pointer;
825
+ text-align: center;
826
+ font-weight: 600;
827
+ border-radius: 2px;
828
+ border-color: #ccc;
829
+ }
830
+ .btn-add {
831
+ color: #333;
832
+ background-color: #f9f9f9;
833
+ }
834
+ .btn-delete {
835
+ color: #fff;
836
+ background-color: #5c636e;
837
+ border: none;
838
+ }
839
+ }
840
+
841
+ *[required]::before {
842
+ content: '*';
843
+ color: red;
844
+ margin-right: 2px;
845
+ }
846
+ }
847
+ `
848
+ ];
849
+ __decorate([
850
+ property({ type: Object }),
851
+ __metadata("design:type", Object)
852
+ ], TaxInvoiceSend.prototype, "supplier", void 0);
853
+ __decorate([
854
+ property({ type: Object }),
855
+ __metadata("design:type", Object)
856
+ ], TaxInvoiceSend.prototype, "buyer", void 0);
857
+ __decorate([
858
+ property({ type: Object }),
859
+ __metadata("design:type", Object)
860
+ ], TaxInvoiceSend.prototype, "taxInvoice", void 0);
861
+ __decorate([
862
+ property({ type: Array }),
863
+ __metadata("design:type", Array)
864
+ ], TaxInvoiceSend.prototype, "taxInvoiceItems", void 0);
865
+ TaxInvoiceSend = __decorate([
866
+ customElement('tax-invoice-send')
867
+ ], TaxInvoiceSend);
868
+ export { TaxInvoiceSend };
869
+ //# sourceMappingURL=tax-invoice-send.js.map