@things-factory/tax-invoice 8.0.0-beta.9 → 8.0.2
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/bootstrap.ts +1 -0
- package/client/index.ts +0 -0
- package/client/pages/main.ts +25 -0
- package/client/pages/tax-audit-result/tax-audit-result-importer.ts +87 -0
- package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +331 -0
- package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +454 -0
- package/client/pages/tax-invoice/tax-invoice-list-page.ts +525 -0
- package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +418 -0
- package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +447 -0
- package/client/pages/tax-invoice-send/company-list-popup.ts +188 -0
- package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +196 -0
- package/client/pages/tax-invoice-send/tax-invoice-send.ts +1181 -0
- package/client/route.ts +23 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/server/index.ts +2 -0
- package/server/routes.ts +28 -0
- package/server/service/index.ts +37 -0
- package/server/service/tax-audit-result/event-subscriber.ts +17 -0
- package/server/service/tax-audit-result/index.ts +9 -0
- package/server/service/tax-audit-result/tax-audit-result-history.ts +120 -0
- package/server/service/tax-audit-result/tax-audit-result-mutation.ts +198 -0
- package/server/service/tax-audit-result/tax-audit-result-query.ts +65 -0
- package/server/service/tax-audit-result/tax-audit-result-type.ts +61 -0
- package/server/service/tax-audit-result/tax-audit-result.ts +99 -0
- package/server/service/tax-invoice/index.ts +6 -0
- package/server/service/tax-invoice/tax-invoice-mutation.ts +138 -0
- package/server/service/tax-invoice/tax-invoice-query.ts +99 -0
- package/server/service/tax-invoice/tax-invoice-type.ts +236 -0
- package/server/service/tax-invoice/tax-invoice-util.ts +224 -0
- package/server/service/tax-invoice/tax-invoice.ts +393 -0
- package/server/service/tax-invoice-api/index.ts +6 -0
- package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +275 -0
- package/server/service/tax-invoice-api/tax-invoice-api-query.ts +40 -0
- package/server/service/tax-invoice-api/tax-invoice-api-type.ts +83 -0
- package/server/service/tax-invoice-api/tax-invoice-api.ts +128 -0
- package/server/service/tax-invoice-company/index.ts +6 -0
- package/server/service/tax-invoice-company/tax-invoice-company-mutation.ts +84 -0
- package/server/service/tax-invoice-company/tax-invoice-company-query.ts +86 -0
- package/server/service/tax-invoice-company/tax-invoice-company-type.ts +105 -0
- package/server/service/tax-invoice-company/tax-invoice-company.ts +128 -0
- package/server/service/tax-invoice-item/index.ts +6 -0
- package/server/service/tax-invoice-item/tax-invoice-item-mutation.ts +128 -0
- package/server/service/tax-invoice-item/tax-invoice-item-query.ts +60 -0
- package/server/service/tax-invoice-item/tax-invoice-item-type.ts +77 -0
- package/server/service/tax-invoice-item/tax-invoice-item.ts +95 -0
- package/server/service/unipost-api/tax-invoice-inquiry.ts +99 -0
- package/server/service/unipost-api/tax-invoice-send.ts +32 -0
- package/server/tsconfig.json +10 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
2
|
+
|
|
3
|
+
import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
|
|
4
|
+
import { CustomAlert, PageView } from '@operato/shell'
|
|
5
|
+
import { css, html } from 'lit'
|
|
6
|
+
import { customElement, state } from 'lit/decorators.js'
|
|
7
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
|
+
import { client } from '@operato/graphql'
|
|
9
|
+
import { i18next, localize } from '@operato/i18n'
|
|
10
|
+
import { notify } from '@operato/layout'
|
|
11
|
+
import gql from 'graphql-tag'
|
|
12
|
+
import { BusinessRegistrationCategory, Category, InvoiceType, Purpose } from '../tax-invoice/tax-invoice-list-page'
|
|
13
|
+
import { CompanyListPopup } from './company-list-popup'
|
|
14
|
+
import { Supplier, Buyer, TaxInvoice, TaxInvoiceItem } from './tax-invoice-send'
|
|
15
|
+
import './tax-invoice-send'
|
|
16
|
+
|
|
17
|
+
@customElement('tax-invoice-send-page')
|
|
18
|
+
export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
|
|
19
|
+
static styles = [
|
|
20
|
+
ScrollbarStyles,
|
|
21
|
+
CommonGristStyles,
|
|
22
|
+
css`
|
|
23
|
+
:host {
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
static get scopedElements() {
|
|
30
|
+
return {
|
|
31
|
+
'company-list-popup': CompanyListPopup
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
|
|
36
|
+
private today: string = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date())
|
|
37
|
+
|
|
38
|
+
private defaultSupplier = {
|
|
39
|
+
supplierBusinessRegistrationCategory: '01',
|
|
40
|
+
supplierBusinessRegistrationNumber: '',
|
|
41
|
+
supplierBranchIdentification: '',
|
|
42
|
+
supplierBusinessName: '',
|
|
43
|
+
supplierRepresentativeName: ''
|
|
44
|
+
}
|
|
45
|
+
@state() supplier: Supplier = this.defaultSupplier
|
|
46
|
+
|
|
47
|
+
private defaultBuyer = {
|
|
48
|
+
buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
|
|
49
|
+
buyerBusinessRegistrationNumber: '',
|
|
50
|
+
buyerBusinessName: '',
|
|
51
|
+
buyerRepresentativeName: ''
|
|
52
|
+
}
|
|
53
|
+
@state() buyer: Buyer = this.defaultBuyer
|
|
54
|
+
|
|
55
|
+
private defaultTaxInvoice = {
|
|
56
|
+
invoiceType: InvoiceType.TAX_INVOICE,
|
|
57
|
+
category: Category.EXPORT,
|
|
58
|
+
issueDate: this.today,
|
|
59
|
+
purpose: Purpose.INVOICE,
|
|
60
|
+
supplyAmount: 0,
|
|
61
|
+
taxAmount: 0,
|
|
62
|
+
totalAmount: 0
|
|
63
|
+
}
|
|
64
|
+
@state() taxInvoice: TaxInvoice = this.defaultTaxInvoice
|
|
65
|
+
|
|
66
|
+
private defaultTaxInvoiceItem = {
|
|
67
|
+
sequence: new Date().getTime(), // 구분용 임시 값 (중복되면 안되니 생성 마다 넣어주기)
|
|
68
|
+
supplyDate: '',
|
|
69
|
+
itemName: '',
|
|
70
|
+
specification: '',
|
|
71
|
+
quantity: 0,
|
|
72
|
+
unitPrice: 0,
|
|
73
|
+
supplyPrice: 0,
|
|
74
|
+
taxPrice: 0
|
|
75
|
+
}
|
|
76
|
+
@state() taxInvoiceItems: TaxInvoiceItem[] = [{ ...this.defaultTaxInvoiceItem }]
|
|
77
|
+
|
|
78
|
+
get context() {
|
|
79
|
+
return {
|
|
80
|
+
title: i18next.t('title.tax invoice send'),
|
|
81
|
+
help: 'tax-invoice-send/tax-invoice-send',
|
|
82
|
+
actions: [
|
|
83
|
+
{
|
|
84
|
+
title: i18next.t('button.tax invoice send'),
|
|
85
|
+
action: this._sendTaxInvoice.bind(this),
|
|
86
|
+
...CommonButtonStyles.add
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
return html` <tax-invoice-send></tax-invoice-send> `
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async _sendTaxInvoice() {
|
|
97
|
+
// 아이템 시퀀스 재 할당 + 날짜, 품목, 규격, 수량이 없으면 필터
|
|
98
|
+
let taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => ({
|
|
99
|
+
...item,
|
|
100
|
+
sequence: idx + 1,
|
|
101
|
+
quantity: Number(item.quantity),
|
|
102
|
+
unitPrice: Number(item.unitPrice)
|
|
103
|
+
}))
|
|
104
|
+
taxInvoiceItems = taxInvoiceItems.filter(
|
|
105
|
+
item => item.supplyDate && item.itemName && item.quantity && item.unitPrice
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
// taxInvoice 데이터 생성 및 타입 변환
|
|
109
|
+
let taxInvoice = { ...this.taxInvoice, ...this.supplier, ...this.buyer }
|
|
110
|
+
taxInvoice.paymentAmountCash = Number(taxInvoice.paymentAmountCash || 0)
|
|
111
|
+
taxInvoice.paymentAmountCheck = Number(taxInvoice.paymentAmountCheck || 0)
|
|
112
|
+
taxInvoice.paymentAmountPromissoryNote = Number(taxInvoice.paymentAmountPromissoryNote || 0)
|
|
113
|
+
taxInvoice.paymentAmountAccountsReceivable = Number(taxInvoice.paymentAmountAccountsReceivable || 0)
|
|
114
|
+
taxInvoice.supplyAmount = Number(taxInvoice.supplyAmount || 0)
|
|
115
|
+
taxInvoice.taxAmount = Number(taxInvoice.taxAmount || 0)
|
|
116
|
+
taxInvoice.buyerBusinessRegistrationNumber = taxInvoice.buyerBusinessRegistrationNumber.replace(/-/gi, '')
|
|
117
|
+
taxInvoice.supplierBusinessRegistrationNumber = taxInvoice.supplierBusinessRegistrationNumber.replace(/-/gi, '')
|
|
118
|
+
|
|
119
|
+
// 공급받는자 필수 값 체크
|
|
120
|
+
if (
|
|
121
|
+
!this.buyer.buyerBusinessRegistrationNumber ||
|
|
122
|
+
!this.buyer.buyerBusinessName ||
|
|
123
|
+
!this.buyer.buyerRepresentativeName
|
|
124
|
+
) {
|
|
125
|
+
await CustomAlert({
|
|
126
|
+
type: 'warning',
|
|
127
|
+
title: '공급받는자 필수 값을 모두 입력해 주세요.',
|
|
128
|
+
text: '공급받는자 필수 값을 모두 입력해 주세요.',
|
|
129
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
130
|
+
})
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 아이템 개수 체크
|
|
135
|
+
if (taxInvoiceItems.length === 0) {
|
|
136
|
+
await CustomAlert({
|
|
137
|
+
type: 'warning',
|
|
138
|
+
title: '등록 가능한 아이템의 개수는 1개 이상이여야 합니다.',
|
|
139
|
+
text: '등록 가능한 아이템의 개수는 1개 이상이여야 합니다.',
|
|
140
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
141
|
+
})
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 세금이 없는 타입인데 세금이 있는지 체크
|
|
146
|
+
if (taxInvoice.invoiceType === InvoiceType.SMALL_BUSINESS_TAX_INVOICE && taxInvoice.taxAmount > 0) {
|
|
147
|
+
await CustomAlert({
|
|
148
|
+
type: 'warning',
|
|
149
|
+
title: '세금이 0원이 아닙니다.',
|
|
150
|
+
text: '세금이 0원이 아닙니다.',
|
|
151
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
152
|
+
})
|
|
153
|
+
return
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// 현금, 수표, 어음, 외상미수금의 합계 = 총 합계금액 체크
|
|
157
|
+
const paymentAmount: number =
|
|
158
|
+
taxInvoice.paymentAmountCash +
|
|
159
|
+
taxInvoice.paymentAmountCheck +
|
|
160
|
+
taxInvoice.paymentAmountPromissoryNote +
|
|
161
|
+
taxInvoice.paymentAmountAccountsReceivable
|
|
162
|
+
if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
|
|
163
|
+
await CustomAlert({
|
|
164
|
+
type: 'warning',
|
|
165
|
+
title: '현금, 수표, 어음, 외상미수금의 합계는 총 합계금액과 동일해야 합니다.',
|
|
166
|
+
text: '현금, 수표, 어음, 외상미수금의 합계는 총 합계금액과 동일해야 합니다.',
|
|
167
|
+
confirmButton: { text: i18next.t('button.confirm') }
|
|
168
|
+
})
|
|
169
|
+
return
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const response = await client.mutate({
|
|
173
|
+
mutation: gql`
|
|
174
|
+
mutation SendTaxInvoicesByApi($taxInvoiceSendList: [TaxInvoiceSend!]!) {
|
|
175
|
+
response: sendTaxInvoicesByApi(taxInvoiceSendList: $taxInvoiceSendList)
|
|
176
|
+
}
|
|
177
|
+
`,
|
|
178
|
+
variables: {
|
|
179
|
+
taxInvoiceSendList: [
|
|
180
|
+
{
|
|
181
|
+
taxInvoice,
|
|
182
|
+
taxInvoiceItems
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
if (!response.errors) {
|
|
189
|
+
notify({ message: i18next.t('text.success tax send') })
|
|
190
|
+
this.taxInvoice = this.defaultTaxInvoice
|
|
191
|
+
this.supplier = this.defaultSupplier
|
|
192
|
+
this.buyer = this.defaultBuyer
|
|
193
|
+
this.taxInvoiceItems = [{ ...this.defaultTaxInvoiceItem }]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|