@things-factory/tax-invoice 8.0.66 → 8.0.67

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 (30) hide show
  1. package/client/index.ts +10 -0
  2. package/client/pages/tax-invoice-send/company-list-popup.ts +2 -1
  3. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +2 -7
  4. package/client/pages/tax-invoice-send/tax-invoice-send.ts +92 -20
  5. package/dist-client/index.d.ts +1 -0
  6. package/dist-client/index.js +1 -1
  7. package/dist-client/index.js.map +1 -1
  8. package/dist-client/pages/tax-invoice-send/company-list-popup.js +7 -3
  9. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -1
  10. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +2 -7
  11. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  12. package/dist-client/pages/tax-invoice-send/tax-invoice-send.d.ts +1 -0
  13. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js +119 -48
  14. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js.map +1 -1
  15. package/dist-client/tsconfig.tsbuildinfo +1 -1
  16. package/dist-server/service/index.d.ts +2 -2
  17. package/dist-server/service/tax-invoice/tax-invoice-query.js +1 -1
  18. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -1
  19. package/dist-server/service/tax-invoice/tax-invoice.d.ts +1 -0
  20. package/dist-server/service/tax-invoice/tax-invoice.js +5 -0
  21. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  22. package/dist-server/service/tax-invoice-api/index.d.ts +1 -1
  23. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.d.ts +2 -0
  24. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +14 -4
  25. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -1
  26. package/dist-server/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +2 -2
  28. package/server/service/tax-invoice/tax-invoice-query.ts +1 -1
  29. package/server/service/tax-invoice/tax-invoice.ts +4 -0
  30. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +30 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/tax-invoice",
3
- "version": "8.0.66",
3
+ "version": "8.0.67",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -34,5 +34,5 @@
34
34
  "@things-factory/export-ui-excel": "^8.0.64",
35
35
  "@things-factory/shell": "^8.0.64"
36
36
  },
37
- "gitHead": "bad5bd7d03a5c378856ec664d1c5abde15472684"
37
+ "gitHead": "5ee3ee99b0a9d8cbda426bea72610422ec50123b"
38
38
  }
@@ -27,7 +27,7 @@ export class TaxInvoiceQuery {
27
27
  domain,
28
28
  params,
29
29
  repository: await getRepository(TaxInvoice),
30
- searchables: ['memo']
30
+ searchables: ['memo', 'approvalNo', 'issueNo', 'supplierBusinessName', 'buyerBusinessName']
31
31
  })
32
32
  const [items, total] = await queryBuilder.getManyAndCount()
33
33
 
@@ -109,6 +109,10 @@ export class TaxInvoice {
109
109
  @Field({ nullable: true, description: '메모' })
110
110
  memo?: string
111
111
 
112
+ @Column({ nullable: true, comment: '요청 제품 (거래명세표) ID' })
113
+ @Field({ nullable: true, description: '연결된 RequestProduct ID' })
114
+ requestProductId?: string
115
+
112
116
  @Column({ nullable: false, comment: '세금계산서 구분 (매출: 10, 매입: 20, NTS: 30)' })
113
117
  @Field({ nullable: false, description: '세금계산서 구분 (매출: 10, 매입: 20, NTS: 30)' })
114
118
  category!: Category
@@ -58,7 +58,10 @@ export class TaxInvoiceApiMutation {
58
58
 
59
59
  @Directive('@transaction')
60
60
  @Mutation(returns => Boolean, { description: 'To delete multiple Tax Invoice Api' })
61
- async deleteTaxInvoiceApis(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
61
+ async deleteTaxInvoiceApis(
62
+ @Arg('ids', type => [String]) ids: string[],
63
+ @Ctx() context: ResolverContext
64
+ ): Promise<boolean> {
62
65
  const { domain, tx } = context.state
63
66
 
64
67
  await tx.getRepository(TaxInvoiceApi).delete({
@@ -75,12 +78,19 @@ export class TaxInvoiceApiMutation {
75
78
  @Arg('taxInvoiceSendList', type => [TaxInvoiceSend]) taxInvoiceSendList: TaxInvoiceSend[],
76
79
  @Ctx() context: ResolverContext
77
80
  ): Promise<boolean> {
78
- if (taxInvoiceSendList.length === 0) throw new Error('tax invoice send exception: no list')
81
+ await this.issueTaxInvoicesByApi(taxInvoiceSendList, context)
82
+
83
+ return true
84
+ }
85
+
86
+ async issueTaxInvoicesByApi(taxInvoiceSendList: TaxInvoiceSend[], context: ResolverContext): Promise<TaxInvoice[]> {
87
+ if (!taxInvoiceSendList?.length) throw new Error('tax invoice send exception: no list')
79
88
 
80
89
  const { domain, user, tx } = context.state
81
90
  const taxInvoiceRepo = tx.getRepository(TaxInvoice)
82
91
  const taxInvoiceItemRepo = tx.getRepository(TaxInvoiceItem)
83
92
  const taxInvoiceApiRepo = tx.getRepository(TaxInvoiceApi)
93
+ const issuedTaxInvoices: TaxInvoice[] = []
84
94
 
85
95
  const apiInfo = await taxInvoiceApiRepo.findOneBy({ isDefault: true })
86
96
  const businessRegistrationNumber = apiInfo.businessRegistrationNumber
@@ -89,7 +99,9 @@ export class TaxInvoiceApiMutation {
89
99
  let failMessage = []
90
100
 
91
101
  // 1. 밸리데이션 및 데이터 파싱
92
- let newTaxInvoiceSendList = taxInvoiceSendList.map(taxInvoiceSend => this._parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no))
102
+ let newTaxInvoiceSendList = taxInvoiceSendList.map(taxInvoiceSend =>
103
+ this._parseTaxInvoiceSendForApi(taxInvoiceSend, aid, customer_no)
104
+ )
93
105
 
94
106
  // 2. 세금계산서 발행 API 호출
95
107
  const apiResult = await sendTaxInvoiceByUniposApi(businessRegistrationNumber, aid, bearer, newTaxInvoiceSendList)
@@ -101,7 +113,11 @@ export class TaxInvoiceApiMutation {
101
113
  // 3. 성공하면 세금계산서 DB에 저장
102
114
  for (let item of apiResult) {
103
115
  if (item?.success) {
104
- const { taxInvoice, taxInvoiceItems } = parseTaxInvoiceByUnipostFormat(item?.tAliceEntry, item?.tAliceEntry?.tAliceItemList, Category.EXPORT)
116
+ const { taxInvoice, taxInvoiceItems } = parseTaxInvoiceByUnipostFormat(
117
+ item?.tAliceEntry,
118
+ item?.tAliceEntry?.tAliceItemList,
119
+ Category.EXPORT
120
+ )
105
121
 
106
122
  // 세금계산서 저장
107
123
  const newTaxInvoice = await taxInvoiceRepo.save({
@@ -110,6 +126,7 @@ export class TaxInvoiceApiMutation {
110
126
  creator: user,
111
127
  updater: user
112
128
  })
129
+ issuedTaxInvoices.push(newTaxInvoice)
113
130
 
114
131
  // 아이템 저장
115
132
  for (const item of taxInvoiceItems) {
@@ -126,7 +143,7 @@ export class TaxInvoiceApiMutation {
126
143
  throw new Error(failCount + '개의 계산서 등록에 실패하였습니다.\n' + failMessage.join('\n'))
127
144
  }
128
145
 
129
- return true
146
+ return issuedTaxInvoices
130
147
  }
131
148
 
132
149
  // 유니스포트에 받을수 있는 포맷으로 데이터 파싱
@@ -149,7 +166,10 @@ export class TaxInvoiceApiMutation {
149
166
  }
150
167
 
151
168
  // 공급자 사업자 등록번호가 전부 숫자이며 10자리 인지 체크
152
- if (isNaN(taxInvoice.supplierBusinessRegistrationNumber) || taxInvoice.supplierBusinessRegistrationNumber.length !== 10) {
169
+ if (
170
+ isNaN(taxInvoice.supplierBusinessRegistrationNumber) ||
171
+ taxInvoice.supplierBusinessRegistrationNumber.length !== 10
172
+ ) {
153
173
  throw new Error('tax invoice send exception: Supplier Business Registration Number is wrong')
154
174
  }
155
175
 
@@ -165,7 +185,10 @@ export class TaxInvoiceApiMutation {
165
185
 
166
186
  // 현금, 수표, 어음, 외상미수금이 있을시 총 합계금액과 금액 동일 체크
167
187
  const paymentAmount: number =
168
- taxInvoice.paymentAmountCash + taxInvoice.paymentAmountCheck + taxInvoice.paymentAmountPromissoryNote + taxInvoice.paymentAmountAccountsReceivable
188
+ taxInvoice.paymentAmountCash +
189
+ taxInvoice.paymentAmountCheck +
190
+ taxInvoice.paymentAmountPromissoryNote +
191
+ taxInvoice.paymentAmountAccountsReceivable
169
192
  if (paymentAmount > 0 && paymentAmount !== taxInvoice.totalAmount) {
170
193
  throw new Error('tax invoice send exception: summary is not same')
171
194
  }