@things-factory/tax-invoice 8.0.0 → 9.0.0-beta.3

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 (51) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/dist-server/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +8 -8
  4. package/client/bootstrap.ts +0 -1
  5. package/client/index.ts +0 -0
  6. package/client/pages/main.ts +0 -25
  7. package/client/pages/tax-audit-result/tax-audit-result-importer.ts +0 -87
  8. package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +0 -331
  9. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +0 -454
  10. package/client/pages/tax-invoice/tax-invoice-list-page.ts +0 -525
  11. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +0 -418
  12. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +0 -447
  13. package/client/pages/tax-invoice-send/company-list-popup.ts +0 -188
  14. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +0 -196
  15. package/client/pages/tax-invoice-send/tax-invoice-send.ts +0 -1181
  16. package/client/route.ts +0 -23
  17. package/client/tsconfig.json +0 -11
  18. package/server/index.ts +0 -2
  19. package/server/routes.ts +0 -28
  20. package/server/service/index.ts +0 -37
  21. package/server/service/tax-audit-result/event-subscriber.ts +0 -17
  22. package/server/service/tax-audit-result/index.ts +0 -9
  23. package/server/service/tax-audit-result/tax-audit-result-history.ts +0 -120
  24. package/server/service/tax-audit-result/tax-audit-result-mutation.ts +0 -198
  25. package/server/service/tax-audit-result/tax-audit-result-query.ts +0 -65
  26. package/server/service/tax-audit-result/tax-audit-result-type.ts +0 -61
  27. package/server/service/tax-audit-result/tax-audit-result.ts +0 -99
  28. package/server/service/tax-invoice/index.ts +0 -6
  29. package/server/service/tax-invoice/tax-invoice-mutation.ts +0 -138
  30. package/server/service/tax-invoice/tax-invoice-query.ts +0 -99
  31. package/server/service/tax-invoice/tax-invoice-type.ts +0 -236
  32. package/server/service/tax-invoice/tax-invoice-util.ts +0 -224
  33. package/server/service/tax-invoice/tax-invoice.ts +0 -393
  34. package/server/service/tax-invoice-api/index.ts +0 -6
  35. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +0 -275
  36. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +0 -40
  37. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +0 -83
  38. package/server/service/tax-invoice-api/tax-invoice-api.ts +0 -128
  39. package/server/service/tax-invoice-company/index.ts +0 -6
  40. package/server/service/tax-invoice-company/tax-invoice-company-mutation.ts +0 -84
  41. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +0 -86
  42. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +0 -105
  43. package/server/service/tax-invoice-company/tax-invoice-company.ts +0 -128
  44. package/server/service/tax-invoice-item/index.ts +0 -6
  45. package/server/service/tax-invoice-item/tax-invoice-item-mutation.ts +0 -128
  46. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +0 -60
  47. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +0 -77
  48. package/server/service/tax-invoice-item/tax-invoice-item.ts +0 -95
  49. package/server/service/unipost-api/tax-invoice-inquiry.ts +0 -99
  50. package/server/service/unipost-api/tax-invoice-send.ts +0 -32
  51. package/server/tsconfig.json +0 -10
@@ -1,525 +0,0 @@
1
- import '@operato/data-grist'
2
-
3
- import { CommonButtonStyles, CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
- import { PageView } from '@operato/shell'
5
- import { css, html } from 'lit'
6
- import { customElement, property, state, query } from 'lit/decorators.js'
7
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
8
- import { DataGrist, FetchOption } 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 { 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 enum Category {
19
- EXPORT = '10',
20
- IMPORT = '20',
21
- NTS = '30'
22
- }
23
- export const CATEGORY = {
24
- [Category.EXPORT]: '매출',
25
- [Category.IMPORT]: '매입',
26
- [Category.NTS]: 'NTS'
27
- }
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
- }
46
- export const INVOICE_TYPE = {
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]: '수정 수입 전자계산서'
62
- }
63
-
64
- export enum Purpose {
65
- RECEIPT = '01',
66
- INVOICE = '02'
67
- }
68
- export const PURPOSE = {
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]: '외국인'
82
- }
83
-
84
- @customElement('tax-invoice-list-page')
85
- export class TaxInvoiceListPage extends localize(i18next)(ScopedElementsMixin(PageView)) {
86
- static styles = [
87
- ScrollbarStyles,
88
- CommonGristStyles,
89
- CommonHeaderStyles,
90
- css`
91
- :host {
92
- display: flex;
93
- flex-direction: column;
94
-
95
- width: 100%;
96
-
97
- --grid-record-emphasized-background-color: red;
98
- --grid-record-emphasized-color: yellow;
99
- }
100
-
101
- div.summary {
102
- display: grid;
103
- grid-template-columns: 0.7fr 1fr 0.7fr 1fr 0.7fr 1fr 0.7fr 1fr;
104
- border: solid #d3dbe5;
105
- border-width: 2px 0;
106
- margin: 15px 40px;
107
- align-content: center;
108
-
109
- span.title {
110
- background-color: #e9edf6;
111
- text-align: center;
112
- display: flex;
113
- align-items: center;
114
- justify-content: center;
115
- height: 35px;
116
- font-weight: bold;
117
- }
118
- span.value {
119
- padding-left: 10px;
120
- display: flex;
121
- align-items: center;
122
- height: 35px;
123
- }
124
- }
125
-
126
- ox-grist {
127
- overflow-y: auto;
128
- flex: 1;
129
- }
130
-
131
- ox-filters-form {
132
- flex: 1;
133
- }
134
- `
135
- ]
136
-
137
- @property({ type: Object }) gristConfig: any
138
- @state() summary: { cnt: number; total_amount: number; supply_amount: number; tax_amount: number } | null = null
139
-
140
- @query('ox-grist') private grist!: DataGrist
141
-
142
- get context() {
143
- return {
144
- title: i18next.t('title.tax invoice list'),
145
- help: 'tax-invoice/tax-invoice',
146
- actions: [
147
- {
148
- title: i18next.t('button.memo save'),
149
- action: this._updateTaxInvoice.bind(this),
150
- ...CommonButtonStyles.save
151
- }
152
- ],
153
- exportable: {
154
- name: i18next.t('title.tax invoice list'),
155
- data: this.exportHandler.bind(this),
156
- accept: ['xlsx']
157
- }
158
- }
159
- }
160
-
161
- render() {
162
- const mode = 'GRID'
163
- const summary = this.summary
164
-
165
- return html`
166
- <div class="summary">
167
- <span class="title">${i18next.t('field.summary total count')}</span>
168
- <span class="value">${this._numberFormat(summary?.cnt)}</span>
169
- <span class="title">${i18next.t('field.summary total amount')}</span>
170
- <span class="value">${this._numberFormat(summary?.total_amount)}</span>
171
- <span class="title">${i18next.t('field.summary supply amount')}</span>
172
- <span class="value">${this._numberFormat(summary?.supply_amount)}</span>
173
- <span class="title">${i18next.t('field.summary tax amount')}</span>
174
- <span class="value">${this._numberFormat(summary?.tax_amount)}</span>
175
- </div>
176
-
177
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
178
- <div slot="headroom" class="header">
179
- <div class="filters">
180
- <ox-filters-form autofocus></ox-filters-form>
181
- </div>
182
- </div>
183
- </ox-grist>
184
- `
185
- }
186
-
187
- async pageInitialized(lifecycle: any) {
188
- this.gristConfig = {
189
- columns: [
190
- { type: 'gutter', gutterName: 'sequence' },
191
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
192
- {
193
- type: 'gutter',
194
- gutterName: 'button',
195
- icon: 'reorder',
196
- handlers: {
197
- click: (columns, data, column, record, rowIndex) => {
198
- this.openDetailPopup(record.id)
199
- }
200
- }
201
- },
202
- {
203
- type: 'string',
204
- name: 'memo',
205
- header: i18next.t('field.memo'),
206
- record: {
207
- editable: true
208
- },
209
- filter: 'search',
210
- width: 150
211
- },
212
- {
213
- type: 'string',
214
- name: 'category',
215
- header: i18next.t('field.tax invoice category'),
216
- record: {
217
- renderer: value => CATEGORY[value],
218
- classifier: function (record, rowIndex) {
219
- return {
220
- emphasized: record.category === Category.EXPORT ? ['#c6daf6', 'black'] : ['#fedbde', 'black']
221
- }
222
- },
223
- align: 'center'
224
- },
225
- filter: {
226
- type: 'select',
227
- value: Category.EXPORT,
228
- options: () => [
229
- {
230
- display: '전체',
231
- value: ''
232
- },
233
- {
234
- display: '매출',
235
- value: Category.EXPORT
236
- },
237
- {
238
- display: '매입',
239
- value: Category.IMPORT
240
- }
241
- ]
242
- },
243
- width: 80
244
- },
245
- {
246
- type: 'date',
247
- name: 'issueDate',
248
- header: i18next.t('field.issue date'),
249
- record: {
250
- align: 'center'
251
- },
252
- filter: {
253
- type: 'date',
254
- operator: 'between'
255
- },
256
- width: 120
257
- },
258
- {
259
- type: 'date',
260
- name: 'signatureDate',
261
- header: i18next.t('field.signature date'),
262
- record: {
263
- align: 'center'
264
- },
265
- width: 120
266
- },
267
- {
268
- type: 'string',
269
- name: 'supplierBusinessRegistrationNumber',
270
- header: i18next.t('field.supplier business registration number'),
271
- record: {
272
- align: 'center',
273
- renderer: value => value.replace(/(\d{3})(\d{2})(\d{5})/g, '$1-$2-$3')
274
- },
275
- width: 150
276
- },
277
- {
278
- type: 'string',
279
- name: 'supplierBusinessName',
280
- header: i18next.t('field.supplier business name'),
281
- record: {
282
- align: 'center'
283
- },
284
- width: 140
285
- },
286
- {
287
- type: 'string',
288
- name: 'supplierRepresentativeName',
289
- header: i18next.t('field.supplier representative name'),
290
- record: {
291
- align: 'center'
292
- },
293
- width: 120
294
- },
295
- {
296
- type: 'number',
297
- name: 'totalAmount',
298
- header: i18next.t('field.total amount'),
299
- record: {
300
- renderer: value => value && this._numberFormat(value),
301
- align: 'center'
302
- },
303
- width: 90
304
- },
305
- {
306
- type: 'number',
307
- name: 'supplyAmount',
308
- header: i18next.t('field.supply amount'),
309
- record: {
310
- renderer: value => value && this._numberFormat(value),
311
- align: 'center'
312
- },
313
- width: 90
314
- },
315
- {
316
- type: 'number',
317
- name: 'taxAmount',
318
- header: i18next.t('field.tax amount'),
319
- record: {
320
- renderer: value => value && this._numberFormat(value),
321
- align: 'center'
322
- },
323
- width: 90
324
- },
325
- {
326
- type: 'string',
327
- name: 'approvalNo',
328
- header: i18next.t('field.approval no'),
329
- record: {
330
- align: 'center',
331
- renderer: value => value.replace(/(\S{8})(\S{8})(\S{8})/g, '$1-$2-$3')
332
- },
333
- width: 200
334
- },
335
- {
336
- type: 'string',
337
- name: 'invoiceType',
338
- header: i18next.t('field.invoice type'),
339
- record: {
340
- renderer: value => INVOICE_TYPE[value],
341
- align: 'center'
342
- },
343
- width: 130
344
- },
345
- {
346
- type: 'string',
347
- name: 'remark0',
348
- header: i18next.t('field.remark0'),
349
- record: {
350
- align: 'center'
351
- },
352
- width: 80
353
- },
354
- {
355
- type: 'string',
356
- name: 'purpose',
357
- header: i18next.t('field.purpose'),
358
- record: {
359
- renderer: value => PURPOSE[value],
360
- align: 'center'
361
- },
362
- width: 80
363
- },
364
- {
365
- type: 'string',
366
- name: 'supplierContactEmail',
367
- header: i18next.t('field.supplier contact email'),
368
- record: {
369
- align: 'center'
370
- },
371
- width: 140
372
- },
373
- {
374
- type: 'string',
375
- name: 'buyer1stContactEmail',
376
- header: i18next.t('field.buyer 1st contact email'),
377
- record: {
378
- align: 'center'
379
- },
380
- width: 140
381
- },
382
- {
383
- type: 'string',
384
- name: 'buyer2ndContactEmail',
385
- header: i18next.t('field.buyer 2nd contact email'),
386
- record: {
387
- align: 'center'
388
- },
389
- width: 140
390
- }
391
- ],
392
- rows: {
393
- selectable: {
394
- multiple: true
395
- },
396
- appendable: false
397
- },
398
- sorters: [
399
- {
400
- name: 'issueDate'
401
- }
402
- ]
403
- }
404
- }
405
-
406
- async pageUpdated(changes: any, lifecycle: any) {
407
- if (this.active) {
408
- // do something here when this page just became as active
409
- }
410
- }
411
-
412
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
413
- const response = await client.query({
414
- query: gql`
415
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $summaryFilters: [Filter!]) {
416
- taxInvoices(filters: $filters, pagination: $pagination, sortings: $sortings) {
417
- items {
418
- id
419
- memo
420
- category
421
- issueDate
422
- signatureDate
423
- supplierBusinessRegistrationNumber
424
- supplierBusinessName
425
- supplierRepresentativeName
426
- totalAmount
427
- supplyAmount
428
- taxAmount
429
- approvalNo
430
- invoiceType
431
- remark0
432
- purpose
433
- supplierContactEmail
434
- buyer1stContactEmail
435
- buyer2ndContactEmail
436
- updater {
437
- id
438
- name
439
- }
440
- updatedAt
441
- }
442
- total
443
- }
444
- taxInvoicesSummary(filters: $summaryFilters) {
445
- summary
446
- }
447
- }
448
- `,
449
- variables: {
450
- filters,
451
- pagination: { page, limit },
452
- sortings,
453
- summaryFilters: filters
454
- }
455
- })
456
-
457
- // 합계 필드 갱신
458
- this.summary = response.data.taxInvoicesSummary.summary
459
-
460
- return {
461
- total: response.data.taxInvoices.total || 0,
462
- records: response.data.taxInvoices.items || []
463
- }
464
- }
465
-
466
- async _updateTaxInvoice() {
467
- let patches = this.grist.dirtyRecords
468
- if (patches && patches.length) {
469
- patches = patches.map(patch => {
470
- let patchField: any = patch.id ? { id: patch.id } : {}
471
- const dirtyFields = patch.__dirtyfields__
472
- for (let key in dirtyFields) {
473
- patchField[key] = dirtyFields[key].after
474
- }
475
- patchField.cuFlag = patch.__dirty__
476
-
477
- return patchField
478
- })
479
-
480
- const response = await client.mutate({
481
- mutation: gql`
482
- mutation ($patches: [TaxInvoicePatch!]!) {
483
- updateMultipleTaxInvoice(patches: $patches) {
484
- id
485
- }
486
- }
487
- `,
488
- variables: {
489
- patches
490
- }
491
- })
492
-
493
- if (!response.errors) {
494
- this.grist.fetch()
495
- notify({ message: i18next.t('text.info_x_successfully', { x: i18next.t('text.save') }) })
496
- } else {
497
- notify({ message: i18next.t('error.fail-save'), level: 'error' })
498
- }
499
- }
500
- }
501
-
502
- async exportHandler() {
503
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records
504
- const targetFieldSet = new Set(['id', 'name'])
505
-
506
- return exportTargets.map(taxInvoice => {
507
- let tempObj = {}
508
- for (const field of targetFieldSet) {
509
- tempObj[field] = taxInvoice[field]
510
- }
511
-
512
- return tempObj
513
- })
514
- }
515
-
516
- private openDetailPopup(id: string) {
517
- openPopup(html` <tax-invoice-detail-popup .taxInvoiceId=${id}> </tax-invoice-detail-popup>`, {
518
- backdrop: true,
519
- size: 'large',
520
- title: i18next.t('title.tax invoice detail')
521
- })
522
- }
523
-
524
- private _numberFormat = (num: number | undefined) => Intl.NumberFormat('en-US').format(num || 0)
525
- }