@things-factory/tax-invoice 6.2.147 → 6.2.152

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 (34) hide show
  1. package/client/pages/tax-invoice-send/company-list-popup.ts +3 -0
  2. package/client/pages/tax-invoice-send/tax-invoice-send-page.ts +9 -898
  3. package/client/pages/tax-invoice-send/tax-invoice-send.ts +951 -0
  4. package/dist-client/pages/tax-invoice-send/company-list-popup.d.ts +3 -0
  5. package/dist-client/pages/tax-invoice-send/company-list-popup.js +3 -0
  6. package/dist-client/pages/tax-invoice-send/company-list-popup.js.map +1 -1
  7. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.d.ts +2 -79
  8. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js +8 -796
  9. package/dist-client/pages/tax-invoice-send/tax-invoice-send-page.js.map +1 -1
  10. package/dist-client/pages/tax-invoice-send/tax-invoice-send.d.ts +112 -0
  11. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js +869 -0
  12. package/dist-client/pages/tax-invoice-send/tax-invoice-send.js.map +1 -0
  13. package/dist-client/route.d.ts +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-server/service/index.js +1 -0
  16. package/dist-server/service/index.js.map +1 -1
  17. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +0 -4
  18. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -1
  19. package/dist-server/service/tax-invoice/tax-invoice-query.js +18 -6
  20. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -1
  21. package/dist-server/service/tax-invoice/tax-invoice-type.js +4 -0
  22. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -1
  23. package/dist-server/service/tax-invoice/tax-invoice-util.js +1 -0
  24. package/dist-server/service/tax-invoice/tax-invoice-util.js.map +1 -1
  25. package/dist-server/service/tax-invoice/tax-invoice.js +5 -0
  26. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -1
  27. package/dist-server/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +3 -3
  29. package/server/service/index.ts +1 -0
  30. package/server/service/tax-invoice/tax-invoice-mutation.ts +0 -3
  31. package/server/service/tax-invoice/tax-invoice-query.ts +19 -7
  32. package/server/service/tax-invoice/tax-invoice-type.ts +3 -0
  33. package/server/service/tax-invoice/tax-invoice-util.ts +1 -0
  34. package/server/service/tax-invoice/tax-invoice.ts +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/tax-invoice",
3
- "version": "6.2.147",
3
+ "version": "6.2.152",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@operato/graphql": "^1.0.0",
31
31
  "@operato/shell": "^1.0.0",
32
- "@things-factory/auth-base": "^6.2.147",
32
+ "@things-factory/auth-base": "^6.2.152",
33
33
  "@things-factory/env": "^6.2.139",
34
34
  "@things-factory/export-ui-excel": "^6.2.147",
35
35
  "@things-factory/shell": "^6.2.147"
36
36
  },
37
- "gitHead": "4b93b26f0edfea36d6273d1caf736477a5e2ceed"
37
+ "gitHead": "07e71fb59347f6dd06372f2bcfbce84f63601f5e"
38
38
  }
@@ -2,6 +2,7 @@
2
2
  export * from './tax-audit-result/tax-audit-result'
3
3
  export * from './tax-invoice-item/tax-invoice-item'
4
4
  export * from './tax-invoice/tax-invoice'
5
+ export * from './tax-invoice-company/tax-invoice-company'
5
6
 
6
7
  /* IMPORT ENTITIES AND RESOLVERS */
7
8
  import { entities as TaxAuditResultEntities, resolvers as TaxAuditResultResolvers, subscribers as TaxAuditResultSubscribers } from './tax-audit-result'
@@ -135,7 +135,4 @@ export class TaxInvoiceMutation {
135
135
 
136
136
  return true
137
137
  }
138
-
139
- // YYYYMMDD => YYYY-MM-DD
140
- private _dateFormat = date => date.replace(/(\d{4})(\d{2})(\d{2})/g, '$1-$2-$3')
141
138
  }
@@ -1,7 +1,7 @@
1
1
  import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
2
2
  import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
3
  import { User } from '@things-factory/auth-base'
4
- import { TaxInvoice } from './tax-invoice'
4
+ import { Category, Purpose, TaxInvoice } from './tax-invoice'
5
5
  import { TaxInvoiceList, TaxInvoiceSummary } from './tax-invoice-type'
6
6
  import { TaxInvoiceItem } from '../tax-invoice-item/tax-invoice-item'
7
7
 
@@ -34,18 +34,30 @@ export class TaxInvoiceQuery {
34
34
  @Query(returns => TaxInvoiceSummary, { description: 'To fetch TaxInvoices Summary' })
35
35
  async taxInvoicesSummary(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaxInvoiceSummary> {
36
36
  const { domain } = context.state
37
+ let category = params.filters.filter(v => v.name === 'category')?.[0]?.value
37
38
 
38
39
  const queryBuilder = getQueryBuilderFromListParams({
39
40
  domain,
40
41
  params: { ...params, pagination: {} },
41
42
  repository: await getRepository(TaxInvoice)
42
43
  })
43
- const summary = await queryBuilder
44
- .select('SUM(supply_amount)', 'supply_amount')
45
- .addSelect('SUM(tax_amount)', 'tax_amount')
46
- .addSelect('SUM(total_amount)', 'total_amount')
47
- .addSelect('COUNT(id)', 'cnt')
48
- .getRawOne()
44
+
45
+ // 매입/매출이 있으면 그냥 가격으로 표시, 전체 조회면 매출-매입 으로 계산
46
+ if (category) {
47
+ queryBuilder
48
+ .select('COUNT(id)', 'cnt')
49
+ .addSelect('SUM(supply_amount)', 'supply_amount')
50
+ .addSelect('SUM(tax_amount)', 'tax_amount')
51
+ .addSelect('SUM(total_amount)', 'total_amount')
52
+ } else {
53
+ queryBuilder
54
+ .select('COUNT(id)', 'cnt')
55
+ .addSelect(`SUM(CASE WHEN category = \'${Category.EXPORT}\' THEN supply_amount ELSE -1 * supply_amount END)`, 'supply_amount')
56
+ .addSelect(`SUM(CASE WHEN category = \'${Category.EXPORT}\' THEN tax_amount ELSE -1 * tax_amount END)`, 'tax_amount')
57
+ .addSelect(`SUM(CASE WHEN category = \'${Category.EXPORT}\' THEN total_amount ELSE -1 * total_amount END)`, 'total_amount')
58
+ }
59
+
60
+ const summary = await queryBuilder.getRawOne()
49
61
 
50
62
  return { summary }
51
63
  }
@@ -46,6 +46,9 @@ export class NewTaxInvoice {
46
46
  @Field({ nullable: true })
47
47
  remark2?: string
48
48
 
49
+ @Field({ nullable: true })
50
+ isSentByApi?: boolean
51
+
49
52
  @Field({ nullable: true })
50
53
  supplierBusinessRegistrationCategory: BusinessRegistrationCategory
51
54
 
@@ -150,6 +150,7 @@ export function parseTaxInvoiceByUnipostFormat(unipostTaxInvoice: UnipostTaxInvo
150
150
  remark0: unipostTaxInvoice.tid_desc0,
151
151
  remark1: unipostTaxInvoice.tid_desc1,
152
152
  remark2: unipostTaxInvoice.tid_desc2,
153
+ isSentByApi: true,
153
154
  category: category,
154
155
  supplierBusinessRegistrationCategory: unipostTaxInvoice.tit_alice_specorg_biztypecode,
155
156
  supplierBusinessRegistrationNumber: unipostTaxInvoice.tit_alice_id,
@@ -146,6 +146,10 @@ export class TaxInvoice {
146
146
  @Field({ nullable: true, description: '비고2' })
147
147
  remark2?: string
148
148
 
149
+ @Column({ nullable: true, default: false, comment: 'API를 통한 발행 여부' })
150
+ @Field({ nullable: true, description: 'API를 통한 발행 여부' })
151
+ isSentByApi?: boolean
152
+
149
153
  @Column({ nullable: true, comment: '공급자 사업자등록번호 구분 코드' })
150
154
  @Field({ nullable: true, description: '공급자 사업자등록번호 구분 코드' })
151
155
  supplierBusinessRegistrationCategory?: BusinessRegistrationCategory