@things-factory/tax-invoice 7.0.0-alpha.8 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/client/bootstrap.ts +1 -0
  2. package/client/pages/tax-audit-result/tax-audit-result-importer.ts +8 -19
  3. package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +10 -25
  4. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +21 -19
  5. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +99 -61
  6. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +2 -67
  7. package/client/pages/{tax-invoice-company/tax-invoice-company-importer.ts → tax-invoice-send/company-list-popup.ts} +69 -57
  8. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +78 -742
  9. package/client/pages/tax-invoice-send/tax-invoice-send.ts +1181 -0
  10. package/config/config.development.js +13 -0
  11. package/config/config.production.js +13 -0
  12. package/dist-client/bootstrap.d.ts +1 -0
  13. package/dist-client/bootstrap.js +1 -1
  14. package/dist-client/bootstrap.js.map +1 -1
  15. package/dist-client/pages/main.js.map +1 -1
  16. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.d.ts +1 -0
  17. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js +5 -12
  18. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js.map +1 -1
  19. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js +8 -16
  20. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js.map +1 -1
  21. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.d.ts +0 -1
  22. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +20 -17
  23. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -1
  24. package/dist-client/pages/tax-invoice/tax-invoice-list-page.d.ts +5 -5
  25. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js.map +1 -1
  26. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +3 -2
  27. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +91 -61
  28. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
  29. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +0 -16
  30. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +3 -62
  31. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -1
  32. package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +69 -0
  33. package/dist-client/pages/{tax-invoice-company/tax-invoice-company-importer.js → tax-invoice-send/company-list-popup.js} +75 -60
  34. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -0
  35. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +11 -78
  36. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +65 -654
  37. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  38. package/dist-client/pages/tax-invoice-send/tax-invoice-send.d.ts +112 -0
  39. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js +1086 -0
  40. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js.map +1 -0
  41. package/dist-client/route.d.ts +1 -1
  42. package/dist-client/route.js.map +1 -1
  43. package/dist-client/tsconfig.tsbuildinfo +1 -1
  44. package/dist-server/index.d.ts +2 -0
  45. package/dist-server/routes.d.ts +1 -0
  46. package/dist-server/service/index.d.ts +9 -0
  47. package/dist-server/service/index.js +1 -0
  48. package/dist-server/service/index.js.map +1 -1
  49. package/dist-server/service/tax-audit-result/event-subscriber.d.ts +7 -0
  50. package/dist-server/service/tax-audit-result/event-subscriber.js +2 -2
  51. package/dist-server/service/tax-audit-result/event-subscriber.js.map +1 -1
  52. package/dist-server/service/tax-audit-result/index.d.ts +7 -0
  53. package/dist-server/service/tax-audit-result/tax-audit-result-history.d.ts +25 -0
  54. package/dist-server/service/tax-audit-result/tax-audit-result-history.js +10 -6
  55. package/dist-server/service/tax-audit-result/tax-audit-result-history.js.map +1 -1
  56. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.d.ts +10 -0
  57. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js +2 -2
  58. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js.map +1 -1
  59. package/dist-server/service/tax-audit-result/tax-audit-result-query.d.ts +12 -0
  60. package/dist-server/service/tax-audit-result/tax-audit-result-query.js +3 -3
  61. package/dist-server/service/tax-audit-result/tax-audit-result-query.js.map +1 -1
  62. package/dist-server/service/tax-audit-result/tax-audit-result-type.d.ts +23 -0
  63. package/dist-server/service/tax-audit-result/tax-audit-result-type.js +6 -6
  64. package/dist-server/service/tax-audit-result/tax-audit-result-type.js.map +1 -1
  65. package/dist-server/service/tax-audit-result/tax-audit-result.d.ts +25 -0
  66. package/dist-server/service/tax-audit-result/tax-audit-result.js +4 -4
  67. package/dist-server/service/tax-audit-result/tax-audit-result.js.map +1 -1
  68. package/dist-server/service/tax-invoice/index.d.ts +5 -0
  69. package/dist-server/service/tax-invoice/tax-invoice-mutation.d.ts +10 -0
  70. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +2 -6
  71. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
  72. package/dist-server/service/tax-invoice/tax-invoice-query.d.ts +14 -0
  73. package/dist-server/service/tax-invoice/tax-invoice-query.js +22 -10
  74. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -1
  75. package/dist-server/service/tax-invoice/tax-invoice-type.d.ts +86 -0
  76. package/dist-server/service/tax-invoice/tax-invoice-type.js +12 -8
  77. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
  78. package/dist-server/service/tax-invoice/tax-invoice-util.d.ts +133 -0
  79. package/dist-server/service/tax-invoice/tax-invoice-util.js +2 -2
  80. package/dist-server/service/tax-invoice/tax-invoice-util.js.map +1 -1
  81. package/dist-server/service/tax-invoice/tax-invoice.d.ts +120 -0
  82. package/dist-server/service/tax-invoice/tax-invoice.js +15 -10
  83. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  84. package/dist-server/service/tax-invoice-api/index.d.ts +5 -0
  85. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.d.ts +8 -0
  86. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +46 -16
  87. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  88. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.d.ts +10 -0
  89. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +15 -9
  90. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
  91. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.d.ts +32 -0
  92. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +9 -13
  93. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
  94. package/dist-server/service/tax-invoice-api/tax-invoice-api.d.ts +31 -0
  95. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +12 -24
  96. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
  97. package/dist-server/service/tax-invoice-company/index.d.ts +5 -0
  98. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.d.ts +7 -0
  99. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js +2 -2
  100. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js.map +1 -1
  101. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.d.ts +14 -0
  102. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +44 -9
  103. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -1
  104. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.d.ts +38 -0
  105. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +59 -9
  106. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -1
  107. package/dist-server/service/tax-invoice-company/tax-invoice-company.d.ts +29 -0
  108. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +14 -24
  109. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -1
  110. package/dist-server/service/tax-invoice-item/index.d.ts +5 -0
  111. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.d.ts +10 -0
  112. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js +2 -2
  113. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js.map +1 -1
  114. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.d.ts +11 -0
  115. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js +3 -3
  116. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -1
  117. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.d.ts +29 -0
  118. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +6 -6
  119. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -1
  120. package/dist-server/service/tax-invoice-item/tax-invoice-item.d.ts +23 -0
  121. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +7 -7
  122. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -1
  123. package/dist-server/service/unipost-api/tax-invoice-inquiry.d.ts +16 -0
  124. package/dist-server/service/unipost-api/tax-invoice-inquiry.js +10 -14
  125. package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -1
  126. package/dist-server/service/unipost-api/tax-invoice-send.d.ts +1 -0
  127. package/dist-server/service/unipost-api/tax-invoice-send.js +5 -7
  128. package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -1
  129. package/dist-server/tsconfig.tsbuildinfo +1 -1
  130. package/package.json +8 -7
  131. package/server/service/index.ts +1 -0
  132. package/server/service/tax-audit-result/tax-audit-result-history.ts +10 -6
  133. package/server/service/tax-audit-result/tax-audit-result-query.ts +4 -1
  134. package/server/service/tax-audit-result/tax-audit-result.ts +6 -2
  135. package/server/service/tax-invoice/tax-invoice-mutation.ts +0 -3
  136. package/server/service/tax-invoice/tax-invoice-query.ts +36 -9
  137. package/server/service/tax-invoice/tax-invoice-type.ts +3 -0
  138. package/server/service/tax-invoice/tax-invoice-util.ts +1 -0
  139. package/server/service/tax-invoice/tax-invoice.ts +19 -4
  140. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +63 -24
  141. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +15 -6
  142. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +2 -5
  143. package/server/service/tax-invoice-api/tax-invoice-api.ts +23 -20
  144. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +39 -6
  145. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +40 -4
  146. package/server/service/tax-invoice-company/tax-invoice-company.ts +11 -21
  147. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +4 -1
  148. package/server/service/tax-invoice-item/tax-invoice-item.ts +22 -8
  149. package/server/service/unipost-api/tax-invoice-inquiry.ts +6 -10
  150. package/server/service/unipost-api/tax-invoice-send.ts +5 -5
  151. package/translations/ko.json +3 -0
  152. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +0 -31
  153. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +0 -1
@@ -1,103 +1,18 @@
1
1
  import '@operato/data-grist'
2
2
 
3
3
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
- import { PageView } from '@operato/shell'
4
+ import { CustomAlert, PageView } from '@operato/shell'
5
5
  import { css, html } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
6
+ import { customElement, state } from 'lit/decorators.js'
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
8
  import { client } from '@operato/graphql'
9
9
  import { i18next, localize } from '@operato/i18n'
10
10
  import { notify } from '@operato/layout'
11
11
  import gql from 'graphql-tag'
12
- import { BUSINESS_REGISTRATION_CATEGORY, BusinessRegistrationCategory, Category, INVOICE_TYPE, InvoiceType, PURPOSE, Purpose } from '../tax-invoice/tax-invoice-list-page'
13
-
14
- const SHORT_INVOICE_TYPE = {
15
- TAX_INVOICE: {
16
- [InvoiceType.TAX_INVOICE]: '일반',
17
- [InvoiceType.SMALL_BUSINESS_TAX_INVOICE]: '영세율',
18
- [InvoiceType.CONSIGNMENT_TAX_INVOICE]: '위수탁',
19
- [InvoiceType.SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE]: '위수탁영세율'
20
- },
21
- INVOICE: {
22
- [InvoiceType.INVOICE]: '일반',
23
- [InvoiceType.CONSIGNMENT_INVOICE]: '위수탁'
24
- // [InvoiceType.IMPORT_INVOICE]: INVOICE_TYPE[IMPORT_INVOICE],
25
- }
26
- }
27
-
28
- const SHORT_BUSINESS_REGISTRATION_CATEGORY = {
29
- [BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER]: '사업자',
30
- [BusinessRegistrationCategory.RESIDENT_REGISTRATION_NUMBER]: '개인',
31
- [BusinessRegistrationCategory.FOREIGNER_REGISTRATION_NUMBER]: '외국인'
32
- }
33
-
34
- interface Supplier {
35
- supplierBusinessRegistrationCategory: string
36
- supplierBusinessRegistrationNumber: string
37
- supplierBranchIdentification?: string
38
- supplierBusinessName: string
39
- supplierRepresentativeName: string
40
- supplierAddress?: string
41
- supplierBusinessType?: string
42
- supplierIndustryType?: string
43
- supplierDepartment?: string
44
- supplierContactName?: string
45
- supplierContactPhone?: string
46
- supplierContactEmail?: string
47
- supplierContactCellPhone?: string
48
- }
49
- interface Buyer {
50
- buyerBusinessRegistrationCategory: BusinessRegistrationCategory
51
- buyerBusinessRegistrationNumber: string
52
- buyerBranchIdentification?: string
53
- buyerBusinessName: string
54
- buyerRepresentativeName: string
55
- buyerAddress?: string
56
- buyerBusinessType?: string
57
- buyerIndustryType?: string
58
- buyer1stDepartment?: string
59
- buyer1stContactName?: string
60
- buyer1stContactPhone?: string
61
- buyer1stContactEmail?: string
62
- buyer1stContactCellPhone?: string
63
- buyer2ndDepartment?: string
64
- buyer2ndContactName?: string
65
- buyer2ndContactPhone?: string
66
- buyer2ndContactEmail?: string
67
- buyer2ndContactCellPhone?: string
68
- }
69
- interface TaxInvoice {
70
- category: Category
71
- issueNo?: string
72
- approvalNo?: string
73
- originalApprovalNo?: string
74
- issueDate: string
75
- signatureDate?: string
76
- invoiceType: InvoiceType
77
- purpose: Purpose
78
- remark0?: string
79
- remark1?: string
80
- remark2?: string
81
- paymentAmountCash?: number
82
- paymentAmountCheck?: number
83
- paymentAmountPromissoryNote?: number
84
- paymentAmountAccountsReceivable?: number
85
- supplyAmount: number
86
- taxAmount?: number
87
- totalAmount: number
88
- // revisedReason?: RevisedReason
89
- }
90
- interface TaxInvoiceItem {
91
- sequence: number
92
- supplyDate: string
93
- itemName: string
94
- specification: string
95
- quantity: number
96
- unitPrice: number
97
- supplyPrice: number
98
- taxPrice: number
99
- remark?: string
100
- }
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'
101
16
 
102
17
  @customElement('tax-invoice-send-page')
103
18
  export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
@@ -107,273 +22,37 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
107
22
  css`
108
23
  :host {
109
24
  display: flex;
110
- flex-direction: column;
111
- overflow-y: auto;
112
- overflow-x: hidden;
113
-
114
- width: 100%;
115
- min-width: 850px;
116
- padding: 0 40px 40px 40px;
117
-
118
- --grid-record-emphasized-background-color: red;
119
- --grid-record-emphasized-color: yellow;
120
- }
121
-
122
- .flex-row {
123
- display: flex;
124
- flex-direction: row;
125
- }
126
- .flex-column {
127
- display: flex;
128
- flex-direction: column;
129
- }
130
-
131
- input[type='text'],
132
- input[type='date'],
133
- input[type='number'] {
134
- width: 85%;
135
- max-width: calc(100% - 12px);
136
- height: 14px;
137
- margin: 0;
138
- padding: 4px 5px 5px;
139
- line-height: 14px;
140
- border: 1px solid #bbb;
141
- background: #fff;
142
- letter-spacing: 0.5px;
143
- }
144
- input[type='date'] {
145
- width: auto;
146
- }
147
- input[readonly] {
148
- background-color: #eee;
149
- }
150
-
151
- div.invoice-type {
152
- font-size: 18px;
153
- margin-top: 15px;
154
- }
155
-
156
- table {
157
- border: solid;
158
- border-width: 2px 0;
159
- border-collapse: collapse;
160
- border-spacing: 0;
161
- }
162
-
163
- .title table {
164
- border-color: #d3dbe5;
165
- width: 100%;
166
- height: 33px;
167
- margin-top: 10px;
168
- font-size: 12px;
169
-
170
- th {
171
- font-size: 13px;
172
- background-color: #e9edf6;
173
- min-width: 140px;
174
- }
175
- td {
176
- width: 50%;
177
- padding-left: 10px;
178
-
179
- & > * {
180
- vertical-align: middle;
181
- }
182
- & > input {
183
- margin: 0 5px 0 1px;
184
- }
185
- }
186
- }
187
-
188
- div.body {
189
- margin-top: 15px;
190
- font-size: 14px;
191
-
192
- div.data {
193
- display: flex;
194
- margin-top: 5px;
195
-
196
- table {
197
- flex: 1;
198
-
199
- td,
200
- th {
201
- padding: 5px;
202
- min-width: 60px;
203
- }
204
- td {
205
- padding-left: 8px;
206
- }
207
- th.target {
208
- width: 25px;
209
- writing-mode: vertical-rl;
210
- min-width: unset;
211
- }
212
-
213
- &.supplier {
214
- border-color: #f64843;
215
-
216
- td,
217
- th {
218
- background-color: #fef5f7;
219
- border: solid 1.5px #f5b1b1;
220
- }
221
- th.target {
222
- background-color: #fedbde;
223
- }
224
- }
225
- &.buyer {
226
- border-color: #007ed9;
227
-
228
- td,
229
- th {
230
- background-color: #f7f7ff;
231
- border: solid 1.5px #a7bcff;
232
- }
233
- th.target {
234
- background-color: #c6daf6;
235
- }
236
- }
237
- }
238
- }
239
-
240
- div.info {
241
- margin-top: 15px;
242
- border: solid;
243
- border-color: #000;
244
- border-width: 2px 0px 0px 0px;
245
-
246
- div.flex-row div {
247
- border: solid #c4d2ff;
248
- border-width: 0px 1.5px 1.5px 1.5px;
249
- margin-right: -1px;
250
- padding: 5px;
251
- text-align: center;
252
-
253
- &.title {
254
- background-color: #e9edf5;
255
- font-weight: bold;
256
- flex: 1;
257
- }
258
- &.value {
259
- flex: 3;
260
- text-align: left;
261
-
262
- .desc {
263
- font-size: 11px;
264
- color: #c90000;
265
- }
266
- }
267
- }
268
- }
269
-
270
- div.items,
271
- div.summary {
272
- margin-top: 20px;
273
-
274
- table {
275
- width: 100%;
276
- border-color: #000;
277
- border-width: 2px 0px 0px 0px;
278
-
279
- th {
280
- background-color: #e9edf5;
281
- }
282
- th,
283
- td {
284
- border: solid 1.5px #c4d2ff;
285
- padding: 5px;
286
- text-align: center;
287
- }
288
- }
289
- }
290
-
291
- div.summary {
292
- display: flex;
293
-
294
- & > table {
295
- flex: 6.7;
296
- }
297
- & > div {
298
- flex: 3.2;
299
- display: flex;
300
- justify-content: center;
301
- align-items: center;
302
- border: 1.5px solid #c4d2ff;
303
- border-top: 2px solid #000;
304
- }
305
-
306
- span.type-wrapper {
307
- margin: 0 10px;
308
-
309
- & > div {
310
- display: flex;
311
- justify-content: center;
312
- align-items: center;
313
- gap: 4px;
314
-
315
- input[type='radio' i] {
316
- margin: 0px;
317
- }
318
- }
319
- }
320
- }
321
-
322
- div.items {
323
- div.desc {
324
- font-weight: 400;
325
- font-size: 12px;
326
- margin-bottom: 5px;
327
- }
328
- div.desc-date {
329
- color: #005d98;
330
- }
331
- button {
332
- font-size: 13px;
333
- height: 25px;
334
- cursor: pointer;
335
- text-align: center;
336
- font-weight: 600;
337
- border-radius: 2px;
338
- border-color: #ccc;
339
- }
340
- .btn-add {
341
- color: #333;
342
- background-color: #f9f9f9;
343
- }
344
- .btn-delete {
345
- color: #fff;
346
- background-color: #5c636e;
347
- border: none;
348
- }
349
- }
350
-
351
- *[required]::before {
352
- content: '*';
353
- color: red;
354
- margin-right: 2px;
355
- }
356
25
  }
357
26
  `
358
27
  ]
359
28
 
29
+ static get scopedElements() {
30
+ return {
31
+ 'company-list-popup': CompanyListPopup
32
+ }
33
+ }
34
+
360
35
  // 오늘 날짜 YYYY-MM-DD 형식으로 뽑기
361
36
  private today: string = new Intl.DateTimeFormat('fr-CA', { timeZone: 'Asia/Seoul' }).format(new Date())
362
37
 
363
- @state() supplier: Supplier = {
38
+ private defaultSupplier = {
364
39
  supplierBusinessRegistrationCategory: '01',
365
40
  supplierBusinessRegistrationNumber: '',
366
41
  supplierBranchIdentification: '',
367
42
  supplierBusinessName: '',
368
43
  supplierRepresentativeName: ''
369
44
  }
370
- @property({ type: Object }) buyer: Buyer = {
45
+ @state() supplier: Supplier = this.defaultSupplier
46
+
47
+ private defaultBuyer = {
371
48
  buyerBusinessRegistrationCategory: BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER,
372
49
  buyerBusinessRegistrationNumber: '',
373
50
  buyerBusinessName: '',
374
51
  buyerRepresentativeName: ''
375
52
  }
376
- @property({ type: Object }) taxInvoice: TaxInvoice = {
53
+ @state() buyer: Buyer = this.defaultBuyer
54
+
55
+ private defaultTaxInvoice = {
377
56
  invoiceType: InvoiceType.TAX_INVOICE,
378
57
  category: Category.EXPORT,
379
58
  issueDate: this.today,
@@ -382,6 +61,7 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
382
61
  taxAmount: 0,
383
62
  totalAmount: 0
384
63
  }
64
+ @state() taxInvoice: TaxInvoice = this.defaultTaxInvoice
385
65
 
386
66
  private defaultTaxInvoiceItem = {
387
67
  sequence: new Date().getTime(), // 구분용 임시 값 (중복되면 안되니 생성 마다 넣어주기)
@@ -393,7 +73,7 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
393
73
  supplyPrice: 0,
394
74
  taxPrice: 0
395
75
  }
396
- @property({ type: Array }) taxInvoiceItems: TaxInvoiceItem[] = [{ ...this.defaultTaxInvoiceItem }]
76
+ @state() taxInvoiceItems: TaxInvoiceItem[] = [{ ...this.defaultTaxInvoiceItem }]
397
77
 
398
78
  get context() {
399
79
  return {
@@ -410,318 +90,20 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
410
90
  }
411
91
 
412
92
  render() {
413
- return html`
414
- <div class="invoice-type">
415
- * ${INVOICE_TYPE[this.taxInvoice?.invoiceType]} (${SHORT_BUSINESS_REGISTRATION_CATEGORY[this.buyer.buyerBusinessRegistrationCategory]})
416
- </div>
417
-
418
- <div class="title">
419
- <table>
420
- <tr>
421
- <th>${i18next.t('field.short invoice type')}</th>
422
- <td>
423
- ${Object.keys(SHORT_INVOICE_TYPE['TAX_INVOICE']).map(key => {
424
- const disabled: boolean = key !== InvoiceType.TAX_INVOICE
425
- const checked: boolean = key === InvoiceType.TAX_INVOICE
426
- return html`
427
- <label for="${'tax_' + key}">${SHORT_INVOICE_TYPE['TAX_INVOICE'][key]}</label>
428
- <input type="radio" id="${'tax_' + key}" value="${key}" name="invoiceType" ?checked=${checked} ?disabled=${disabled} />
429
- `
430
- })}
431
- </td>
432
- <th>${i18next.t('field.tax invoice buyer registration category')}</th>
433
- <td>
434
- ${Object.keys(BUSINESS_REGISTRATION_CATEGORY).map(key => {
435
- const disabled: boolean = key !== BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER
436
- const checked: boolean = key === BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER
437
- return html`
438
- <label for="${'tax_' + key}">${BUSINESS_REGISTRATION_CATEGORY[key]}</label>
439
- <input type="radio" id="${'tax_' + key}" value="${key}" name="buyerBusinessRegistrationCategory" ?checked=${checked} ?disabled=${disabled} />
440
- `
441
- })}
442
- </td>
443
- </tr>
444
- </table>
445
- </div>
446
-
447
- <div class="body">
448
- <div class="data">
449
- <table class="supplier">
450
- <colgroup>
451
- <col width="150px" />
452
- <col width="18%" />
453
- <col width="32%" />
454
- <col width="18%" />
455
- <col width="32%" />
456
- </colgroup>
457
- <tr>
458
- <th rowspan="6" class="target">${i18next.t('field.tax invoice supplier')}</th>
459
- <th required>${i18next.t('field.short business registration number')}</th>
460
- <td>${this.supplier?.supplierBusinessRegistrationNumber.replace(/(\S{3})(\S{2})(\S{5})/g, '$1-$2-$3')}</td>
461
- <th>${i18next.t('field.short branch identification')}</th>
462
- <td>${this.supplier?.supplierBranchIdentification}</td>
463
- </tr>
464
- <tr>
465
- <th required>${i18next.t('field.short tax invoice business name')}</th>
466
- <td><input type="text" name="supplierBusinessName" .value=${this.supplier?.supplierBusinessName || ''} @input=${this._onInputTaxInvoice} /></td>
467
- <th required>${i18next.t('field.tax invoice representative name')}</th>
468
- <td>
469
- <input type="text" name="supplierRepresentativeName" .value=${this.supplier?.supplierRepresentativeName || ''} @input=${this._onInputTaxInvoice} />
470
- </td>
471
- </tr>
472
- <tr>
473
- <th>${i18next.t('field.address')}</th>
474
- <td colspan="3">${this.supplier?.supplierAddress}</td>
475
- </tr>
476
- <tr>
477
- <th>${i18next.t('field.business type')}</th>
478
- <td><input type="text" name="supplierBusinessType" .value=${this.supplier?.supplierBusinessType || ''} @input=${this._onInputTaxInvoice} /></td>
479
- <th>${i18next.t('field.industry type')}</th>
480
- <td><input type="text" name="supplierIndustryType" .value=${this.supplier?.supplierIndustryType || ''} @input=${this._onInputTaxInvoice} /></td>
481
- </tr>
482
- <tr>
483
- <th rowspan="2">${i18next.t('field.email')}</th>
484
- <td rowspan="2" colspan="3">
485
- <input type="text" name="supplierContactEmail" .value=${this.supplier?.supplierContactEmail || ''} @input=${this._onInputTaxInvoice} />
486
- </td>
487
- </tr>
488
- <tr></tr>
489
- </table>
490
-
491
- <table class="buyer">
492
- <colgroup>
493
- <col width="150px" />
494
- <col width="18%" />
495
- <col width="32%" />
496
- <col width="18%" />
497
- <col width="32%" />
498
- </colgroup>
499
- <tr>
500
- <th rowspan="6" class="target">${i18next.t('field.tax invoice buyer')}</th>
501
- <th required>${i18next.t('field.short business registration number')}</th>
502
- <td>
503
- <input
504
- type="text"
505
- maxlength="10"
506
- name="buyerBusinessRegistrationNumber"
507
- .value=${this.buyer?.buyerBusinessRegistrationNumber || ''}
508
- @input=${this._onInputTaxInvoice}
509
- />
510
- </td>
511
- <th>${i18next.t('field.short branch identification')}</th>
512
- <td><input type="text" name="buyerBranchIdentification" .value=${this.buyer?.buyerBranchIdentification || ''} @input=${this._onInputTaxInvoice} /></td>
513
- </tr>
514
- <tr>
515
- <th required>${i18next.t('field.short tax invoice business name')}</th>
516
- <td><input type="text" name="buyerBusinessName" .value=${this.buyer?.buyerBusinessName || ''} @input=${this._onInputTaxInvoice} /></td>
517
- <th required>${i18next.t('field.tax invoice representative name')}</th>
518
- <td><input type="text" name="buyerRepresentativeName" .value=${this.buyer?.buyerRepresentativeName || ''} @input=${this._onInputTaxInvoice} /></td>
519
- </tr>
520
- <tr>
521
- <th>${i18next.t('field.address')}</th>
522
- <td colspan="3"><input type="text" name="buyerAddress" .value=${this.buyer?.buyerAddress || ''} @input=${this._onInputTaxInvoice} /></td>
523
- </tr>
524
- <tr>
525
- <th>${i18next.t('field.business type')}</th>
526
- <td><input type="text" name="buyerBusinessType" .value=${this.buyer?.buyerBusinessType || ''} @input=${this._onInputTaxInvoice} /></td>
527
-
528
- <th>${i18next.t('field.industry type')}</th>
529
- <td><input type="text" name="buyerIndustryType" .value=${this.buyer?.buyerIndustryType || ''} @input=${this._onInputTaxInvoice} /></td>
530
- </tr>
531
- <tr>
532
- <th>${i18next.t('field.email')}</th>
533
- <td colspan="3"><input type="text" name="buyer1stContactEmail" .value=${this.buyer?.buyer1stContactEmail || ''} @input=${this._onInputTaxInvoice} /></td>
534
- </tr>
535
- <tr>
536
- <th>${i18next.t('field.email')}</th>
537
- <td colspan="3"><input type="text" name="buyer2ndContactEmail" .value=${this.buyer?.buyer2ndContactEmail || ''} @input=${this._onInputTaxInvoice} /></td>
538
- </tr>
539
- </table>
540
- </div>
541
-
542
- <div class="info flex-column">
543
- <div class="flex-row">
544
- <div class="title" required>${i18next.t('field.issue date')}</div>
545
- <div class="value">
546
- <input type="date" name="issueDate" .value=${this.taxInvoice.issueDate} @input=${this._onInputTaxInvoice} />
547
- <span class="desc">※ 작성일자는 공급 연월일을 의미함</span>
548
- </div>
549
- <div class="title">${i18next.t('field.remark0')}</div>
550
- <div class="value"><input type="text" name="remark0" .value=${this.taxInvoice?.remark0 || ''} @input=${this._onInputTaxInvoice} /></div>
551
- </div>
552
- <div class="flex-row">
553
- <div class="title">${i18next.t('field.total amount')}</div>
554
- <div class="value">${this._numberFormat(this.taxInvoice?.totalAmount)}</div>
555
- <div class="title">${i18next.t('field.supply amount')}</div>
556
- <div class="value">${this._numberFormat(this.taxInvoice?.supplyAmount)}</div>
557
- <div class="title">${i18next.t('field.tax amount')}</div>
558
- <div class="value">${this._numberFormat(this.taxInvoice?.taxAmount)}</div>
559
- </div>
560
- </div>
561
-
562
- <div class="items">
563
- <div class="desc desc-date">
564
- ※ 아래 '품목'의 '월'은 상단 '작성일자'의 '월'이 자동 반영됩니다. 합계의 '계산' 버튼은 금액을 공급가액과 세액으로 계산할 수 있습니다.
565
- </div>
566
- <div class="desc"><button class="btn-add" @click=${this._onAddInvoiceItem}>품목추가</button> 품목은 최대 16개까지 추가, 삭제 가능</div>
567
-
568
- <table>
569
- <colgroup>
570
- <col width="5%" />
571
- <col width="5%" />
572
- <col width="14%" />
573
- <col width="7%" />
574
- <col width="7%" />
575
- <col width="12%" />
576
- <col width="12%" />
577
- <col width="12%" />
578
- <col width="16%" />
579
- <col width="8%" />
580
- </colgroup>
581
- <tr>
582
- <th>${i18next.t('field.tax invoice month')}</th>
583
- <th required>${i18next.t('field.tax invoice day')}</th>
584
- <th required>${i18next.t('field.tax invoice item name')}</th>
585
- <th>${i18next.t('field.tax invoice ea')}</th>
586
- <th required>${i18next.t('field.tax invoice quantity')}</th>
587
- <th required>${i18next.t('field.tax invoice price')}</th>
588
- <th>${i18next.t('field.supply amount')}</th>
589
- <th>${i18next.t('field.tax amount')}</th>
590
- <th>${i18next.t('field.remark0')}</th>
591
- <th>${i18next.t('field.delete')}</th>
592
- </tr>
593
-
594
- ${this.taxInvoiceItems.map(
595
- (item, idx) =>
596
- html`
597
- <tr>
598
- <input type="hidden" name="sequence" value=${item.sequence} />
599
- <td>${this.taxInvoice.issueDate.split('-')[1]}</td>
600
- <td><input type="text" numeric maxlength="2" name="supplyDate" @input=${e => this._onInputItem(e, idx)} /></td>
601
- <td><input type="text" name="itemName" .value=${item.itemName} @input=${e => this._onInputItem(e, idx)} /></td>
602
- <td><input type="text" name="specification" .value=${item.specification} @input=${e => this._onInputItem(e, idx)} /></td>
603
- <td><input type="text" numeric name="quantity" .value=${this._numberFormat(item.quantity)} @input=${e => this._onInputItem(e, idx)} /></td>
604
- <td><input type="text" numeric name="unitPrice" .value=${this._numberFormat(item.unitPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
605
- <td><input type="text" readonly name="supplyPrice" .value=${this._numberFormat(item.supplyPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
606
- <td><input type="text" readonly name="taxPrice" .value=${this._numberFormat(item.taxPrice)} @input=${e => this._onInputItem(e, idx)} /></td>
607
- <td><input type="text" name="remark" .value=${item.remark || ''} @input=${e => this._onInputItem(e, idx)} /></td>
608
- <td><button class="btn-delete" @click=${e => this._onRemoveInvoiceItem(e, item.sequence)}>삭제</button></td>
609
- </tr>
610
- `
611
- )}
612
- </table>
613
- </div>
614
-
615
- <div class="summary">
616
- <table>
617
- <colgroup>
618
- <col width="25%" />
619
- <col width="25%" />
620
- <col width="25%" />
621
- <col width="25%" />
622
- </colgroup>
623
- <tr>
624
- <th>${i18next.t('field.tax invoice payment cash')}</th>
625
- <th>${i18next.t('field.tax invoice payment check')}</th>
626
- <th>${i18next.t('field.tax invoice payment promissory note')}</th>
627
- <th>${i18next.t('field.tax invoice payment accounts receivable')}</th>
628
- </tr>
629
- <tr>
630
- <td><input type="text" numeric name="paymentAmountCash" .value=${this.taxInvoice?.paymentAmountCash || ''} @input=${this._onInputTaxInvoice} /></td>
631
- <td><input type="text" numeric name="paymentAmountCheck" .value=${this.taxInvoice?.paymentAmountCheck || ''} @input=${this._onInputTaxInvoice} /></td>
632
- <td>
633
- <input
634
- type="text"
635
- numeric
636
- name="paymentAmountPromissoryNote"
637
- .value=${this.taxInvoice?.paymentAmountPromissoryNote || ''}
638
- @input=${this._onInputTaxInvoice}
639
- />
640
- </td>
641
- <td>
642
- <input
643
- type="text"
644
- numeric
645
- name="paymentAmountAccountsReceivable"
646
- .value=${this.taxInvoice?.paymentAmountAccountsReceivable || ''}
647
- @input=${this._onInputTaxInvoice}
648
- />
649
- </td>
650
- </tr>
651
- </table>
652
- <div>
653
- ${i18next.t('text.prev tax invoice description payment') + ' ('}
654
- <span class="type-wrapper">
655
- <div>
656
- <input type="radio" id="purpose_20" name="purpose" .value=${Purpose.INVOICE} @change=${this._onInputTaxInvoice} checked />
657
- <label for="purpose_20">${PURPOSE[Purpose.INVOICE]}</label>
658
- </div>
659
- <div>
660
- <input type="radio" id="purpose_10" name="purpose" .value=${Purpose.RECEIPT} @change=${this._onInputTaxInvoice} />
661
- <label for="purpose_10">${PURPOSE[Purpose.RECEIPT]}</label>
662
- </div>
663
- </span>
664
- ${') ' + i18next.t('text.next tax invoice description payment')}
665
- </div>
666
- </div>
667
- </div>
668
- `
93
+ return html` <tax-invoice-send></tax-invoice-send> `
669
94
  }
670
95
 
671
- async pageInitialized(lifecycle: any) {
672
- this._fetchSupplier()
673
- }
674
-
675
- async _fetchSupplier() {
676
- const response = await client.query({
677
- query: gql`
678
- query TaxInvoiceApi {
679
- response: taxInvoiceApi {
680
- businessRegistrationNumber
681
- branchIdentification
682
- businessName
683
- representativeName
684
- address
685
- businessType
686
- industryType
687
- department
688
- contactName
689
- contactPhone
690
- contactEmail
691
- contactCellPhone
692
- }
693
- }
694
- `
695
- })
696
-
697
- const supplier = response.data.response
698
- this.supplier = {
699
- supplierBusinessRegistrationCategory: supplier.businessRegistrationCategory,
700
- supplierBusinessRegistrationNumber: supplier.businessRegistrationNumber,
701
- supplierBranchIdentification: supplier.branchIdentification,
702
- supplierBusinessName: supplier.businessName,
703
- supplierRepresentativeName: supplier.representativeName,
704
- supplierAddress: supplier.address,
705
- supplierBusinessType: supplier.businessType,
706
- supplierIndustryType: supplier.industryType,
707
- supplierDepartment: supplier.department,
708
- supplierContactName: supplier.contactName,
709
- supplierContactPhone: supplier.contactPhone,
710
- supplierContactEmail: supplier.contactEmail,
711
- supplierContactCellPhone: supplier.contactCellPhone
712
- }
713
- }
714
-
715
- async pageUpdated(changes: any, lifecycle: any) {
716
- if (this.active) {
717
- // do something here when this page just became as active
718
- }
719
- }
720
-
721
- async _sendTaxInvoice(num: string) {
96
+ async _sendTaxInvoice() {
722
97
  // 아이템 시퀀스 재 할당 + 날짜, 품목, 규격, 수량이 없으면 필터
723
- let taxInvoiceItems = this.taxInvoiceItems.map((item, idx) => ({ ...item, sequence: idx + 1, quantity: Number(item.quantity), unitPrice: Number(item.unitPrice) }))
724
- taxInvoiceItems = taxInvoiceItems.filter(item => item.supplyDate && item.itemName && item.quantity && item.unitPrice)
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
+ )
725
107
 
726
108
  // taxInvoice 데이터 생성 및 타입 변환
727
109
  let taxInvoice = { ...this.taxInvoice, ...this.supplier, ...this.buyer }
@@ -729,24 +111,61 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
729
111
  taxInvoice.paymentAmountCheck = Number(taxInvoice.paymentAmountCheck || 0)
730
112
  taxInvoice.paymentAmountPromissoryNote = Number(taxInvoice.paymentAmountPromissoryNote || 0)
731
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, '')
732
118
 
733
119
  // 공급받는자 필수 값 체크
734
- if (!this.buyer.buyerBusinessRegistrationNumber || !this.buyer.buyerBusinessName || !this.buyer.buyerRepresentativeName) {
735
- alert('공급받는자 필수 값을 모두 입력해 주세요.')
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
+ })
736
131
  return
737
132
  }
738
133
 
739
134
  // 아이템 개수 체크
740
135
  if (taxInvoiceItems.length === 0) {
741
- alert('등록 가능한 아아템의 개수는 1개 이상이여야 합니다.')
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
+ })
742
153
  return
743
154
  }
744
155
 
745
156
  // 현금, 수표, 어음, 외상미수금의 합계 = 총 합계금액 체크
746
157
  const paymentAmount: number =
747
- taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable
158
+ taxInvoice.paymentAmountCash +
159
+ taxInvoice.paymentAmountCheck +
160
+ taxInvoice.paymentAmountPromissoryNote +
161
+ taxInvoice.paymentAmountAccountsReceivable
748
162
  if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
749
- alert('현금, 수표, 어음, 외상미수금의 합계는 총 합계금액과 동일해야 합니다.')
163
+ await CustomAlert({
164
+ type: 'warning',
165
+ title: '현금, 수표, 어음, 외상미수금의 합계는 총 합계금액과 동일해야 합니다.',
166
+ text: '현금, 수표, 어음, 외상미수금의 합계는 총 합계금액과 동일해야 합니다.',
167
+ confirmButton: { text: i18next.t('button.confirm') }
168
+ })
750
169
  return
751
170
  }
752
171
 
@@ -768,93 +187,10 @@ export class TaxInvoiceSendPage extends localize(i18next)(ScopedElementsMixin(Pa
768
187
 
769
188
  if (!response.errors) {
770
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 }]
771
194
  }
772
195
  }
773
-
774
- private _numberFormat(value: number | undefined): string {
775
- return !value ? '' : new Intl.NumberFormat('en-US').format(value) || ''
776
- }
777
-
778
- // Input 요소의 값이 변경될 때 호출되는 콜백 함수
779
- private _onInputTaxInvoice(event: InputEvent) {
780
- const target = event.target as HTMLInputElement
781
-
782
- // 숫자 타입은 다른 문자 입력 제거
783
- if (target.hasAttribute('numeric')) {
784
- target.value = target.value.replace(/\D/g, '')
785
- }
786
-
787
- if (target.name.startsWith('supplier')) {
788
- this.supplier[target.name] = target.value
789
- } else if (target.name.startsWith('buyer')) {
790
- this.buyer[target.name] = target.value
791
- } else {
792
- // 날짜 체크가 오늘 날짜를 넘어가면 값 변경 되면 안됨
793
- if (target.name === 'issueDate' && target.value > this.today) {
794
- target.value = this.taxInvoice['issueDate']
795
- alert('작성일자는 현재일까지 입력하시기 바랍니다.')
796
- return
797
- }
798
-
799
- this.taxInvoice[target.name] = target.value
800
-
801
- // 날짜 변경시에는 아이템 변경도 리 렌더가 필요해서 데이터 갱신
802
- if (target.name === 'issueDate') this.taxInvoice = { ...this.taxInvoice }
803
- }
804
- }
805
-
806
- // Input 요소의 값이 변경될 때 호출되는 콜백 함수
807
- private _onInputItem(e: InputEvent, idx: number) {
808
- const target = e.target as HTMLInputElement
809
- let inputVal = target.value
810
-
811
- // 숫자 타입은 다른 문자 입력 제거
812
- if (target.hasAttribute('numeric')) {
813
- inputVal = inputVal.replace(/\D/g, '')
814
- target.value = inputVal
815
- }
816
-
817
- // 공급일자 케이스 시 => 세금계산서의 작성일자의 YYYY-MM + 아이템의 입력된 DD
818
- if (target.name === 'supplyDate') {
819
- const itemDate = this.taxInvoice.issueDate.substring(0, 8) + inputVal.padStart(2, '0')
820
- if (itemDate > this.taxInvoice.issueDate) {
821
- alert('품목의 일자는 작성일자보다 클 수 없습니다.')
822
- target.value = ''
823
- }
824
- inputVal = itemDate
825
- }
826
-
827
- if (target.name == 'quantity' || target.name == 'unitPrice') {
828
- const supplyPrice = target.name == 'quantity' ? Number(inputVal) * this.taxInvoiceItems[idx]['unitPrice'] : Number(inputVal) * this.taxInvoiceItems[idx]['quantity']
829
- this.taxInvoiceItems[idx]['supplyPrice'] = supplyPrice
830
- this.taxInvoiceItems[idx]['taxPrice'] = Math.floor(supplyPrice / 10)
831
- this.taxInvoiceItems = [...this.taxInvoiceItems]
832
- this._setTaxInvoiceSummaryCalc()
833
- }
834
-
835
- this.taxInvoiceItems[idx][target.name] = inputVal
836
- }
837
-
838
- private _onAddInvoiceItem(e: Event) {
839
- e.preventDefault()
840
- if (this.taxInvoiceItems.length >= 16) {
841
- alert('품목은 최대 16개까지 추가 가능합니다.')
842
- return
843
- }
844
-
845
- this.taxInvoiceItems = [...this.taxInvoiceItems, { ...this.defaultTaxInvoiceItem, sequence: new Date().getTime() }]
846
- }
847
-
848
- private _onRemoveInvoiceItem(e: Event, sequence: number) {
849
- e.preventDefault()
850
- this.taxInvoiceItems = [...this.taxInvoiceItems.filter(item => item.sequence != sequence)]
851
- this._setTaxInvoiceSummaryCalc()
852
- }
853
-
854
- private _setTaxInvoiceSummaryCalc() {
855
- const supplyPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.supplyPrice, 0)
856
- const taxPrice = this.taxInvoiceItems.reduce((prev, item) => prev + item.taxPrice, 0)
857
-
858
- this.taxInvoice = { ...this.taxInvoice, supplyAmount: supplyPrice, taxAmount: taxPrice, totalAmount: supplyPrice + taxPrice }
859
- }
860
196
  }