@things-factory/tax-invoice 7.0.0-alpha.0 → 7.0.0-alpha.18

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 (70) hide show
  1. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +39 -11
  2. package/client/pages/tax-invoice/tax-invoice-list-page.ts +150 -152
  3. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +52 -114
  4. package/client/pages/tax-invoice-company/tax-invoice-company-importer.ts +2 -2
  5. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +860 -0
  6. package/client/route.ts +4 -4
  7. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +44 -13
  8. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -1
  9. package/dist-client/pages/tax-invoice/tax-invoice-list-page.d.ts +63 -23
  10. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js +149 -143
  11. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js.map +1 -1
  12. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +3 -5
  13. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +52 -105
  14. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -1
  15. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +2 -2
  16. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -1
  17. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +106 -0
  18. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +776 -0
  19. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -0
  20. package/dist-client/route.d.ts +1 -1
  21. package/dist-client/route.js +3 -3
  22. package/dist-client/route.js.map +1 -1
  23. package/dist-client/tsconfig.tsbuildinfo +1 -1
  24. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +59 -41
  25. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
  26. package/dist-server/service/tax-invoice/tax-invoice-query.js +25 -2
  27. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -1
  28. package/dist-server/service/tax-invoice/tax-invoice-type.js +20 -257
  29. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
  30. package/dist-server/service/tax-invoice/tax-invoice-util.js +93 -0
  31. package/dist-server/service/tax-invoice/tax-invoice-util.js.map +1 -0
  32. package/dist-server/service/tax-invoice/tax-invoice.js +26 -28
  33. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  34. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +176 -21
  35. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  36. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +4 -25
  37. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
  38. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +22 -1
  39. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
  40. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +7 -9
  41. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
  42. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +0 -8
  43. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -1
  44. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -1
  45. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +2 -10
  46. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -1
  47. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +6 -15
  48. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -1
  49. package/dist-server/service/unipost-api/tax-invoice-inquiry.js +90 -0
  50. package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -0
  51. package/dist-server/service/unipost-api/tax-invoice-send.js +34 -0
  52. package/dist-server/service/unipost-api/tax-invoice-send.js.map +1 -0
  53. package/dist-server/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +5 -5
  55. package/server/service/tax-invoice/tax-invoice-mutation.ts +64 -45
  56. package/server/service/tax-invoice/tax-invoice-query.ts +22 -4
  57. package/server/service/tax-invoice/tax-invoice-type.ts +19 -197
  58. package/server/service/tax-invoice/tax-invoice-util.ts +223 -0
  59. package/server/service/tax-invoice/tax-invoice.ts +42 -53
  60. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +203 -34
  61. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +4 -21
  62. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +15 -0
  63. package/server/service/tax-invoice-api/tax-invoice-api.ts +7 -19
  64. package/server/service/tax-invoice-company/tax-invoice-company.ts +0 -4
  65. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +1 -1
  66. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +2 -11
  67. package/server/service/tax-invoice-item/tax-invoice-item.ts +6 -10
  68. package/server/service/unipost-api/tax-invoice-inquiry.ts +103 -0
  69. package/server/service/unipost-api/tax-invoice-send.ts +32 -0
  70. package/translations/ko.json +14 -1
@@ -3,7 +3,7 @@ import '@operato/data-grist'
3
3
 
4
4
  import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
5
5
  import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
6
+ import { customElement, property, state } from 'lit/decorators.js'
7
7
  import { client } from '@operato/graphql'
8
8
  import { i18next, localize } from '@operato/i18n'
9
9
  import gql from 'graphql-tag'
@@ -66,10 +66,15 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
66
66
  td,
67
67
  th {
68
68
  padding: 5px;
69
+ min-width: 60px;
70
+ }
71
+ td {
72
+ padding-left: 8px;
69
73
  }
70
74
  th.target {
71
75
  width: 25px;
72
76
  writing-mode: vertical-rl;
77
+ min-width: unset;
73
78
  }
74
79
 
75
80
  &.supplier {
@@ -149,7 +154,7 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
149
154
  <table>
150
155
  <tr>
151
156
  <th>${i18next.t('field.approval no')}</th>
152
- <td>${this.detail.approvalNo}</td>
157
+ <td>${this.detail?.approvalNo?.replace(/(\S{8})(\S{8})(\S{8})/g, '$1-$2-$3')}</td>
153
158
  </tr>
154
159
  </table>
155
160
  </div>
@@ -168,7 +173,7 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
168
173
  <tr>
169
174
  <th rowspan="6" class="target">${i18next.t('field.tax invoice supplier')}</th>
170
175
  <th>${i18next.t('field.short business registration number')}</th>
171
- <td>${this.detail.supplierBusinessRegistrationNumber}</td>
176
+ <td>${this.detail?.supplierBusinessRegistrationNumber?.replace(/(\d{3})(\d{2})(\d{5})/g, '$1-$2-$3')}</td>
172
177
  <th>${i18next.t('field.short branch identification')}</th>
173
178
  <td>${this.detail.supplierBranchIdentification}</td>
174
179
  </tr>
@@ -196,10 +201,17 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
196
201
  </table>
197
202
 
198
203
  <table class="buyer">
204
+ <colgroup>
205
+ <col width="150px" />
206
+ <col width="18%" />
207
+ <col width="32%" />
208
+ <col width="18%" />
209
+ <col width="32%" />
210
+ </colgroup>
199
211
  <tr>
200
212
  <th rowspan="6" class="target">${i18next.t('field.tax invoice buyer')}</th>
201
213
  <th>${i18next.t('field.short business registration number')}</th>
202
- <td>${this.detail.buyerBusinessRegistrationNumber}</td>
214
+ <td>${this.detail?.buyerBusinessRegistrationNumber?.replace(/(\d{3})(\d{2})(\d{5})/g, '$1-$2-$3')}</td>
203
215
  <th>${i18next.t('field.short branch identification')}</th>
204
216
  <td>${this.detail.buyerBranchIdentification}</td>
205
217
  </tr>
@@ -247,7 +259,7 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
247
259
  <th>${i18next.t('field.remark0')}</th>
248
260
  </tr>
249
261
  <tr>
250
- <td>${this.detail.issueDate}</td>
262
+ <td>${this.detail.issueDate?.split('T')[0]}</td>
251
263
  <td>${this._numberFormat(this.detail.supplyAmount)}</td>
252
264
  <td>${this._numberFormat(this.detail.taxAmount)}</td>
253
265
  <td>${this.detail.modificationReason}</td>
@@ -285,11 +297,15 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
285
297
  item =>
286
298
  html`
287
299
  <tr>
288
- <td>${item.issueDate}</td>
289
- <td>${item.supplyAmount}</td>
290
- <td>${item.taxAmount}</td>
291
- <td>${item.modificationReason}</td>
292
- <td>${item.remark0}</td>
300
+ <td>${item.supplyDate.split('-')[1]}</td>
301
+ <td>${item.supplyDate.split('-')[2]?.split('T')[0]}</td>
302
+ <td>${item.itemName}</td>
303
+ <td>${item.specification}</td>
304
+ <td>${item.quantity}</td>
305
+ <td>${this._numberFormat(item.unitPrice)}</td>
306
+ <td>${this._numberFormat(item.supplyPrice)}</td>
307
+ <td>${this._numberFormat(item.taxPrice)}</td>
308
+ <td>${item.remark}</td>
293
309
  </tr>
294
310
  `
295
311
  )}
@@ -340,7 +356,6 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
340
356
  query ($id: String!) {
341
357
  responses: taxInvoice(id: $id) {
342
358
  id
343
- name
344
359
  category
345
360
  approvalNo
346
361
  originalApprovalNo
@@ -409,6 +424,19 @@ export class TaxInvoiceDetailPopup extends localize(i18next)(LitElement) {
409
424
  name
410
425
  }
411
426
  updatedAt
427
+
428
+ taxInvoiceItems {
429
+ id
430
+ sequence
431
+ supplyDate
432
+ itemName
433
+ specification
434
+ quantity
435
+ unitPrice
436
+ supplyPrice
437
+ taxPrice
438
+ remark
439
+ }
412
440
  }
413
441
  }
414
442
  `,
@@ -1,47 +1,84 @@
1
1
  import '@operato/data-grist'
2
2
 
3
3
  import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
- import { PageView, navigate, store } from '@operato/shell'
4
+ import { PageView } from '@operato/shell'
5
5
  import { css, html } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
6
+ import { customElement, property, state, query } from 'lit/decorators.js'
7
7
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
- import { ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'
8
+ import { DataGrist, FetchOption } from '@operato/data-grist'
9
9
  import { client } from '@operato/graphql'
10
10
  import { i18next, localize } from '@operato/i18n'
11
11
  import { notify, openPopup } from '@operato/layout'
12
- import { OxPopup, OxPrompt } from '@operato/popup'
12
+ import { OxPrompt } from '@operato/popup'
13
13
  import { isMobileDevice } from '@operato/utils'
14
14
  import gql from 'graphql-tag'
15
15
 
16
16
  import './tax-invoice-detail-popup'
17
17
 
18
+ export enum Category {
19
+ EXPORT = '10',
20
+ IMPORT = '20',
21
+ NTS = '30'
22
+ }
18
23
  export const CATEGORY = {
19
- '10': '매출',
20
- '20': '매입',
21
- '30': 'NTS'
24
+ [Category.EXPORT]: '매출',
25
+ [Category.IMPORT]: '매입',
26
+ [Category.NTS]: 'NTS'
22
27
  }
23
28
 
29
+ export enum InvoiceType {
30
+ 'TAX_INVOICE' = '0101',
31
+ 'SMALL_BUSINESS_TAX_INVOICE' = '0102',
32
+ 'CONSIGNMENT_TAX_INVOICE' = '0103',
33
+ 'SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE' = '0105',
34
+ 'REVISED_TAX_INVOICE' = '0201',
35
+ 'REVISED_SMALL_BUSINESS_TAX_INVOICE' = '0202',
36
+ 'REVISED_CONSIGNMENT_TAX_INVOICE' = '0203',
37
+ 'REVISED_IMPORT_TAX_INVOICE' = '0204',
38
+ 'REVISED_SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE' = '0205',
39
+ 'INVOICE' = '0301',
40
+ 'CONSIGNMENT_INVOICE' = '0303',
41
+ 'IMPORT_INVOICE' = '0304',
42
+ 'REVISED_INVOICE' = '0401',
43
+ 'REVISED_CONSIGNMENT_INVOICE' = '0403',
44
+ 'REVISED_IMPORT_INVOICE' = '0404'
45
+ }
24
46
  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': '정 수입 계산서'
47
+ [InvoiceType.TAX_INVOICE]: '일반 전자세금계산서',
48
+ [InvoiceType.SMALL_BUSINESS_TAX_INVOICE]: '영세율 전자세금계산서',
49
+ [InvoiceType.CONSIGNMENT_TAX_INVOICE]: '위수탁 전자세금계산서',
50
+ [InvoiceType.SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE]: '영세율 위수탁 전자세금계산서',
51
+ [InvoiceType.REVISED_TAX_INVOICE]: '수정 일반 전자세금계산서',
52
+ [InvoiceType.REVISED_SMALL_BUSINESS_TAX_INVOICE]: '수정 영세율 전자세금계산서',
53
+ [InvoiceType.REVISED_CONSIGNMENT_TAX_INVOICE]: '수정 위수탁 전자세금계산서',
54
+ [InvoiceType.REVISED_IMPORT_TAX_INVOICE]: '수정 수입 전자세금계산서',
55
+ [InvoiceType.REVISED_SMALL_BUSINESS_CONSIGNMENT_TAX_INVOICE]: '수정 영세율 위수탁 전자세금계산서',
56
+ [InvoiceType.INVOICE]: '일반 전자계산서',
57
+ [InvoiceType.CONSIGNMENT_INVOICE]: '위수탁 전자계산서',
58
+ [InvoiceType.IMPORT_INVOICE]: '수입 전자계산서',
59
+ [InvoiceType.REVISED_INVOICE]: '수정 일반 전자계산서',
60
+ [InvoiceType.REVISED_CONSIGNMENT_INVOICE]: '수정 위수탁 전자계산서',
61
+ [InvoiceType.REVISED_IMPORT_INVOICE]: '수정 수입 전자계산서'
40
62
  }
41
63
 
64
+ export enum Purpose {
65
+ RECEIPT = '01',
66
+ INVOICE = '02'
67
+ }
42
68
  export const PURPOSE = {
43
- '01': '영수',
44
- '02': '청구'
69
+ [Purpose.RECEIPT]: '영수',
70
+ [Purpose.INVOICE]: '청구'
71
+ }
72
+
73
+ export enum BusinessRegistrationCategory {
74
+ BUSINESS_REGISTRATION_NUMBER = '01', // 사업자등록번호
75
+ RESIDENT_REGISTRATION_NUMBER = '02', // 주민등록번호
76
+ FOREIGNER_REGISTRATION_NUMBER = '03' // 외국인등록번호
77
+ }
78
+ export const BUSINESS_REGISTRATION_CATEGORY = {
79
+ [BusinessRegistrationCategory.BUSINESS_REGISTRATION_NUMBER]: '사업자등록번호',
80
+ [BusinessRegistrationCategory.RESIDENT_REGISTRATION_NUMBER]: '주민등록번호',
81
+ [BusinessRegistrationCategory.FOREIGNER_REGISTRATION_NUMBER]: '외국인'
45
82
  }
46
83
 
47
84
  @customElement('tax-invoice-list-page')
@@ -52,17 +89,43 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
52
89
  css`
53
90
  :host {
54
91
  display: flex;
92
+ flex-direction: column;
55
93
 
56
94
  width: 100%;
57
95
 
58
96
  --grid-record-emphasized-background-color: red;
59
97
  --grid-record-emphasized-color: yellow;
60
98
  }
99
+
100
+ div.summary {
101
+ display: grid;
102
+ grid-template-columns: 0.7fr 1fr 0.7fr 1fr 0.7fr 1fr 0.7fr 1fr;
103
+ border: solid #d3dbe5;
104
+ border-width: 2px 0;
105
+ margin: 15px 40px;
106
+ align-content: center;
107
+
108
+ span.title {
109
+ background-color: #e9edf6;
110
+ text-align: center;
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: center;
114
+ height: 35px;
115
+ font-weight: bold;
116
+ }
117
+ span.value {
118
+ padding-left: 10px;
119
+ display: flex;
120
+ align-items: center;
121
+ height: 35px;
122
+ }
123
+ }
61
124
  `
62
125
  ]
63
126
 
64
127
  @property({ type: Object }) gristConfig: any
65
- @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'
128
+ @state() summary: { cnt: number; total_amount: number; supply_amount: number; tax_amount: number } | null = null
66
129
 
67
130
  @query('ox-grist') private grist!: DataGrist
68
131
 
@@ -72,9 +135,9 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
72
135
  help: 'tax-invoice/tax-invoice',
73
136
  actions: [
74
137
  {
75
- title: i18next.t('button.delete'),
76
- action: this._deleteTaxInvoice.bind(this),
77
- ...CommonButtonStyles.delete
138
+ title: i18next.t('button.memo save'),
139
+ action: this._updateTaxInvoice.bind(this),
140
+ ...CommonButtonStyles.save
78
141
  }
79
142
  ],
80
143
  exportable: {
@@ -87,8 +150,20 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
87
150
 
88
151
  render() {
89
152
  const mode = 'GRID'
153
+ const summary = this.summary
90
154
 
91
155
  return html`
156
+ <div class="summary">
157
+ <span class="title">${i18next.t('field.summary total count')}</span>
158
+ <span class="value">${this._numberFormat(summary?.cnt)}</span>
159
+ <span class="title">${i18next.t('field.summary total amount')}</span>
160
+ <span class="value">${this._numberFormat(summary?.total_amount)}</span>
161
+ <span class="title">${i18next.t('field.summary supply amount')}</span>
162
+ <span class="value">${this._numberFormat(summary?.supply_amount)}</span>
163
+ <span class="title">${i18next.t('field.summary tax amount')}</span>
164
+ <span class="value">${this._numberFormat(summary?.tax_amount)}</span>
165
+ </div>
166
+
92
167
  <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
93
168
  <div slot="headroom">
94
169
  <div id="filters">
@@ -97,7 +172,6 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
97
172
  </div>
98
173
  </ox-grist>
99
174
  `
100
- // <button @click=${() => this.createTaxInvoice('3')}>생성</button>
101
175
  }
102
176
 
103
177
  async pageInitialized(lifecycle: any) {
@@ -117,8 +191,8 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
117
191
  },
118
192
  {
119
193
  type: 'string',
120
- name: 'name',
121
- header: i18next.t('field.name'),
194
+ name: 'memo',
195
+ header: i18next.t('field.memo'),
122
196
  record: {
123
197
  editable: true
124
198
  },
@@ -131,8 +205,31 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
131
205
  header: i18next.t('field.tax invoice category'),
132
206
  record: {
133
207
  renderer: value => CATEGORY[value],
208
+ classifier: function (record, rowIndex) {
209
+ return {
210
+ emphasized: record.category === Category.EXPORT ? ['#c6daf6', 'black'] : ['#fedbde', 'black']
211
+ }
212
+ },
134
213
  align: 'center'
135
214
  },
215
+ filter: {
216
+ type: 'select',
217
+ value: Category.EXPORT,
218
+ options: () => [
219
+ {
220
+ display: '전체',
221
+ value: ''
222
+ },
223
+ {
224
+ display: '매출',
225
+ value: Category.EXPORT
226
+ },
227
+ {
228
+ display: '매입',
229
+ value: Category.IMPORT
230
+ }
231
+ ]
232
+ },
136
233
  width: 80
137
234
  },
138
235
  {
@@ -162,7 +259,8 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
162
259
  name: 'supplierBusinessRegistrationNumber',
163
260
  header: i18next.t('field.supplier business registration number'),
164
261
  record: {
165
- align: 'center'
262
+ align: 'center',
263
+ renderer: value => value.replace(/(\d{3})(\d{2})(\d{5})/g, '$1-$2-$3')
166
264
  },
167
265
  width: 150
168
266
  },
@@ -189,7 +287,7 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
189
287
  name: 'totalAmount',
190
288
  header: i18next.t('field.total amount'),
191
289
  record: {
192
- renderer: value => value && new Intl.NumberFormat('en-US').format(value),
290
+ renderer: value => value && this._numberFormat(value),
193
291
  align: 'center'
194
292
  },
195
293
  width: 90
@@ -199,7 +297,7 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
199
297
  name: 'supplyAmount',
200
298
  header: i18next.t('field.supply amount'),
201
299
  record: {
202
- renderer: value => value && new Intl.NumberFormat('en-US').format(value),
300
+ renderer: value => value && this._numberFormat(value),
203
301
  align: 'center'
204
302
  },
205
303
  width: 90
@@ -209,7 +307,7 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
209
307
  name: 'taxAmount',
210
308
  header: i18next.t('field.tax amount'),
211
309
  record: {
212
- renderer: value => value && new Intl.NumberFormat('en-US').format(value),
310
+ renderer: value => value && this._numberFormat(value),
213
311
  align: 'center'
214
312
  },
215
313
  width: 90
@@ -219,7 +317,8 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
219
317
  name: 'approvalNo',
220
318
  header: i18next.t('field.approval no'),
221
319
  record: {
222
- align: 'center'
320
+ align: 'center',
321
+ renderer: value => value.replace(/(\S{8})(\S{8})(\S{8})/g, '$1-$2-$3')
223
322
  },
224
323
  width: 200
225
324
  },
@@ -303,11 +402,11 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
303
402
  async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
304
403
  const response = await client.query({
305
404
  query: gql`
306
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
307
- responses: taxInvoices(filters: $filters, pagination: $pagination, sortings: $sortings) {
405
+ query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $summaryFilters: [Filter!]) {
406
+ taxInvoices(filters: $filters, pagination: $pagination, sortings: $sortings) {
308
407
  items {
309
408
  id
310
- name
409
+ memo
311
410
  category
312
411
  issueDate
313
412
  signatureDate
@@ -332,50 +431,25 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
332
431
  }
333
432
  total
334
433
  }
434
+ taxInvoicesSummary(filters: $summaryFilters) {
435
+ summary
436
+ }
335
437
  }
336
438
  `,
337
439
  variables: {
338
440
  filters,
339
441
  pagination: { page, limit },
340
- sortings
442
+ sortings,
443
+ summaryFilters: filters
341
444
  }
342
445
  })
343
446
 
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
- })
447
+ // 합계 필드 갱신
448
+ this.summary = response.data.taxInvoicesSummary.summary
371
449
 
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
- }
450
+ return {
451
+ total: response.data.taxInvoices.total || 0,
452
+ records: response.data.taxInvoices.items || []
379
453
  }
380
454
  }
381
455
 
@@ -415,84 +489,6 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
415
489
  }
416
490
  }
417
491
 
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
492
  async exportHandler() {
497
493
  const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
498
494
  const targetFieldSet = new Set(['id', 'name'])
@@ -514,4 +510,6 @@ export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(Pa
514
510
  title: i18next.t('title.tax invoice detail')
515
511
  })
516
512
  }
513
+
514
+ private _numberFormat = (num: number | undefined) => Intl.NumberFormat('en-US').format(num || 0)
517
515
  }