@things-factory/tax-invoice 6.2.86 → 6.2.90

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 (61) hide show
  1. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +12 -6
  2. package/client/pages/tax-invoice/tax-invoice-list-page.ts +147 -176
  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 +580 -0
  6. package/client/route.ts +4 -4
  7. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +18 -9
  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 -168
  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 +100 -0
  18. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +510 -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 +132 -27
  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 +24 -1
  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 +22 -259
  29. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
  30. package/dist-server/service/tax-invoice/tax-invoice.js +22 -16
  31. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  32. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +13 -21
  33. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  34. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +4 -25
  35. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -1
  36. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +5 -0
  37. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -1
  38. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +7 -1
  39. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -1
  40. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -1
  41. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +4 -4
  42. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -1
  43. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +3 -3
  44. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -1
  45. package/dist-server/service/unipost-api/tax-invoice-inquiry.js +90 -0
  46. package/dist-server/service/unipost-api/tax-invoice-inquiry.js.map +1 -0
  47. package/dist-server/tsconfig.tsbuildinfo +1 -1
  48. package/package.json +5 -5
  49. package/server/service/tax-invoice/tax-invoice-mutation.ts +137 -36
  50. package/server/service/tax-invoice/tax-invoice-query.ts +21 -3
  51. package/server/service/tax-invoice/tax-invoice-type.ts +21 -199
  52. package/server/service/tax-invoice/tax-invoice.ts +38 -45
  53. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +19 -33
  54. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +4 -21
  55. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +4 -0
  56. package/server/service/tax-invoice-api/tax-invoice-api.ts +7 -15
  57. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +1 -1
  58. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +4 -7
  59. package/server/service/tax-invoice-item/tax-invoice-item.ts +3 -3
  60. package/server/service/unipost-api/tax-invoice-inquiry.ts +103 -0
  61. package/translations/ko.json +10 -1
@@ -7,46 +7,32 @@ import { TaxInvoiceApiPatch } from './tax-invoice-api-type'
7
7
  @Resolver(TaxInvoiceApi)
8
8
  export class TaxInvoiceApiMutation {
9
9
  @Directive('@transaction')
10
- @Mutation(returns => [TaxInvoiceApi], { description: 'To modify multiple Tax Invoice Api information' })
11
- async updateMultipleTaxInvoiceApis(
12
- @Arg('patches', type => [TaxInvoiceApiPatch]) patches: TaxInvoiceApiPatch[],
13
- @Ctx() context: ResolverContext
14
- ): Promise<TaxInvoiceApi[]> {
10
+ @Mutation(returns => TaxInvoiceApi, { description: 'To modify Tax Invoice Api information' })
11
+ async updateMultipleTaxInvoiceApi(@Arg('patch', type => TaxInvoiceApiPatch) patch: TaxInvoiceApiPatch, @Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {
15
12
  const { domain, user, tx } = context.state
16
-
17
- let results = []
18
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
19
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
20
13
  const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)
14
+ let results
21
15
 
22
- if (_createRecords.length > 0) {
23
- for (let i = 0; i < _createRecords.length; i++) {
24
- const newRecord = _createRecords[i]
25
-
26
- const result = await taxInvoiceApiRepo.save({
27
- ...newRecord,
28
- domain,
29
- creator: user,
30
- updater: user
31
- })
16
+ if (patch.cuFlag.toUpperCase() === '+') {
17
+ const result = await taxInvoiceApiRepo.save({
18
+ ...patch,
19
+ domain,
20
+ creator: user,
21
+ updater: user
22
+ })
32
23
 
33
- results.push({ ...result, cuFlag: '+' })
34
- }
24
+ results = { ...result, cuFlag: '+' }
35
25
  }
36
26
 
37
- if (_updateRecords.length > 0) {
38
- for (let i = 0; i < _updateRecords.length; i++) {
39
- const updateRecord = _updateRecords[i]
40
- const taxInvoiceApi = await taxInvoiceApiRepo.findOneBy({ id: updateRecord.id })
41
-
42
- const result = await taxInvoiceApiRepo.save({
43
- ...taxInvoiceApi,
44
- ...updateRecord,
45
- updater: user
46
- })
27
+ if (patch.cuFlag.toUpperCase() === 'M') {
28
+ const taxInvoiceApi = await taxInvoiceApiRepo.findOneBy({ id: patch.id })
29
+ const result = await taxInvoiceApiRepo.save({
30
+ ...taxInvoiceApi,
31
+ ...patch,
32
+ updater: user
33
+ })
47
34
 
48
- results.push({ ...result, cuFlag: 'M' })
49
- }
35
+ results = { ...result, cuFlag: 'M' }
50
36
  }
51
37
 
52
38
  return results
@@ -1,36 +1,19 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
2
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
1
+ import { Resolver, Query, FieldResolver, Root, Ctx } from 'type-graphql'
2
+ import { Domain, getRepository } from '@things-factory/shell'
3
3
  import { User } from '@things-factory/auth-base'
4
4
  import { TaxInvoiceApi } from './tax-invoice-api'
5
- import { TaxInvoiceApiList } from './tax-invoice-api-type'
6
5
 
7
6
  @Resolver(TaxInvoiceApi)
8
7
  export class TaxInvoiceApiQuery {
9
8
  @Query(returns => TaxInvoiceApi!, { nullable: true, description: 'To fetch a Tax Invoice Api' })
10
- async taxInvoiceApi(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {
9
+ async taxInvoiceApi(@Ctx() context: ResolverContext): Promise<TaxInvoiceApi> {
11
10
  const { domain } = context.state
12
11
 
13
12
  return await getRepository(TaxInvoiceApi).findOne({
14
- where: { domain: { id: domain.id }, id }
13
+ where: { domain: { id: domain.id } }
15
14
  })
16
15
  }
17
16
 
18
- @Query(returns => TaxInvoiceApiList, { description: 'To fetch multiple Tax Invoice Api' })
19
- async taxInvoiceApis(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaxInvoiceApiList> {
20
- const { domain } = context.state
21
-
22
- const queryBuilder = getQueryBuilderFromListParams({
23
- domain,
24
- params,
25
- repository: await getRepository(TaxInvoiceApi),
26
- searchables: ['name', 'description']
27
- })
28
-
29
- const [items, total] = await queryBuilder.getManyAndCount()
30
-
31
- return { items, total }
32
- }
33
-
34
17
  @FieldResolver(type => Domain)
35
18
  async domain(@Root() taxInvoiceApi: TaxInvoiceApi): Promise<Domain> {
36
19
  return taxInvoiceApi.domainId && (await getRepository(Domain).findOneBy({ id: taxInvoiceApi.domainId }))
@@ -1,5 +1,6 @@
1
1
  import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
2
  import { TaxInvoiceApi } from './tax-invoice-api'
3
+ import { ScalarObject } from '@things-factory/shell'
3
4
 
4
5
  @InputType()
5
6
  export class TaxInvoiceApiPatch {
@@ -57,6 +58,9 @@ export class TaxInvoiceApiPatch {
57
58
  @Field({ nullable: true })
58
59
  contactCellPhone?: string
59
60
 
61
+ @Field(type => ScalarObject, { nullable: true })
62
+ attributes?: any
63
+
60
64
  @Field({ nullable: true })
61
65
  cuFlag?: string
62
66
  }
@@ -1,23 +1,10 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- OneToOne,
8
- Column,
9
- RelationId,
10
- ManyToOne,
11
- PrimaryGeneratedColumn,
12
- VersionColumn,
13
- JoinColumn
14
- } from 'typeorm'
1
+ import { CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
15
2
  import { ObjectType, Field, ID } from 'type-graphql'
16
3
 
17
4
  import { Domain, ScalarObject, encryptTransformer } from '@things-factory/shell'
18
5
  import { User } from '@things-factory/auth-base'
19
6
 
20
- @Entity()
7
+ @Entity('tax_invoice_api') // api는 한개만 존재해야함.
21
8
  @Index('ix_tax_invoice_api_0', (taxInvoiceApi: TaxInvoiceApi) => [taxInvoiceApi.domain, taxInvoiceApi.name, taxInvoiceApi.deletedAt])
22
9
  @Index('ix_tax_invoice_api_1', (taxInvoiceApi: TaxInvoiceApi) => [taxInvoiceApi.domain, taxInvoiceApi.description, taxInvoiceApi.deletedAt])
23
10
  @ObjectType({ description: 'Entity for Tax Invoice Api' })
@@ -33,6 +20,11 @@ export class TaxInvoiceApi {
33
20
  @RelationId((taxInvoiceApi: TaxInvoiceApi) => taxInvoiceApi.domain)
34
21
  domainId?: string
35
22
 
23
+ // 2개 이상 들어가는 것을 방지하는 플래그
24
+ @Field({ nullable: false })
25
+ @Column({ nullable: false, default: 1, unique: true })
26
+ uniqueSequence!: number
27
+
36
28
  @Field({ nullable: false })
37
29
  @Column({ nullable: false })
38
30
  name!: string
@@ -1,4 +1,4 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
1
+ import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
2
2
  import { Attachment } from '@things-factory/attachment-base'
3
3
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
4
4
  import { User } from '@things-factory/auth-base'
@@ -1,7 +1,4 @@
1
- import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
2
- import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
3
1
  import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
4
-
5
2
  import { TaxInvoiceItem } from './tax-invoice-item'
6
3
 
7
4
  @InputType()
@@ -9,8 +6,8 @@ export class NewTaxInvoiceItem {
9
6
  @Field(type => Int, { nullable: false, description: '아이템 일련번호' })
10
7
  sequence: number
11
8
 
12
- @Field({ nullable: false, description: '공급년월일(YYYYMMDD)' })
13
- supplyDate: string
9
+ @Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })
10
+ supplyDate: Date
14
11
 
15
12
  @Field({ nullable: false, description: '품목명' })
16
13
  itemName: string
@@ -42,8 +39,8 @@ export class TaxInvoiceItemPatch {
42
39
  @Field(type => Int, { nullable: false, description: '아이템 일련번호' })
43
40
  sequence: number
44
41
 
45
- @Field({ nullable: false, description: '공급년월일(YYYYMMDD)' })
46
- supplyDate: string
42
+ @Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })
43
+ supplyDate: Date
47
44
 
48
45
  @Field({ nullable: false, description: '품목명' })
49
46
  itemName: string
@@ -32,9 +32,9 @@ export class TaxInvoiceItem {
32
32
  @Field({ nullable: true, description: '아이템 일련번호' })
33
33
  sequence?: number
34
34
 
35
- @Column({ nullable: false, comment: '공급년월일(YYYYMMDD)' })
36
- @Field({ nullable: false, description: '공급년월일(YYYYMMDD)' })
37
- supplyDate!: string
35
+ @Column({ nullable: false, comment: '공급년월일(YYYY-MM-DD)' })
36
+ @Field({ nullable: false, description: '공급년월일(YYYY-MM-DD)' })
37
+ supplyDate!: Date
38
38
 
39
39
  @Column({ nullable: false, comment: '품목명' })
40
40
  @Field({ nullable: false, description: '품목명' })
@@ -0,0 +1,103 @@
1
+ import { Category } from '../tax-invoice/tax-invoice'
2
+ // import getTestTaxInvoiceData from './test-data'
3
+
4
+ // 세금계산서 조회 API
5
+ const INQUIRY_URL = {
6
+ dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/searchbills',
7
+ prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/searchbills'
8
+ }
9
+ // 세금계산서 조회 후 처리 결과 갱신
10
+ const CONFIRM_URL = {
11
+ dev: 'https://inf1dev.unipost.co.kr:47523/unitax/rest/v3/hometax/updateBills',
12
+ prod: 'https://inf1.unipost.co.kr/unitax/rest/v3/hometax/updateBills'
13
+ }
14
+
15
+ export enum UnipostTaxType {
16
+ EXPORT = 'AR', // 매출
17
+ IMPORT = 'AP' // 매입
18
+ }
19
+
20
+ export interface ConfirmData {
21
+ aid: string
22
+ tax_type: UnipostTaxType
23
+ tid_issueid: string
24
+ success: boolean
25
+ message: string
26
+ }
27
+
28
+ export async function getTaxInvoiceByUniposApi(businessRegistrationNumber: string, aid: string, bearer: string) {
29
+ if (!businessRegistrationNumber || !aid || !bearer) {
30
+ throw new Error('no parameter in unipos api')
31
+ }
32
+
33
+ const approvalNoList: Array<string> = []
34
+ const taxList = []
35
+ const taxTypeArr = [UnipostTaxType.EXPORT, UnipostTaxType.IMPORT]
36
+
37
+ // 매입, 매출 각각 요청
38
+ for (const taxType of taxTypeArr) {
39
+ const response = await _callTaxInvoiceInquiry(businessRegistrationNumber, aid, bearer, taxType)
40
+
41
+ // 성공 일시 세금 계산서 데이터 배열에 추가
42
+ if (response.status === 200) {
43
+ const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT
44
+ const taxData = await response.json()
45
+
46
+ if (taxData.success === true) {
47
+ for (let tax of taxData.tAliceEntry) {
48
+ approvalNoList.push(tax.tid_issueid)
49
+ taxList.push({ ...tax, category })
50
+ }
51
+ }
52
+ }
53
+
54
+ // 테스트 코드
55
+ // const category = taxType === 'AR' ? Category.EXPORT : Category.IMPORT
56
+ // const taxData = getTestTaxInvoiceData(category)
57
+ // if (taxData.success === true) {
58
+ // for (let tax of taxData.tAliceEntry) {
59
+ // approvalNoList.push(tax.tid_issueid)
60
+ // taxList.push({ ...tax, category })
61
+ // }
62
+ // }
63
+ }
64
+
65
+ return {
66
+ approvalNoList,
67
+ taxList
68
+ }
69
+ }
70
+
71
+ async function _callTaxInvoiceInquiry(businessRegistrationNumber: string, aid: string, bearer: string, taxType: UnipostTaxType) {
72
+ const response = await fetch(INQUIRY_URL.dev, {
73
+ method: 'POST',
74
+ headers: {
75
+ 'Content-Type': 'application/json',
76
+ Authorization: 'Basic ' + bearer,
77
+ AID: aid,
78
+ COM_REGNO: businessRegistrationNumber
79
+ },
80
+ body: JSON.stringify({
81
+ aid,
82
+ tax_type: taxType,
83
+ biz_no: businessRegistrationNumber,
84
+ period: 30
85
+ })
86
+ })
87
+
88
+ return response
89
+ }
90
+ export async function callTaxInvoiceConfirm(businessRegistrationNumber: string, aid: string, bearer: string, confirmData: ConfirmData[]) {
91
+ const response = await fetch(CONFIRM_URL.dev, {
92
+ method: 'POST',
93
+ headers: {
94
+ 'Content-Type': 'application/json',
95
+ Authorization: 'Basic ' + bearer,
96
+ AID: aid,
97
+ COM_REGNO: businessRegistrationNumber
98
+ },
99
+ body: JSON.stringify(confirmData)
100
+ })
101
+
102
+ return response
103
+ }
@@ -9,6 +9,8 @@
9
9
  "title.tax invoice matching": "세금계산서 매칭",
10
10
  "title.tax invoice api": "세금계산서 API 설정",
11
11
  "title.tax invoice detail": "전자세금계산서 상세조회",
12
+ "button.memo save": "메모 저장",
13
+ "button.tax invoice send": "발급하기",
12
14
 
13
15
  "text.company supplier": "공급사",
14
16
  "text.company buyer": "거래처",
@@ -16,6 +18,7 @@
16
18
  "text.tax invoice description purpose 01": "영수",
17
19
  "text.tax invoice description purpose 02": "청구",
18
20
 
21
+ "field.memo": "메모",
19
22
  "field.business registration number": "사업자등록번호",
20
23
  "field.short business registration number": "등록번호",
21
24
  "field.branch identification": "종사업장 식별 코드",
@@ -45,8 +48,13 @@
45
48
  "field.total amount": "합계금액",
46
49
  "field.supply amount": "공급가액",
47
50
  "field.tax amount": "세액",
51
+ "field.summary total count": "총 건수",
52
+ "field.summary total amount": "총 합계금액",
53
+ "field.summary supply amount": "총 공급가액",
54
+ "field.summary tax amount": "총 세액",
48
55
  "field.approval no": "승인번호",
49
56
  "field.original approval no": "원 승인번호",
57
+ "field.short invoice type": "전자세금계산서 종류",
50
58
  "field.invoice type": "전자세금계산서 종류",
51
59
  "field.remark0": "비고",
52
60
  "field.remark1": "비고1",
@@ -67,5 +75,6 @@
67
75
  "field.tax invoice payment cash": "현금",
68
76
  "field.tax invoice payment check": "수표",
69
77
  "field.tax invoice payment promissory note": "어음",
70
- "field.tax invoice payment accounts receivable": "외상 미수금"
78
+ "field.tax invoice payment accounts receivable": "외상 미수금",
79
+ "field.tax invoice buyer registration category": "공급받는자 구분"
71
80
  }