@hed-hog/finance 0.0.275 → 0.0.278

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 (40) hide show
  1. package/README.md +40 -22
  2. package/dist/dto/create-bank-reconciliation.dto.d.ts +8 -0
  3. package/dist/dto/create-bank-reconciliation.dto.d.ts.map +1 -0
  4. package/dist/dto/create-bank-reconciliation.dto.js +43 -0
  5. package/dist/dto/create-bank-reconciliation.dto.js.map +1 -0
  6. package/dist/finance-data.controller.d.ts +2 -0
  7. package/dist/finance-data.controller.d.ts.map +1 -1
  8. package/dist/finance-statements.controller.d.ts +42 -0
  9. package/dist/finance-statements.controller.d.ts.map +1 -1
  10. package/dist/finance-statements.controller.js +13 -0
  11. package/dist/finance-statements.controller.js.map +1 -1
  12. package/dist/finance.service.d.ts +44 -0
  13. package/dist/finance.service.d.ts.map +1 -1
  14. package/dist/finance.service.js +98 -9
  15. package/dist/finance.service.js.map +1 -1
  16. package/hedhog/data/route.yaml +9 -0
  17. package/hedhog/frontend/app/_components/person-field-with-create.tsx.ejs +126 -126
  18. package/hedhog/frontend/app/accounts-payable/approvals/page.tsx.ejs +373 -373
  19. package/hedhog/frontend/app/accounts-payable/installments/[id]/page.tsx.ejs +1270 -1270
  20. package/hedhog/frontend/app/accounts-receivable/installments/[id]/page.tsx.ejs +982 -982
  21. package/hedhog/frontend/app/cash-and-banks/bank-accounts/page.tsx.ejs +686 -686
  22. package/hedhog/frontend/app/cash-and-banks/bank-reconciliation/page.tsx.ejs +152 -32
  23. package/hedhog/frontend/app/cash-and-banks/statements/page.tsx.ejs +986 -986
  24. package/hedhog/frontend/app/cash-and-banks/transfers/page.tsx.ejs +492 -492
  25. package/hedhog/frontend/app/page.tsx.ejs +372 -372
  26. package/hedhog/frontend/app/planning/cash-flow-forecast/page.tsx.ejs +329 -329
  27. package/hedhog/frontend/app/planning/receivables-calendar/page.tsx.ejs +227 -227
  28. package/hedhog/frontend/app/planning/scenarios/page.tsx.ejs +408 -408
  29. package/hedhog/frontend/messages/en.json +15 -5
  30. package/hedhog/frontend/messages/pt.json +15 -5
  31. package/package.json +5 -5
  32. package/src/dto/create-bank-reconciliation.dto.ts +24 -0
  33. package/src/finance-statements.controller.ts +14 -0
  34. package/src/finance.module.ts +43 -43
  35. package/src/finance.service.ts +118 -0
  36. package/src/index.ts +14 -14
  37. package/dist/finance.controller.d.ts +0 -276
  38. package/dist/finance.controller.d.ts.map +0 -1
  39. package/dist/finance.controller.js +0 -110
  40. package/dist/finance.controller.js.map +0 -1
@@ -1,227 +1,227 @@
1
- 'use client';
2
-
3
- import { Page, PageHeader } from '@/components/entity-list';
4
- import { Badge } from '@/components/ui/badge';
5
- import {
6
- Card,
7
- CardContent,
8
- CardDescription,
9
- CardHeader,
10
- CardTitle,
11
- } from '@/components/ui/card';
12
- import { Money } from '@/components/ui/money';
13
- import {
14
- Table,
15
- TableBody,
16
- TableCell,
17
- TableHead,
18
- TableHeader,
19
- TableRow,
20
- } from '@/components/ui/table';
21
- import { Building2, CalendarDays, CreditCard, Smartphone } from 'lucide-react';
22
- import { useTranslations } from 'next-intl';
23
- import { formatarData } from '../../_lib/formatters';
24
- import { useFinanceData } from '../../_lib/use-finance-data';
25
-
26
- export default function RecebiveisPage() {
27
- const t = useTranslations('finance.ReceivablesCalendarPage');
28
- const { data } = useFinanceData();
29
- const { recebiveis, adquirentes } = data;
30
-
31
- const statusConfig = {
32
- confirmado: {
33
- label: t('status.confirmado'),
34
- className: 'bg-green-100 text-green-700',
35
- },
36
- pendente: {
37
- label: t('status.pendente'),
38
- className: 'bg-yellow-100 text-yellow-700',
39
- },
40
- liquidado: {
41
- label: t('status.liquidado'),
42
- className: 'bg-blue-100 text-blue-700',
43
- },
44
- };
45
-
46
- const totalBruto = recebiveis.reduce((acc, r) => acc + r.bruto, 0);
47
- const totalTaxas = recebiveis.reduce((acc, r) => acc + r.taxas, 0);
48
- const totalLiquido = recebiveis.reduce((acc, r) => acc + r.liquido, 0);
49
- const taxasPercentual =
50
- totalBruto > 0 ? ((totalTaxas / totalBruto) * 100).toFixed(2) : '0.00';
51
-
52
- return (
53
- <Page>
54
- <PageHeader
55
- title={t('header.title')}
56
- description={t('header.description')}
57
- breadcrumbs={[
58
- { label: t('breadcrumbs.home'), href: '/' },
59
- { label: t('breadcrumbs.finance'), href: '/finance' },
60
- { label: t('breadcrumbs.current') },
61
- ]}
62
- />
63
-
64
- <div className="grid gap-4 md:grid-cols-4">
65
- <Card>
66
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
67
- <CardTitle className="text-sm font-medium">
68
- {t('cards.totalGross')}
69
- </CardTitle>
70
- <CalendarDays className="h-4 w-4 text-muted-foreground" />
71
- </CardHeader>
72
- <CardContent>
73
- <div className="text-2xl font-bold">
74
- <Money value={totalBruto} />
75
- </div>
76
- <p className="text-xs text-muted-foreground">
77
- {t('cards.receivablesCount', { count: recebiveis.length })}
78
- </p>
79
- </CardContent>
80
- </Card>
81
- <Card>
82
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
83
- <CardTitle className="text-sm font-medium">
84
- {t('cards.fees')}
85
- </CardTitle>
86
- </CardHeader>
87
- <CardContent>
88
- <div className="text-2xl font-bold text-red-600">
89
- - <Money value={totalTaxas} />
90
- </div>
91
- <p className="text-xs text-muted-foreground">
92
- {t('cards.percentOfGross', {
93
- percent: taxasPercentual,
94
- })}
95
- </p>
96
- </CardContent>
97
- </Card>
98
- <Card>
99
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
100
- <CardTitle className="text-sm font-medium">
101
- {t('cards.totalNet')}
102
- </CardTitle>
103
- </CardHeader>
104
- <CardContent>
105
- <div className="text-2xl font-bold text-green-600">
106
- <Money value={totalLiquido} />
107
- </div>
108
- </CardContent>
109
- </Card>
110
- <Card>
111
- <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
112
- <CardTitle className="text-sm font-medium">
113
- {t('cards.confirmed')}
114
- </CardTitle>
115
- </CardHeader>
116
- <CardContent>
117
- <div className="text-2xl font-bold">
118
- {recebiveis.filter((r) => r.status === 'confirmado').length}
119
- </div>
120
- <p className="text-xs text-muted-foreground">
121
- {t('cards.ofTotal', { total: recebiveis.length })}
122
- </p>
123
- </CardContent>
124
- </Card>
125
- </div>
126
-
127
- <div className="grid gap-6 lg:grid-cols-3">
128
- {adquirentes.map((adquirente) => {
129
- const Icon =
130
- adquirente.nome === 'PagSeguro'
131
- ? Smartphone
132
- : adquirente.nome === 'Cielo'
133
- ? CreditCard
134
- : Building2;
135
- return (
136
- <Card key={adquirente.nome}>
137
- <CardHeader>
138
- <div className="flex items-center gap-3">
139
- <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-muted">
140
- <Icon className="h-5 w-5" />
141
- </div>
142
- <div>
143
- <CardTitle className="text-base">
144
- {adquirente.nome}
145
- </CardTitle>
146
- <CardDescription>
147
- {t('acquirers.transactions', {
148
- count: adquirente.transacoes,
149
- })}
150
- </CardDescription>
151
- </div>
152
- </div>
153
- </CardHeader>
154
- <CardContent>
155
- <div className="text-2xl font-bold">
156
- <Money value={adquirente.total} />
157
- </div>
158
- <p className="text-xs text-muted-foreground">
159
- {t('acquirers.toReceive')}
160
- </p>
161
- </CardContent>
162
- </Card>
163
- );
164
- })}
165
- </div>
166
-
167
- <Card>
168
- <CardHeader>
169
- <CardTitle>{t('table.title')}</CardTitle>
170
- <CardDescription>{t('table.description')}</CardDescription>
171
- </CardHeader>
172
- <CardContent>
173
- <Table>
174
- <TableHeader>
175
- <TableRow>
176
- <TableHead>{t('table.headers.channel')}</TableHead>
177
- <TableHead>{t('table.headers.acquirer')}</TableHead>
178
- <TableHead>{t('table.headers.expectedDate')}</TableHead>
179
- <TableHead className="text-right">
180
- {t('table.headers.gross')}
181
- </TableHead>
182
- <TableHead className="text-right">
183
- {t('table.headers.fees')}
184
- </TableHead>
185
- <TableHead className="text-right">
186
- {t('table.headers.net')}
187
- </TableHead>
188
- <TableHead>{t('table.headers.status')}</TableHead>
189
- </TableRow>
190
- </TableHeader>
191
- <TableBody>
192
- {recebiveis.map((recebivel) => {
193
- const status =
194
- statusConfig[recebivel.status as keyof typeof statusConfig];
195
- return (
196
- <TableRow key={recebivel.id}>
197
- <TableCell className="font-medium">
198
- {recebivel.canal}
199
- </TableCell>
200
- <TableCell>{recebivel.adquirente}</TableCell>
201
- <TableCell>
202
- {formatarData(recebivel.dataPrevista)}
203
- </TableCell>
204
- <TableCell className="text-right">
205
- <Money value={recebivel.bruto} />
206
- </TableCell>
207
- <TableCell className="text-right text-red-600">
208
- - <Money value={recebivel.taxas} />
209
- </TableCell>
210
- <TableCell className="text-right font-semibold">
211
- <Money value={recebivel.liquido} />
212
- </TableCell>
213
- <TableCell>
214
- <Badge className={status.className} variant="outline">
215
- {status.label}
216
- </Badge>
217
- </TableCell>
218
- </TableRow>
219
- );
220
- })}
221
- </TableBody>
222
- </Table>
223
- </CardContent>
224
- </Card>
225
- </Page>
226
- );
227
- }
1
+ 'use client';
2
+
3
+ import { Page, PageHeader } from '@/components/entity-list';
4
+ import { Badge } from '@/components/ui/badge';
5
+ import {
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from '@/components/ui/card';
12
+ import { Money } from '@/components/ui/money';
13
+ import {
14
+ Table,
15
+ TableBody,
16
+ TableCell,
17
+ TableHead,
18
+ TableHeader,
19
+ TableRow,
20
+ } from '@/components/ui/table';
21
+ import { Building2, CalendarDays, CreditCard, Smartphone } from 'lucide-react';
22
+ import { useTranslations } from 'next-intl';
23
+ import { formatarData } from '../../_lib/formatters';
24
+ import { useFinanceData } from '../../_lib/use-finance-data';
25
+
26
+ export default function RecebiveisPage() {
27
+ const t = useTranslations('finance.ReceivablesCalendarPage');
28
+ const { data } = useFinanceData();
29
+ const { recebiveis, adquirentes } = data;
30
+
31
+ const statusConfig = {
32
+ confirmado: {
33
+ label: t('status.confirmado'),
34
+ className: 'bg-green-100 text-green-700',
35
+ },
36
+ pendente: {
37
+ label: t('status.pendente'),
38
+ className: 'bg-yellow-100 text-yellow-700',
39
+ },
40
+ liquidado: {
41
+ label: t('status.liquidado'),
42
+ className: 'bg-blue-100 text-blue-700',
43
+ },
44
+ };
45
+
46
+ const totalBruto = recebiveis.reduce((acc, r) => acc + r.bruto, 0);
47
+ const totalTaxas = recebiveis.reduce((acc, r) => acc + r.taxas, 0);
48
+ const totalLiquido = recebiveis.reduce((acc, r) => acc + r.liquido, 0);
49
+ const taxasPercentual =
50
+ totalBruto > 0 ? ((totalTaxas / totalBruto) * 100).toFixed(2) : '0.00';
51
+
52
+ return (
53
+ <Page>
54
+ <PageHeader
55
+ title={t('header.title')}
56
+ description={t('header.description')}
57
+ breadcrumbs={[
58
+ { label: t('breadcrumbs.home'), href: '/' },
59
+ { label: t('breadcrumbs.finance'), href: '/finance' },
60
+ { label: t('breadcrumbs.current') },
61
+ ]}
62
+ />
63
+
64
+ <div className="grid gap-4 md:grid-cols-4">
65
+ <Card>
66
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
67
+ <CardTitle className="text-sm font-medium">
68
+ {t('cards.totalGross')}
69
+ </CardTitle>
70
+ <CalendarDays className="h-4 w-4 text-muted-foreground" />
71
+ </CardHeader>
72
+ <CardContent>
73
+ <div className="text-2xl font-bold">
74
+ <Money value={totalBruto} />
75
+ </div>
76
+ <p className="text-xs text-muted-foreground">
77
+ {t('cards.receivablesCount', { count: recebiveis.length })}
78
+ </p>
79
+ </CardContent>
80
+ </Card>
81
+ <Card>
82
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
83
+ <CardTitle className="text-sm font-medium">
84
+ {t('cards.fees')}
85
+ </CardTitle>
86
+ </CardHeader>
87
+ <CardContent>
88
+ <div className="text-2xl font-bold text-red-600">
89
+ - <Money value={totalTaxas} />
90
+ </div>
91
+ <p className="text-xs text-muted-foreground">
92
+ {t('cards.percentOfGross', {
93
+ percent: taxasPercentual,
94
+ })}
95
+ </p>
96
+ </CardContent>
97
+ </Card>
98
+ <Card>
99
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
100
+ <CardTitle className="text-sm font-medium">
101
+ {t('cards.totalNet')}
102
+ </CardTitle>
103
+ </CardHeader>
104
+ <CardContent>
105
+ <div className="text-2xl font-bold text-green-600">
106
+ <Money value={totalLiquido} />
107
+ </div>
108
+ </CardContent>
109
+ </Card>
110
+ <Card>
111
+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
112
+ <CardTitle className="text-sm font-medium">
113
+ {t('cards.confirmed')}
114
+ </CardTitle>
115
+ </CardHeader>
116
+ <CardContent>
117
+ <div className="text-2xl font-bold">
118
+ {recebiveis.filter((r) => r.status === 'confirmado').length}
119
+ </div>
120
+ <p className="text-xs text-muted-foreground">
121
+ {t('cards.ofTotal', { total: recebiveis.length })}
122
+ </p>
123
+ </CardContent>
124
+ </Card>
125
+ </div>
126
+
127
+ <div className="grid gap-6 lg:grid-cols-3">
128
+ {adquirentes.map((adquirente) => {
129
+ const Icon =
130
+ adquirente.nome === 'PagSeguro'
131
+ ? Smartphone
132
+ : adquirente.nome === 'Cielo'
133
+ ? CreditCard
134
+ : Building2;
135
+ return (
136
+ <Card key={adquirente.nome}>
137
+ <CardHeader>
138
+ <div className="flex items-center gap-3">
139
+ <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-muted">
140
+ <Icon className="h-5 w-5" />
141
+ </div>
142
+ <div>
143
+ <CardTitle className="text-base">
144
+ {adquirente.nome}
145
+ </CardTitle>
146
+ <CardDescription>
147
+ {t('acquirers.transactions', {
148
+ count: adquirente.transacoes,
149
+ })}
150
+ </CardDescription>
151
+ </div>
152
+ </div>
153
+ </CardHeader>
154
+ <CardContent>
155
+ <div className="text-2xl font-bold">
156
+ <Money value={adquirente.total} />
157
+ </div>
158
+ <p className="text-xs text-muted-foreground">
159
+ {t('acquirers.toReceive')}
160
+ </p>
161
+ </CardContent>
162
+ </Card>
163
+ );
164
+ })}
165
+ </div>
166
+
167
+ <Card>
168
+ <CardHeader>
169
+ <CardTitle>{t('table.title')}</CardTitle>
170
+ <CardDescription>{t('table.description')}</CardDescription>
171
+ </CardHeader>
172
+ <CardContent>
173
+ <Table>
174
+ <TableHeader>
175
+ <TableRow>
176
+ <TableHead>{t('table.headers.channel')}</TableHead>
177
+ <TableHead>{t('table.headers.acquirer')}</TableHead>
178
+ <TableHead>{t('table.headers.expectedDate')}</TableHead>
179
+ <TableHead className="text-right">
180
+ {t('table.headers.gross')}
181
+ </TableHead>
182
+ <TableHead className="text-right">
183
+ {t('table.headers.fees')}
184
+ </TableHead>
185
+ <TableHead className="text-right">
186
+ {t('table.headers.net')}
187
+ </TableHead>
188
+ <TableHead>{t('table.headers.status')}</TableHead>
189
+ </TableRow>
190
+ </TableHeader>
191
+ <TableBody>
192
+ {recebiveis.map((recebivel) => {
193
+ const status =
194
+ statusConfig[recebivel.status as keyof typeof statusConfig];
195
+ return (
196
+ <TableRow key={recebivel.id}>
197
+ <TableCell className="font-medium">
198
+ {recebivel.canal}
199
+ </TableCell>
200
+ <TableCell>{recebivel.adquirente}</TableCell>
201
+ <TableCell>
202
+ {formatarData(recebivel.dataPrevista)}
203
+ </TableCell>
204
+ <TableCell className="text-right">
205
+ <Money value={recebivel.bruto} />
206
+ </TableCell>
207
+ <TableCell className="text-right text-red-600">
208
+ - <Money value={recebivel.taxas} />
209
+ </TableCell>
210
+ <TableCell className="text-right font-semibold">
211
+ <Money value={recebivel.liquido} />
212
+ </TableCell>
213
+ <TableCell>
214
+ <Badge className={status.className} variant="outline">
215
+ {status.label}
216
+ </Badge>
217
+ </TableCell>
218
+ </TableRow>
219
+ );
220
+ })}
221
+ </TableBody>
222
+ </Table>
223
+ </CardContent>
224
+ </Card>
225
+ </Page>
226
+ );
227
+ }