@things-factory/tax-invoice 6.2.147 → 6.2.149

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