@things-factory/tax-invoice 6.2.84

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 (151) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/client/bootstrap.ts +0 -0
  4. package/client/index.ts +0 -0
  5. package/client/pages/main.ts +25 -0
  6. package/client/pages/tax-audit-result/tax-audit-result-importer.ts +97 -0
  7. package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +355 -0
  8. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +424 -0
  9. package/client/pages/tax-invoice/tax-invoice-list-page.ts +517 -0
  10. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +428 -0
  11. package/client/pages/tax-invoice-company/tax-invoice-company-importer.ts +175 -0
  12. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +496 -0
  13. package/client/route.ts +23 -0
  14. package/client/tsconfig.json +11 -0
  15. package/dist-client/bootstrap.d.ts +0 -0
  16. package/dist-client/bootstrap.js +2 -0
  17. package/dist-client/bootstrap.js.map +1 -0
  18. package/dist-client/index.d.ts +0 -0
  19. package/dist-client/index.js +2 -0
  20. package/dist-client/index.js.map +1 -0
  21. package/dist-client/pages/main.d.ts +1 -0
  22. package/dist-client/pages/main.js +27 -0
  23. package/dist-client/pages/main.js.map +1 -0
  24. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.d.ts +22 -0
  25. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js +100 -0
  26. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js.map +1 -0
  27. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.d.ts +62 -0
  28. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js +331 -0
  29. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js.map +1 -0
  30. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.d.ts +14 -0
  31. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +430 -0
  32. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -0
  33. package/dist-client/pages/tax-invoice/tax-invoice-list-page.d.ts +70 -0
  34. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js +500 -0
  35. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js.map +1 -0
  36. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +36 -0
  37. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +419 -0
  38. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -0
  39. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +31 -0
  40. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +182 -0
  41. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -0
  42. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +57 -0
  43. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +477 -0
  44. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -0
  45. package/dist-client/route.d.ts +1 -0
  46. package/dist-client/route.js +20 -0
  47. package/dist-client/route.js.map +1 -0
  48. package/dist-client/tsconfig.tsbuildinfo +1 -0
  49. package/dist-server/index.js +6 -0
  50. package/dist-server/index.js.map +1 -0
  51. package/dist-server/routes.js +25 -0
  52. package/dist-server/routes.js.map +1 -0
  53. package/dist-server/service/index.js +37 -0
  54. package/dist-server/service/index.js.map +1 -0
  55. package/dist-server/service/tax-audit-result/event-subscriber.js +21 -0
  56. package/dist-server/service/tax-audit-result/event-subscriber.js.map +1 -0
  57. package/dist-server/service/tax-audit-result/index.js +12 -0
  58. package/dist-server/service/tax-audit-result/index.js.map +1 -0
  59. package/dist-server/service/tax-audit-result/tax-audit-result-history.js +123 -0
  60. package/dist-server/service/tax-audit-result/tax-audit-result-history.js.map +1 -0
  61. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js +168 -0
  62. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js.map +1 -0
  63. package/dist-server/service/tax-audit-result/tax-audit-result-query.js +97 -0
  64. package/dist-server/service/tax-audit-result/tax-audit-result-query.js.map +1 -0
  65. package/dist-server/service/tax-audit-result/tax-audit-result-type.js +86 -0
  66. package/dist-server/service/tax-audit-result/tax-audit-result-type.js.map +1 -0
  67. package/dist-server/service/tax-audit-result/tax-audit-result.js +110 -0
  68. package/dist-server/service/tax-audit-result/tax-audit-result.js.map +1 -0
  69. package/dist-server/service/tax-invoice/index.js +9 -0
  70. package/dist-server/service/tax-invoice/index.js.map +1 -0
  71. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +127 -0
  72. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -0
  73. package/dist-server/service/tax-invoice/tax-invoice-query.js +90 -0
  74. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -0
  75. package/dist-server/service/tax-invoice/tax-invoice-type.js +553 -0
  76. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -0
  77. package/dist-server/service/tax-invoice/tax-invoice.js +465 -0
  78. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -0
  79. package/dist-server/service/tax-invoice-api/index.js +9 -0
  80. package/dist-server/service/tax-invoice-api/index.js.map +1 -0
  81. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +64 -0
  82. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -0
  83. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +79 -0
  84. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -0
  85. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +103 -0
  86. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -0
  87. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +163 -0
  88. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -0
  89. package/dist-server/service/tax-invoice-company/index.js +9 -0
  90. package/dist-server/service/tax-invoice-company/index.js.map +1 -0
  91. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js +80 -0
  92. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js.map +1 -0
  93. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +89 -0
  94. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -0
  95. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +100 -0
  96. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -0
  97. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +166 -0
  98. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -0
  99. package/dist-server/service/tax-invoice-item/index.js +9 -0
  100. package/dist-server/service/tax-invoice-item/index.js.map +1 -0
  101. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js +127 -0
  102. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js.map +1 -0
  103. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js +87 -0
  104. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -0
  105. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +121 -0
  106. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -0
  107. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +115 -0
  108. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -0
  109. package/dist-server/tsconfig.tsbuildinfo +1 -0
  110. package/helps/tax-invoice/tax-audit-result.md +160 -0
  111. package/helps/tax-invoice/tax-invoice-api.md +160 -0
  112. package/helps/tax-invoice/tax-invoice-send.md +160 -0
  113. package/helps/tax-invoice/tax-invoice.md +160 -0
  114. package/package.json +37 -0
  115. package/server/index.ts +2 -0
  116. package/server/routes.ts +28 -0
  117. package/server/service/index.ts +36 -0
  118. package/server/service/tax-audit-result/event-subscriber.ts +17 -0
  119. package/server/service/tax-audit-result/index.ts +9 -0
  120. package/server/service/tax-audit-result/tax-audit-result-history.ts +110 -0
  121. package/server/service/tax-audit-result/tax-audit-result-mutation.ts +198 -0
  122. package/server/service/tax-audit-result/tax-audit-result-query.ts +62 -0
  123. package/server/service/tax-audit-result/tax-audit-result-type.ts +61 -0
  124. package/server/service/tax-audit-result/tax-audit-result.ts +95 -0
  125. package/server/service/tax-invoice/index.ts +6 -0
  126. package/server/service/tax-invoice/tax-invoice-mutation.ts +122 -0
  127. package/server/service/tax-invoice/tax-invoice-query.ts +54 -0
  128. package/server/service/tax-invoice/tax-invoice-type.ts +411 -0
  129. package/server/service/tax-invoice/tax-invoice.ts +389 -0
  130. package/server/service/tax-invoice-api/index.ts +6 -0
  131. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +67 -0
  132. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +48 -0
  133. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +71 -0
  134. package/server/service/tax-invoice-api/tax-invoice-api.ts +137 -0
  135. package/server/service/tax-invoice-company/index.ts +6 -0
  136. package/server/service/tax-invoice-company/tax-invoice-company-mutation.ts +84 -0
  137. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +53 -0
  138. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +69 -0
  139. package/server/service/tax-invoice-company/tax-invoice-company.ts +142 -0
  140. package/server/service/tax-invoice-item/index.ts +6 -0
  141. package/server/service/tax-invoice-item/tax-invoice-item-mutation.ts +128 -0
  142. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +57 -0
  143. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +86 -0
  144. package/server/service/tax-invoice-item/tax-invoice-item.ts +85 -0
  145. package/server/tsconfig.json +10 -0
  146. package/things-factory.config.js +23 -0
  147. package/translations/en.json +1 -0
  148. package/translations/ja.json +1 -0
  149. package/translations/ko.json +71 -0
  150. package/translations/ms.json +1 -0
  151. package/translations/zh.json +1 -0
@@ -0,0 +1,517 @@
1
+ import '@operato/data-grist'
2
+
3
+ import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
+ import { PageView, navigate, store } from '@operato/shell'
5
+ import { css, html } from 'lit'
6
+ import { customElement, property, query } from 'lit/decorators.js'
7
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
+ import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
9
+ import { client } from '@operato/graphql'
10
+ import { i18next, localize } from '@operato/i18n'
11
+ import { notify, openPopup } from '@operato/layout'
12
+ import { OxPopup, OxPrompt } from '@operato/popup'
13
+ import { isMobileDevice } from '@operato/utils'
14
+ import gql from 'graphql-tag'
15
+
16
+ import './tax-invoice-detail-popup'
17
+
18
+ export const CATEGORY = {
19
+ '10': '매출',
20
+ '20': '매입',
21
+ '30': 'NTS'
22
+ }
23
+
24
+ export const INVOICE_TYPE = {
25
+ '0101': '일반 세금계산서',
26
+ '0102': '영세율 세금계산서',
27
+ '0103': '위수탁 세금계산서',
28
+ '0105': '영세율 위수탁 세금계산서',
29
+ '0201': '수정 일반 세금계산서',
30
+ '0202': '수정 영세율 세금계산서',
31
+ '0203': '수정 위수탁 세금계산서',
32
+ '0204': '수정 수입 세금계산서',
33
+ '0205': '수정 영세율 위수탁 세금계산서',
34
+ '0301': '일반 계산서',
35
+ '0303': '위수탁 계산서',
36
+ '0304': '수입 계산서',
37
+ '0401': '수정 일반 계산서',
38
+ '0403': '수정 위수탁 계산서',
39
+ '0404': '정 수입 계산서'
40
+ }
41
+
42
+ export const PURPOSE = {
43
+ '01': '영수',
44
+ '02': '청구'
45
+ }
46
+
47
+ @customElement('tax-invoice-list-page')
48
+ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
49
+ static styles = [
50
+ ScrollbarStyles,
51
+ CommonGristStyles,
52
+ css`
53
+ :host {
54
+ display: flex;
55
+
56
+ width: 100%;
57
+
58
+ --grid-record-emphasized-background-color: red;
59
+ --grid-record-emphasized-color: yellow;
60
+ }
61
+ `
62
+ ]
63
+
64
+ @property({ type: Object }) gristConfig: any
65
+ @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
66
+
67
+ @query('ox-grist') private grist!: DataGrist
68
+
69
+ get context() {
70
+ return {
71
+ title: i18next.t('title.tax invoice list'),
72
+ help: 'tax-invoice/tax-invoice',
73
+ actions: [
74
+ {
75
+ title: i18next.t('button.delete'),
76
+ action: this._deleteTaxInvoice.bind(this),
77
+ ...CommonButtonStyles.delete
78
+ }
79
+ ],
80
+ exportable: {
81
+ name: i18next.t('title.tax invoice list'),
82
+ data: this.exportHandler.bind(this),
83
+ accept: ['xlsx']
84
+ }
85
+ }
86
+ }
87
+
88
+ render() {
89
+ const mode = 'GRID'
90
+
91
+ return html`
92
+ <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
93
+ <div slot="headroom">
94
+ <div id="filters">
95
+ <ox-filters-form autofocus></ox-filters-form>
96
+ </div>
97
+ </div>
98
+ </ox-grist>
99
+ `
100
+ // <button @click=${() => this.createTaxInvoice('3')}>생성</button>
101
+ }
102
+
103
+ async pageInitialized(lifecycle: any) {
104
+ this.gristConfig = {
105
+ columns: [
106
+ { type: 'gutter', gutterName: 'sequence' },
107
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
108
+ {
109
+ type: 'gutter',
110
+ gutterName: 'button',
111
+ icon: 'reorder',
112
+ handlers: {
113
+ click: (columns, data, column, record, rowIndex) => {
114
+ this.openDetailPopup(record.id)
115
+ }
116
+ }
117
+ },
118
+ {
119
+ type: 'string',
120
+ name: 'name',
121
+ header: i18next.t('field.name'),
122
+ record: {
123
+ editable: true
124
+ },
125
+ filter: 'search',
126
+ width: 150
127
+ },
128
+ {
129
+ type: 'string',
130
+ name: 'category',
131
+ header: i18next.t('field.tax invoice category'),
132
+ record: {
133
+ renderer: value => CATEGORY[value],
134
+ align: 'center'
135
+ },
136
+ width: 80
137
+ },
138
+ {
139
+ type: 'date',
140
+ name: 'issueDate',
141
+ header: i18next.t('field.issue date'),
142
+ record: {
143
+ align: 'center'
144
+ },
145
+ filter: {
146
+ type: 'date',
147
+ operator: 'between'
148
+ },
149
+ width: 120
150
+ },
151
+ {
152
+ type: 'date',
153
+ name: 'signatureDate',
154
+ header: i18next.t('field.signature date'),
155
+ record: {
156
+ align: 'center'
157
+ },
158
+ width: 120
159
+ },
160
+ {
161
+ type: 'string',
162
+ name: 'supplierBusinessRegistrationNumber',
163
+ header: i18next.t('field.supplier business registration number'),
164
+ record: {
165
+ align: 'center'
166
+ },
167
+ width: 150
168
+ },
169
+ {
170
+ type: 'string',
171
+ name: 'supplierBusinessName',
172
+ header: i18next.t('field.supplier business name'),
173
+ record: {
174
+ align: 'center'
175
+ },
176
+ width: 140
177
+ },
178
+ {
179
+ type: 'string',
180
+ name: 'supplierRepresentativeName',
181
+ header: i18next.t('field.supplier representative name'),
182
+ record: {
183
+ align: 'center'
184
+ },
185
+ width: 120
186
+ },
187
+ {
188
+ type: 'number',
189
+ name: 'totalAmount',
190
+ header: i18next.t('field.total amount'),
191
+ record: {
192
+ renderer: value => value && new Intl.NumberFormat('en-US').format(value),
193
+ align: 'center'
194
+ },
195
+ width: 90
196
+ },
197
+ {
198
+ type: 'number',
199
+ name: 'supplyAmount',
200
+ header: i18next.t('field.supply amount'),
201
+ record: {
202
+ renderer: value => value && new Intl.NumberFormat('en-US').format(value),
203
+ align: 'center'
204
+ },
205
+ width: 90
206
+ },
207
+ {
208
+ type: 'number',
209
+ name: 'taxAmount',
210
+ header: i18next.t('field.tax amount'),
211
+ record: {
212
+ renderer: value => value && new Intl.NumberFormat('en-US').format(value),
213
+ align: 'center'
214
+ },
215
+ width: 90
216
+ },
217
+ {
218
+ type: 'string',
219
+ name: 'approvalNo',
220
+ header: i18next.t('field.approval no'),
221
+ record: {
222
+ align: 'center'
223
+ },
224
+ width: 200
225
+ },
226
+ {
227
+ type: 'string',
228
+ name: 'invoiceType',
229
+ header: i18next.t('field.invoice type'),
230
+ record: {
231
+ renderer: value => INVOICE_TYPE[value],
232
+ align: 'center'
233
+ },
234
+ width: 130
235
+ },
236
+ {
237
+ type: 'string',
238
+ name: 'remark0',
239
+ header: i18next.t('field.remark0'),
240
+ record: {
241
+ align: 'center'
242
+ },
243
+ width: 80
244
+ },
245
+ {
246
+ type: 'string',
247
+ name: 'purpose',
248
+ header: i18next.t('field.purpose'),
249
+ record: {
250
+ renderer: value => PURPOSE[value],
251
+ align: 'center'
252
+ },
253
+ width: 80
254
+ },
255
+ {
256
+ type: 'string',
257
+ name: 'supplierContactEmail',
258
+ header: i18next.t('field.supplier contact email'),
259
+ record: {
260
+ align: 'center'
261
+ },
262
+ width: 140
263
+ },
264
+ {
265
+ type: 'string',
266
+ name: 'buyer1stContactEmail',
267
+ header: i18next.t('field.buyer 1st contact email'),
268
+ record: {
269
+ align: 'center'
270
+ },
271
+ width: 140
272
+ },
273
+ {
274
+ type: 'string',
275
+ name: 'buyer2ndContactEmail',
276
+ header: i18next.t('field.buyer 2nd contact email'),
277
+ record: {
278
+ align: 'center'
279
+ },
280
+ width: 140
281
+ }
282
+ ],
283
+ rows: {
284
+ selectable: {
285
+ multiple: true
286
+ },
287
+ appendable: false
288
+ },
289
+ sorters: [
290
+ {
291
+ name: 'issueDate'
292
+ }
293
+ ]
294
+ }
295
+ }
296
+
297
+ async pageUpdated(changes: any, lifecycle: any) {
298
+ if (this.active) {
299
+ // do something here when this page just became as active
300
+ }
301
+ }
302
+
303
+ async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
304
+ const response = await client.query({
305
+ query: gql`
306
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
307
+ responses: taxInvoices(filters: $filters, pagination: $pagination, sortings: $sortings) {
308
+ items {
309
+ id
310
+ name
311
+ category
312
+ issueDate
313
+ signatureDate
314
+ supplierBusinessRegistrationNumber
315
+ supplierBusinessName
316
+ supplierRepresentativeName
317
+ totalAmount
318
+ supplyAmount
319
+ taxAmount
320
+ approvalNo
321
+ invoiceType
322
+ remark0
323
+ purpose
324
+ supplierContactEmail
325
+ buyer1stContactEmail
326
+ buyer2ndContactEmail
327
+ updater {
328
+ id
329
+ name
330
+ }
331
+ updatedAt
332
+ }
333
+ total
334
+ }
335
+ }
336
+ `,
337
+ variables: {
338
+ filters,
339
+ pagination: { page, limit },
340
+ sortings
341
+ }
342
+ })
343
+
344
+ return {
345
+ total: response.data.responses.total || 0,
346
+ records: response.data.responses.items || []
347
+ }
348
+ }
349
+
350
+ async _deleteTaxInvoice() {
351
+ if (
352
+ await OxPrompt.open({
353
+ title: i18next.t('text.are_you_sure'),
354
+ text: i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }),
355
+ confirmButton: { text: i18next.t('button.confirm') },
356
+ cancelButton: { text: i18next.t('button.cancel') }
357
+ })
358
+ ) {
359
+ const ids = this.grist.selected.map(record => record.id)
360
+ if (ids && ids.length > 0) {
361
+ const response = await client.mutate({
362
+ mutation: gql`
363
+ mutation ($ids: [String!]!) {
364
+ deleteTaxInvoices(ids: $ids)
365
+ }
366
+ `,
367
+ variables: {
368
+ ids
369
+ }
370
+ })
371
+
372
+ if (!response.errors) {
373
+ this.grist.fetch()
374
+ notify({
375
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
376
+ })
377
+ }
378
+ }
379
+ }
380
+ }
381
+
382
+ async _updateTaxInvoice() {
383
+ let patches = this.grist.dirtyRecords
384
+ if (patches && patches.length) {
385
+ patches = patches.map(patch => {
386
+ let patchField: any = patch.id ? { id: patch.id } : {}
387
+ const dirtyFields = patch.__dirtyfields__
388
+ for (let key in dirtyFields) {
389
+ patchField[key] = dirtyFields[key].after
390
+ }
391
+ patchField.cuFlag = patch.__dirty__
392
+
393
+ return patchField
394
+ })
395
+
396
+ const response = await client.mutate({
397
+ mutation: gql`
398
+ mutation ($patches: [TaxInvoicePatch!]!) {
399
+ updateMultipleTaxInvoice(patches: $patches) {
400
+ id
401
+ }
402
+ }
403
+ `,
404
+ variables: {
405
+ patches
406
+ }
407
+ })
408
+
409
+ if (!response.errors) {
410
+ this.grist.fetch()
411
+ notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') }) })
412
+ } else {
413
+ notify({ message: i18next.t('error.fail-save'), level: 'error' })
414
+ }
415
+ }
416
+ }
417
+
418
+ async createTaxInvoice(num: string) {
419
+ const year = '2024'
420
+ const month = '01'
421
+ const day = '02'
422
+ const firstWordOfNum = num.slice(0, 1)
423
+ const firstWordOfNumNext = String(Number(num.slice(0, 1)) + 1).slice(0, 1)
424
+ const supplyAmount = 1000000 * Number(firstWordOfNum)
425
+ const taxAmount = supplyAmount / 10
426
+
427
+ const taxInvoice = {
428
+ name: '설명' + num.repeat(3),
429
+ category: 10,
430
+ approvalNo: year + month + day + '-' + firstWordOfNum.repeat(8) + '-' + firstWordOfNum.repeat(8),
431
+ issueDate: `${year}-${month}-${day}`,
432
+ signatureDate: `${year}-${month}-${Number(day) + 1}`,
433
+ invoiceType: '0101',
434
+ purpose: '02',
435
+ remark0: '비고' + num.repeat(3),
436
+ supplierBusinessRegistrationCategory: '01',
437
+ supplierBusinessRegistrationNumber: `${firstWordOfNum.repeat(3)}-${firstWordOfNum.repeat(2)}-${firstWordOfNum.repeat(5)}`,
438
+ supplierBusinessName: '공급자 회사명' + firstWordOfNum.repeat(3),
439
+ supplierRepresentativeName: '공급자 대표자' + firstWordOfNum.repeat(3),
440
+ supplierAddress: '공급자 주소' + firstWordOfNum.repeat(3),
441
+ supplierBusinessType: '공급자 업태' + firstWordOfNum.repeat(3),
442
+ supplierIndustryType: '공급자 업종' + firstWordOfNum.repeat(3),
443
+ supplierDepartment: '공급자 담당 부서' + firstWordOfNum.repeat(3),
444
+ supplierContactName: '공급자 담당자명' + firstWordOfNum.repeat(3),
445
+ supplierContactPhone: `010-${firstWordOfNum.repeat(4)}-${firstWordOfNum.repeat(4)}`,
446
+ supplierContactEmail: '공급자 담당자 이메일' + firstWordOfNum.repeat(3),
447
+ supplierContactCellPhone: '공급자 핸드폰 번호' + firstWordOfNum.repeat(3),
448
+
449
+ buyerBusinessRegistrationCategory: '01',
450
+ buyerBusinessRegistrationNumber: `${firstWordOfNumNext.repeat(3)}-${firstWordOfNumNext.repeat(2)}-${firstWordOfNumNext.repeat(5)}`,
451
+ buyerBusinessName: '공급자 회사명' + firstWordOfNum.repeat(3),
452
+ buyerRepresentativeName: '공급자 대표자' + firstWordOfNum.repeat(3),
453
+ buyerAddress: '공급자 주소' + firstWordOfNum.repeat(3),
454
+ buyerBusinessType: '공급자 업태' + firstWordOfNum.repeat(3),
455
+ buyerIndustryType: '공급자 업종' + firstWordOfNum.repeat(3),
456
+ buyer1stDepartment: '공급자 담당 부서 1st' + firstWordOfNum.repeat(3),
457
+ buyer1stContactName: '공급자 담당자명 1st' + firstWordOfNum.repeat(3),
458
+ buyer1stContactPhone: `011-${firstWordOfNumNext.repeat(4)}-${firstWordOfNumNext.repeat(4)}`,
459
+ buyer1stContactEmail: '공급자 담당자 이메일 1st' + firstWordOfNum.repeat(3),
460
+ buyer1stContactCellPhone: '공급자 핸드폰 번호 1st' + firstWordOfNum.repeat(3),
461
+ buyer2ndDepartment: '공급자 담당 부서 2nd' + firstWordOfNum.repeat(3),
462
+ buyer2ndContactName: '공급자 담당자명 2nd' + firstWordOfNum.repeat(3),
463
+ buyer2ndContactPhone: `022-${firstWordOfNumNext.repeat(4)}-${firstWordOfNumNext.repeat(4)}`,
464
+ buyer2ndContactEmail: '공급자 담당자 이메일 2nd' + firstWordOfNum.repeat(3),
465
+ buyer2ndContactCellPhone: '공급자 핸드폰 번호 2nd' + firstWordOfNum.repeat(3),
466
+
467
+ paymentAmountCash: 0,
468
+ paymentAmountCheck: 0,
469
+ paymentAmountPromissoryNote: 0,
470
+ paymentAmountAccountsReceivable: 0,
471
+ supplyAmount: supplyAmount,
472
+ taxAmount: taxAmount,
473
+ totalAmount: supplyAmount + taxAmount
474
+ }
475
+ const response = await client.mutate({
476
+ mutation: gql`
477
+ mutation CreateTaxInvoice($taxInvoice: NewTaxInvoice!) {
478
+ createTaxInvoice(taxInvoice: $taxInvoice) {
479
+ id
480
+ }
481
+ }
482
+ `,
483
+ variables: {
484
+ taxInvoice
485
+ }
486
+ })
487
+
488
+ if (!response.errors) {
489
+ this.grist.fetch()
490
+ notify({
491
+ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })
492
+ })
493
+ }
494
+ }
495
+
496
+ async exportHandler() {
497
+ const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
498
+ const targetFieldSet = new Set(['id', 'name'])
499
+
500
+ return exportTargets.map(taxInvoice => {
501
+ let tempObj = {}
502
+ for (const field of targetFieldSet) {
503
+ tempObj[field] = taxInvoice[field]
504
+ }
505
+
506
+ return tempObj
507
+ })
508
+ }
509
+
510
+ private openDetailPopup(id: string) {
511
+ openPopup(html` <tax-invoice-detail-popup .taxInvoiceId=${id}> </tax-invoice-detail-popup>`, {
512
+ backdrop: true,
513
+ size: 'large',
514
+ title: i18next.t('title.tax invoice detail')
515
+ })
516
+ }
517
+ }