@things-factory/tax-invoice 6.2.90 → 6.2.92

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.
@@ -66,10 +66,15 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
66
66
  td,
67
67
  th {
68
68
  padding: 5px;
69
+ min-width: 60px;
70
+ }
71
+ td {
72
+ padding-left: 8px;
69
73
  }
70
74
  th.target {
71
75
  width: 25px;
72
76
  writing-mode: vertical-rl;
77
+ min-width: unset;
73
78
  }
74
79
 
75
80
  &.supplier {
@@ -9,7 +9,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 } 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
+ import { keyed } from 'lit/directives/keyed.js'
13
14
 
14
15
  const SHORT_INVOICE_TYPE = {
15
16
  TAX_INVOICE: {
@@ -70,8 +71,8 @@ interface TaxInvoice {
70
71
  issueNo?: string
71
72
  approvalNo?: string
72
73
  originalApprovalNo?: string
73
- issueDate: Date | null
74
- signatureDate?: Date
74
+ issueDate: string
75
+ signatureDate?: string
75
76
  invoiceType: InvoiceType
76
77
  purpose: Purpose
77
78
  remark0?: string
@@ -84,12 +85,11 @@ interface TaxInvoice {
84
85
  supplyAmount: number
85
86
  taxAmount?: number
86
87
  totalAmount: number
87
- taxInvoiceItems?: TaxInvoiceItem[]
88
88
  // revisedReason?: RevisedReason
89
89
  }
90
90
  interface TaxInvoiceItem {
91
- sequence?: number
92
- supplyDate: Date
91
+ sequence: number
92
+ supplyDate: string
93
93
  itemName: string
94
94
  specification: string
95
95
  quantity: number
@@ -108,15 +108,47 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
108
108
  :host {
109
109
  display: flex;
110
110
  flex-direction: column;
111
+ overflow-y: auto;
112
+ overflow-x: hidden;
111
113
 
112
114
  width: 100%;
113
115
  min-width: 850px;
114
116
  margin: 0 40px;
117
+ padding-bottom: 40px;
115
118
 
116
119
  --grid-record-emphasized-background-color: red;
117
120
  --grid-record-emphasized-color: yellow;
118
121
  }
119
122
 
123
+ .flex-row {
124
+ display: flex;
125
+ flex-direction: row;
126
+ }
127
+ .flex-column {
128
+ display: flex;
129
+ flex-direction: column;
130
+ }
131
+
132
+ input[type='text'],
133
+ input[type='date'],
134
+ input[type='number'] {
135
+ width: 85%;
136
+ max-width: calc(100% - 12px);
137
+ height: 14px;
138
+ margin: 0;
139
+ padding: 4px 5px 5px;
140
+ line-height: 14px;
141
+ border: 1px solid #bbb;
142
+ background: #fff;
143
+ letter-spacing: 0.5px;
144
+ }
145
+ input[type='date'] {
146
+ width: auto;
147
+ }
148
+ input[readonly] {
149
+ background-color: #eee;
150
+ }
151
+
120
152
  div.invoice-type {
121
153
  font-size: 18px;
122
154
  margin-top: 15px;
@@ -127,16 +159,6 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
127
159
  border-width: 2px 0;
128
160
  border-collapse: collapse;
129
161
  border-spacing: 0;
130
-
131
- input[type='text'] {
132
- height: 14px;
133
- margin: 0;
134
- padding: 4px 5px 5px;
135
- line-height: 14px;
136
- border: 1px solid #bbb;
137
- background: #fff;
138
- letter-spacing: 0.5px;
139
- }
140
162
  }
141
163
 
142
164
  .title table {
@@ -178,10 +200,15 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
178
200
  td,
179
201
  th {
180
202
  padding: 5px;
203
+ min-width: 60px;
204
+ }
205
+ td {
206
+ padding-left: 8px;
181
207
  }
182
208
  th.target {
183
209
  width: 25px;
184
210
  writing-mode: vertical-rl;
211
+ min-width: unset;
185
212
  }
186
213
 
187
214
  &.supplier {
@@ -211,10 +238,39 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
211
238
  }
212
239
  }
213
240
 
241
+ div.info {
242
+ margin-top: 15px;
243
+ border: solid;
244
+ border-color: #000;
245
+ border-width: 2px 0px 0px 0px;
246
+
247
+ div.flex-row div {
248
+ border: solid #c4d2ff;
249
+ border-width: 0px 1.5px 1.5px 1.5px;
250
+ margin-right: -1px;
251
+ padding: 5px;
252
+ text-align: center;
253
+
254
+ &.title {
255
+ background-color: #e9edf5;
256
+ font-weight: bold;
257
+ flex: 1;
258
+ }
259
+ &.value {
260
+ flex: 3;
261
+ text-align: left;
262
+
263
+ .desc {
264
+ font-size: 11px;
265
+ color: #c90000;
266
+ }
267
+ }
268
+ }
269
+ }
270
+
214
271
  div.items,
215
- div.info,
216
272
  div.summary {
217
- margin-top: 15px;
273
+ margin-top: 20px;
218
274
 
219
275
  table {
220
276
  width: 100%;
@@ -248,32 +304,91 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
248
304
  border-top: 2px solid #000;
249
305
  }
250
306
  }
307
+
308
+ div.items {
309
+ div.desc {
310
+ font-weight: 400;
311
+ font-size: 12px;
312
+ margin-bottom: 5px;
313
+ }
314
+ div.desc-date {
315
+ color: #005d98;
316
+ }
317
+ button {
318
+ font-size: 13px;
319
+ height: 25px;
320
+ cursor: pointer;
321
+ text-align: center;
322
+ font-weight: 600;
323
+ border-radius: 2px;
324
+ border-color: #ccc;
325
+ }
326
+ .btn-add {
327
+ color: #333;
328
+ background-color: #f9f9f9;
329
+ }
330
+ .btn-delete {
331
+ color: #fff;
332
+ background-color: #5c636e;
333
+ border: none;
334
+ }
335
+ }
336
+
337
+ *[required]::before {
338
+ content: '*';
339
+ color: red;
340
+ margin-right: 2px;
341
+ }
251
342
  }
252
343
  `
253
344
  ]
254
345
 
346
+ private today: string = new Intl.DateTimeFormat('ko-KR', {
347
+ timeZone: 'Asia/Seoul',
348
+ year: 'numeric',
349
+ month: '2-digit',
350
+ day: '2-digit'
351
+ })
352
+ .format(new Date())
353
+ .replace(/[.\s]/g, '')
354
+ .replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3')
355
+
255
356
  @query('form[name="tax-invoice-form"]') private taxInvoiceForm!: HTMLFormElement
256
357
 
257
358
  @state() supplier: Supplier = {
258
359
  supplierBusinessRegistrationNumber: '',
360
+ supplierBranchIdentification: '',
259
361
  supplierBusinessName: '',
260
362
  supplierRepresentativeName: ''
261
363
  }
262
- @property() buyer: Buyer = {
364
+ @property({ type: Object }) buyer: Buyer = {
263
365
  buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
264
366
  buyerBusinessRegistrationNumber: '',
265
367
  buyerBusinessName: '',
266
368
  buyerRepresentativeName: ''
267
369
  }
268
- @property() taxInvoice: TaxInvoice = {
370
+ @property({ type: Object }) taxInvoice: TaxInvoice = {
269
371
  invoiceType: InvoiceType.TAX_INVOICE,
270
372
  category: Category.EXPORT,
271
- issueDate: null,
272
- purpose: Purpose.RECEIPT,
373
+ issueDate: this.today,
374
+ purpose: Purpose.INVOICE,
273
375
  supplyAmount: 0,
376
+ taxAmount: 0,
274
377
  totalAmount: 0
275
378
  }
276
379
 
380
+ private defaultTaxInvoiceItem = {
381
+ sequence: new Date().getTime(), // 구분용 임시 값 (중복되면 안되니 생성 마다 넣어주기)
382
+ supplyDate: '',
383
+ itemName: '',
384
+ specification: '',
385
+ quantity: 0,
386
+ unitPrice: 0,
387
+ supplyPrice: 0,
388
+ taxPrice: 0
389
+ }
390
+ @property({ type: Array }) taxInvoiceItems: TaxInvoiceItem[] = [{ ...this.defaultTaxInvoiceItem }]
391
+
277
392
  get context() {
278
393
  return {
279
394
  title: i18next.t('title.tax invoice send'),
@@ -336,16 +451,18 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
336
451
  </colgroup>
337
452
  <tr>
338
453
  <th rowspan="6" class="target">${i18next.t('field.tax invoice supplier')}</th>
339
- <th>${i18next.t('field.short business registration number')}</th>
340
- <td><input type="text" name="supplierBusinessRegistrationNumber" .value=${this.supplier?.supplierBusinessRegistrationNumber || ''} readonly /></td>
454
+ <th required>${i18next.t('field.short business registration number')}</th>
455
+ <td>${this.supplier?.supplierBusinessRegistrationNumber.replace(/(\S{3})(\S{2})(\S{5})/g, '$1-$2-$3')}</td>
341
456
  <th>${i18next.t('field.short branch identification')}</th>
342
- <td><input type="text" name="supplierBranchIdentification" .value=${this.supplier?.supplierBranchIdentification || ''} readonly /></td>
457
+ <td>${this.supplier?.supplierBranchIdentification}</td>
343
458
  </tr>
344
459
  <tr>
345
- <th>${i18next.t('field.short tax invoice business name')}</th>
460
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
346
461
  <td><input type="text" name="supplierBusinessName" .value=${this.supplier?.supplierBusinessName || ''} @input=${this._onInputTaxInvoice} /></td>
347
- <th>${i18next.t('field.short representative name')}</th>
348
- <td>${this.supplier?.supplierRepresentativeName}</td>
462
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
463
+ <td>
464
+ <input type="text" name="supplierRepresentativeName" .value=${this.supplier?.supplierRepresentativeName || ''} @input=${this._onInputTaxInvoice} />
465
+ </td>
349
466
  </tr>
350
467
  <tr>
351
468
  <th>${i18next.t('field.address')}</th>
@@ -353,13 +470,15 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
353
470
  </tr>
354
471
  <tr>
355
472
  <th>${i18next.t('field.business type')}</th>
356
- <td>${this.supplier?.supplierBusinessType}</td>
473
+ <td><input type="text" name="supplierBusinessType" .value=${this.supplier?.supplierBusinessType || ''} @input=${this._onInputTaxInvoice} /></td>
357
474
  <th>${i18next.t('field.industry type')}</th>
358
- <td>${this.supplier?.supplierIndustryType}</td>
475
+ <td><input type="text" name="supplierIndustryType" .value=${this.supplier?.supplierIndustryType || ''} @input=${this._onInputTaxInvoice} /></td>
359
476
  </tr>
360
477
  <tr>
361
478
  <th rowspan="2">${i18next.t('field.email')}</th>
362
- <td rowspan="2" colspan="3">${this.supplier?.supplierContactEmail}</td>
479
+ <td rowspan="2" colspan="3">
480
+ <input type="text" name="supplierContactEmail" .value=${this.supplier?.supplierContactEmail || ''} @input=${this._onInputTaxInvoice} />
481
+ </td>
363
482
  </tr>
364
483
  <tr></tr>
365
484
  </table>
@@ -374,73 +493,84 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
374
493
  </colgroup>
375
494
  <tr>
376
495
  <th rowspan="6" class="target">${i18next.t('field.tax invoice buyer')}</th>
377
- <th>${i18next.t('field.short business registration number')}</th>
378
- <td>${this.buyer?.buyerBusinessRegistrationNumber}</td>
496
+ <th required>${i18next.t('field.short business registration number')}</th>
497
+ <td>
498
+ <input
499
+ type="text"
500
+ name="buyerBusinessRegistrationNumber"
501
+ .value=${this.buyer?.buyerBusinessRegistrationNumber || ''}
502
+ @input=${this._onInputTaxInvoice}
503
+ />
504
+ </td>
379
505
  <th>${i18next.t('field.short branch identification')}</th>
380
- <td>${this.buyer?.buyerBranchIdentification}</td>
506
+ <td><input type="text" name="buyerBranchIdentification" .value=${this.buyer?.buyerBranchIdentification || ''} @input=${this._onInputTaxInvoice} /></td>
381
507
  </tr>
382
508
  <tr>
383
- <th>${i18next.t('field.short tax invoice business name')}</th>
384
- <td>${this.buyer?.buyerBusinessName}</td>
385
- <th>${i18next.t('field.short representative name')}</th>
386
- <td>${this.buyer?.buyerRepresentativeName}</td>
509
+ <th required>${i18next.t('field.short tax invoice business name')}</th>
510
+ <td><input type="text" name="buyerBusinessName" .value=${this.buyer?.buyerBusinessName || ''} @input=${this._onInputTaxInvoice} /></td>
511
+ <th required>${i18next.t('field.tax invoice representative name')}</th>
512
+ <td><input type="text" name="buyerRepresentativeName" .value=${this.buyer?.buyerRepresentativeName || ''} @input=${this._onInputTaxInvoice} /></td>
387
513
  </tr>
388
514
  <tr>
389
515
  <th>${i18next.t('field.address')}</th>
390
- <td colspan="3">${this.buyer?.buyerAddress}</td>
516
+ <td colspan="3"><input type="text" name="buyerAddress" .value=${this.buyer?.buyerAddress || ''} @input=${this._onInputTaxInvoice} /></td>
391
517
  </tr>
392
518
  <tr>
393
519
  <th>${i18next.t('field.business type')}</th>
394
- <td>${this.buyer?.buyerBusinessType}</td>
520
+ <td><input type="text" name="buyerBusinessType" .value=${this.buyer?.buyerBusinessType || ''} @input=${this._onInputTaxInvoice} /></td>
521
+
395
522
  <th>${i18next.t('field.industry type')}</th>
396
- <td>${this.buyer?.buyerIndustryType}</td>
523
+ <td><input type="text" name="buyerIndustryType" .value=${this.buyer?.buyerIndustryType || ''} @input=${this._onInputTaxInvoice} /></td>
397
524
  </tr>
398
525
  <tr>
399
526
  <th>${i18next.t('field.email')}</th>
400
- <td colspan="3">${this.buyer?.buyer1stContactEmail}</td>
527
+ <td colspan="3"><input type="text" name="buyer1stContactEmail" .value=${this.buyer?.buyer1stContactEmail || ''} @input=${this._onInputTaxInvoice} /></td>
401
528
  </tr>
402
529
  <tr>
403
530
  <th>${i18next.t('field.email')}</th>
404
- <td colspan="3">${this.buyer?.buyer2ndContactEmail}</td>
531
+ <td colspan="3"><input type="text" name="buyer2ndContactEmail" .value=${this.buyer?.buyer2ndContactEmail || ''} @input=${this._onInputTaxInvoice} /></td>
405
532
  </tr>
406
533
  </table>
407
534
  </div>
408
535
 
409
- <div class="info">
410
- <table>
411
- <colgroup>
412
- <col width="15%" />
413
- <col width="15%" />
414
- <col width="15%" />
415
- <col width="40%" />
416
- </colgroup>
417
- <tr>
418
- <th>${i18next.t('field.issue date')}</th>
419
- <th>${i18next.t('field.supply amount')}</th>
420
- <th>${i18next.t('field.tax amount')}</th>
421
- <th>${i18next.t('field.remark0')}</th>
422
- </tr>
423
- <tr>
424
- <td>${this.taxInvoice?.issueDate}</td>
425
- <td>${this._numberFormat(this.taxInvoice?.supplyAmount)}</td>
426
- <td>${this._numberFormat(this.taxInvoice?.taxAmount)}</td>
427
- <td>${this.taxInvoice?.remark0}</td>
428
- </tr>
429
- </table>
536
+ <div class="info flex-column">
537
+ <div class="flex-row">
538
+ <div class="title" required>${i18next.t('field.issue date')}</div>
539
+ <div class="value">
540
+ <input type="date" name="issueDate" .value=${this.taxInvoice.issueDate} @input=${this._onInputTaxInvoice} />
541
+ <span class="desc">※ 작성일자는 공급 연월일을 의미함</span>
542
+ </div>
543
+ <div class="title">${i18next.t('field.remark0')}</div>
544
+ <div class="value"><input type="text" name="remark0" .value=${this.taxInvoice?.remark0 || ''} @input=${this._onInputTaxInvoice} /></div>
545
+ </div>
546
+ <div class="flex-row">
547
+ <div class="title">${i18next.t('field.total amount')}</div>
548
+ <div class="value">${this._numberFormat(this.taxInvoice?.totalAmount)}</div>
549
+ <div class="title">${i18next.t('field.supply amount')}</div>
550
+ <div class="value">${this._numberFormat(this.taxInvoice?.supplyAmount)}</div>
551
+ <div class="title">${i18next.t('field.tax amount')}</div>
552
+ <div class="value">${this._numberFormat(this.taxInvoice?.taxAmount)}</div>
553
+ </div>
430
554
  </div>
431
555
 
432
556
  <div class="items">
557
+ <div class="desc desc-date">
558
+ ※ 아래 '품목'의 '월'은 상단 '작성일자'의 '월'이 자동 반영됩니다. 합계의 '계산' 버튼은 금액을 공급가액과 세액으로 계산할 수 있습니다.
559
+ </div>
560
+ <div class="desc"><button class="btn-add" @click=${this._onAddInvoiceItem}>품목추가</button> 품목은 최대 16개까지 추가, 삭제 가능</div>
561
+
433
562
  <table>
434
563
  <colgroup>
435
- <col width="4%" />
436
- <col width="4%" />
437
- <col width="15%" />
438
- <col width="9%" />
439
- <col width="9%" />
440
- <col width="13%" />
441
- <col width="13%" />
442
- <col width="13%" />
443
- <col width="20%" />
564
+ <col width="5%" />
565
+ <col width="5%" />
566
+ <col width="14%" />
567
+ <col width="7%" />
568
+ <col width="7%" />
569
+ <col width="12%" />
570
+ <col width="12%" />
571
+ <col width="12%" />
572
+ <col width="16%" />
573
+ <col width="8%" />
444
574
  </colgroup>
445
575
  <tr>
446
576
  <th>${i18next.t('field.tax invoice month')}</th>
@@ -452,21 +582,24 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
452
582
  <th>${i18next.t('field.supply amount')}</th>
453
583
  <th>${i18next.t('field.tax amount')}</th>
454
584
  <th>${i18next.t('field.remark0')}</th>
585
+ <th>${i18next.t('field.delete')}</th>
455
586
  </tr>
456
587
 
457
- ${this.taxInvoice?.taxInvoiceItems?.map(
458
- item =>
588
+ ${this.taxInvoiceItems.map(
589
+ (item, idx) =>
459
590
  html`
460
591
  <tr>
461
- <td>${item.supplyDate}</td>
462
- <td>${item.supplyDate}</td>
463
- <td>${item.itemName}</td>
464
- <td>${item.specification}</td>
465
- <td>${item.quantity}</td>
466
- <td>${this._numberFormat(item.unitPrice)}</td>
467
- <td>${this._numberFormat(item.supplyPrice)}</td>
468
- <td>${this._numberFormat(item.taxPrice)}</td>
469
- <td>${item.remark}</td>
592
+ <input type="hidden" name="sequence" value=${item.sequence} />
593
+ <td>${this.taxInvoice.issueDate.split('-')[1]}</td>
594
+ <td><input type="text" numeric maxlength="2" name="supplyDate" @input=${e => this._onInputItem(e, idx)} /></td>
595
+ <td><input type="text" name="itemName" .value=${item.itemName} @input=${e => this._onInputItem(e, idx)} /></td>
596
+ <td><input type="text" name="specification" .value=${item.specification} @input=${e => this._onInputItem(e, idx)} /></td>
597
+ <td><input type="text" numeric name="quantity" .value=${this._numberFormat(item.quantity)} @input=${e => this._onInputItem(e, idx)} /></td>
598
+ <td><input type="text" numeric name="unitPrice" .value=${this._numberFormat(item.unitPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
599
+ <td><input type="text" readonly name="supplyPrice" .value=${this._numberFormat(item.supplyPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
600
+ <td><input type="text" readonly name="taxPrice" .value=${this._numberFormat(item.taxPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
601
+ <td><input type="text" name="remark" .value=${item.remark || ''} @input=${e => this._onInputItem(e, idx)} /></td>
602
+ <td><button class="btn-delete" @click=${e => this._onRemoveInvoiceItem(e, item.sequence)}>삭제</button></td>
470
603
  </tr>
471
604
  `
472
605
  )}
@@ -476,28 +609,54 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
476
609
  <div class="summary">
477
610
  <table>
478
611
  <colgroup>
479
- <col width="20%" />
480
- <col width="20%" />
481
- <col width="20%" />
482
- <col width="20%" />
483
- <col width="20%" />
612
+ <col width="25%" />
613
+ <col width="25%" />
614
+ <col width="25%" />
615
+ <col width="25%" />
484
616
  </colgroup>
485
617
  <tr>
486
- <th>${i18next.t('field.total amount')}</th>
487
618
  <th>${i18next.t('field.tax invoice payment cash')}</th>
488
619
  <th>${i18next.t('field.tax invoice payment check')}</th>
489
620
  <th>${i18next.t('field.tax invoice payment promissory note')}</th>
490
621
  <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>
491
622
  </tr>
492
623
  <tr>
493
- <td>${this._numberFormat(this.taxInvoice?.totalAmount)}</td>
494
- <td>${this._numberFormat(this.taxInvoice?.paymentAmountCash)}</td>
495
- <td>${this._numberFormat(this.taxInvoice?.paymentAmountCheck)}</td>
496
- <td>${this._numberFormat(this.taxInvoice?.paymentAmountPromissoryNote)}</td>
497
- <td>${this._numberFormat(this.taxInvoice?.paymentAmountAccountsReceivable)}</td>
624
+ <td><input type="text" numeric name="paymentAmountCash" .value=${this.taxInvoice?.paymentAmountCash} @input=${this._onInputTaxInvoice} /></td>
625
+ <td><input type="text" numeric name="paymentAmountCheck" .value=${this.taxInvoice?.paymentAmountCheck} @input=${this._onInputTaxInvoice} /></td>
626
+ <td>
627
+ <input
628
+ type="text"
629
+ numeric
630
+ name="paymentAmountPromissoryNote"
631
+ .value=${this.taxInvoice?.paymentAmountPromissoryNote}
632
+ @input=${this._onInputTaxInvoice}
633
+ />
634
+ </td>
635
+ <td>
636
+ <input
637
+ type="text"
638
+ numeric
639
+ name="paymentAmountAccountsReceivable"
640
+ .value=${this.taxInvoice?.paymentAmountAccountsReceivable}
641
+ @input=${this._onInputTaxInvoice}
642
+ />
643
+ </td>
498
644
  </tr>
499
645
  </table>
500
- <div>${i18next.t('text.tax invoice description payment', { value: i18next.t(`text.tax invoice description purpose ${this.taxInvoice?.purpose}`) })}</div>
646
+ <div>
647
+ ${i18next.t('text.prev tax invoice description payment') + ' ('}
648
+ <span style="margin:0 10px">
649
+ <div>
650
+ <input type="radio" id="purpose_20" name="purpose" .value=${Purpose.INVOICE} @change=${this._onInputTaxInvoice} checked />
651
+ <label for="purpose_20">${PURPOSE[Purpose.INVOICE]}</label>
652
+ </div>
653
+ <div>
654
+ <input type="radio" id="purpose_10" name="purpose" .value=${Purpose.RECEIPT} @change=${this._onInputTaxInvoice} />
655
+ <label for="purpose_10">${PURPOSE[Purpose.RECEIPT]}</label>
656
+ </div>
657
+ </span>
658
+ ${') ' + i18next.t('text.next tax invoice description payment')}
659
+ </div>
501
660
  </div>
502
661
  </form>
503
662
  </div>
@@ -511,8 +670,8 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
511
670
  async _fetchSupplier() {
512
671
  const response = await client.query({
513
672
  query: gql`
514
- query TaxInvoiceApi() {
515
- taxInvoiceApi() {
673
+ query TaxInvoiceApi {
674
+ response: taxInvoiceApi {
516
675
  businessRegistrationNumber
517
676
  branchIdentification
518
677
  businessName
@@ -530,9 +689,21 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
530
689
  `
531
690
  })
532
691
 
533
- console.log('response.data.responses : ', response.data.responses)
534
-
535
- this.supplier = response.data.responses
692
+ const supplier = response.data.response
693
+ this.supplier = {
694
+ supplierBusinessRegistrationNumber: supplier.businessRegistrationNumber,
695
+ supplierBranchIdentification: supplier.branchIdentification,
696
+ supplierBusinessName: supplier.businessName,
697
+ supplierRepresentativeName: supplier.representativeName,
698
+ supplierAddress: supplier.address,
699
+ supplierBusinessType: supplier.businessType,
700
+ supplierIndustryType: supplier.industryType,
701
+ supplierDepartment: supplier.department,
702
+ supplierContactName: supplier.contactName,
703
+ supplierContactPhone: supplier.contactPhone,
704
+ supplierContactEmail: supplier.contactEmail,
705
+ supplierContactCellPhone: supplier.contactCellPhone
706
+ }
536
707
  }
537
708
 
538
709
  async pageUpdated(changes: any, lifecycle: any) {
@@ -542,8 +713,14 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
542
713
  }
543
714
 
544
715
  async _sendTaxInvoice(num: string) {
545
- console.log(this.taxInvoiceForm)
546
- console.log(this.supplier)
716
+ this.taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => ({ ...item, sequence: idx + 1 }))
717
+
718
+ console.log('taxInvoice : ', this.taxInvoice)
719
+ console.log('taxInvoiceItems : ', this.taxInvoiceItems)
720
+ // console.log('supplier : ', this.supplier)
721
+ // console.log('buyer : ', this.buyer)
722
+
723
+ // TODO 현금,수표 합계 == 총 합계금액 체크
547
724
 
548
725
  return
549
726
 
@@ -569,12 +746,69 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
569
746
  }
570
747
 
571
748
  private _numberFormat(value: number | undefined): string {
572
- return !value ? '' : new Intl.NumberFormat('en-US').format(value)
749
+ return !value ? '' : new Intl.NumberFormat('en-US').format(value) || ''
573
750
  }
574
751
 
575
752
  // Input 요소의 값이 변경될 때 호출되는 콜백 함수
576
753
  private _onInputTaxInvoice(event: InputEvent) {
577
754
  const target = event.target as HTMLInputElement
578
- this.supplier[target.name] = target.value
755
+
756
+ if (target.name.startsWith('supplier')) {
757
+ this.supplier[target.name] = target.value
758
+ } else if (target.name.startsWith('buyer')) {
759
+ this.buyer[target.name] = target.value
760
+ } else {
761
+ this.taxInvoice[target.name] = target.value
762
+ }
763
+ }
764
+
765
+ // Input 요소의 값이 변경될 때 호출되는 콜백 함수
766
+ private _onInputItem(e: InputEvent, idx: number) {
767
+ const target = e.target as HTMLInputElement
768
+ let inputVal = target.value
769
+
770
+ // 숫자 타입은 다른 문자 입력 제거
771
+ if (target.hasAttribute('numeric')) {
772
+ inputVal = inputVal.replace(/\D/g, '')
773
+ target.value = inputVal
774
+ }
775
+
776
+ // 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
777
+ if (target.name === 'supplyDate') {
778
+ inputVal = this.taxInvoice.issueDate.substring(0, 8) + inputVal.padStart(2, '0')
779
+ }
780
+
781
+ if (target.name == 'quantity' || target.name == 'unitPrice') {
782
+ const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity']
783
+ this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice
784
+ this.taxInvoiceItems[idx]['taxPrice'] = Math.floor(supplyPrice / 10)
785
+ this.taxInvoiceItems = [...this.taxInvoiceItems]
786
+ this._setTaxInvoiceSummaryCalc()
787
+ }
788
+
789
+ this.taxInvoiceItems[idx][target.name] = inputVal
790
+ }
791
+
792
+ private _onAddInvoiceItem(e: Event) {
793
+ e.preventDefault()
794
+ if (this.taxInvoiceItems.length >= 16) {
795
+ alert('품목은 최대 16개까지 추가 가능합니다.')
796
+ return
797
+ }
798
+
799
+ this.taxInvoiceItems = [...this.taxInvoiceItems, { ...this.defaultTaxInvoiceItem, sequence: new Date().getTime() }]
800
+ }
801
+
802
+ private _onRemoveInvoiceItem(e: Event, sequence: number) {
803
+ e.preventDefault()
804
+ this.taxInvoiceItems = [...this.taxInvoiceItems.filter(item => item.sequence != sequence)]
805
+ this._setTaxInvoiceSummaryCalc()
806
+ }
807
+
808
+ private _setTaxInvoiceSummaryCalc() {
809
+ const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.supplyPrice, 0)
810
+ const taxPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.taxPrice, 0)
811
+
812
+ this.taxInvoice = { ...this.taxInvoice, supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: supplyPrice + taxPrice }
579
813
  }
580
814
  }