@hed-hog/finance 0.0.253 → 0.0.256
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.
- package/dist/finance-installments.controller.d.ts +66 -2
- package/dist/finance-installments.controller.d.ts.map +1 -1
- package/dist/finance.service.d.ts +66 -2
- package/dist/finance.service.d.ts.map +1 -1
- package/dist/finance.service.js +63 -7
- package/dist/finance.service.js.map +1 -1
- package/hedhog/frontend/app/_components/finance-entity-field-with-create.tsx.ejs +572 -0
- package/hedhog/frontend/app/_components/finance-title-actions-menu.tsx.ejs +244 -0
- package/hedhog/frontend/app/_components/person-field-with-create.tsx.ejs +143 -51
- package/hedhog/frontend/app/_lib/title-action-rules.ts.ejs +36 -0
- package/hedhog/frontend/app/accounts-payable/installments/[id]/page.tsx.ejs +189 -242
- package/hedhog/frontend/app/accounts-payable/installments/page.tsx.ejs +1189 -545
- package/hedhog/frontend/app/accounts-receivable/installments/[id]/page.tsx.ejs +176 -133
- package/hedhog/frontend/app/accounts-receivable/installments/page.tsx.ejs +1459 -312
- package/hedhog/frontend/app/page.tsx.ejs +15 -4
- package/hedhog/frontend/messages/en.json +294 -5
- package/hedhog/frontend/messages/pt.json +294 -5
- package/package.json +5 -5
- package/src/finance.service.ts +85 -10
|
@@ -99,11 +99,114 @@
|
|
|
99
99
|
"description": "Não há aprovações pendentes."
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
|
+
"PersonFieldWithCreate": {
|
|
103
|
+
"sheet": {
|
|
104
|
+
"title": "Novo {entityLabel}",
|
|
105
|
+
"description": "Apenas nome e tipo são obrigatórios. Você pode completar os demais dados agora ou depois."
|
|
106
|
+
},
|
|
107
|
+
"common": {
|
|
108
|
+
"select": "Selecione"
|
|
109
|
+
},
|
|
110
|
+
"types": {
|
|
111
|
+
"individual": "Pessoa Física",
|
|
112
|
+
"company": "Pessoa Jurídica"
|
|
113
|
+
},
|
|
114
|
+
"fields": {
|
|
115
|
+
"name": "Nome",
|
|
116
|
+
"type": "Tipo",
|
|
117
|
+
"documentIndividualOptional": "CPF (opcional)",
|
|
118
|
+
"documentCompanyOptional": "CNPJ (opcional)",
|
|
119
|
+
"emailOptional": "E-mail (opcional)",
|
|
120
|
+
"phoneOptional": "Telefone (opcional)",
|
|
121
|
+
"addressOptional": "Endereço (opcional)"
|
|
122
|
+
},
|
|
123
|
+
"placeholders": {
|
|
124
|
+
"name": "Nome do {entityLabel}",
|
|
125
|
+
"email": "{entityLabel}@empresa.com",
|
|
126
|
+
"phone": "(11) 99999-9999",
|
|
127
|
+
"addressLine1": "Rua, número, complemento",
|
|
128
|
+
"city": "Cidade",
|
|
129
|
+
"state": "UF"
|
|
130
|
+
},
|
|
131
|
+
"search": {
|
|
132
|
+
"placeholder": "Digite para buscar pessoa...",
|
|
133
|
+
"loading": "Buscando pessoas...",
|
|
134
|
+
"noResults": "Nenhuma pessoa encontrada"
|
|
135
|
+
},
|
|
136
|
+
"actions": {
|
|
137
|
+
"cancel": "Cancelar",
|
|
138
|
+
"saveEntity": "Salvar {entityLabel}",
|
|
139
|
+
"createNew": "Criar novo cadastro",
|
|
140
|
+
"clearSelection": "Limpar seleção",
|
|
141
|
+
"createEntityAria": "Criar novo {entityLabel}"
|
|
142
|
+
},
|
|
143
|
+
"messages": {
|
|
144
|
+
"createdSuccess": "{entityLabel} criado com sucesso",
|
|
145
|
+
"createdError": "Não foi possível criar {entityLabel}"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"FinanceEntityFieldWithCreate": {
|
|
149
|
+
"validation": {
|
|
150
|
+
"nameRequired": "Nome é obrigatório"
|
|
151
|
+
},
|
|
152
|
+
"fields": {
|
|
153
|
+
"name": "Nome"
|
|
154
|
+
},
|
|
155
|
+
"actions": {
|
|
156
|
+
"cancel": "Cancelar",
|
|
157
|
+
"save": "Salvar",
|
|
158
|
+
"createCategoryAria": "Criar nova categoria",
|
|
159
|
+
"createCostCenterAria": "Criar novo centro de custo"
|
|
160
|
+
},
|
|
161
|
+
"categorySheet": {
|
|
162
|
+
"title": "Nova categoria",
|
|
163
|
+
"description": "Cadastre uma nova categoria para usar neste lançamento.",
|
|
164
|
+
"namePlaceholder": "Nome da categoria"
|
|
165
|
+
},
|
|
166
|
+
"costCenterSheet": {
|
|
167
|
+
"title": "Novo centro de custo",
|
|
168
|
+
"description": "Cadastre um novo centro de custo para usar neste lançamento.",
|
|
169
|
+
"namePlaceholder": "Nome do centro de custo"
|
|
170
|
+
},
|
|
171
|
+
"messages": {
|
|
172
|
+
"categoryCreateSuccess": "Categoria criada com sucesso",
|
|
173
|
+
"categoryCreateError": "Não foi possível criar categoria",
|
|
174
|
+
"costCenterCreateSuccess": "Centro de custo criado com sucesso",
|
|
175
|
+
"costCenterCreateError": "Não foi possível criar centro de custo"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
102
178
|
"PayableInstallmentsPage": {
|
|
103
179
|
"common": {
|
|
104
180
|
"select": "Selecione...",
|
|
105
181
|
"cancel": "Cancelar",
|
|
106
|
-
"save": "Salvar"
|
|
182
|
+
"save": "Salvar",
|
|
183
|
+
"upload": {
|
|
184
|
+
"label": "Arquivo da fatura (opcional)",
|
|
185
|
+
"upload": "Upload",
|
|
186
|
+
"change": "Trocar arquivo",
|
|
187
|
+
"remove": "Remover",
|
|
188
|
+
"selectedPrefix": "Arquivo:",
|
|
189
|
+
"uploadingProgress": "Upload em andamento: {progress}%",
|
|
190
|
+
"processingAi": "Analisando documento com IA",
|
|
191
|
+
"lowConfidence": "Confiança da extração: {confidence}%",
|
|
192
|
+
"fillingWithAi": "Preenchendo com IA...",
|
|
193
|
+
"uploadingFile": "Enviando arquivo..."
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"validation": {
|
|
197
|
+
"documentRequired": "Documento é obrigatório",
|
|
198
|
+
"supplierRequired": "Fornecedor é obrigatório",
|
|
199
|
+
"dueDateRequired": "Vencimento é obrigatório",
|
|
200
|
+
"amountGreaterThanZero": "Valor deve ser maior que zero",
|
|
201
|
+
"invalidInstallmentCount": "Quantidade de parcelas inválida",
|
|
202
|
+
"installmentsMin": "Mínimo de 1 parcela",
|
|
203
|
+
"installmentsMax": "Máximo de 120 parcelas",
|
|
204
|
+
"installmentDueDateRequired": "Vencimento da parcela é obrigatório",
|
|
205
|
+
"installmentAmountGreaterThanZero": "Valor da parcela deve ser maior que zero",
|
|
206
|
+
"installmentsRequired": "Informe ao menos uma parcela",
|
|
207
|
+
"installmentsCountMismatch": "Quantidade de parcelas não confere com o detalhamento",
|
|
208
|
+
"installmentsSumMismatch": "A soma das parcelas deve ser igual ao valor total",
|
|
209
|
+
"installmentRequired": "Parcela obrigatória"
|
|
107
210
|
},
|
|
108
211
|
"newTitle": {
|
|
109
212
|
"action": "Novo Título",
|
|
@@ -169,9 +272,75 @@
|
|
|
169
272
|
"approve": "Aprovar",
|
|
170
273
|
"settle": "Baixar",
|
|
171
274
|
"reverse": "Estornar",
|
|
172
|
-
"cancel": "Cancelar"
|
|
275
|
+
"cancel": "Cancelar",
|
|
276
|
+
"openAttachment": "Abrir anexo"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
"dialogs": {
|
|
280
|
+
"cancel": {
|
|
281
|
+
"title": "Confirmar cancelamento",
|
|
282
|
+
"description": "Esta ação cancela o título e não pode ser desfeita automaticamente.",
|
|
283
|
+
"cancel": "Voltar",
|
|
284
|
+
"confirm": "Confirmar cancelamento"
|
|
285
|
+
},
|
|
286
|
+
"reverse": {
|
|
287
|
+
"title": "Confirmar estorno",
|
|
288
|
+
"description": "Informe o motivo do estorno. O sistema recalculará os saldos e status automaticamente.",
|
|
289
|
+
"reasonLabel": "Motivo do estorno",
|
|
290
|
+
"reasonPlaceholder": "Ex.: baixa duplicada",
|
|
291
|
+
"cancel": "Voltar",
|
|
292
|
+
"confirm": "Confirmar estorno"
|
|
173
293
|
}
|
|
174
294
|
},
|
|
295
|
+
"settleSheet": {
|
|
296
|
+
"title": "Registrar baixa",
|
|
297
|
+
"description": "Informe a parcela e o valor da baixa para o título {document}.",
|
|
298
|
+
"installmentLabel": "Parcela",
|
|
299
|
+
"installmentPlaceholder": "Selecione",
|
|
300
|
+
"installmentOption": "Parcela {number} - em aberto: {amount}",
|
|
301
|
+
"amountLabel": "Valor",
|
|
302
|
+
"descriptionLabel": "Descrição (opcional)",
|
|
303
|
+
"confirm": "Confirmar baixa"
|
|
304
|
+
},
|
|
305
|
+
"installmentsEditor": {
|
|
306
|
+
"title": "Parcelas",
|
|
307
|
+
"countLabel": "Quantidade de Parcelas",
|
|
308
|
+
"recalculate": "Recalcular automaticamente",
|
|
309
|
+
"autoRedistributeLabel": "Redistribuir automaticamente o restante ao editar parcela",
|
|
310
|
+
"autoRedistributeHint": "A redistribuição ocorre ao parar de digitar e ao sair do campo.",
|
|
311
|
+
"dueDateLabel": "Vencimento",
|
|
312
|
+
"amountLabel": "Valor",
|
|
313
|
+
"totalPrefix": "Soma das parcelas: {total}",
|
|
314
|
+
"adjustmentNeeded": "(ajuste necessário)"
|
|
315
|
+
},
|
|
316
|
+
"editTitle": {
|
|
317
|
+
"description": "Edite os dados do título enquanto estiver em rascunho."
|
|
318
|
+
},
|
|
319
|
+
"messages": {
|
|
320
|
+
"createSuccess": "Título criado com sucesso",
|
|
321
|
+
"createError": "Erro ao criar título",
|
|
322
|
+
"invalidFile": "Arquivo inválido",
|
|
323
|
+
"attachSuccess": "Arquivo relacionado com sucesso",
|
|
324
|
+
"aiExtractSuccess": "Dados da fatura extraídos e preenchidos automaticamente",
|
|
325
|
+
"aiExtractError": "Não foi possível extrair os dados automaticamente",
|
|
326
|
+
"uploadError": "Não foi possível enviar o arquivo",
|
|
327
|
+
"invalidTitleForEdit": "Título inválido para edição",
|
|
328
|
+
"updateSuccess": "Título atualizado com sucesso",
|
|
329
|
+
"updateError": "Não foi possível atualizar o título",
|
|
330
|
+
"editDraftOnly": "Apenas títulos em rascunho podem ser editados",
|
|
331
|
+
"cancelSuccess": "Título cancelado com sucesso",
|
|
332
|
+
"cancelError": "Não foi possível cancelar o título",
|
|
333
|
+
"approveSuccess": "Título aprovado com sucesso",
|
|
334
|
+
"approveError": "Não foi possível aprovar o título",
|
|
335
|
+
"noInstallmentForSettle": "Nenhuma parcela disponível para baixa",
|
|
336
|
+
"settleSuccess": "Baixa registrada com sucesso",
|
|
337
|
+
"settleError": "Não foi possível registrar a baixa",
|
|
338
|
+
"noActiveSettlementToReverse": "Nenhuma liquidação ativa para estornar",
|
|
339
|
+
"reverseDefaultReason": "Estorno realizado pela listagem de títulos",
|
|
340
|
+
"reverseSuccess": "Estorno realizado com sucesso",
|
|
341
|
+
"reverseError": "Não foi possível estornar a liquidação",
|
|
342
|
+
"openAttachmentError": "Não foi possível abrir o anexo"
|
|
343
|
+
},
|
|
175
344
|
"footer": {
|
|
176
345
|
"showing": "Mostrando {filtered} de {total} registros",
|
|
177
346
|
"previous": "Anterior",
|
|
@@ -212,6 +381,8 @@
|
|
|
212
381
|
"reverse": {
|
|
213
382
|
"title": "Confirmar estorno",
|
|
214
383
|
"description": "Esta ação estorna a liquidação selecionada, recalcula os saldos das parcelas e atualiza o status do título.",
|
|
384
|
+
"reasonLabel": "Motivo do estorno",
|
|
385
|
+
"reasonPlaceholder": "Ex.: baixa duplicada",
|
|
215
386
|
"cancel": "Cancelar",
|
|
216
387
|
"confirm": "Confirmar estorno"
|
|
217
388
|
}
|
|
@@ -234,7 +405,9 @@
|
|
|
234
405
|
"reverseSuccess": "Estorno realizado com sucesso",
|
|
235
406
|
"reverseError": "Não foi possível estornar a liquidação",
|
|
236
407
|
"cancelSuccess": "Título cancelado com sucesso",
|
|
237
|
-
"cancelError": "Não foi possível cancelar o título"
|
|
408
|
+
"cancelError": "Não foi possível cancelar o título",
|
|
409
|
+
"unreconcileSuccess": "Conciliação removida com sucesso",
|
|
410
|
+
"unreconcileError": "Não foi possível desconciliar a liquidação"
|
|
238
411
|
},
|
|
239
412
|
"documentData": {
|
|
240
413
|
"title": "Dados do Documento",
|
|
@@ -300,6 +473,32 @@
|
|
|
300
473
|
"reverseDialogConfirm": "Confirmar estorno",
|
|
301
474
|
"none": "Nenhuma liquidação registrada"
|
|
302
475
|
},
|
|
476
|
+
"settlementsHistory": {
|
|
477
|
+
"loading": "Carregando histórico de liquidações...",
|
|
478
|
+
"allocationsTitle": "Rateios",
|
|
479
|
+
"allocationInstallment": "Parcela",
|
|
480
|
+
"headers": {
|
|
481
|
+
"date": "Data",
|
|
482
|
+
"type": "Tipo",
|
|
483
|
+
"status": "Status",
|
|
484
|
+
"netAmount": "Valor Líquido",
|
|
485
|
+
"method": "Método",
|
|
486
|
+
"account": "Conta",
|
|
487
|
+
"reconciled": "Conciliação",
|
|
488
|
+
"actions": "Ações"
|
|
489
|
+
},
|
|
490
|
+
"normalType": "NORMAL",
|
|
491
|
+
"reversalType": "REVERSAL",
|
|
492
|
+
"reversedStatus": "ESTORNO",
|
|
493
|
+
"reconciled": {
|
|
494
|
+
"yes": "Conciliado",
|
|
495
|
+
"no": "Pendente"
|
|
496
|
+
},
|
|
497
|
+
"unreconcile": "Desconciliar",
|
|
498
|
+
"unreconcileLoading": "Desconciliando...",
|
|
499
|
+
"unreconcileFirst": "Desconciliar primeiro",
|
|
500
|
+
"reverse": "Estornar"
|
|
501
|
+
},
|
|
303
502
|
"audit": { "none": "Nenhum evento de auditoria" }
|
|
304
503
|
},
|
|
305
504
|
"CollectionsDefaultPage": {
|
|
@@ -376,7 +575,33 @@
|
|
|
376
575
|
"common": {
|
|
377
576
|
"select": "Selecione...",
|
|
378
577
|
"cancel": "Cancelar",
|
|
379
|
-
"save": "Salvar"
|
|
578
|
+
"save": "Salvar",
|
|
579
|
+
"upload": {
|
|
580
|
+
"label": "Arquivo da fatura (opcional)",
|
|
581
|
+
"upload": "Upload",
|
|
582
|
+
"change": "Trocar arquivo",
|
|
583
|
+
"remove": "Remover",
|
|
584
|
+
"selectedPrefix": "Arquivo:",
|
|
585
|
+
"uploadingProgress": "Upload em andamento: {progress}%",
|
|
586
|
+
"processingAi": "Analisando documento com IA",
|
|
587
|
+
"lowConfidence": "Confiança da extração: {confidence}%",
|
|
588
|
+
"fillingWithAi": "Preenchendo com IA...",
|
|
589
|
+
"uploadingFile": "Enviando arquivo..."
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
"validation": {
|
|
593
|
+
"documentRequired": "Documento é obrigatório",
|
|
594
|
+
"clientRequired": "Cliente é obrigatório",
|
|
595
|
+
"dueDateRequired": "Vencimento é obrigatório",
|
|
596
|
+
"amountGreaterThanZero": "Valor deve ser maior que zero",
|
|
597
|
+
"invalidInstallmentCount": "Quantidade de parcelas inválida",
|
|
598
|
+
"installmentsMin": "Mínimo de 1 parcela",
|
|
599
|
+
"installmentsMax": "Máximo de 120 parcelas",
|
|
600
|
+
"installmentDueDateRequired": "Vencimento da parcela é obrigatório",
|
|
601
|
+
"installmentAmountGreaterThanZero": "Valor da parcela deve ser maior que zero",
|
|
602
|
+
"installmentsRequired": "Informe ao menos uma parcela",
|
|
603
|
+
"installmentsCountMismatch": "Quantidade de parcelas não confere com o detalhamento",
|
|
604
|
+
"installmentsSumMismatch": "A soma das parcelas deve ser igual ao valor total"
|
|
380
605
|
},
|
|
381
606
|
"newTitle": {
|
|
382
607
|
"action": "Novo Título",
|
|
@@ -436,9 +661,37 @@
|
|
|
436
661
|
"viewDetails": "Ver Detalhes",
|
|
437
662
|
"edit": "Editar",
|
|
438
663
|
"registerReceipt": "Registrar Recebimento",
|
|
439
|
-
"sendCollection": "Enviar Cobrança"
|
|
664
|
+
"sendCollection": "Enviar Cobrança",
|
|
665
|
+
"openAttachment": "Abrir anexo"
|
|
440
666
|
}
|
|
441
667
|
},
|
|
668
|
+
"installmentsEditor": {
|
|
669
|
+
"title": "Parcelas",
|
|
670
|
+
"countLabel": "Quantidade de Parcelas",
|
|
671
|
+
"recalculate": "Recalcular automaticamente",
|
|
672
|
+
"autoRedistributeLabel": "Redistribuir automaticamente o restante ao editar parcela",
|
|
673
|
+
"dueDateLabel": "Vencimento",
|
|
674
|
+
"amountLabel": "Valor",
|
|
675
|
+
"totalPrefix": "Soma das parcelas: {total}",
|
|
676
|
+
"adjustmentNeeded": "(ajuste necessário)"
|
|
677
|
+
},
|
|
678
|
+
"editTitle": {
|
|
679
|
+
"description": "Edite os dados do título enquanto estiver em rascunho."
|
|
680
|
+
},
|
|
681
|
+
"messages": {
|
|
682
|
+
"createSuccess": "Título criado com sucesso",
|
|
683
|
+
"createError": "Erro ao criar título",
|
|
684
|
+
"invalidFile": "Arquivo inválido",
|
|
685
|
+
"attachSuccess": "Arquivo relacionado com sucesso",
|
|
686
|
+
"aiExtractSuccess": "Dados da fatura extraídos e preenchidos automaticamente",
|
|
687
|
+
"aiExtractError": "Não foi possível extrair os dados automaticamente",
|
|
688
|
+
"uploadError": "Não foi possível enviar o arquivo",
|
|
689
|
+
"invalidTitleForEdit": "Título inválido para edição",
|
|
690
|
+
"updateSuccess": "Título atualizado com sucesso",
|
|
691
|
+
"updateError": "Não foi possível atualizar o título",
|
|
692
|
+
"editDraftOnly": "Apenas títulos em rascunho podem ser editados",
|
|
693
|
+
"openAttachmentError": "Não foi possível abrir o anexo"
|
|
694
|
+
},
|
|
442
695
|
"footer": {
|
|
443
696
|
"showing": "Mostrando {filtered} de {total} registros",
|
|
444
697
|
"previous": "Anterior",
|
|
@@ -465,9 +718,43 @@
|
|
|
465
718
|
"actions": {
|
|
466
719
|
"title": "Ações",
|
|
467
720
|
"edit": "Editar",
|
|
721
|
+
"approve": "Aprovar",
|
|
468
722
|
"registerReceipt": "Registrar Recebimento",
|
|
469
723
|
"sendCollection": "Enviar Cobrança"
|
|
470
724
|
},
|
|
725
|
+
"common": {
|
|
726
|
+
"cancel": "Cancelar"
|
|
727
|
+
},
|
|
728
|
+
"validation": {
|
|
729
|
+
"installmentRequired": "Parcela obrigatória",
|
|
730
|
+
"amountGreaterThanZero": "Valor deve ser maior que zero"
|
|
731
|
+
},
|
|
732
|
+
"settleSheet": {
|
|
733
|
+
"title": "Registrar recebimento",
|
|
734
|
+
"description": "Informe a parcela e o valor para baixa parcial ou total.",
|
|
735
|
+
"installmentLabel": "Parcela",
|
|
736
|
+
"installmentPlaceholder": "Selecione",
|
|
737
|
+
"installmentOption": "Parcela {number} - em aberto: {amount}",
|
|
738
|
+
"amountLabel": "Valor",
|
|
739
|
+
"descriptionLabel": "Descrição (opcional)",
|
|
740
|
+
"confirm": "Confirmar recebimento"
|
|
741
|
+
},
|
|
742
|
+
"reverseSheet": {
|
|
743
|
+
"title": "Confirmar estorno",
|
|
744
|
+
"description": "Esta ação estorna o recebimento e recalcula saldos e status.",
|
|
745
|
+
"reasonLabel": "Motivo do estorno",
|
|
746
|
+
"reasonPlaceholder": "Ex.: baixa duplicada",
|
|
747
|
+
"confirm": "Confirmar estorno"
|
|
748
|
+
},
|
|
749
|
+
"messages": {
|
|
750
|
+
"approveSuccess": "Título aprovado com sucesso",
|
|
751
|
+
"approveError": "Não foi possível aprovar o título",
|
|
752
|
+
"settleSuccess": "Recebimento registrado com sucesso",
|
|
753
|
+
"settleError": "Não foi possível registrar o recebimento",
|
|
754
|
+
"reverseSuccess": "Estorno realizado com sucesso",
|
|
755
|
+
"reverseError": "Não foi possível estornar o recebimento",
|
|
756
|
+
"reverseDefaultReason": "Estorno realizado no detalhe do título"
|
|
757
|
+
},
|
|
471
758
|
"documentData": {
|
|
472
759
|
"title": "Dados do Documento",
|
|
473
760
|
"client": "Cliente",
|
|
@@ -521,6 +808,8 @@
|
|
|
521
808
|
"discount": "Desconto",
|
|
522
809
|
"account": "Conta",
|
|
523
810
|
"method": "Método",
|
|
811
|
+
"actions": "Ações",
|
|
812
|
+
"reverseButton": "Estornar",
|
|
524
813
|
"none": "Nenhum recebimento registrado"
|
|
525
814
|
},
|
|
526
815
|
"audit": { "none": "Nenhum evento de auditoria" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hed-hog/finance",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.256",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"@nestjs/jwt": "^11",
|
|
11
11
|
"@nestjs/mapped-types": "*",
|
|
12
12
|
"@hed-hog/api-pagination": "0.0.5",
|
|
13
|
-
"@hed-hog/contact": "0.0.251",
|
|
14
|
-
"@hed-hog/tag": "0.0.251",
|
|
15
13
|
"@hed-hog/api-locale": "0.0.11",
|
|
14
|
+
"@hed-hog/contact": "0.0.254",
|
|
16
15
|
"@hed-hog/api-prisma": "0.0.4",
|
|
17
|
-
"@hed-hog/
|
|
16
|
+
"@hed-hog/tag": "0.0.254",
|
|
18
17
|
"@hed-hog/api": "0.0.3",
|
|
19
|
-
"@hed-hog/core": "0.0.
|
|
18
|
+
"@hed-hog/core": "0.0.254",
|
|
19
|
+
"@hed-hog/api-types": "0.0.1"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
package/src/finance.service.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getLocaleText } from '@hed-hog/api-locale';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
PageOrderDirection,
|
|
4
|
+
PaginationDTO,
|
|
5
|
+
PaginationService,
|
|
6
|
+
} from '@hed-hog/api-pagination';
|
|
3
7
|
import { PrismaService } from '@hed-hog/api-prisma';
|
|
4
8
|
import { AiService, FileService } from '@hed-hog/core';
|
|
5
9
|
import {
|
|
@@ -2399,6 +2403,7 @@ export class FinanceService {
|
|
|
2399
2403
|
status?: string,
|
|
2400
2404
|
) {
|
|
2401
2405
|
const prismaStatus = this.mapStatusFromPt(status);
|
|
2406
|
+
const search = paginationParams?.search?.trim();
|
|
2402
2407
|
const where: any = {
|
|
2403
2408
|
title_type: titleType,
|
|
2404
2409
|
};
|
|
@@ -2407,15 +2412,45 @@ export class FinanceService {
|
|
|
2407
2412
|
where.status = prismaStatus;
|
|
2408
2413
|
}
|
|
2409
2414
|
|
|
2410
|
-
|
|
2415
|
+
if (search) {
|
|
2416
|
+
where.OR = [
|
|
2417
|
+
{
|
|
2418
|
+
document_number: {
|
|
2419
|
+
contains: search,
|
|
2420
|
+
mode: 'insensitive',
|
|
2421
|
+
},
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
person: {
|
|
2425
|
+
name: {
|
|
2426
|
+
contains: search,
|
|
2427
|
+
mode: 'insensitive',
|
|
2428
|
+
},
|
|
2429
|
+
},
|
|
2430
|
+
},
|
|
2431
|
+
];
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
const normalizedPaginationParams: PaginationDTO = {
|
|
2435
|
+
...paginationParams,
|
|
2436
|
+
sortField: paginationParams?.sortField || 'created_at',
|
|
2437
|
+
sortOrder: paginationParams?.sortOrder || PageOrderDirection.Desc,
|
|
2438
|
+
};
|
|
2439
|
+
|
|
2440
|
+
const paginated = await this.paginationService.paginate(
|
|
2411
2441
|
this.prisma.financial_title,
|
|
2412
|
-
|
|
2442
|
+
normalizedPaginationParams,
|
|
2413
2443
|
{
|
|
2414
2444
|
where,
|
|
2415
2445
|
include: this.defaultTitleInclude(),
|
|
2416
2446
|
orderBy: { created_at: 'desc' },
|
|
2417
2447
|
},
|
|
2418
2448
|
);
|
|
2449
|
+
|
|
2450
|
+
return {
|
|
2451
|
+
...paginated,
|
|
2452
|
+
data: (paginated.data || []).map((title) => this.mapTitleToFront(title)),
|
|
2453
|
+
};
|
|
2419
2454
|
}
|
|
2420
2455
|
|
|
2421
2456
|
private async getTitleById(id: number, titleType: TitleType, locale: string) {
|
|
@@ -3286,9 +3321,18 @@ export class FinanceService {
|
|
|
3286
3321
|
|
|
3287
3322
|
await tx.settlement_allocation.create({
|
|
3288
3323
|
data: {
|
|
3289
|
-
|
|
3290
|
-
|
|
3324
|
+
settlement: {
|
|
3325
|
+
connect: {
|
|
3326
|
+
id: settlement.id,
|
|
3327
|
+
},
|
|
3328
|
+
},
|
|
3329
|
+
financial_installment: {
|
|
3330
|
+
connect: {
|
|
3331
|
+
id: installment.id,
|
|
3332
|
+
},
|
|
3333
|
+
},
|
|
3291
3334
|
allocated_amount_cents: amountCents,
|
|
3335
|
+
amount_cents: amountCents,
|
|
3292
3336
|
discount_cents: this.toCents(data.discount || 0),
|
|
3293
3337
|
interest_cents: this.toCents(data.interest || 0),
|
|
3294
3338
|
penalty_cents: this.toCents(data.penalty || 0),
|
|
@@ -3459,7 +3503,7 @@ export class FinanceService {
|
|
|
3459
3503
|
title_competence_date: Date | null;
|
|
3460
3504
|
}>
|
|
3461
3505
|
>`
|
|
3462
|
-
SELECT
|
|
3506
|
+
SELECT
|
|
3463
3507
|
s.id,
|
|
3464
3508
|
s.settlement_type::text,
|
|
3465
3509
|
s.settled_at,
|
|
@@ -3479,6 +3523,7 @@ export class FinanceService {
|
|
|
3479
3523
|
INNER JOIN financial_installment fi ON fi.id = sa.installment_id
|
|
3480
3524
|
INNER JOIN financial_title ft ON ft.id = fi.title_id
|
|
3481
3525
|
WHERE s.id = ${settlementId}
|
|
3526
|
+
LIMIT 1
|
|
3482
3527
|
FOR UPDATE OF s
|
|
3483
3528
|
`;
|
|
3484
3529
|
|
|
@@ -3618,9 +3663,18 @@ export class FinanceService {
|
|
|
3618
3663
|
|
|
3619
3664
|
await tx.settlement_allocation.create({
|
|
3620
3665
|
data: {
|
|
3621
|
-
|
|
3622
|
-
|
|
3666
|
+
settlement: {
|
|
3667
|
+
connect: {
|
|
3668
|
+
id: reversalId,
|
|
3669
|
+
},
|
|
3670
|
+
},
|
|
3671
|
+
financial_installment: {
|
|
3672
|
+
connect: {
|
|
3673
|
+
id: allocation.installment_id,
|
|
3674
|
+
},
|
|
3675
|
+
},
|
|
3623
3676
|
allocated_amount_cents: -Math.abs(originalAmount),
|
|
3677
|
+
amount_cents: -Math.abs(originalAmount),
|
|
3624
3678
|
discount_cents: -Math.abs(allocation.discount_cents || 0),
|
|
3625
3679
|
interest_cents: -Math.abs(allocation.interest_cents || 0),
|
|
3626
3680
|
penalty_cents: -Math.abs(allocation.penalty_cents || 0),
|
|
@@ -4513,7 +4567,28 @@ export class FinanceService {
|
|
|
4513
4567
|
return Math.round(value * 100);
|
|
4514
4568
|
}
|
|
4515
4569
|
|
|
4516
|
-
private fromCents(value: number) {
|
|
4517
|
-
|
|
4570
|
+
private fromCents(value: number | bigint | string | null | undefined) {
|
|
4571
|
+
if (value === null || value === undefined) {
|
|
4572
|
+
return 0;
|
|
4573
|
+
}
|
|
4574
|
+
|
|
4575
|
+
if (typeof value === 'bigint') {
|
|
4576
|
+
const isNegative = value < BigInt(0);
|
|
4577
|
+
const absoluteValue = isNegative ? -value : value;
|
|
4578
|
+
const whole = absoluteValue / BigInt(100);
|
|
4579
|
+
const cents = absoluteValue % BigInt(100);
|
|
4580
|
+
const composedValue = Number(whole) + Number(cents) / 100;
|
|
4581
|
+
|
|
4582
|
+
return Number((isNegative ? -composedValue : composedValue).toFixed(2));
|
|
4583
|
+
}
|
|
4584
|
+
|
|
4585
|
+
const numericValue =
|
|
4586
|
+
typeof value === 'string' ? Number(value) : Number(value || 0);
|
|
4587
|
+
|
|
4588
|
+
if (!Number.isFinite(numericValue)) {
|
|
4589
|
+
return 0;
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
return Number((numericValue / 100).toFixed(2));
|
|
4518
4593
|
}
|
|
4519
4594
|
}
|