@things-factory/tax-invoice 7.0.1-alpha.4 → 7.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +87 -37
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +7 -3
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +77 -31
- package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +24 -2
- package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
- package/dist-server/service/tax-invoice-item/tax-invoice-item.js +2 -2
- package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +29 -4
- package/server/service/tax-invoice-item/tax-invoice-item.ts +3 -3
|
@@ -85,7 +85,7 @@ interface TaxInvoice {
|
|
|
85
85
|
paymentAmountPromissoryNote?: number
|
|
86
86
|
paymentAmountAccountsReceivable?: number
|
|
87
87
|
supplyAmount: number
|
|
88
|
-
taxAmount
|
|
88
|
+
taxAmount: number
|
|
89
89
|
totalAmount: number
|
|
90
90
|
// revisedReason?: RevisedReason
|
|
91
91
|
}
|
|
@@ -146,7 +146,8 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
146
146
|
input[type='date'] {
|
|
147
147
|
width: auto;
|
|
148
148
|
}
|
|
149
|
-
input[readonly]
|
|
149
|
+
input[readonly],
|
|
150
|
+
input:disabled {
|
|
150
151
|
background-color: #eee;
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -375,21 +376,26 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
375
376
|
|
|
376
377
|
// 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
|
|
377
378
|
private today: string = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date())
|
|
379
|
+
private isTaxFree = false
|
|
378
380
|
|
|
379
|
-
|
|
381
|
+
private defaultSupplier = {
|
|
380
382
|
supplierBusinessRegistrationCategory: '01',
|
|
381
383
|
supplierBusinessRegistrationNumber: '',
|
|
382
384
|
supplierBranchIdentification: '',
|
|
383
385
|
supplierBusinessName: '',
|
|
384
386
|
supplierRepresentativeName: ''
|
|
385
387
|
}
|
|
386
|
-
@
|
|
388
|
+
@state() supplier: Supplier = this.defaultSupplier
|
|
389
|
+
|
|
390
|
+
private defaultBuyer = {
|
|
387
391
|
buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
|
|
388
392
|
buyerBusinessRegistrationNumber: '',
|
|
389
393
|
buyerBusinessName: '',
|
|
390
394
|
buyerRepresentativeName: ''
|
|
391
395
|
}
|
|
392
|
-
@property({ type: Object })
|
|
396
|
+
@property({ type: Object }) buyer: Buyer = this.defaultBuyer
|
|
397
|
+
|
|
398
|
+
private defaultTaxInvoice = {
|
|
393
399
|
invoiceType: InvoiceType.TAX_INVOICE,
|
|
394
400
|
category: Category.EXPORT,
|
|
395
401
|
issueDate: this.today,
|
|
@@ -398,6 +404,7 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
398
404
|
taxAmount: 0,
|
|
399
405
|
totalAmount: 0
|
|
400
406
|
}
|
|
407
|
+
@property({ type: Object }) taxInvoice: TaxInvoice = this.defaultTaxInvoice
|
|
401
408
|
|
|
402
409
|
private defaultTaxInvoiceItem = {
|
|
403
410
|
sequence: new Date().getTime(), // 구분용 임시 값 (중복되면 안되니 생성 마다 넣어주기)
|
|
@@ -437,11 +444,19 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
437
444
|
<th>${i18next.t('field.short invoice type')}</th>
|
|
438
445
|
<td>
|
|
439
446
|
${Object.keys(SHORT_INVOICE_TYPE['TAX_INVOICE']).map(key => {
|
|
440
|
-
const disabled: boolean = key !== InvoiceType.TAX_INVOICE
|
|
447
|
+
const disabled: boolean = key !== InvoiceType.TAX_INVOICE && key !== InvoiceType.SMALL_BUSINESS_TAX_INVOICE
|
|
441
448
|
const checked: boolean = key === InvoiceType.TAX_INVOICE
|
|
442
449
|
return html`
|
|
443
450
|
<label for="${'tax_' + key}">${SHORT_INVOICE_TYPE['TAX_INVOICE'][key]}</label>
|
|
444
|
-
<input
|
|
451
|
+
<input
|
|
452
|
+
type="radio"
|
|
453
|
+
id="${'tax_' + key}"
|
|
454
|
+
.value="${key}"
|
|
455
|
+
name="invoiceType"
|
|
456
|
+
?checked=${checked}
|
|
457
|
+
?disabled=${disabled}
|
|
458
|
+
@change=${this._onInputTaxInvoice}
|
|
459
|
+
/>
|
|
445
460
|
`
|
|
446
461
|
})}
|
|
447
462
|
</td>
|
|
@@ -613,22 +628,30 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
613
628
|
</tr>
|
|
614
629
|
|
|
615
630
|
${this.taxInvoiceItems.map(
|
|
616
|
-
(item, idx) =>
|
|
617
|
-
|
|
618
|
-
<
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
<
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
631
|
+
(item, idx) => html`
|
|
632
|
+
<tr>
|
|
633
|
+
<input type="hidden" name="sequence" value=${item.sequence} />
|
|
634
|
+
<td>${this.taxInvoice.issueDate.split('-')[1]}</td>
|
|
635
|
+
<td><input type="text" numeric maxlength="2" name="supplyDate" @input=${e => this._onInputItem(e, idx)} /></td>
|
|
636
|
+
<td><input type="text" name="itemName" .value=${item.itemName} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
637
|
+
<td><input type="text" name="specification" .value=${item.specification} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
638
|
+
<td><input type="text" numeric name="quantity" .value=${this._numberFormat(item.quantity)} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
639
|
+
<td><input type="text" numeric name="unitPrice" .value=${this._numberFormat(item.unitPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
640
|
+
<td><input type="text" numeric name="supplyPrice" .value=${this._numberFormat(item.supplyPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
641
|
+
<td>
|
|
642
|
+
<input
|
|
643
|
+
type="text"
|
|
644
|
+
numeric
|
|
645
|
+
name="taxPrice"
|
|
646
|
+
.value=${this._numberFormat(item.taxPrice)}
|
|
647
|
+
@input=${e => this._onInputItem(e, idx)}
|
|
648
|
+
.disabled=${this.isTaxFree}
|
|
649
|
+
/>
|
|
650
|
+
</td>
|
|
651
|
+
<td><input type="text" name="remark" .value=${item.remark || ''} @input=${e => this._onInputItem(e, idx)} /></td>
|
|
652
|
+
<td><button class="btn-delete" @click=${e => this._onRemoveInvoiceItem(e, item.sequence)}>삭제</button></td>
|
|
653
|
+
</tr>
|
|
654
|
+
`
|
|
632
655
|
)}
|
|
633
656
|
</table>
|
|
634
657
|
</div>
|
|
@@ -739,7 +762,7 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
739
762
|
}
|
|
740
763
|
}
|
|
741
764
|
|
|
742
|
-
async _sendTaxInvoice(
|
|
765
|
+
async _sendTaxInvoice() {
|
|
743
766
|
// 아이템 시퀀스 재 할당 + 날짜, 품목, 규격, 수량이 없으면 필터
|
|
744
767
|
let taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => ({ ...item, sequence: idx + 1, quantity: Number(item.quantity), unitPrice: Number(item.unitPrice) }))
|
|
745
768
|
taxInvoiceItems = taxInvoiceItems.filter(item => item.supplyDate && item.itemName && item.quantity && item.unitPrice)
|
|
@@ -750,6 +773,10 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
750
773
|
taxInvoice.paymentAmountCheck = Number(taxInvoice.paymentAmountCheck || 0)
|
|
751
774
|
taxInvoice.paymentAmountPromissoryNote = Number(taxInvoice.paymentAmountPromissoryNote || 0)
|
|
752
775
|
taxInvoice.paymentAmountAccountsReceivable = Number(taxInvoice.paymentAmountAccountsReceivable || 0)
|
|
776
|
+
taxInvoice.supplyAmount = Number(taxInvoice.supplyAmount || 0)
|
|
777
|
+
taxInvoice.taxAmount = Number(taxInvoice.taxAmount || 0)
|
|
778
|
+
taxInvoice.buyerBusinessRegistrationNumber = taxInvoice.buyerBusinessRegistrationNumber.replace(/-/gi, '')
|
|
779
|
+
taxInvoice.supplierBusinessRegistrationNumber = taxInvoice.supplierBusinessRegistrationNumber.replace(/-/gi, '')
|
|
753
780
|
|
|
754
781
|
// 공급받는자 필수 값 체크
|
|
755
782
|
if (!this.buyer.buyerBusinessRegistrationNumber || !this.buyer.buyerBusinessName || !this.buyer.buyerRepresentativeName) {
|
|
@@ -763,6 +790,12 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
763
790
|
return
|
|
764
791
|
}
|
|
765
792
|
|
|
793
|
+
// 세금이 없는 타입인데 세금이 있는지 체크
|
|
794
|
+
if (taxInvoice.invoiceType === InvoiceType.SMALL_BUSINESS_TAX_INVOICE && taxInvoice.taxAmount > 0) {
|
|
795
|
+
alert('세금이 0원이 아닙니다.')
|
|
796
|
+
return
|
|
797
|
+
}
|
|
798
|
+
|
|
766
799
|
// 현금, 수표, 어음, 외상미수금의 합계 = 총 합계금액 체크
|
|
767
800
|
const paymentAmount: number =
|
|
768
801
|
taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable
|
|
@@ -789,10 +822,14 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
789
822
|
|
|
790
823
|
if (!response.errors) {
|
|
791
824
|
notify({ message: i18next.t('text.success tax send') })
|
|
825
|
+
this.taxInvoice = this.defaultTaxInvoice
|
|
826
|
+
this.supplier = this.defaultSupplier
|
|
827
|
+
this.buyer = this.defaultBuyer
|
|
828
|
+
this.taxInvoiceItems = []
|
|
792
829
|
}
|
|
793
830
|
}
|
|
794
831
|
|
|
795
|
-
private _numberFormat(value: number
|
|
832
|
+
private _numberFormat(value: number): string {
|
|
796
833
|
return !value ? '' : new Intl.NumberFormat('en-US').format(value) || ''
|
|
797
834
|
}
|
|
798
835
|
|
|
@@ -817,27 +854,33 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
817
854
|
return
|
|
818
855
|
}
|
|
819
856
|
|
|
820
|
-
|
|
857
|
+
// 세금이 없는 영세율이 선택 시 모든 아이템의 세금 0원으로 초기화
|
|
858
|
+
if (target.name === 'invoiceType' && target.value === InvoiceType.SMALL_BUSINESS_TAX_INVOICE) {
|
|
859
|
+
this.isTaxFree = true
|
|
860
|
+
this.taxInvoice = { ...this.taxInvoice, taxAmount: 0 }
|
|
861
|
+
this.taxInvoiceItems = this.taxInvoiceItems.map(item => ({ ...item, taxPrice: 0 }))
|
|
862
|
+
}
|
|
821
863
|
|
|
822
|
-
//
|
|
823
|
-
|
|
864
|
+
// 변경시에는 아이템 변경도 리 렌더가 필요해서 데이터 갱신
|
|
865
|
+
this.taxInvoice[target.name] = target.value
|
|
866
|
+
this.taxInvoice = { ...this.taxInvoice }
|
|
824
867
|
}
|
|
825
868
|
}
|
|
826
869
|
|
|
827
870
|
// Input 요소의 값이 변경될 때 호출되는 콜백 함수
|
|
828
871
|
private _onInputItem(e: InputEvent, idx: number) {
|
|
829
872
|
const target = e.target as HTMLInputElement
|
|
830
|
-
let inputVal = target.value
|
|
873
|
+
let inputVal: any = target.value
|
|
831
874
|
|
|
832
875
|
// 숫자 타입은 다른 문자 입력 제거
|
|
833
876
|
if (target.hasAttribute('numeric')) {
|
|
834
|
-
inputVal = inputVal.replace(/\D/g, '')
|
|
877
|
+
inputVal = Number(inputVal.replace(/\D/g, ''))
|
|
835
878
|
target.value = inputVal
|
|
836
879
|
}
|
|
837
880
|
|
|
838
881
|
// 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
|
|
839
882
|
if (target.name === 'supplyDate') {
|
|
840
|
-
const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.padStart(2, '0')
|
|
883
|
+
const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.toString().padStart(2, '0')
|
|
841
884
|
if (itemDate > this.taxInvoice.issueDate) {
|
|
842
885
|
alert('품목의 일자는 작성일자보다 클 수 없습니다.')
|
|
843
886
|
target.value = ''
|
|
@@ -845,15 +888,21 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
845
888
|
inputVal = itemDate
|
|
846
889
|
}
|
|
847
890
|
|
|
891
|
+
// 수량, 단가 수정시 공급가액/세액 자동 계산
|
|
848
892
|
if (target.name == 'quantity' || target.name == 'unitPrice') {
|
|
849
893
|
const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity']
|
|
850
894
|
this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice
|
|
851
|
-
this.taxInvoiceItems[idx]['taxPrice'] = Math.floor(supplyPrice / 10)
|
|
852
|
-
this.taxInvoiceItems = [...this.taxInvoiceItems]
|
|
853
|
-
this._setTaxInvoiceSummaryCalc()
|
|
895
|
+
this.taxInvoiceItems[idx]['taxPrice'] = this.isTaxFree ? 0 : Math.floor(supplyPrice / 10)
|
|
854
896
|
}
|
|
855
897
|
|
|
898
|
+
// 인풋에 값 넣기
|
|
856
899
|
this.taxInvoiceItems[idx][target.name] = inputVal
|
|
900
|
+
|
|
901
|
+
// 아이템 금액에 관련된 필드 수정시 합계 계산
|
|
902
|
+
if (['quantity', 'unitPrice', 'supplyPrice', 'taxPrice'].includes(target.name)) {
|
|
903
|
+
this.taxInvoiceItems = [...this.taxInvoiceItems]
|
|
904
|
+
this._setTaxInvoiceSummaryCalc()
|
|
905
|
+
}
|
|
857
906
|
}
|
|
858
907
|
|
|
859
908
|
private async _openSupplierPopup() {
|
|
@@ -993,9 +1042,10 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
|
|
|
993
1042
|
}
|
|
994
1043
|
|
|
995
1044
|
private _setTaxInvoiceSummaryCalc() {
|
|
996
|
-
const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.supplyPrice, 0)
|
|
997
|
-
const taxPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.taxPrice, 0)
|
|
1045
|
+
const supplyPrice: number = this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.supplyPrice), 0) || 0
|
|
1046
|
+
const taxPrice: number = this.isTaxFree ? 0 : this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.taxPrice), 0) || 0
|
|
1047
|
+
const totalAmount: number = supplyPrice + taxPrice
|
|
998
1048
|
|
|
999
|
-
this.taxInvoice = { ...this.taxInvoice, supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount:
|
|
1049
|
+
this.taxInvoice = { ...this.taxInvoice, supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: totalAmount }
|
|
1000
1050
|
}
|
|
1001
1051
|
}
|
|
@@ -54,7 +54,7 @@ interface TaxInvoice {
|
|
|
54
54
|
paymentAmountPromissoryNote?: number;
|
|
55
55
|
paymentAmountAccountsReceivable?: number;
|
|
56
56
|
supplyAmount: number;
|
|
57
|
-
taxAmount
|
|
57
|
+
taxAmount: number;
|
|
58
58
|
totalAmount: number;
|
|
59
59
|
}
|
|
60
60
|
interface TaxInvoiceItem {
|
|
@@ -75,8 +75,12 @@ export declare class TaxInvoiceSendPage extends TaxInvoiceSendPage_base {
|
|
|
75
75
|
'company-list-popup': typeof CompanyListPopup;
|
|
76
76
|
};
|
|
77
77
|
private today;
|
|
78
|
+
private isTaxFree;
|
|
79
|
+
private defaultSupplier;
|
|
78
80
|
supplier: Supplier;
|
|
81
|
+
private defaultBuyer;
|
|
79
82
|
buyer: Buyer;
|
|
83
|
+
private defaultTaxInvoice;
|
|
80
84
|
taxInvoice: TaxInvoice;
|
|
81
85
|
private defaultTaxInvoiceItem;
|
|
82
86
|
taxInvoiceItems: TaxInvoiceItem[];
|
|
@@ -92,14 +96,14 @@ export declare class TaxInvoiceSendPage extends TaxInvoiceSendPage_base {
|
|
|
92
96
|
danger: boolean;
|
|
93
97
|
};
|
|
94
98
|
title: string;
|
|
95
|
-
action: (
|
|
99
|
+
action: () => Promise<void>;
|
|
96
100
|
}[];
|
|
97
101
|
};
|
|
98
102
|
render(): import("lit").TemplateResult<1>;
|
|
99
103
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
100
104
|
_fetchSupplier(): Promise<void>;
|
|
101
105
|
pageUpdated(changes: any, lifecycle: any): Promise<void>;
|
|
102
|
-
_sendTaxInvoice(
|
|
106
|
+
_sendTaxInvoice(): Promise<void>;
|
|
103
107
|
private _numberFormat;
|
|
104
108
|
private _onInputTaxInvoice;
|
|
105
109
|
private _onInputItem;
|
|
@@ -35,20 +35,23 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
35
35
|
super(...arguments);
|
|
36
36
|
// 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
|
|
37
37
|
this.today = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date());
|
|
38
|
-
this.
|
|
38
|
+
this.isTaxFree = false;
|
|
39
|
+
this.defaultSupplier = {
|
|
39
40
|
supplierBusinessRegistrationCategory: '01',
|
|
40
41
|
supplierBusinessRegistrationNumber: '',
|
|
41
42
|
supplierBranchIdentification: '',
|
|
42
43
|
supplierBusinessName: '',
|
|
43
44
|
supplierRepresentativeName: ''
|
|
44
45
|
};
|
|
45
|
-
this.
|
|
46
|
+
this.supplier = this.defaultSupplier;
|
|
47
|
+
this.defaultBuyer = {
|
|
46
48
|
buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
|
|
47
49
|
buyerBusinessRegistrationNumber: '',
|
|
48
50
|
buyerBusinessName: '',
|
|
49
51
|
buyerRepresentativeName: ''
|
|
50
52
|
};
|
|
51
|
-
this.
|
|
53
|
+
this.buyer = this.defaultBuyer;
|
|
54
|
+
this.defaultTaxInvoice = {
|
|
52
55
|
invoiceType: InvoiceType.TAX_INVOICE,
|
|
53
56
|
category: Category.EXPORT,
|
|
54
57
|
issueDate: this.today,
|
|
@@ -57,6 +60,7 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
57
60
|
taxAmount: 0,
|
|
58
61
|
totalAmount: 0
|
|
59
62
|
};
|
|
63
|
+
this.taxInvoice = this.defaultTaxInvoice;
|
|
60
64
|
this.defaultTaxInvoiceItem = {
|
|
61
65
|
sequence: new Date().getTime(),
|
|
62
66
|
supplyDate: '',
|
|
@@ -96,11 +100,19 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
96
100
|
<th>${i18next.t('field.short invoice type')}</th>
|
|
97
101
|
<td>
|
|
98
102
|
${Object.keys(SHORT_INVOICE_TYPE['TAX_INVOICE']).map(key => {
|
|
99
|
-
const disabled = key !== InvoiceType.TAX_INVOICE;
|
|
103
|
+
const disabled = key !== InvoiceType.TAX_INVOICE && key !== InvoiceType.SMALL_BUSINESS_TAX_INVOICE;
|
|
100
104
|
const checked = key === InvoiceType.TAX_INVOICE;
|
|
101
105
|
return html `
|
|
102
106
|
<label for="${'tax_' + key}">${SHORT_INVOICE_TYPE['TAX_INVOICE'][key]}</label>
|
|
103
|
-
<input
|
|
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
|
+
/>
|
|
104
116
|
`;
|
|
105
117
|
})}
|
|
106
118
|
</td>
|
|
@@ -272,20 +284,29 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
272
284
|
</tr>
|
|
273
285
|
|
|
274
286
|
${this.taxInvoiceItems.map((item, idx) => html `
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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
|
+
`)}
|
|
289
310
|
</table>
|
|
290
311
|
</div>
|
|
291
312
|
|
|
@@ -390,7 +411,7 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
390
411
|
// do something here when this page just became as active
|
|
391
412
|
}
|
|
392
413
|
}
|
|
393
|
-
async _sendTaxInvoice(
|
|
414
|
+
async _sendTaxInvoice() {
|
|
394
415
|
// 아이템 시퀀스 재 할당 + 날짜, 품목, 규격, 수량이 없으면 필터
|
|
395
416
|
let taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => (Object.assign(Object.assign({}, item), { sequence: idx + 1, quantity: Number(item.quantity), unitPrice: Number(item.unitPrice) })));
|
|
396
417
|
taxInvoiceItems = taxInvoiceItems.filter(item => item.supplyDate && item.itemName && item.quantity && item.unitPrice);
|
|
@@ -400,6 +421,10 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
400
421
|
taxInvoice.paymentAmountCheck = Number(taxInvoice.paymentAmountCheck || 0);
|
|
401
422
|
taxInvoice.paymentAmountPromissoryNote = Number(taxInvoice.paymentAmountPromissoryNote || 0);
|
|
402
423
|
taxInvoice.paymentAmountAccountsReceivable = Number(taxInvoice.paymentAmountAccountsReceivable || 0);
|
|
424
|
+
taxInvoice.supplyAmount = Number(taxInvoice.supplyAmount || 0);
|
|
425
|
+
taxInvoice.taxAmount = Number(taxInvoice.taxAmount || 0);
|
|
426
|
+
taxInvoice.buyerBusinessRegistrationNumber = taxInvoice.buyerBusinessRegistrationNumber.replace(/-/gi, '');
|
|
427
|
+
taxInvoice.supplierBusinessRegistrationNumber = taxInvoice.supplierBusinessRegistrationNumber.replace(/-/gi, '');
|
|
403
428
|
// 공급받는자 필수 값 체크
|
|
404
429
|
if (!this.buyer.buyerBusinessRegistrationNumber || !this.buyer.buyerBusinessName || !this.buyer.buyerRepresentativeName) {
|
|
405
430
|
alert('공급받는자 필수 값을 모두 입력해 주세요.');
|
|
@@ -410,6 +435,11 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
410
435
|
alert('등록 가능한 아아템의 개수는 1개 이상이여야 합니다.');
|
|
411
436
|
return;
|
|
412
437
|
}
|
|
438
|
+
// 세금이 없는 타입인데 세금이 있는지 체크
|
|
439
|
+
if (taxInvoice.invoiceType === InvoiceType.SMALL_BUSINESS_TAX_INVOICE && taxInvoice.taxAmount > 0) {
|
|
440
|
+
alert('세금이 0원이 아닙니다.');
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
413
443
|
// 현금, 수표, 어음, 외상미수금의 합계 = 총 합계금액 체크
|
|
414
444
|
const paymentAmount = taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable;
|
|
415
445
|
if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
|
|
@@ -433,6 +463,10 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
433
463
|
});
|
|
434
464
|
if (!response.errors) {
|
|
435
465
|
notify({ message: i18next.t('text.success tax send') });
|
|
466
|
+
this.taxInvoice = this.defaultTaxInvoice;
|
|
467
|
+
this.supplier = this.defaultSupplier;
|
|
468
|
+
this.buyer = this.defaultBuyer;
|
|
469
|
+
this.taxInvoiceItems = [];
|
|
436
470
|
}
|
|
437
471
|
}
|
|
438
472
|
_numberFormat(value) {
|
|
@@ -458,10 +492,15 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
458
492
|
alert('작성일자는 현재일까지 입력하시기 바랍니다.');
|
|
459
493
|
return;
|
|
460
494
|
}
|
|
495
|
+
// 세금이 없는 영세율이 선택 시 모든 아이템의 세금 0원으로 초기화
|
|
496
|
+
if (target.name === 'invoiceType' && target.value === InvoiceType.SMALL_BUSINESS_TAX_INVOICE) {
|
|
497
|
+
this.isTaxFree = true;
|
|
498
|
+
this.taxInvoice = Object.assign(Object.assign({}, this.taxInvoice), { taxAmount: 0 });
|
|
499
|
+
this.taxInvoiceItems = this.taxInvoiceItems.map(item => (Object.assign(Object.assign({}, item), { taxPrice: 0 })));
|
|
500
|
+
}
|
|
501
|
+
// 변경시에는 아이템 변경도 리 렌더가 필요해서 데이터 갱신
|
|
461
502
|
this.taxInvoice[target.name] = target.value;
|
|
462
|
-
|
|
463
|
-
if (target.name === 'issueDate')
|
|
464
|
-
this.taxInvoice = Object.assign({}, this.taxInvoice);
|
|
503
|
+
this.taxInvoice = Object.assign({}, this.taxInvoice);
|
|
465
504
|
}
|
|
466
505
|
}
|
|
467
506
|
// Input 요소의 값이 변경될 때 호출되는 콜백 함수
|
|
@@ -470,26 +509,31 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
470
509
|
let inputVal = target.value;
|
|
471
510
|
// 숫자 타입은 다른 문자 입력 제거
|
|
472
511
|
if (target.hasAttribute('numeric')) {
|
|
473
|
-
inputVal = inputVal.replace(/\D/g, '');
|
|
512
|
+
inputVal = Number(inputVal.replace(/\D/g, ''));
|
|
474
513
|
target.value = inputVal;
|
|
475
514
|
}
|
|
476
515
|
// 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
|
|
477
516
|
if (target.name === 'supplyDate') {
|
|
478
|
-
const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.padStart(2, '0');
|
|
517
|
+
const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.toString().padStart(2, '0');
|
|
479
518
|
if (itemDate > this.taxInvoice.issueDate) {
|
|
480
519
|
alert('품목의 일자는 작성일자보다 클 수 없습니다.');
|
|
481
520
|
target.value = '';
|
|
482
521
|
}
|
|
483
522
|
inputVal = itemDate;
|
|
484
523
|
}
|
|
524
|
+
// 수량, 단가 수정시 공급가액/세액 자동 계산
|
|
485
525
|
if (target.name == 'quantity' || target.name == 'unitPrice') {
|
|
486
526
|
const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity'];
|
|
487
527
|
this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice;
|
|
488
|
-
this.taxInvoiceItems[idx]['taxPrice'] = Math.floor(supplyPrice / 10);
|
|
528
|
+
this.taxInvoiceItems[idx]['taxPrice'] = this.isTaxFree ? 0 : Math.floor(supplyPrice / 10);
|
|
529
|
+
}
|
|
530
|
+
// 인풋에 값 넣기
|
|
531
|
+
this.taxInvoiceItems[idx][target.name] = inputVal;
|
|
532
|
+
// 아이템 금액에 관련된 필드 수정시 합계 계산
|
|
533
|
+
if (['quantity', 'unitPrice', 'supplyPrice', 'taxPrice'].includes(target.name)) {
|
|
489
534
|
this.taxInvoiceItems = [...this.taxInvoiceItems];
|
|
490
535
|
this._setTaxInvoiceSummaryCalc();
|
|
491
536
|
}
|
|
492
|
-
this.taxInvoiceItems[idx][target.name] = inputVal;
|
|
493
537
|
}
|
|
494
538
|
async _openSupplierPopup() {
|
|
495
539
|
const response = await client.query({
|
|
@@ -613,9 +657,10 @@ let TaxInvoiceSendPage = class TaxInvoiceSendPage extends localize(i18next)(Scop
|
|
|
613
657
|
this._setTaxInvoiceSummaryCalc();
|
|
614
658
|
}
|
|
615
659
|
_setTaxInvoiceSummaryCalc() {
|
|
616
|
-
const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.supplyPrice, 0);
|
|
617
|
-
const taxPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.taxPrice, 0);
|
|
618
|
-
|
|
660
|
+
const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.supplyPrice), 0) || 0;
|
|
661
|
+
const taxPrice = this.isTaxFree ? 0 : this.taxInvoiceItems.reduce((prev, item) => prev + Number(item.taxPrice), 0) || 0;
|
|
662
|
+
const totalAmount = supplyPrice + taxPrice;
|
|
663
|
+
this.taxInvoice = Object.assign(Object.assign({}, this.taxInvoice), { supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: totalAmount });
|
|
619
664
|
}
|
|
620
665
|
};
|
|
621
666
|
TaxInvoiceSendPage.styles = [
|
|
@@ -661,7 +706,8 @@ TaxInvoiceSendPage.styles = [
|
|
|
661
706
|
input[type='date'] {
|
|
662
707
|
width: auto;
|
|
663
708
|
}
|
|
664
|
-
input[readonly]
|
|
709
|
+
input[readonly],
|
|
710
|
+
input:disabled {
|
|
665
711
|
background-color: #eee;
|
|
666
712
|
}
|
|
667
713
|
|