@things-factory/tax-invoice 6.2.90 → 6.2.96

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.
@@ -9,7 +9,7 @@ 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 } from '../tax-invoice/tax-invoice-list-page';
12
+ import { BUSINESS_REGISTRATION_CATEGORY, BusinessRegistrationCategory, Category, INVOICE_TYPE, InvoiceType, PURPOSE, Purpose } from '../tax-invoice/tax-invoice-list-page';
13
13
  const SHORT_INVOICE_TYPE = {
14
14
  TAX_INVOICE: {
15
15
  [InvoiceType.TAX_INVOICE]: '일반',
@@ -31,8 +31,18 @@ const SHORT_BUSINESS_REGISTRATION_CATEGORY = {
31
31
  let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
32
32
  constructor() {
33
33
  super(...arguments);
34
+ this.today = new Intl.DateTimeFormat('ko-KR', {
35
+ timeZone: 'Asia/Seoul',
36
+ year: 'numeric',
37
+ month: '2-digit',
38
+ day: '2-digit'
39
+ })
40
+ .format(new Date())
41
+ .replace(/[.\s]/g, '')
42
+ .replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3');
34
43
  this.supplier = {
35
44
  supplierBusinessRegistrationNumber: '',
45
+ supplierBranchIdentification: '',
36
46
  supplierBusinessName: '',
37
47
  supplierRepresentativeName: ''
38
48
  };
@@ -45,11 +55,23 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
45
55
  this.taxInvoice = {
46
56
  invoiceType: InvoiceType.TAX_INVOICE,
47
57
  category: Category.EXPORT,
48
- issueDate: null,
49
- purpose: Purpose.RECEIPT,
58
+ issueDate: this.today,
59
+ purpose: Purpose.INVOICE,
50
60
  supplyAmount: 0,
61
+ taxAmount: 0,
51
62
  totalAmount: 0
52
63
  };
64
+ this.defaultTaxInvoiceItem = {
65
+ sequence: new Date().getTime(),
66
+ supplyDate: '',
67
+ itemName: '',
68
+ specification: '',
69
+ quantity: 0,
70
+ unitPrice: 0,
71
+ supplyPrice: 0,
72
+ taxPrice: 0
73
+ };
74
+ this.taxInvoiceItems = [Object.assign({}, this.defaultTaxInvoiceItem)];
53
75
  }
54
76
  get context() {
55
77
  return {
@@ -61,7 +83,7 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
61
83
  };
62
84
  }
63
85
  render() {
64
- 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, _3, _4, _5;
86
+ 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;
65
87
  return html `
66
88
  <div class="invoice-type">
67
89
  * ${INVOICE_TYPE[(_a = this.taxInvoice) === null || _a === void 0 ? void 0 : _a.invoiceType]} (${SHORT_BUSINESS_REGISTRATION_CATEGORY[this.buyer.buyerBusinessRegistrationCategory]})
@@ -109,16 +131,18 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
109
131
  </colgroup>
110
132
  <tr>
111
133
  <th rowspan="6" class="target">${i18next.t('field.tax invoice supplier')}</th>
112
- <th>${i18next.t('field.short business registration number')}</th>
113
- <td><input type="text" name="supplierBusinessRegistrationNumber" .value=${((_b = this.supplier) === null || _b === void 0 ? void 0 : _b.supplierBusinessRegistrationNumber) || ''} readonly /></td>
134
+ <th required>${i18next.t('field.short business registration number')}</th>
135
+ <td>${(_b = this.supplier) === null || _b === void 0 ? void 0 : _b.supplierBusinessRegistrationNumber.replace(/(\S{3})(\S{2})(\S{5})/g, '$1-$2-$3')}</td>
114
136
  <th>${i18next.t('field.short branch identification')}</th>
115
- <td><input type="text" name="supplierBranchIdentification" .value=${((_c = this.supplier) === null || _c === void 0 ? void 0 : _c.supplierBranchIdentification) || ''} readonly /></td>
137
+ <td>${(_c = this.supplier) === null || _c === void 0 ? void 0 : _c.supplierBranchIdentification}</td>
116
138
  </tr>
117
139
  <tr>
118
- <th>${i18next.t('field.short tax invoice business name')}</th>
140
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
119
141
  <td><input type="text" name="supplierBusinessName" .value=${((_d = this.supplier) === null || _d === void 0 ? void 0 : _d.supplierBusinessName) || ''} @input=${this._onInputTaxInvoice} /></td>
120
- <th>${i18next.t('field.short representative name')}</th>
121
- <td>${(_e = this.supplier) === null || _e === void 0 ? void 0 : _e.supplierRepresentativeName}</td>
142
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
143
+ <td>
144
+ <input type="text" name="supplierRepresentativeName" .value=${((_e = this.supplier) === null || _e === void 0 ? void 0 : _e.supplierRepresentativeName) || ''} @input=${this._onInputTaxInvoice} />
145
+ </td>
122
146
  </tr>
123
147
  <tr>
124
148
  <th>${i18next.t('field.address')}</th>
@@ -126,13 +150,15 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
126
150
  </tr>
127
151
  <tr>
128
152
  <th>${i18next.t('field.business type')}</th>
129
- <td>${(_g = this.supplier) === null || _g === void 0 ? void 0 : _g.supplierBusinessType}</td>
153
+ <td><input type="text" name="supplierBusinessType" .value=${((_g = this.supplier) === null || _g === void 0 ? void 0 : _g.supplierBusinessType) || ''} @input=${this._onInputTaxInvoice} /></td>
130
154
  <th>${i18next.t('field.industry type')}</th>
131
- <td>${(_h = this.supplier) === null || _h === void 0 ? void 0 : _h.supplierIndustryType}</td>
155
+ <td><input type="text" name="supplierIndustryType" .value=${((_h = this.supplier) === null || _h === void 0 ? void 0 : _h.supplierIndustryType) || ''} @input=${this._onInputTaxInvoice} /></td>
132
156
  </tr>
133
157
  <tr>
134
158
  <th rowspan="2">${i18next.t('field.email')}</th>
135
- <td rowspan="2" colspan="3">${(_j = this.supplier) === null || _j === void 0 ? void 0 : _j.supplierContactEmail}</td>
159
+ <td rowspan="2" colspan="3">
160
+ <input type="text" name="supplierContactEmail" .value=${((_j = this.supplier) === null || _j === void 0 ? void 0 : _j.supplierContactEmail) || ''} @input=${this._onInputTaxInvoice} />
161
+ </td>
136
162
  </tr>
137
163
  <tr></tr>
138
164
  </table>
@@ -147,73 +173,84 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
147
173
  </colgroup>
148
174
  <tr>
149
175
  <th rowspan="6" class="target">${i18next.t('field.tax invoice buyer')}</th>
150
- <th>${i18next.t('field.short business registration number')}</th>
151
- <td>${(_k = this.buyer) === null || _k === void 0 ? void 0 : _k.buyerBusinessRegistrationNumber}</td>
176
+ <th required>${i18next.t('field.short business registration number')}</th>
177
+ <td>
178
+ <input
179
+ type="text"
180
+ name="buyerBusinessRegistrationNumber"
181
+ .value=${((_k = this.buyer) === null || _k === void 0 ? void 0 : _k.buyerBusinessRegistrationNumber) || ''}
182
+ @input=${this._onInputTaxInvoice}
183
+ />
184
+ </td>
152
185
  <th>${i18next.t('field.short branch identification')}</th>
153
- <td>${(_l = this.buyer) === null || _l === void 0 ? void 0 : _l.buyerBranchIdentification}</td>
186
+ <td><input type="text" name="buyerBranchIdentification" .value=${((_l = this.buyer) === null || _l === void 0 ? void 0 : _l.buyerBranchIdentification) || ''} @input=${this._onInputTaxInvoice} /></td>
154
187
  </tr>
155
188
  <tr>
156
- <th>${i18next.t('field.short tax invoice business name')}</th>
157
- <td>${(_m = this.buyer) === null || _m === void 0 ? void 0 : _m.buyerBusinessName}</td>
158
- <th>${i18next.t('field.short representative name')}</th>
159
- <td>${(_o = this.buyer) === null || _o === void 0 ? void 0 : _o.buyerRepresentativeName}</td>
189
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
190
+ <td><input type="text" name="buyerBusinessName" .value=${((_m = this.buyer) === null || _m === void 0 ? void 0 : _m.buyerBusinessName) || ''} @input=${this._onInputTaxInvoice} /></td>
191
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
192
+ <td><input type="text" name="buyerRepresentativeName" .value=${((_o = this.buyer) === null || _o === void 0 ? void 0 : _o.buyerRepresentativeName) || ''} @input=${this._onInputTaxInvoice} /></td>
160
193
  </tr>
161
194
  <tr>
162
195
  <th>${i18next.t('field.address')}</th>
163
- <td colspan="3">${(_p = this.buyer) === null || _p === void 0 ? void 0 : _p.buyerAddress}</td>
196
+ <td colspan="3"><input type="text" name="buyerAddress" .value=${((_p = this.buyer) === null || _p === void 0 ? void 0 : _p.buyerAddress) || ''} @input=${this._onInputTaxInvoice} /></td>
164
197
  </tr>
165
198
  <tr>
166
199
  <th>${i18next.t('field.business type')}</th>
167
- <td>${(_q = this.buyer) === null || _q === void 0 ? void 0 : _q.buyerBusinessType}</td>
200
+ <td><input type="text" name="buyerBusinessType" .value=${((_q = this.buyer) === null || _q === void 0 ? void 0 : _q.buyerBusinessType) || ''} @input=${this._onInputTaxInvoice} /></td>
201
+
168
202
  <th>${i18next.t('field.industry type')}</th>
169
- <td>${(_r = this.buyer) === null || _r === void 0 ? void 0 : _r.buyerIndustryType}</td>
203
+ <td><input type="text" name="buyerIndustryType" .value=${((_r = this.buyer) === null || _r === void 0 ? void 0 : _r.buyerIndustryType) || ''} @input=${this._onInputTaxInvoice} /></td>
170
204
  </tr>
171
205
  <tr>
172
206
  <th>${i18next.t('field.email')}</th>
173
- <td colspan="3">${(_s = this.buyer) === null || _s === void 0 ? void 0 : _s.buyer1stContactEmail}</td>
207
+ <td colspan="3"><input type="text" name="buyer1stContactEmail" .value=${((_s = this.buyer) === null || _s === void 0 ? void 0 : _s.buyer1stContactEmail) || ''} @input=${this._onInputTaxInvoice} /></td>
174
208
  </tr>
175
209
  <tr>
176
210
  <th>${i18next.t('field.email')}</th>
177
- <td colspan="3">${(_t = this.buyer) === null || _t === void 0 ? void 0 : _t.buyer2ndContactEmail}</td>
211
+ <td colspan="3"><input type="text" name="buyer2ndContactEmail" .value=${((_t = this.buyer) === null || _t === void 0 ? void 0 : _t.buyer2ndContactEmail) || ''} @input=${this._onInputTaxInvoice} /></td>
178
212
  </tr>
179
213
  </table>
180
214
  </div>
181
215
 
182
- <div class="info">
183
- <table>
184
- <colgroup>
185
- <col width="15%" />
186
- <col width="15%" />
187
- <col width="15%" />
188
- <col width="40%" />
189
- </colgroup>
190
- <tr>
191
- <th>${i18next.t('field.issue date')}</th>
192
- <th>${i18next.t('field.supply amount')}</th>
193
- <th>${i18next.t('field.tax amount')}</th>
194
- <th>${i18next.t('field.remark0')}</th>
195
- </tr>
196
- <tr>
197
- <td>${(_u = this.taxInvoice) === null || _u === void 0 ? void 0 : _u.issueDate}</td>
198
- <td>${this._numberFormat((_v = this.taxInvoice) === null || _v === void 0 ? void 0 : _v.supplyAmount)}</td>
199
- <td>${this._numberFormat((_w = this.taxInvoice) === null || _w === void 0 ? void 0 : _w.taxAmount)}</td>
200
- <td>${(_x = this.taxInvoice) === null || _x === void 0 ? void 0 : _x.remark0}</td>
201
- </tr>
202
- </table>
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=${((_u = this.taxInvoice) === null || _u === void 0 ? void 0 : _u.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((_v = this.taxInvoice) === null || _v === void 0 ? void 0 : _v.totalAmount)}</div>
229
+ <div class="title">${i18next.t('field.supply amount')}</div>
230
+ <div class="value">${this._numberFormat((_w = this.taxInvoice) === null || _w === void 0 ? void 0 : _w.supplyAmount)}</div>
231
+ <div class="title">${i18next.t('field.tax amount')}</div>
232
+ <div class="value">${this._numberFormat((_x = this.taxInvoice) === null || _x === void 0 ? void 0 : _x.taxAmount)}</div>
233
+ </div>
203
234
  </div>
204
235
 
205
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
+
206
242
  <table>
207
243
  <colgroup>
208
- <col width="4%" />
209
- <col width="4%" />
210
- <col width="15%" />
211
- <col width="9%" />
212
- <col width="9%" />
213
- <col width="13%" />
214
- <col width="13%" />
215
- <col width="13%" />
216
- <col width="20%" />
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%" />
217
254
  </colgroup>
218
255
  <tr>
219
256
  <th>${i18next.t('field.tax invoice month')}</th>
@@ -225,19 +262,22 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
225
262
  <th>${i18next.t('field.supply amount')}</th>
226
263
  <th>${i18next.t('field.tax amount')}</th>
227
264
  <th>${i18next.t('field.remark0')}</th>
265
+ <th>${i18next.t('field.delete')}</th>
228
266
  </tr>
229
267
 
230
- ${(_z = (_y = this.taxInvoice) === null || _y === void 0 ? void 0 : _y.taxInvoiceItems) === null || _z === void 0 ? void 0 : _z.map(item => html `
268
+ ${this.taxInvoiceItems.map((item, idx) => html `
231
269
  <tr>
232
- <td>${item.supplyDate}</td>
233
- <td>${item.supplyDate}</td>
234
- <td>${item.itemName}</td>
235
- <td>${item.specification}</td>
236
- <td>${item.quantity}</td>
237
- <td>${this._numberFormat(item.unitPrice)}</td>
238
- <td>${this._numberFormat(item.supplyPrice)}</td>
239
- <td>${this._numberFormat(item.taxPrice)}</td>
240
- <td>${item.remark}</td>
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" readonly name="supplyPrice" .value=${this._numberFormat(item.supplyPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
278
+ <td><input type="text" readonly name="taxPrice" .value=${this._numberFormat(item.taxPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
279
+ <td><input type="text" name="remark" .value=${item.remark || ''} @input=${e => this._onInputItem(e, idx)} /></td>
280
+ <td><button class="btn-delete" @click=${e => this._onRemoveInvoiceItem(e, item.sequence)}>삭제</button></td>
241
281
  </tr>
242
282
  `)}
243
283
  </table>
@@ -246,28 +286,54 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
246
286
  <div class="summary">
247
287
  <table>
248
288
  <colgroup>
249
- <col width="20%" />
250
- <col width="20%" />
251
- <col width="20%" />
252
- <col width="20%" />
253
- <col width="20%" />
289
+ <col width="25%" />
290
+ <col width="25%" />
291
+ <col width="25%" />
292
+ <col width="25%" />
254
293
  </colgroup>
255
294
  <tr>
256
- <th>${i18next.t('field.total amount')}</th>
257
295
  <th>${i18next.t('field.tax invoice payment cash')}</th>
258
296
  <th>${i18next.t('field.tax invoice payment check')}</th>
259
297
  <th>${i18next.t('field.tax invoice payment promissory note')}</th>
260
298
  <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>
261
299
  </tr>
262
300
  <tr>
263
- <td>${this._numberFormat((_0 = this.taxInvoice) === null || _0 === void 0 ? void 0 : _0.totalAmount)}</td>
264
- <td>${this._numberFormat((_1 = this.taxInvoice) === null || _1 === void 0 ? void 0 : _1.paymentAmountCash)}</td>
265
- <td>${this._numberFormat((_2 = this.taxInvoice) === null || _2 === void 0 ? void 0 : _2.paymentAmountCheck)}</td>
266
- <td>${this._numberFormat((_3 = this.taxInvoice) === null || _3 === void 0 ? void 0 : _3.paymentAmountPromissoryNote)}</td>
267
- <td>${this._numberFormat((_4 = this.taxInvoice) === null || _4 === void 0 ? void 0 : _4.paymentAmountAccountsReceivable)}</td>
301
+ <td><input type="text" numeric name="paymentAmountCash" .value=${(_y = this.taxInvoice) === null || _y === void 0 ? void 0 : _y.paymentAmountCash} @input=${this._onInputTaxInvoice} /></td>
302
+ <td><input type="text" numeric name="paymentAmountCheck" .value=${(_z = this.taxInvoice) === null || _z === void 0 ? void 0 : _z.paymentAmountCheck} @input=${this._onInputTaxInvoice} /></td>
303
+ <td>
304
+ <input
305
+ type="text"
306
+ numeric
307
+ name="paymentAmountPromissoryNote"
308
+ .value=${(_0 = this.taxInvoice) === null || _0 === void 0 ? void 0 : _0.paymentAmountPromissoryNote}
309
+ @input=${this._onInputTaxInvoice}
310
+ />
311
+ </td>
312
+ <td>
313
+ <input
314
+ type="text"
315
+ numeric
316
+ name="paymentAmountAccountsReceivable"
317
+ .value=${(_1 = this.taxInvoice) === null || _1 === void 0 ? void 0 : _1.paymentAmountAccountsReceivable}
318
+ @input=${this._onInputTaxInvoice}
319
+ />
320
+ </td>
268
321
  </tr>
269
322
  </table>
270
- <div>${i18next.t('text.tax invoice description payment', { value: i18next.t(`text.tax invoice description purpose ${(_5 = this.taxInvoice) === null || _5 === void 0 ? void 0 : _5.purpose}`) })}</div>
323
+ <div>
324
+ ${i18next.t('text.prev tax invoice description payment') + ' ('}
325
+ <span style="margin:0 10px">
326
+ <div>
327
+ <input type="radio" id="purpose_20" name="purpose" .value=${Purpose.INVOICE} @change=${this._onInputTaxInvoice} checked />
328
+ <label for="purpose_20">${PURPOSE[Purpose.INVOICE]}</label>
329
+ </div>
330
+ <div>
331
+ <input type="radio" id="purpose_10" name="purpose" .value=${Purpose.RECEIPT} @change=${this._onInputTaxInvoice} />
332
+ <label for="purpose_10">${PURPOSE[Purpose.RECEIPT]}</label>
333
+ </div>
334
+ </span>
335
+ ${') ' + i18next.t('text.next tax invoice description payment')}
336
+ </div>
271
337
  </div>
272
338
  </form>
273
339
  </div>
@@ -279,8 +345,8 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
279
345
  async _fetchSupplier() {
280
346
  const response = await client.query({
281
347
  query: gql `
282
- query TaxInvoiceApi() {
283
- taxInvoiceApi() {
348
+ query TaxInvoiceApi {
349
+ response: taxInvoiceApi {
284
350
  businessRegistrationNumber
285
351
  branchIdentification
286
352
  businessName
@@ -297,8 +363,21 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
297
363
  }
298
364
  `
299
365
  });
300
- console.log('response.data.responses : ', response.data.responses);
301
- this.supplier = response.data.responses;
366
+ const supplier = response.data.response;
367
+ this.supplier = {
368
+ supplierBusinessRegistrationNumber: supplier.businessRegistrationNumber,
369
+ supplierBranchIdentification: supplier.branchIdentification,
370
+ supplierBusinessName: supplier.businessName,
371
+ supplierRepresentativeName: supplier.representativeName,
372
+ supplierAddress: supplier.address,
373
+ supplierBusinessType: supplier.businessType,
374
+ supplierIndustryType: supplier.industryType,
375
+ supplierDepartment: supplier.department,
376
+ supplierContactName: supplier.contactName,
377
+ supplierContactPhone: supplier.contactPhone,
378
+ supplierContactEmail: supplier.contactEmail,
379
+ supplierContactCellPhone: supplier.contactCellPhone
380
+ };
302
381
  }
303
382
  async pageUpdated(changes, lifecycle) {
304
383
  if (this.active) {
@@ -306,8 +385,12 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
306
385
  }
307
386
  }
308
387
  async _sendTaxInvoice(num) {
309
- console.log(this.taxInvoiceForm);
310
- console.log(this.supplier);
388
+ this.taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => (Object.assign(Object.assign({}, item), { sequence: idx + 1 })));
389
+ console.log('taxInvoice : ', this.taxInvoice);
390
+ console.log('taxInvoiceItems : ', this.taxInvoiceItems);
391
+ // console.log('supplier : ', this.supplier)
392
+ // console.log('buyer : ', this.buyer)
393
+ // TODO 현금,수표 합계 == 총 합계금액 체크
311
394
  return;
312
395
  const response = await client.mutate({
313
396
  mutation: gql `
@@ -329,12 +412,60 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
329
412
  }
330
413
  }
331
414
  _numberFormat(value) {
332
- return !value ? '' : new Intl.NumberFormat('en-US').format(value);
415
+ return !value ? '' : new Intl.NumberFormat('en-US').format(value) || '';
333
416
  }
334
417
  // Input 요소의 값이 변경될 때 호출되는 콜백 함수
335
418
  _onInputTaxInvoice(event) {
336
419
  const target = event.target;
337
- this.supplier[target.name] = target.value;
420
+ if (target.name.startsWith('supplier')) {
421
+ this.supplier[target.name] = target.value;
422
+ }
423
+ else if (target.name.startsWith('buyer')) {
424
+ this.buyer[target.name] = target.value;
425
+ }
426
+ else {
427
+ this.taxInvoice[target.name] = target.value;
428
+ }
429
+ }
430
+ // Input 요소의 값이 변경될 때 호출되는 콜백 함수
431
+ _onInputItem(e, idx) {
432
+ const target = e.target;
433
+ let inputVal = target.value;
434
+ // 숫자 타입은 다른 문자 입력 제거
435
+ if (target.hasAttribute('numeric')) {
436
+ inputVal = inputVal.replace(/\D/g, '');
437
+ target.value = inputVal;
438
+ }
439
+ // 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
440
+ if (target.name === 'supplyDate') {
441
+ inputVal = this.taxInvoice.issueDate.substring(0, 8) + inputVal.padStart(2, '0');
442
+ }
443
+ if (target.name == 'quantity' || target.name == 'unitPrice') {
444
+ const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity'];
445
+ this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice;
446
+ this.taxInvoiceItems[idx]['taxPrice'] = Math.floor(supplyPrice / 10);
447
+ this.taxInvoiceItems = [...this.taxInvoiceItems];
448
+ this._setTaxInvoiceSummaryCalc();
449
+ }
450
+ this.taxInvoiceItems[idx][target.name] = inputVal;
451
+ }
452
+ _onAddInvoiceItem(e) {
453
+ e.preventDefault();
454
+ if (this.taxInvoiceItems.length >= 16) {
455
+ alert('품목은 최대 16개까지 추가 가능합니다.');
456
+ return;
457
+ }
458
+ this.taxInvoiceItems = [...this.taxInvoiceItems, Object.assign(Object.assign({}, this.defaultTaxInvoiceItem), { sequence: new Date().getTime() })];
459
+ }
460
+ _onRemoveInvoiceItem(e, sequence) {
461
+ e.preventDefault();
462
+ this.taxInvoiceItems = [...this.taxInvoiceItems.filter(item => item.sequence != sequence)];
463
+ this._setTaxInvoiceSummaryCalc();
464
+ }
465
+ _setTaxInvoiceSummaryCalc() {
466
+ const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.supplyPrice, 0);
467
+ const taxPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.taxPrice, 0);
468
+ this.taxInvoice = Object.assign(Object.assign({}, this.taxInvoice), { supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: supplyPrice + taxPrice });
338
469
  }
339
470
  };
340
471
  TaxInvoiceSendPage.styles = [
@@ -344,15 +475,47 @@ TaxInvoiceSendPage.styles = [
344
475
  :host {
345
476
  display: flex;
346
477
  flex-direction: column;
478
+ overflow-y: auto;
479
+ overflow-x: hidden;
347
480
 
348
481
  width: 100%;
349
482
  min-width: 850px;
350
483
  margin: 0 40px;
484
+ padding-bottom: 40px;
351
485
 
352
486
  --grid-record-emphasized-background-color: red;
353
487
  --grid-record-emphasized-color: yellow;
354
488
  }
355
489
 
490
+ .flex-row {
491
+ display: flex;
492
+ flex-direction: row;
493
+ }
494
+ .flex-column {
495
+ display: flex;
496
+ flex-direction: column;
497
+ }
498
+
499
+ input[type='text'],
500
+ input[type='date'],
501
+ input[type='number'] {
502
+ width: 85%;
503
+ max-width: calc(100% - 12px);
504
+ height: 14px;
505
+ margin: 0;
506
+ padding: 4px 5px 5px;
507
+ line-height: 14px;
508
+ border: 1px solid #bbb;
509
+ background: #fff;
510
+ letter-spacing: 0.5px;
511
+ }
512
+ input[type='date'] {
513
+ width: auto;
514
+ }
515
+ input[readonly] {
516
+ background-color: #eee;
517
+ }
518
+
356
519
  div.invoice-type {
357
520
  font-size: 18px;
358
521
  margin-top: 15px;
@@ -363,16 +526,6 @@ TaxInvoiceSendPage.styles = [
363
526
  border-width: 2px 0;
364
527
  border-collapse: collapse;
365
528
  border-spacing: 0;
366
-
367
- input[type='text'] {
368
- height: 14px;
369
- margin: 0;
370
- padding: 4px 5px 5px;
371
- line-height: 14px;
372
- border: 1px solid #bbb;
373
- background: #fff;
374
- letter-spacing: 0.5px;
375
- }
376
529
  }
377
530
 
378
531
  .title table {
@@ -414,10 +567,15 @@ TaxInvoiceSendPage.styles = [
414
567
  td,
415
568
  th {
416
569
  padding: 5px;
570
+ min-width: 60px;
571
+ }
572
+ td {
573
+ padding-left: 8px;
417
574
  }
418
575
  th.target {
419
576
  width: 25px;
420
577
  writing-mode: vertical-rl;
578
+ min-width: unset;
421
579
  }
422
580
 
423
581
  &.supplier {
@@ -447,10 +605,39 @@ TaxInvoiceSendPage.styles = [
447
605
  }
448
606
  }
449
607
 
608
+ div.info {
609
+ margin-top: 15px;
610
+ border: solid;
611
+ border-color: #000;
612
+ border-width: 2px 0px 0px 0px;
613
+
614
+ div.flex-row div {
615
+ border: solid #c4d2ff;
616
+ border-width: 0px 1.5px 1.5px 1.5px;
617
+ margin-right: -1px;
618
+ padding: 5px;
619
+ text-align: center;
620
+
621
+ &.title {
622
+ background-color: #e9edf5;
623
+ font-weight: bold;
624
+ flex: 1;
625
+ }
626
+ &.value {
627
+ flex: 3;
628
+ text-align: left;
629
+
630
+ .desc {
631
+ font-size: 11px;
632
+ color: #c90000;
633
+ }
634
+ }
635
+ }
636
+ }
637
+
450
638
  div.items,
451
- div.info,
452
639
  div.summary {
453
- margin-top: 15px;
640
+ margin-top: 20px;
454
641
 
455
642
  table {
456
643
  width: 100%;
@@ -484,6 +671,41 @@ TaxInvoiceSendPage.styles = [
484
671
  border-top: 2px solid #000;
485
672
  }
486
673
  }
674
+
675
+ div.items {
676
+ div.desc {
677
+ font-weight: 400;
678
+ font-size: 12px;
679
+ margin-bottom: 5px;
680
+ }
681
+ div.desc-date {
682
+ color: #005d98;
683
+ }
684
+ button {
685
+ font-size: 13px;
686
+ height: 25px;
687
+ cursor: pointer;
688
+ text-align: center;
689
+ font-weight: 600;
690
+ border-radius: 2px;
691
+ border-color: #ccc;
692
+ }
693
+ .btn-add {
694
+ color: #333;
695
+ background-color: #f9f9f9;
696
+ }
697
+ .btn-delete {
698
+ color: #fff;
699
+ background-color: #5c636e;
700
+ border: none;
701
+ }
702
+ }
703
+
704
+ *[required]::before {
705
+ content: '*';
706
+ color: red;
707
+ margin-right: 2px;
708
+ }
487
709
  }
488
710
  `
489
711
  ];
@@ -496,13 +718,17 @@ __decorate([
496
718
  __metadata("design:type", Object)
497
719
  ], TaxInvoiceSendPage.prototype, "supplier", void 0);
498
720
  __decorate([
499
- property(),
721
+ property({ type: Object }),
500
722
  __metadata("design:type", Object)
501
723
  ], TaxInvoiceSendPage.prototype, "buyer", void 0);
502
724
  __decorate([
503
- property(),
725
+ property({ type: Object }),
504
726
  __metadata("design:type", Object)
505
727
  ], TaxInvoiceSendPage.prototype, "taxInvoice", void 0);
728
+ __decorate([
729
+ property({ type: Array }),
730
+ __metadata("design:type", Array)
731
+ ], TaxInvoiceSendPage.prototype, "taxInvoiceItems", void 0);
506
732
  TaxInvoiceSendPage = __decorate([
507
733
  customElement('tax-invoice-send-page')
508
734
  ], TaxInvoiceSendPage);