@fayz-ai/plugin-financial 0.23.4 → 0.24.0
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/components/AccountPicker.d.ts +1 -1
- package/dist/components/AccountPicker.d.ts.map +1 -1
- package/dist/components/BankPicker.d.ts +1 -1
- package/dist/components/BankPicker.d.ts.map +1 -1
- package/dist/components/CancelInvoiceDialog.d.ts +1 -1
- package/dist/components/CancelInvoiceDialog.d.ts.map +1 -1
- package/dist/components/CashSessionHeaderControl.d.ts +2 -2
- package/dist/components/CashSessionHeaderControl.d.ts.map +1 -1
- package/dist/components/CashSessionReviewModal.d.ts.map +1 -1
- package/dist/components/ChartOfAccountsTree.d.ts.map +1 -1
- package/dist/components/ClientAccountModal.d.ts +2 -7
- package/dist/components/ClientAccountModal.d.ts.map +1 -1
- package/dist/components/CnabRemittanceModal.d.ts +4 -3
- package/dist/components/CnabRemittanceModal.d.ts.map +1 -1
- package/dist/components/CommissionFunctionsDialog.d.ts +2 -2
- package/dist/components/CommissionFunctionsDialog.d.ts.map +1 -1
- package/dist/components/CommissionRuleDialog.d.ts +2 -2
- package/dist/components/CommissionRuleDialog.d.ts.map +1 -1
- package/dist/components/FinancialCounterpartySearchSelect.d.ts +1 -1
- package/dist/components/FinancialCounterpartySearchSelect.d.ts.map +1 -1
- package/dist/components/FinancialSettings.d.ts.map +1 -1
- package/dist/components/InstallmentSource.d.ts +1 -1
- package/dist/components/InstallmentSource.d.ts.map +1 -1
- package/dist/components/PaymentFields.d.ts +3 -1
- package/dist/components/PaymentFields.d.ts.map +1 -1
- package/dist/components/PaymentIcons.d.ts +2 -1
- package/dist/components/PaymentIcons.d.ts.map +1 -1
- package/dist/components/PaymentModal.d.ts +1 -1
- package/dist/components/PaymentModal.d.ts.map +1 -1
- package/dist/components/PaymentReceiptModal.d.ts +2 -2
- package/dist/components/PaymentReceiptModal.d.ts.map +1 -1
- package/dist/components/PersonStatementWidget.d.ts +1 -1
- package/dist/components/PersonStatementWidget.d.ts.map +1 -1
- package/dist/components/ReceivePaymentModal.d.ts +2 -8
- package/dist/components/ReceivePaymentModal.d.ts.map +1 -1
- package/dist/components/ReceiveStockDialog.d.ts +1 -1
- package/dist/components/ReceiveStockDialog.d.ts.map +1 -1
- package/dist/components/ReconcileFlow.d.ts +2 -2
- package/dist/components/ReconcileFlow.d.ts.map +1 -1
- package/dist/components/ReconcileModals.d.ts +1 -1
- package/dist/components/ReconcileModals.d.ts.map +1 -1
- package/dist/components/TransferModal.d.ts.map +1 -1
- package/dist/components/financialZoneWidgets.d.ts +4 -0
- package/dist/components/financialZoneWidgets.d.ts.map +1 -0
- package/dist/context.d.ts +2 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/data/registries.d.ts.map +1 -1
- package/dist/index.d.ts +9 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4349 -8604
- package/dist/index.js.map +1 -1
- package/dist/lib/analytics-cards.d.ts +1 -1
- package/dist/lib/analytics-cards.d.ts.map +1 -1
- package/dist/lib/receipt-reading.d.ts +1 -1
- package/dist/lib/receipt-reading.d.ts.map +1 -1
- package/dist/lib/routes.d.ts +1 -3
- package/dist/lib/routes.d.ts.map +1 -1
- package/dist/lib/settings-only.d.ts.map +1 -1
- package/dist/locales/en.d.ts.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/migrations/index.d.ts +4 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/settings/CardMachinesSettings.d.ts +8 -0
- package/dist/settings/CardMachinesSettings.d.ts.map +1 -0
- package/dist/settings/v1-settings.d.ts +2 -0
- package/dist/settings/v1-settings.d.ts.map +1 -0
- package/dist/views/CashRegistersView.d.ts.map +1 -1
- package/dist/views/ClientAccountPanel.d.ts.map +1 -1
- package/dist/views/CommissionRulesView.d.ts +1 -1
- package/dist/views/CommissionRulesView.d.ts.map +1 -1
- package/dist/views/CommissionsView.d.ts.map +1 -1
- package/dist/views/FinancialPage.d.ts +2 -2
- package/dist/views/FinancialPage.d.ts.map +1 -1
- package/dist/views/GoalsView.d.ts.map +1 -1
- package/dist/views/InvoiceDetailView.d.ts +1 -1
- package/dist/views/InvoiceDetailView.d.ts.map +1 -1
- package/dist/views/InvoiceFormView.d.ts +1 -1
- package/dist/views/InvoiceFormView.d.ts.map +1 -1
- package/dist/views/InvoiceListView.d.ts +2 -1
- package/dist/views/InvoiceListView.d.ts.map +1 -1
- package/dist/views/ReconciliationView.d.ts.map +1 -1
- package/dist/views/RecurringBillsView.d.ts +1 -1
- package/dist/views/RecurringBillsView.d.ts.map +1 -1
- package/dist/views/StatementsView.d.ts.map +1 -1
- package/dist/views/dashboardWidgets.d.ts +2 -2
- package/dist/views/dashboardWidgets.d.ts.map +1 -1
- package/dist/views/document-memory.d.ts.map +1 -1
- package/dist/views/payable-agent.d.ts +1 -1
- package/dist/views/payable-agent.d.ts.map +1 -1
- package/dist/views/payable-lines.d.ts +0 -2
- package/dist/views/payable-lines.d.ts.map +1 -1
- package/package.json +5 -4
- package/dist/data/index.d.ts +0 -4
- package/dist/data/index.d.ts.map +0 -1
- package/dist/data/match-statement.d.ts +0 -34
- package/dist/data/match-statement.d.ts.map +0 -1
- package/dist/data/mock.d.ts +0 -25
- package/dist/data/mock.d.ts.map +0 -1
- package/dist/data/supabase.d.ts +0 -3
- package/dist/data/supabase.d.ts.map +0 -1
- package/dist/data/tables.d.ts +0 -43
- package/dist/data/tables.d.ts.map +0 -1
- package/dist/data/types.d.ts +0 -327
- package/dist/data/types.d.ts.map +0 -1
- package/dist/lib/accounts.d.ts +0 -16
- package/dist/lib/accounts.d.ts.map +0 -1
- package/dist/lib/chart-tree.d.ts +0 -28
- package/dist/lib/chart-tree.d.ts.map +0 -1
- package/dist/lib/cnab240.d.ts +0 -106
- package/dist/lib/cnab240.d.ts.map +0 -1
- package/dist/lib/fx-auto.d.ts +0 -7
- package/dist/lib/fx-auto.d.ts.map +0 -1
- package/dist/lib/idempotency.d.ts +0 -2
- package/dist/lib/idempotency.d.ts.map +0 -1
- package/dist/lib/invoice-list.d.ts +0 -46
- package/dist/lib/invoice-list.d.ts.map +0 -1
- package/dist/lib/payment-how.d.ts +0 -31
- package/dist/lib/payment-how.d.ts.map +0 -1
- package/dist/lib/reconcile.d.ts +0 -151
- package/dist/lib/reconcile.d.ts.map +0 -1
- package/dist/lib/settlements.d.ts +0 -28
- package/dist/lib/settlements.d.ts.map +0 -1
- package/dist/lib/statement-order.d.ts +0 -4
- package/dist/lib/statement-order.d.ts.map +0 -1
- package/dist/lib/tenant.d.ts +0 -3
- package/dist/lib/tenant.d.ts.map +0 -1
- package/dist/store.d.ts +0 -51
- package/dist/store.d.ts.map +0 -1
- package/dist/types.d.ts +0 -1362
- package/dist/types.d.ts.map +0 -1
package/dist/types.d.ts
DELETED
|
@@ -1,1362 +0,0 @@
|
|
|
1
|
-
/** Direction: debit (money going out / payable) or credit (money coming in / receivable) */
|
|
2
|
-
export type TransactionDirection = 'debit' | 'credit';
|
|
3
|
-
/** What kind of financial movement this is */
|
|
4
|
-
export type MovementKind = 'bill' | 'payment' | 'transfer';
|
|
5
|
-
/** Status of a financial movement */
|
|
6
|
-
export type MovementStatus = 'pending' | 'paid' | 'partial' | 'overdue' | 'cancelled';
|
|
7
|
-
/** Status of an invoice */
|
|
8
|
-
export type InvoiceStatus = 'draft' | 'open' | 'partial' | 'paid' | 'cancelled' | 'overdue'
|
|
9
|
-
/**
|
|
10
|
-
* PREVISTO, não devido.
|
|
11
|
-
*
|
|
12
|
-
* A ocorrência de uma recorrência que ainda não foi consolidada: ela aparece
|
|
13
|
-
* na lista para que o mês se enxergue inteiro, mas não é conta — não tem
|
|
14
|
-
* fatura, não entra no razão e não cobra ninguém. Vira conta quando alguém
|
|
15
|
-
* manda (ver `financial_consolidate_occurrence`). É o `provisioned` do V1.
|
|
16
|
-
*/
|
|
17
|
-
| 'provisioned';
|
|
18
|
-
/** Type of bank account */
|
|
19
|
-
export type BankAccountType = 'bank' | 'cash_physical' | 'cash_session' | 'card_receivable_credit' | 'card_receivable_debit' | 'card_payable' | 'person' | 'unit' | 'unidentified' | 'system';
|
|
20
|
-
/** Cash session status */
|
|
21
|
-
export type CashSessionStatus = 'open' | 'closed';
|
|
22
|
-
/** Discount/interest application mode */
|
|
23
|
-
export type AdjustmentMode = 'percentage' | 'fixed';
|
|
24
|
-
/** Chart of accounts node type */
|
|
25
|
-
export type AccountNodeType = 'group' | 'leaf';
|
|
26
|
-
/** Item type on an invoice line — parametrizable per vertical */
|
|
27
|
-
export type InvoiceItemKind = string;
|
|
28
|
-
export interface Invoice {
|
|
29
|
-
id: string;
|
|
30
|
-
direction: TransactionDirection;
|
|
31
|
-
/** ISO code the document was written in. Absent = the house's currency. */
|
|
32
|
-
currency?: string;
|
|
33
|
-
/** Free labels the house puts on the bill. */
|
|
34
|
-
tags?: string[];
|
|
35
|
-
/** Competência — o eixo do razão e do DRE. */
|
|
36
|
-
invoiceDate: string;
|
|
37
|
-
/**
|
|
38
|
-
* Vencimento: o próximo em aberto, ou o último quando tudo já foi pago.
|
|
39
|
-
*
|
|
40
|
-
* É a data que a LISTA mostra e por onde ela ordena, porque é a pergunta da
|
|
41
|
-
* tela ("o que eu pago esta semana") e é como o V1 sempre a construiu. A
|
|
42
|
-
* competência continua sendo a do razão.
|
|
43
|
-
*/
|
|
44
|
-
dueDate?: string;
|
|
45
|
-
/**
|
|
46
|
-
* O TÍTULO a que esta linha pertence.
|
|
47
|
-
*
|
|
48
|
-
* A lista é de PARCELAS — é assim que o V1 sempre a mostrou, e é a única
|
|
49
|
-
* granularidade em que "o que vence no dia 11" tem resposta. Então `id` é a
|
|
50
|
-
* parcela (a chave da linha) e `invoiceId` é o documento que se abre ao
|
|
51
|
-
* clicar. Numa linha que não veio parcelada os dois são iguais.
|
|
52
|
-
*/
|
|
53
|
-
invoiceId?: string;
|
|
54
|
-
/** "3 de 4" — o numerador. */
|
|
55
|
-
installmentNumber?: number;
|
|
56
|
-
/** Quantos recibos a conta tem. O clipe da linha, como no V1. */
|
|
57
|
-
attachmentCount?: number;
|
|
58
|
-
fiscalNumber?: string;
|
|
59
|
-
totalAmount: number;
|
|
60
|
-
paidAmount: number;
|
|
61
|
-
status: InvoiceStatus;
|
|
62
|
-
totalInstallments: number;
|
|
63
|
-
contactId?: string;
|
|
64
|
-
contactName?: string;
|
|
65
|
-
cashSessionId?: string;
|
|
66
|
-
unitId?: string;
|
|
67
|
-
observations?: string;
|
|
68
|
-
/** Denormalized summary of item descriptions for list display */
|
|
69
|
-
itemsSummary?: string;
|
|
70
|
-
/** Latest active settlement details for this installment in list views. */
|
|
71
|
-
paymentMethodId?: string;
|
|
72
|
-
paymentMethodTypeId?: string;
|
|
73
|
-
paymentAccountId?: string;
|
|
74
|
-
paymentCardInstallments?: number;
|
|
75
|
-
/** If this order has a scheduled time (booking), the start time */
|
|
76
|
-
bookingStartsAt?: string;
|
|
77
|
-
metadata?: Record<string, unknown>;
|
|
78
|
-
tenantId: string;
|
|
79
|
-
createdAt: string;
|
|
80
|
-
updatedAt: string;
|
|
81
|
-
/** Who filed the bill — feeds the record footer. Written by the DB trigger. */
|
|
82
|
-
createdBy?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Esta linha é uma OCORRÊNCIA provisionada, não uma conta.
|
|
85
|
-
*
|
|
86
|
-
* Linha virtual: não existe fatura por trás dela. A lista a desenha
|
|
87
|
-
* tracejada e troca as ações pelo botão «Consolidar», que é o único caminho
|
|
88
|
-
* que a transforma em dívida. Ver o V1 em `PayablesList`.
|
|
89
|
-
*/
|
|
90
|
-
isProvisionedOccurrence?: boolean;
|
|
91
|
-
/** O id da ocorrência, que é o que «Consolidar» manda para a RPC. */
|
|
92
|
-
occurrenceId?: string;
|
|
93
|
-
/** A régua que a gerou — para abrir a recorrência a partir da linha. */
|
|
94
|
-
recurringBillId?: string;
|
|
95
|
-
}
|
|
96
|
-
export interface InvoiceItem {
|
|
97
|
-
id: string;
|
|
98
|
-
invoiceId: string;
|
|
99
|
-
/** The picture of the product this line names, when it names one that has a picture. */
|
|
100
|
-
imageUrl?: string;
|
|
101
|
-
itemKind: InvoiceItemKind;
|
|
102
|
-
referenceId?: string;
|
|
103
|
-
description: string;
|
|
104
|
-
quantity: number;
|
|
105
|
-
unitPrice: number;
|
|
106
|
-
totalAmount: number;
|
|
107
|
-
discount: number;
|
|
108
|
-
surcharge: number;
|
|
109
|
-
accountId?: string;
|
|
110
|
-
costCenterId?: string;
|
|
111
|
-
isExecuted?: boolean;
|
|
112
|
-
executionDate?: string;
|
|
113
|
-
executedByProfessionalId?: string;
|
|
114
|
-
metadata?: Record<string, unknown>;
|
|
115
|
-
/** Set when the line was cancelled on its own (cancel by item). */
|
|
116
|
-
cancelledAt?: string;
|
|
117
|
-
cancelReason?: string;
|
|
118
|
-
createdAt: string;
|
|
119
|
-
}
|
|
120
|
-
export interface FinancialMovement {
|
|
121
|
-
id: string;
|
|
122
|
-
invoiceId?: string;
|
|
123
|
-
direction: TransactionDirection;
|
|
124
|
-
movementKind: MovementKind;
|
|
125
|
-
amount: number;
|
|
126
|
-
paidAmount: number;
|
|
127
|
-
status: MovementStatus;
|
|
128
|
-
/** For a payment: the bill it settles. See migration 014. */
|
|
129
|
-
settlesMovementId?: string;
|
|
130
|
-
dueDate: string;
|
|
131
|
-
paymentDate?: string;
|
|
132
|
-
installmentNumber?: number;
|
|
133
|
-
paymentMethodId?: string;
|
|
134
|
-
paymentMethodTypeId?: string;
|
|
135
|
-
/** How the money moved (`pix`, `cash`, `credit_card`…) — the column the
|
|
136
|
-
* payment RPCs write; `paymentMethodId` is the V1-era registry link. */
|
|
137
|
-
method?: string;
|
|
138
|
-
bankAccountId?: string;
|
|
139
|
-
cashSessionId?: string;
|
|
140
|
-
cardBrand?: string;
|
|
141
|
-
cardInstallments?: number;
|
|
142
|
-
/** Processing/MDR fee deducted at settlement (net cash = paidAmount - feeAmount for credits) */
|
|
143
|
-
feeAmount?: number;
|
|
144
|
-
debitAccountId?: string;
|
|
145
|
-
creditAccountId?: string;
|
|
146
|
-
notes?: string;
|
|
147
|
-
metadata?: Record<string, unknown>;
|
|
148
|
-
/** Provider of an imported bank-statement line (set on imported movements only) */
|
|
149
|
-
externalSource?: string;
|
|
150
|
-
/** Provider-unique id of the imported bank line (idempotency key with externalSource) */
|
|
151
|
-
externalId?: string;
|
|
152
|
-
/** When this movement was reconciled — matched or accepted (undefined = pending) */
|
|
153
|
-
reconciledAt?: string;
|
|
154
|
-
/** For an imported bank line: the internal movement it was matched to */
|
|
155
|
-
matchedMovementId?: string;
|
|
156
|
-
tenantId: string;
|
|
157
|
-
createdAt: string;
|
|
158
|
-
updatedAt: string;
|
|
159
|
-
}
|
|
160
|
-
export interface BankAccount {
|
|
161
|
-
id: string;
|
|
162
|
-
name: string;
|
|
163
|
-
accountType: BankAccountType;
|
|
164
|
-
/** Número da instituição (COMPE/ISPB) — o que boleto, CNAB e PIX usam. `bankName` é o nome que a pessoa lê. */
|
|
165
|
-
bankCode?: string;
|
|
166
|
-
bankName?: string;
|
|
167
|
-
accountNumber?: string;
|
|
168
|
-
agencyNumber?: string;
|
|
169
|
-
/** Titular: raramente é o tenant — é o sócio, a holding, a empresa de serviços em cujo nome a conta está. */
|
|
170
|
-
holderName?: string;
|
|
171
|
-
holderDocument?: string;
|
|
172
|
-
/** Bank-specific CNAB fields live in metadata until every bank shares a stable schema. */
|
|
173
|
-
metadata?: Record<string, unknown>;
|
|
174
|
-
currentBalance: number;
|
|
175
|
-
initialBalance: number;
|
|
176
|
-
creditLimit?: number;
|
|
177
|
-
dueDay?: number;
|
|
178
|
-
closingDay?: number;
|
|
179
|
-
/** O dia seguinte ao fechamento: a compra cai na fatura mais distante. */
|
|
180
|
-
bestPurchaseDay?: number;
|
|
181
|
-
/** Bandeira, para conta de cartão. É o que liga a conta às taxas, que já são por bandeira. */
|
|
182
|
-
cardBrandId?: string | null;
|
|
183
|
-
/** Os quatro últimos do cartão (101) — é por eles que quem tem quatro sabe qual é. */
|
|
184
|
-
lastFour?: string | null;
|
|
185
|
-
/** Cor do cartão na tela — é assim que quem tem quatro sabe qual é (028). */
|
|
186
|
-
color?: string | null;
|
|
187
|
-
isActive: boolean;
|
|
188
|
-
unitId?: string;
|
|
189
|
-
tenantId: string;
|
|
190
|
-
createdAt: string;
|
|
191
|
-
updatedAt: string;
|
|
192
|
-
}
|
|
193
|
-
export interface CashSession {
|
|
194
|
-
id: string;
|
|
195
|
-
bankAccountId: string;
|
|
196
|
-
bankAccountName?: string;
|
|
197
|
-
status: CashSessionStatus;
|
|
198
|
-
openedAt: string;
|
|
199
|
-
openedByUserId?: string;
|
|
200
|
-
openedByName?: string;
|
|
201
|
-
openingBalance: number;
|
|
202
|
-
closedAt?: string;
|
|
203
|
-
closedByUserId?: string;
|
|
204
|
-
closedByName?: string;
|
|
205
|
-
closingBalance?: number;
|
|
206
|
-
expectedBalance?: number;
|
|
207
|
-
/** Live expected cash for an OPEN session, from v_financial_cash_session_expected (018). */
|
|
208
|
-
expectedCash?: number;
|
|
209
|
-
/** What the session took in, per payment method — pix included, not folded into "card". */
|
|
210
|
-
receivedByMethod?: Record<string, number>;
|
|
211
|
-
paymentCount?: number;
|
|
212
|
-
difference?: number;
|
|
213
|
-
notes?: string;
|
|
214
|
-
unitId?: string;
|
|
215
|
-
tenantId: string;
|
|
216
|
-
createdAt: string;
|
|
217
|
-
}
|
|
218
|
-
export interface PaymentMethod {
|
|
219
|
-
id: string;
|
|
220
|
-
name: string;
|
|
221
|
-
paymentMethodTypeId: string;
|
|
222
|
-
isActive: boolean;
|
|
223
|
-
discountMode?: AdjustmentMode;
|
|
224
|
-
discountValue?: number;
|
|
225
|
-
interestMode?: AdjustmentMode;
|
|
226
|
-
interestValue?: number;
|
|
227
|
-
minInstallments: number;
|
|
228
|
-
maxInstallments: number;
|
|
229
|
-
serviceFilterMode?: 'all' | 'include' | 'exclude';
|
|
230
|
-
serviceFilterIds?: string[];
|
|
231
|
-
tenantId: string;
|
|
232
|
-
createdAt: string;
|
|
233
|
-
updatedAt: string;
|
|
234
|
-
}
|
|
235
|
-
export interface PaymentMethodType {
|
|
236
|
-
id: string;
|
|
237
|
-
name: string;
|
|
238
|
-
transactionType?: string;
|
|
239
|
-
isActive: boolean;
|
|
240
|
-
allowedAccountTypes?: BankAccountType[];
|
|
241
|
-
tenantId: string;
|
|
242
|
-
createdAt: string;
|
|
243
|
-
}
|
|
244
|
-
/** The nature of a chart-of-accounts entry. */
|
|
245
|
-
export type AccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense';
|
|
246
|
-
export interface ChartOfAccountsNode {
|
|
247
|
-
id: string;
|
|
248
|
-
code: string;
|
|
249
|
-
name: string;
|
|
250
|
-
nodeType: AccountNodeType;
|
|
251
|
-
parentId?: string;
|
|
252
|
-
/** asset | liability | equity | revenue | expense — see migration 013. */
|
|
253
|
-
accountType?: AccountType;
|
|
254
|
-
isActive: boolean;
|
|
255
|
-
tenantId: string;
|
|
256
|
-
createdAt: string;
|
|
257
|
-
}
|
|
258
|
-
export interface CostCenter {
|
|
259
|
-
id: string;
|
|
260
|
-
code: string;
|
|
261
|
-
name: string;
|
|
262
|
-
isActive: boolean;
|
|
263
|
-
tenantId: string;
|
|
264
|
-
createdAt: string;
|
|
265
|
-
updatedAt: string;
|
|
266
|
-
}
|
|
267
|
-
export interface CardTransaction {
|
|
268
|
-
id: string;
|
|
269
|
-
movementId: string;
|
|
270
|
-
cardBrand: string;
|
|
271
|
-
totalAmount: number;
|
|
272
|
-
installmentCount: number;
|
|
273
|
-
currentInstallment: number;
|
|
274
|
-
installmentAmount: number;
|
|
275
|
-
expectedDate: string;
|
|
276
|
-
receivedDate?: string;
|
|
277
|
-
fee?: number;
|
|
278
|
-
netAmount?: number;
|
|
279
|
-
status: 'pending' | 'received' | 'cancelled';
|
|
280
|
-
tenantId: string;
|
|
281
|
-
createdAt: string;
|
|
282
|
-
}
|
|
283
|
-
export interface CreateInvoiceInput {
|
|
284
|
-
direction: TransactionDirection;
|
|
285
|
-
invoiceDate: string;
|
|
286
|
-
fiscalNumber?: string;
|
|
287
|
-
contactId?: string;
|
|
288
|
-
contactName?: string;
|
|
289
|
-
cashSessionId?: string;
|
|
290
|
-
unitId?: string;
|
|
291
|
-
/** ISO code to write the document in. Absent = the unit's currency. */
|
|
292
|
-
currency?: string;
|
|
293
|
-
tags?: string[];
|
|
294
|
-
observations?: string;
|
|
295
|
-
metadata?: Record<string, unknown>;
|
|
296
|
-
items: CreateInvoiceItemInput[];
|
|
297
|
-
installments: CreateMovementInput[];
|
|
298
|
-
}
|
|
299
|
-
export interface CreateInvoiceItemInput {
|
|
300
|
-
itemKind: InvoiceItemKind;
|
|
301
|
-
referenceId?: string;
|
|
302
|
-
description: string;
|
|
303
|
-
quantity: number;
|
|
304
|
-
unitPrice: number;
|
|
305
|
-
discount?: number;
|
|
306
|
-
surcharge?: number;
|
|
307
|
-
accountId?: string;
|
|
308
|
-
costCenterId?: string;
|
|
309
|
-
metadata?: Record<string, unknown>;
|
|
310
|
-
}
|
|
311
|
-
export interface CreateMovementInput {
|
|
312
|
-
direction: TransactionDirection;
|
|
313
|
-
movementKind: MovementKind;
|
|
314
|
-
amount: number;
|
|
315
|
-
dueDate: string;
|
|
316
|
-
installmentNumber?: number;
|
|
317
|
-
paymentMethodId?: string;
|
|
318
|
-
bankAccountId?: string;
|
|
319
|
-
notes?: string;
|
|
320
|
-
metadata?: Record<string, unknown>;
|
|
321
|
-
}
|
|
322
|
-
export interface PayMovementInput {
|
|
323
|
-
movementId: string;
|
|
324
|
-
amount: number;
|
|
325
|
-
paymentDate: string;
|
|
326
|
-
paymentMethodId?: string;
|
|
327
|
-
paymentMethodTypeId?: string;
|
|
328
|
-
bankAccountId?: string;
|
|
329
|
-
cashSessionId?: string;
|
|
330
|
-
cardBrand?: string;
|
|
331
|
-
cardInstallments?: number;
|
|
332
|
-
/** Free-text payment description / memo shown in the extract */
|
|
333
|
-
notes?: string;
|
|
334
|
-
/**
|
|
335
|
-
* O que acompanha ESTE pagamento — hoje, `receiptUrl`: a foto do comprovante.
|
|
336
|
-
* Fica na parcela paga, não na fatura: o recibo prova que um dinheiro
|
|
337
|
-
* específico mudou de mão.
|
|
338
|
-
*/
|
|
339
|
-
metadata?: Record<string, unknown>;
|
|
340
|
-
/** Stable for every retry of the same payment attempt. */
|
|
341
|
-
idempotencyKey?: string;
|
|
342
|
-
}
|
|
343
|
-
export interface CancellationReason {
|
|
344
|
-
id: string;
|
|
345
|
-
name: string;
|
|
346
|
-
}
|
|
347
|
-
/** Goods a payable line brought into stock, still traceable to its note. */
|
|
348
|
-
export interface InvoiceStockEntry {
|
|
349
|
-
itemId: string;
|
|
350
|
-
productId: string;
|
|
351
|
-
locationId: string;
|
|
352
|
-
/** Quantity that entered, in the product's stock unit. */
|
|
353
|
-
entered: number;
|
|
354
|
-
/** What is still at that location — the most a return or loss can move. */
|
|
355
|
-
available: number;
|
|
356
|
-
enteredOn: string;
|
|
357
|
-
}
|
|
358
|
-
export type StockDestination = 'devolver' | 'perda' | 'manter';
|
|
359
|
-
export interface CancelInvoiceItemsInput {
|
|
360
|
-
invoiceId: string;
|
|
361
|
-
/** Empty = every live line (the whole invoice). */
|
|
362
|
-
itemIds: string[];
|
|
363
|
-
reasonId: string;
|
|
364
|
-
detail?: string;
|
|
365
|
-
stock: Array<{
|
|
366
|
-
itemId: string;
|
|
367
|
-
destination: StockDestination;
|
|
368
|
-
note?: string;
|
|
369
|
-
}>;
|
|
370
|
-
idempotencyKey?: string;
|
|
371
|
-
}
|
|
372
|
-
export interface CancelInvoiceItemsResult {
|
|
373
|
-
whole: boolean;
|
|
374
|
-
amount: number;
|
|
375
|
-
/** What had been paid on the cancelled part and became counterparty credit. */
|
|
376
|
-
creditAmount: number;
|
|
377
|
-
}
|
|
378
|
-
export interface InstallmentChargeInput {
|
|
379
|
-
installmentId: string;
|
|
380
|
-
kind: 'interest' | 'fine' | 'discount';
|
|
381
|
-
/** Always positive — `kind` carries the sign. */
|
|
382
|
-
amount: number;
|
|
383
|
-
accountId?: string;
|
|
384
|
-
description?: string;
|
|
385
|
-
idempotencyKey?: string;
|
|
386
|
-
}
|
|
387
|
-
export interface CancelInvoiceInput {
|
|
388
|
-
invoiceId: string;
|
|
389
|
-
reason: string;
|
|
390
|
-
/** Stable for every retry of the same cancellation attempt. */
|
|
391
|
-
idempotencyKey?: string;
|
|
392
|
-
}
|
|
393
|
-
export interface OpenCashSessionInput {
|
|
394
|
-
bankAccountId: string;
|
|
395
|
-
openingBalance: number;
|
|
396
|
-
openedByUserId?: string;
|
|
397
|
-
openedByName?: string;
|
|
398
|
-
unitId?: string;
|
|
399
|
-
notes?: string;
|
|
400
|
-
}
|
|
401
|
-
export interface CloseCashSessionInput {
|
|
402
|
-
sessionId: string;
|
|
403
|
-
closingBalance: number;
|
|
404
|
-
closedByUserId?: string;
|
|
405
|
-
closedByName?: string;
|
|
406
|
-
notes?: string;
|
|
407
|
-
}
|
|
408
|
-
export interface CreateBankAccountInput {
|
|
409
|
-
name: string;
|
|
410
|
-
accountType: BankAccountType;
|
|
411
|
-
bankCode?: string;
|
|
412
|
-
bankName?: string;
|
|
413
|
-
accountNumber?: string;
|
|
414
|
-
agencyNumber?: string;
|
|
415
|
-
holderName?: string;
|
|
416
|
-
holderDocument?: string;
|
|
417
|
-
initialBalance?: number;
|
|
418
|
-
creditLimit?: number;
|
|
419
|
-
dueDay?: number;
|
|
420
|
-
closingDay?: number;
|
|
421
|
-
bestPurchaseDay?: number;
|
|
422
|
-
cardBrandId?: string | null;
|
|
423
|
-
unitId?: string;
|
|
424
|
-
}
|
|
425
|
-
export interface DateRange {
|
|
426
|
-
from: string;
|
|
427
|
-
to: string;
|
|
428
|
-
}
|
|
429
|
-
export interface InvoiceQuery {
|
|
430
|
-
direction?: TransactionDirection;
|
|
431
|
-
status?: InvoiceStatus | InvoiceStatus[];
|
|
432
|
-
contactId?: string;
|
|
433
|
-
unitId?: string;
|
|
434
|
-
accountId?: string;
|
|
435
|
-
costCenterId?: string;
|
|
436
|
-
dateRange?: DateRange;
|
|
437
|
-
search?: string;
|
|
438
|
-
/** Número do documento/nota — o campo "Nota Fiscal" do recorte do V1. */
|
|
439
|
-
fiscalNumber?: string;
|
|
440
|
-
/** Conta bancária de onde saiu (ou entrou) o dinheiro — 114. */
|
|
441
|
-
bankAccountId?: string;
|
|
442
|
-
page?: number;
|
|
443
|
-
pageSize?: number;
|
|
444
|
-
}
|
|
445
|
-
export interface DreQuery {
|
|
446
|
-
year: number;
|
|
447
|
-
unitId?: string;
|
|
448
|
-
}
|
|
449
|
-
export interface DreRow {
|
|
450
|
-
unitId?: string;
|
|
451
|
-
competenceMonth?: string;
|
|
452
|
-
accountId?: string;
|
|
453
|
-
accountCode?: string;
|
|
454
|
-
accountName?: string;
|
|
455
|
-
accountType: 'revenue' | 'expense';
|
|
456
|
-
parentAccountId?: string;
|
|
457
|
-
statementCode?: string;
|
|
458
|
-
statementName?: string;
|
|
459
|
-
unclassified: boolean;
|
|
460
|
-
amount: number;
|
|
461
|
-
discount: number;
|
|
462
|
-
lineCount: number;
|
|
463
|
-
}
|
|
464
|
-
export interface MovementQuery {
|
|
465
|
-
direction?: TransactionDirection;
|
|
466
|
-
status?: MovementStatus | MovementStatus[];
|
|
467
|
-
bankAccountId?: string;
|
|
468
|
-
cashSessionId?: string;
|
|
469
|
-
/** Scope to a single invoice's movements (bills + payments). */
|
|
470
|
-
invoiceId?: string;
|
|
471
|
-
dateRange?: DateRange;
|
|
472
|
-
page?: number;
|
|
473
|
-
pageSize?: number;
|
|
474
|
-
}
|
|
475
|
-
export interface StatementQuery {
|
|
476
|
-
/** Omit (or pass undefined) for a consolidated "All accounts" statement */
|
|
477
|
-
bankAccountId?: string;
|
|
478
|
-
dateRange: DateRange;
|
|
479
|
-
}
|
|
480
|
-
export interface CreateTransferInput {
|
|
481
|
-
fromAccountId: string;
|
|
482
|
-
toAccountId: string;
|
|
483
|
-
amount: number;
|
|
484
|
-
/** YYYY-MM-DD — becomes payment_date on both ledger legs */
|
|
485
|
-
date: string;
|
|
486
|
-
notes?: string;
|
|
487
|
-
}
|
|
488
|
-
export interface TransferResult {
|
|
489
|
-
/** Shared correlation id stored in both legs' metadata */
|
|
490
|
-
transferId: string;
|
|
491
|
-
debitMovementId: string;
|
|
492
|
-
creditMovementId: string;
|
|
493
|
-
}
|
|
494
|
-
export interface PaginatedResult<T> {
|
|
495
|
-
data: T[];
|
|
496
|
-
total: number;
|
|
497
|
-
}
|
|
498
|
-
export interface FinancialSummary {
|
|
499
|
-
totalBalance: number;
|
|
500
|
-
totalReceivable: number;
|
|
501
|
-
totalPayable: number;
|
|
502
|
-
monthlyInflow: number;
|
|
503
|
-
monthlyOutflow: number;
|
|
504
|
-
overdueReceivableCount: number;
|
|
505
|
-
overdueReceivableAmount: number;
|
|
506
|
-
overduePayableCount: number;
|
|
507
|
-
overduePayableAmount: number;
|
|
508
|
-
/**
|
|
509
|
-
* Amounts in a currency with no rate to the house's on file. They are NOT in
|
|
510
|
-
* the totals above (never counted 1:1), so the screen has to say they exist.
|
|
511
|
-
*/
|
|
512
|
-
excluded?: Array<{
|
|
513
|
-
currency: string;
|
|
514
|
-
balance: number;
|
|
515
|
-
receivable: number;
|
|
516
|
-
payable: number;
|
|
517
|
-
inflow: number;
|
|
518
|
-
outflow: number;
|
|
519
|
-
}>;
|
|
520
|
-
}
|
|
521
|
-
/** What a statement row represents — a normal movement or one leg of a transfer */
|
|
522
|
-
export type StatementEntryKind = 'movement' | 'transfer-in' | 'transfer-out';
|
|
523
|
-
export interface StatementEntry {
|
|
524
|
-
movement: FinancialMovement;
|
|
525
|
-
invoice?: Invoice;
|
|
526
|
-
/** NET cash running balance after this row */
|
|
527
|
-
runningBalance: number;
|
|
528
|
-
/** Amount that settled the receivable/payable (= paidAmount) */
|
|
529
|
-
gross: number;
|
|
530
|
-
/** Processing/MDR fee deducted (>= 0) */
|
|
531
|
-
fee: number;
|
|
532
|
-
/** Cash impact: gross - fee for credit; gross for debit */
|
|
533
|
-
net: number;
|
|
534
|
-
entryKind: StatementEntryKind;
|
|
535
|
-
/** For transfers: the other side's account */
|
|
536
|
-
counterAccountId?: string;
|
|
537
|
-
counterAccountName?: string;
|
|
538
|
-
/** When this row is a reconciled bank line, the internal movement it was matched to. */
|
|
539
|
-
reconciledWith?: {
|
|
540
|
-
movementId: string;
|
|
541
|
-
description?: string;
|
|
542
|
-
invoiceId?: string;
|
|
543
|
-
fiscalNumber?: string;
|
|
544
|
-
contactName?: string;
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
/** Full statement result with header context (opening/closing balance + period totals) */
|
|
548
|
-
export interface StatementResult {
|
|
549
|
-
entries: StatementEntry[];
|
|
550
|
-
/** Balance as of start-of-day dateFrom (excludes in-range rows) */
|
|
551
|
-
openingBalance: number;
|
|
552
|
-
/** openingBalance + net of all in-range rows */
|
|
553
|
-
closingBalance: number;
|
|
554
|
-
/** Sum of NET credits in range */
|
|
555
|
-
totalCredits: number;
|
|
556
|
-
/** Sum of NET debits (cash out) in range */
|
|
557
|
-
totalDebits: number;
|
|
558
|
-
/** Sum of fees in range */
|
|
559
|
-
totalFees: number;
|
|
560
|
-
/** totalCredits - totalDebits */
|
|
561
|
-
net: number;
|
|
562
|
-
/** Echo of the queried account; undefined for consolidated */
|
|
563
|
-
accountId?: string;
|
|
564
|
-
/** Ledger-computed current balance of the selected account (as of today) */
|
|
565
|
-
accountCurrentBalance?: number;
|
|
566
|
-
}
|
|
567
|
-
export interface CashSessionSummary {
|
|
568
|
-
session: CashSession;
|
|
569
|
-
movementCount: number;
|
|
570
|
-
totalInflow: number;
|
|
571
|
-
totalOutflow: number;
|
|
572
|
-
}
|
|
573
|
-
/** A normalized bank-statement line, ready to import. */
|
|
574
|
-
export interface BankStatementLine {
|
|
575
|
-
/** Provider-unique transaction id (idempotency key with externalSource) */
|
|
576
|
-
externalId: string;
|
|
577
|
-
/** Provider that produced the line (e.g. 'plugbank', 'inter') */
|
|
578
|
-
externalSource: string;
|
|
579
|
-
/** credit = money in, debit = money out */
|
|
580
|
-
direction: TransactionDirection;
|
|
581
|
-
/** Sempre positivo — o sinal esta em `direction`. */
|
|
582
|
-
amount: number;
|
|
583
|
-
/** YYYY-MM-DD settlement date */
|
|
584
|
-
date: string;
|
|
585
|
-
description: string;
|
|
586
|
-
/** Account the line belongs to; falls back to the import's bankAccountId */
|
|
587
|
-
bankAccountId?: string;
|
|
588
|
-
/** Quando o provedor diz que efetivou, se disser. */
|
|
589
|
-
effectiveAt?: string;
|
|
590
|
-
/** O saldo do banco NESTA linha — e com ele que se confere se o extrato bate. */
|
|
591
|
-
balanceAfter?: number;
|
|
592
|
-
counterpartyName?: string;
|
|
593
|
-
counterpartyDocument?: string;
|
|
594
|
-
document?: string;
|
|
595
|
-
code?: string;
|
|
596
|
-
category?: string;
|
|
597
|
-
transactionType?: string;
|
|
598
|
-
/** O cru, porque o contrato do provedor muda sem avisar. */
|
|
599
|
-
rawPayload?: Record<string, unknown>;
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* A linha do extrato COMO ELA FICA GUARDADA — a evidencia, nao o lancamento.
|
|
603
|
-
*
|
|
604
|
-
* Ela nao e um `FinancialMovement` e a migration 112 explica por que: uma linha
|
|
605
|
-
* recem-chegada nao tem duas pernas porque ainda nao se sabe contra o que ela
|
|
606
|
-
* lanca, e `plg_financial_movements_legs_check` recusa quem nao tem. Casada, o
|
|
607
|
-
* evento economico e o movimento; aceita como avulsa, e ela mesma.
|
|
608
|
-
*/
|
|
609
|
-
export interface ImportedStatementLine extends BankStatementLine {
|
|
610
|
-
id: string;
|
|
611
|
-
tenantId?: string;
|
|
612
|
-
unitId?: string;
|
|
613
|
-
bankAccountId?: string;
|
|
614
|
-
/** O provedor tirou a linha do extrato. Ela nao some — deixa de aparecer. */
|
|
615
|
-
providerDeleted?: boolean;
|
|
616
|
-
reconciledAt?: string;
|
|
617
|
-
/** Nulo COM `reconciledAt` = aceita como avulsa. */
|
|
618
|
-
matchedMovementId?: string;
|
|
619
|
-
createdAt?: string;
|
|
620
|
-
updatedAt?: string;
|
|
621
|
-
/**
|
|
622
|
-
* De quem e o dinheiro, na linha JA conciliada — «Pagador:» numa entrada,
|
|
623
|
-
* «Fornecedor:» numa saida. Vem do lancamento casado, nao do provedor, e e
|
|
624
|
-
* o que responde «conciliei isto com o que?» sem abrir nada.
|
|
625
|
-
*/
|
|
626
|
-
matchedCounterpartyName?: string;
|
|
627
|
-
/**
|
|
628
|
-
* A conta que a linha conciliada prova, para «Ver conta» ter para onde ir.
|
|
629
|
-
*
|
|
630
|
-
* Sai do MESMO `select` que ja busca a contraparte — ele lia
|
|
631
|
-
* `financial_invoice_id` e jogava fora. Um botao desabilitado "porque nao
|
|
632
|
-
* sabemos o id" quando o id estava na resposta e uma tela mentindo sobre o
|
|
633
|
-
* que ela tem.
|
|
634
|
-
*/
|
|
635
|
-
matchedInvoiceId?: string;
|
|
636
|
-
}
|
|
637
|
-
export interface ImportBankTransactionsInput {
|
|
638
|
-
/** Default account for lines that don't carry their own */
|
|
639
|
-
bankAccountId?: string;
|
|
640
|
-
lines: BankStatementLine[];
|
|
641
|
-
}
|
|
642
|
-
export interface ImportBankTransactionsResult {
|
|
643
|
-
imported: number;
|
|
644
|
-
/** Lines skipped because they were already imported (idempotency) */
|
|
645
|
-
duplicates: number;
|
|
646
|
-
}
|
|
647
|
-
export interface UnreconciledQuery {
|
|
648
|
-
bankAccountId?: string;
|
|
649
|
-
dateRange?: DateRange;
|
|
650
|
-
}
|
|
651
|
-
/** Se a linha do extrato ja foi casada com um lancamento do sistema. */
|
|
652
|
-
export type StatementLineStatus = 'reconciled' | 'pending';
|
|
653
|
-
/**
|
|
654
|
-
* A busca da Conciliacao, com os mesmos recortes do V1: conta, periodo, tipo,
|
|
655
|
-
* status e texto livre — mais a pagina, porque um mes de extrato nao cabe numa
|
|
656
|
-
* tela e o V1 pagina de 50 em 50.
|
|
657
|
-
*/
|
|
658
|
-
export interface StatementLinesQuery {
|
|
659
|
-
bankAccountId?: string;
|
|
660
|
-
dateRange?: DateRange;
|
|
661
|
-
/** Entrada (credit) ou Saida (debit); ausente = ambos. */
|
|
662
|
-
direction?: TransactionDirection;
|
|
663
|
-
status?: StatementLineStatus;
|
|
664
|
-
/** Casa com a descricao e com o identificador do provedor. */
|
|
665
|
-
search?: string;
|
|
666
|
-
/** 1-based, como a paginacao que a tela mostra. */
|
|
667
|
-
page?: number;
|
|
668
|
-
pageSize?: number;
|
|
669
|
-
}
|
|
670
|
-
export interface StatementLinesResult {
|
|
671
|
-
rows: ImportedStatementLine[];
|
|
672
|
-
/** Total de linhas que o filtro encontrou, nao o da pagina. */
|
|
673
|
-
total: number;
|
|
674
|
-
page: number;
|
|
675
|
-
pageSize: number;
|
|
676
|
-
/**
|
|
677
|
-
* Somas **da pagina**, e o rotulo na tela diz isso com todas as letras.
|
|
678
|
-
* Foi a unica coisa da tela do V1 que evita uma leitura errada: quem troca de
|
|
679
|
-
* pagina troca os tres numeros, e quem nao sabe disso fecha o mes errado.
|
|
680
|
-
*/
|
|
681
|
-
pageCredits: number;
|
|
682
|
-
pageDebits: number;
|
|
683
|
-
pageBalance: number;
|
|
684
|
-
}
|
|
685
|
-
/** A candidate internal movement to reconcile an imported bank line against. */
|
|
686
|
-
export interface ReconciliationCandidate {
|
|
687
|
-
movement: FinancialMovement;
|
|
688
|
-
invoice?: Invoice;
|
|
689
|
-
/** 0..1 confidence from amount + date proximity */
|
|
690
|
-
score: number;
|
|
691
|
-
/** Installments in the bill, for the «1/3» column. */
|
|
692
|
-
installmentCount?: number;
|
|
693
|
-
}
|
|
694
|
-
/** Free search over the bills a statement line can settle — V1's "Vincular manualmente". */
|
|
695
|
-
export interface ReconciliationTargetQuery {
|
|
696
|
-
/** YYYY-MM-DD, on the due date */
|
|
697
|
-
dueFrom?: string;
|
|
698
|
-
dueTo?: string;
|
|
699
|
-
/** `all` = open + paid-but-not-yet-reconciled */
|
|
700
|
-
status?: 'all' | 'open' | 'paid';
|
|
701
|
-
/** Counterparty, number or description */
|
|
702
|
-
search?: string;
|
|
703
|
-
amountMin?: number;
|
|
704
|
-
amountMax?: number;
|
|
705
|
-
page?: number;
|
|
706
|
-
pageSize?: number;
|
|
707
|
-
}
|
|
708
|
-
export interface ReconciliationTargetResult {
|
|
709
|
-
data: ReconciliationCandidate[];
|
|
710
|
-
hasMore: boolean;
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* «Marcar como transferencia»: a linha do extrato nao e receita nem despesa —
|
|
714
|
-
* e dinheiro andando entre duas contas da casa.
|
|
715
|
-
*
|
|
716
|
-
* A conta do extrato e sempre uma das pontas; a outra vem do usuario. A
|
|
717
|
-
* convencao de direcao e a do V1, e ela importa: uma SAIDA no extrato (debit)
|
|
718
|
-
* significa que o dinheiro deixou a conta do extrato, entao ela e a origem.
|
|
719
|
-
* Inverter isso faz o saldo consolidado andar duas vezes no sentido errado.
|
|
720
|
-
*/
|
|
721
|
-
export interface ReconcileAsTransferInput {
|
|
722
|
-
/** A linha importada (externalSource preenchido). */
|
|
723
|
-
bankMovementId: string;
|
|
724
|
-
/** A outra ponta — conta de destino numa saida, de origem numa entrada. */
|
|
725
|
-
counterAccountId: string;
|
|
726
|
-
notes?: string;
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* «Lancar como conta»: a linha do extrato nao casa com nada porque o
|
|
730
|
-
* lancamento nunca existiu. Entao ele nasce AQUI, classificado, e a linha
|
|
731
|
-
* passa a ser a prova dele.
|
|
732
|
-
*
|
|
733
|
-
* Substitui o «aceitar como avulsa» — que, depois que a evidencia saiu do
|
|
734
|
-
* razao (migration 112), marcava a linha sem lancar nada: o dinheiro no banco
|
|
735
|
-
* e fora do livro, e o extrato deixando de bater em silencio.
|
|
736
|
-
*/
|
|
737
|
-
export interface ReconcileAsBillInput {
|
|
738
|
-
/** A linha importada. */
|
|
739
|
-
bankMovementId: string;
|
|
740
|
-
/**
|
|
741
|
-
* Saida vira conta a pagar, entrada vira conta a receber. A direcao da linha
|
|
742
|
-
* e o padrao — mas o operador corrige, porque um estorno chega como credito
|
|
743
|
-
* numa conta que e despesa.
|
|
744
|
-
*/
|
|
745
|
-
direction?: TransactionDirection;
|
|
746
|
-
/** O cadastro da contraparte, quando ela ja existe no sistema. */
|
|
747
|
-
contactId?: string;
|
|
748
|
-
/** De quem e o dinheiro — fornecedor numa saida, pagador numa entrada. */
|
|
749
|
-
contactName?: string;
|
|
750
|
-
/** O que aparece na conta; cai para a descricao do provedor. */
|
|
751
|
-
description?: string;
|
|
752
|
-
/** Plano de contas. E o que faz a conta aparecer classificada na DRE. */
|
|
753
|
-
accountId?: string;
|
|
754
|
-
costCenterId?: string;
|
|
755
|
-
/** Vencimento da conta; cai para a data da linha do extrato. */
|
|
756
|
-
dueDate?: string;
|
|
757
|
-
/**
|
|
758
|
-
* Os itens do comprovante. Vazio = uma linha so, com a descricao e o valor
|
|
759
|
-
* do extrato. Quando ha itens, a soma deles TEM de fechar com a linha: o
|
|
760
|
-
* extrato e a fonte da verdade do valor, nao o papel.
|
|
761
|
-
*/
|
|
762
|
-
items?: ReconcileBillItemInput[];
|
|
763
|
-
/**
|
|
764
|
-
* Como a conta foi paga. Ausente = quita contra a conta do extrato sem dizer
|
|
765
|
-
* a forma, que e o que o import fazia sozinho; presente = o mesmo formulario
|
|
766
|
-
* de pagamento da fatura, com forma, conta e cartao.
|
|
767
|
-
*/
|
|
768
|
-
payment?: ReconcilePaymentInput;
|
|
769
|
-
/** A foto do comprovante, quando houve uma. Viaja com o pagamento. */
|
|
770
|
-
receiptUrl?: string;
|
|
771
|
-
}
|
|
772
|
-
/** Uma linha do comprovante que virou item da conta. */
|
|
773
|
-
export interface ReconcileBillItemInput {
|
|
774
|
-
description: string;
|
|
775
|
-
quantity: number;
|
|
776
|
-
unitPrice: number;
|
|
777
|
-
/** Plano de contas do item; cai para o da conta inteira. */
|
|
778
|
-
accountId?: string;
|
|
779
|
-
costCenterId?: string;
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* Como o dinheiro andou, na forma que o formulario de pagamento da fatura ja
|
|
783
|
-
* fala. E o MESMO componente nas duas telas: uma segunda escolha de forma de
|
|
784
|
-
* pagamento seria um segundo vocabulario de dinheiro nascendo.
|
|
785
|
-
*/
|
|
786
|
-
export interface ReconcilePaymentInput {
|
|
787
|
-
paymentMethodId?: string;
|
|
788
|
-
paymentMethodTypeId?: string;
|
|
789
|
-
bankAccountId?: string;
|
|
790
|
-
cashSessionId?: string;
|
|
791
|
-
cardBrand?: string;
|
|
792
|
-
cardInstallments?: number;
|
|
793
|
-
/** Cai para a data da linha do extrato. */
|
|
794
|
-
paymentDate?: string;
|
|
795
|
-
notes?: string;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Juros, multa ou desconto que EXPLICAM a diferenca entre a linha do extrato e
|
|
799
|
-
* a conta que ela quita.
|
|
800
|
-
*
|
|
801
|
-
* O `financial_receive_payment` recusa pagar mais que o saldo em aberto
|
|
802
|
-
* (23514), e isso esta certo: uma parcela de 100 nunca foi de 112. Entao o
|
|
803
|
-
* ajuste nao vai dentro do pagamento — ele nasce como um lancamento PROPRIO,
|
|
804
|
-
* classificado, quitado na mesma data e contra a mesma conta. O balancete
|
|
805
|
-
* continua fechando e o extrato continua batendo.
|
|
806
|
-
*/
|
|
807
|
-
export interface ReconcileAdjustment {
|
|
808
|
-
type: 'interest' | 'fine' | 'discount';
|
|
809
|
-
/** Sempre positivo — o `type` diz o sinal. */
|
|
810
|
-
amount: number;
|
|
811
|
-
description?: string;
|
|
812
|
-
/** Plano de contas do ajuste. Sem ele o juros nasce sem classificacao. */
|
|
813
|
-
accountId?: string;
|
|
814
|
-
}
|
|
815
|
-
export interface ReconcileInput {
|
|
816
|
-
/** The imported bank-line movement (externalSource set) */
|
|
817
|
-
bankMovementId: string;
|
|
818
|
-
/** Internal movement to link; omit to accept the line standalone */
|
|
819
|
-
matchedMovementId?: string;
|
|
820
|
-
/**
|
|
821
|
-
* `settle` — a conta alvo esta EM ABERTO e conciliar a quita com o valor da
|
|
822
|
-
* linha. `link_only` — ela ja foi paga na mao no sistema, e conciliar so
|
|
823
|
-
* amarra a linha: criar um segundo pagamento dobraria o dinheiro.
|
|
824
|
-
*
|
|
825
|
-
* Ausente = `link_only`, que e o comportamento que esta tela sempre teve.
|
|
826
|
-
*/
|
|
827
|
-
mode?: 'settle' | 'link_only';
|
|
828
|
-
/** Como quitar, quando `mode: 'settle'`. */
|
|
829
|
-
payment?: ReconcilePaymentInput;
|
|
830
|
-
/** A diferenca entre o extrato e a conta, explicada. Ver ReconcileAdjustment. */
|
|
831
|
-
adjustments?: ReconcileAdjustment[];
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* O que a IA leu de um comprovante fotografado.
|
|
835
|
-
*
|
|
836
|
-
* O valor, a data e a conta bancaria do EXTRATO ficam travados como fonte da
|
|
837
|
-
* verdade — o papel pode estar torto, amassado ou ser de outro dia. O que o
|
|
838
|
-
* comprovante acrescenta e o que o extrato nao sabe: de quem e, o que foi
|
|
839
|
-
* comprado, e em que prateleira isso mora.
|
|
840
|
-
*/
|
|
841
|
-
export interface ReceiptReading {
|
|
842
|
-
contactName?: string;
|
|
843
|
-
/** Sugestao de plano de contas, pelo codigo ou pelo nome. */
|
|
844
|
-
accountHint?: string;
|
|
845
|
-
items?: ReconcileBillItemInput[];
|
|
846
|
-
/** O documento no papel (numero da nota, do cupom). */
|
|
847
|
-
document?: string;
|
|
848
|
-
/** O que a leitura teve de chutar ou nao conseguiu ler. */
|
|
849
|
-
warnings?: string[];
|
|
850
|
-
}
|
|
851
|
-
/** 55 = NF-e (mercadoria), 65 = NFC-e (consumidor), nfse = serviço (prefeitura). */
|
|
852
|
-
export type NotaFiscalModel = 'nfe' | 'nfce' | 'nfse';
|
|
853
|
-
export type NotaFiscalStatus = 'draft' | 'processing' | 'issued' | 'cancelled' | 'error';
|
|
854
|
-
export interface NotaFiscal {
|
|
855
|
-
id: string;
|
|
856
|
-
tenantId: string;
|
|
857
|
-
model: NotaFiscalModel;
|
|
858
|
-
status: NotaFiscalStatus;
|
|
859
|
-
/** Número da nota — null while draft (assigned on issue). */
|
|
860
|
-
number: string | null;
|
|
861
|
-
series: string | null;
|
|
862
|
-
/** Order this nota documents (plg_shop_orders / orders id), if any. */
|
|
863
|
-
orderId?: string;
|
|
864
|
-
contactId?: string;
|
|
865
|
-
contactName?: string;
|
|
866
|
-
totalAmount: number;
|
|
867
|
-
issuedAt?: string;
|
|
868
|
-
/** Chave de acesso (44 dígitos), when authorized. */
|
|
869
|
-
accessKey?: string;
|
|
870
|
-
/** Links to the authorized XML and the DANFE/DANFCE PDF. */
|
|
871
|
-
xmlUrl?: string;
|
|
872
|
-
danfeUrl?: string;
|
|
873
|
-
/** External emissor id (focusnfe | nfeio | plugnotas | manual). */
|
|
874
|
-
emissor?: string;
|
|
875
|
-
errorMessage?: string;
|
|
876
|
-
observations?: string;
|
|
877
|
-
metadata?: Record<string, unknown>;
|
|
878
|
-
createdAt: string;
|
|
879
|
-
updatedAt: string;
|
|
880
|
-
}
|
|
881
|
-
export interface CreateNotaFiscalInput {
|
|
882
|
-
model?: NotaFiscalModel;
|
|
883
|
-
orderId?: string;
|
|
884
|
-
contactId?: string;
|
|
885
|
-
contactName?: string;
|
|
886
|
-
totalAmount: number;
|
|
887
|
-
series?: string;
|
|
888
|
-
observations?: string;
|
|
889
|
-
}
|
|
890
|
-
export interface NotaFiscalQuery {
|
|
891
|
-
status?: NotaFiscalStatus | NotaFiscalStatus[];
|
|
892
|
-
model?: NotaFiscalModel;
|
|
893
|
-
orderId?: string;
|
|
894
|
-
search?: string;
|
|
895
|
-
page?: number;
|
|
896
|
-
pageSize?: number;
|
|
897
|
-
}
|
|
898
|
-
/** Uma comissão apurada, com a venda que a originou (009). */
|
|
899
|
-
export interface CommissionEntry {
|
|
900
|
-
id: string;
|
|
901
|
-
personId: string;
|
|
902
|
-
personName?: string | null;
|
|
903
|
-
itemId: string;
|
|
904
|
-
itemName?: string | null;
|
|
905
|
-
orderId?: string | null;
|
|
906
|
-
invoiceId?: string | null;
|
|
907
|
-
invoiceNumber?: string | null;
|
|
908
|
-
competenceDate?: string | null;
|
|
909
|
-
ruleName?: string | null;
|
|
910
|
-
functionName?: string | null;
|
|
911
|
-
baseAmount: number;
|
|
912
|
-
rate: number;
|
|
913
|
-
amount: number;
|
|
914
|
-
share: number;
|
|
915
|
-
role?: string | null;
|
|
916
|
-
status: 'pending' | 'approved' | 'paid' | 'cancelled';
|
|
917
|
-
}
|
|
918
|
-
/** Os nove do V1. Os que o motor ainda não honra estão em UNENFORCED_CRITERIA. */
|
|
919
|
-
export type CommissionCriteriaType = 'service' | 'category' | 'professional' | 'professional_group' | 'profession' | 'unit' | 'payment_method_type' | 'weekday' | 'time_range';
|
|
920
|
-
/**
|
|
921
|
-
* Quatro dos nove não restringem a apuração (009 + 021):
|
|
922
|
-
* `profession` e `professional_group` não têm cadastro no V2 para onde apontar,
|
|
923
|
-
* e `payment_method_type` só se conhece quando o pagamento acontece — depois de
|
|
924
|
-
* a linha nascer, que é quando a regra é resolvida.
|
|
925
|
-
*
|
|
926
|
-
* A tela DIZ isso em vez de oferecer um controle que não faz nada: um critério
|
|
927
|
-
* que parece configurado e é ignorado custa um mês de comissão errada.
|
|
928
|
-
*/
|
|
929
|
-
export declare const UNENFORCED_CRITERIA: CommissionCriteriaType[];
|
|
930
|
-
export interface CommissionRuleCriteria {
|
|
931
|
-
id?: string;
|
|
932
|
-
criteriaType: CommissionCriteriaType;
|
|
933
|
-
/** `{ids:[…]}` para listas, `{days:[0..6]}` para dias, `{ranges:[{from,to}]}` para horários. */
|
|
934
|
-
criteriaValue: Record<string, unknown>;
|
|
935
|
-
}
|
|
936
|
-
/** Uma faixa de produção. `to` vazio = sem limite; paga `fixed` OU `percent`. */
|
|
937
|
-
export interface CommissionTier {
|
|
938
|
-
from: number;
|
|
939
|
-
to?: number | null;
|
|
940
|
-
fixed?: number | null;
|
|
941
|
-
percent?: number | null;
|
|
942
|
-
}
|
|
943
|
-
export interface CommissionFunction {
|
|
944
|
-
id?: string;
|
|
945
|
-
ruleId?: string;
|
|
946
|
-
functionName: string;
|
|
947
|
-
accountType: 'professional_executor' | 'professional' | 'supplier' | 'select_on_launch';
|
|
948
|
-
personId?: string | null;
|
|
949
|
-
valueType: 'percentage' | 'fixed';
|
|
950
|
-
valueAmount: number;
|
|
951
|
-
calculationBase: 'total' | 'net';
|
|
952
|
-
tierMode: 'none' | 'marginal' | 'retroactive' | 'guaranteed_min';
|
|
953
|
-
minGuaranteed?: number | null;
|
|
954
|
-
tiers: CommissionTier[];
|
|
955
|
-
isVariable: boolean;
|
|
956
|
-
displayOrder: number;
|
|
957
|
-
isActive: boolean;
|
|
958
|
-
}
|
|
959
|
-
export interface CommissionRule {
|
|
960
|
-
id: string;
|
|
961
|
-
name: string;
|
|
962
|
-
description?: string | null;
|
|
963
|
-
priority: number;
|
|
964
|
-
isDefault: boolean;
|
|
965
|
-
isActive: boolean;
|
|
966
|
-
unitId?: string | null;
|
|
967
|
-
/** Herdados da 003; hoje só semeiam a função padrão quando a regra não tem nenhuma (020). */
|
|
968
|
-
valueType: 'percentage' | 'fixed';
|
|
969
|
-
value: number;
|
|
970
|
-
criteria: CommissionRuleCriteria[];
|
|
971
|
-
functions: CommissionFunction[];
|
|
972
|
-
}
|
|
973
|
-
export interface CommissionRuleInput {
|
|
974
|
-
id?: string;
|
|
975
|
-
name: string;
|
|
976
|
-
description?: string | null;
|
|
977
|
-
priority: number;
|
|
978
|
-
isDefault?: boolean;
|
|
979
|
-
isActive?: boolean;
|
|
980
|
-
unitId?: string | null;
|
|
981
|
-
criteria?: CommissionRuleCriteria[];
|
|
982
|
-
}
|
|
983
|
-
/** Os cadastros para onde os critérios apontam, numa carga só. */
|
|
984
|
-
export interface CommissionCatalogs {
|
|
985
|
-
services: {
|
|
986
|
-
id: string;
|
|
987
|
-
name: string;
|
|
988
|
-
categoryId?: string | null;
|
|
989
|
-
}[];
|
|
990
|
-
categories: {
|
|
991
|
-
id: string;
|
|
992
|
-
name: string;
|
|
993
|
-
}[];
|
|
994
|
-
professionals: {
|
|
995
|
-
id: string;
|
|
996
|
-
name: string;
|
|
997
|
-
}[];
|
|
998
|
-
units: {
|
|
999
|
-
id: string;
|
|
1000
|
-
name: string;
|
|
1001
|
-
}[];
|
|
1002
|
-
}
|
|
1003
|
-
/** Um mês do ano da unidade: os três degraus e o realizado do livro. */
|
|
1004
|
-
export interface GoalMonth {
|
|
1005
|
-
goalId?: string | null;
|
|
1006
|
-
unitId: string;
|
|
1007
|
-
year: number;
|
|
1008
|
-
month: number;
|
|
1009
|
-
targetAmount: number;
|
|
1010
|
-
superAmount: number;
|
|
1011
|
-
hyperAmount: number;
|
|
1012
|
-
achievedAmount: number;
|
|
1013
|
-
targetPercent: number;
|
|
1014
|
-
superPercent: number;
|
|
1015
|
-
hyperPercent: number;
|
|
1016
|
-
notes?: string | null;
|
|
1017
|
-
}
|
|
1018
|
-
export interface SaveGoalInput {
|
|
1019
|
-
id?: string;
|
|
1020
|
-
unitId: string;
|
|
1021
|
-
year: number;
|
|
1022
|
-
month: number;
|
|
1023
|
-
targetAmount: number;
|
|
1024
|
-
superAmount: number;
|
|
1025
|
-
hyperAmount: number;
|
|
1026
|
-
notes?: string | null;
|
|
1027
|
-
}
|
|
1028
|
-
/** O estado que a casa fala, não o enum da loja. */
|
|
1029
|
-
export type GiftCardState = 'issued' | 'active' | 'redeemed' | 'expired' | 'revoked';
|
|
1030
|
-
/** Um vale-presente como o Financeiro o lê: valor de face e saldo SEPARADOS. */
|
|
1031
|
-
export interface GiftCard {
|
|
1032
|
-
id: string;
|
|
1033
|
-
/** Dezesseis dígitos, como cartão. Um título ao portador. */
|
|
1034
|
-
code: string;
|
|
1035
|
-
/** O de face, gravado na emissão. Nunca muda. */
|
|
1036
|
-
faceValue: number;
|
|
1037
|
-
/** O que resta. `null` = nunca ativado — que não é a mesma coisa que zero. */
|
|
1038
|
-
balance: number | null;
|
|
1039
|
-
state: GiftCardState;
|
|
1040
|
-
currency: string;
|
|
1041
|
-
issuedAt: string;
|
|
1042
|
-
expiresAt: string | null;
|
|
1043
|
-
activatedAt: string | null;
|
|
1044
|
-
note: string | null;
|
|
1045
|
-
customerEmail: string | null;
|
|
1046
|
-
}
|
|
1047
|
-
export interface IssueGiftCardsInput {
|
|
1048
|
-
quantity: number;
|
|
1049
|
-
/** O mesmo para todos: um lote é uniforme. */
|
|
1050
|
-
unitAmount: number;
|
|
1051
|
-
/** Vazio = não expira. */
|
|
1052
|
-
expiresAt?: string | null;
|
|
1053
|
-
note?: string | null;
|
|
1054
|
-
}
|
|
1055
|
-
export interface GiftCardQuery {
|
|
1056
|
-
search?: string;
|
|
1057
|
-
state?: GiftCardState;
|
|
1058
|
-
minValue?: number;
|
|
1059
|
-
maxValue?: number;
|
|
1060
|
-
issuedFrom?: string;
|
|
1061
|
-
issuedTo?: string;
|
|
1062
|
-
}
|
|
1063
|
-
/** Um fechamento de caixa na fila de conferência. */
|
|
1064
|
-
export interface CashSessionReview {
|
|
1065
|
-
sessionId: string;
|
|
1066
|
-
unitId?: string | null;
|
|
1067
|
-
openedAt?: string | null;
|
|
1068
|
-
closedAt?: string | null;
|
|
1069
|
-
openedByName?: string | null;
|
|
1070
|
-
closedByName?: string | null;
|
|
1071
|
-
closedByUserId?: string | null;
|
|
1072
|
-
openingBalance: number;
|
|
1073
|
-
closingBalance: number;
|
|
1074
|
-
difference: number;
|
|
1075
|
-
reviewStatus: 'pending' | 'approved' | 'rejected';
|
|
1076
|
-
reviewedAt?: string | null;
|
|
1077
|
-
reviewerName?: string | null;
|
|
1078
|
-
reviewNotes?: string | null;
|
|
1079
|
-
}
|
|
1080
|
-
export interface CommissionQuery {
|
|
1081
|
-
periodStart?: string;
|
|
1082
|
-
periodEnd?: string;
|
|
1083
|
-
personId?: string;
|
|
1084
|
-
status?: string;
|
|
1085
|
-
}
|
|
1086
|
-
export interface GenerateCommissionsInput {
|
|
1087
|
-
periodStart: string;
|
|
1088
|
-
periodEnd: string;
|
|
1089
|
-
unitId?: string;
|
|
1090
|
-
}
|
|
1091
|
-
/** O lote apurado: é por ele que se aprova e se levanta o borderô. */
|
|
1092
|
-
export interface CommissionGeneration {
|
|
1093
|
-
id: string;
|
|
1094
|
-
periodStart: string;
|
|
1095
|
-
periodEnd: string;
|
|
1096
|
-
status: 'draft' | 'approved' | 'paid' | 'cancelled';
|
|
1097
|
-
total: number;
|
|
1098
|
-
entries: number;
|
|
1099
|
-
}
|
|
1100
|
-
export interface CommissionApproveResult {
|
|
1101
|
-
generationId: string;
|
|
1102
|
-
approved: number;
|
|
1103
|
-
}
|
|
1104
|
-
export interface CommissionPayRunResult {
|
|
1105
|
-
generationId: string;
|
|
1106
|
-
payables: number;
|
|
1107
|
-
total: number;
|
|
1108
|
-
dueDate: string;
|
|
1109
|
-
}
|
|
1110
|
-
export interface CommissionGenerationResult {
|
|
1111
|
-
generationId: string;
|
|
1112
|
-
entries: number;
|
|
1113
|
-
total: number;
|
|
1114
|
-
}
|
|
1115
|
-
/** A competência mensal e seu estado (006). */
|
|
1116
|
-
export interface FinancialPeriod {
|
|
1117
|
-
id: string;
|
|
1118
|
-
competenceMonth: string;
|
|
1119
|
-
status: 'open' | 'closed';
|
|
1120
|
-
closedAt?: string | null;
|
|
1121
|
-
reopenReason?: string | null;
|
|
1122
|
-
}
|
|
1123
|
-
/** Uma conta do balancete: débito, crédito e saldo (006). */
|
|
1124
|
-
export interface TrialBalanceRow {
|
|
1125
|
-
accountId: string;
|
|
1126
|
-
accountCode?: string | null;
|
|
1127
|
-
accountName?: string | null;
|
|
1128
|
-
competenceMonth: string;
|
|
1129
|
-
totalDebit: number;
|
|
1130
|
-
totalCredit: number;
|
|
1131
|
-
balance: number;
|
|
1132
|
-
}
|
|
1133
|
-
/** Saldo em aberto por faixa de atraso (016). */
|
|
1134
|
-
export interface AgingRow {
|
|
1135
|
-
installmentId: string;
|
|
1136
|
-
invoiceNumber?: string | null;
|
|
1137
|
-
counterpartyName?: string | null;
|
|
1138
|
-
dueDate: string;
|
|
1139
|
-
balance: number;
|
|
1140
|
-
daysOverdue: number;
|
|
1141
|
-
bucket: 'current' | 'd1_15' | 'd16_30' | 'd31_60' | 'd61_90' | 'd90_plus';
|
|
1142
|
-
}
|
|
1143
|
-
/** Receita − CMV − comissão, por mês (015). */
|
|
1144
|
-
export interface MarginRow {
|
|
1145
|
-
competenceMonth: string;
|
|
1146
|
-
revenue: number;
|
|
1147
|
-
cogs: number;
|
|
1148
|
-
commission: number;
|
|
1149
|
-
margin: number;
|
|
1150
|
-
marginPercent: number;
|
|
1151
|
-
}
|
|
1152
|
-
export type RecurringBillDirection = 'payable' | 'receivable';
|
|
1153
|
-
export type RecurringBillFrequency = 'weekly' | 'monthly' | 'quarterly' | 'yearly';
|
|
1154
|
-
/** A rule that creates one financial title per competence when explicitly run. */
|
|
1155
|
-
export interface RecurringBill {
|
|
1156
|
-
id: string;
|
|
1157
|
-
direction: RecurringBillDirection;
|
|
1158
|
-
description: string;
|
|
1159
|
-
counterpartyPersonId?: string | null;
|
|
1160
|
-
counterpartyName?: string | null;
|
|
1161
|
-
amount: number;
|
|
1162
|
-
items: CreateInvoiceItemInput[];
|
|
1163
|
-
unitId?: string | null;
|
|
1164
|
-
chartAccountId?: string | null;
|
|
1165
|
-
costCenterId?: string | null;
|
|
1166
|
-
frequency: RecurringBillFrequency;
|
|
1167
|
-
dueDay: number;
|
|
1168
|
-
startsOn: string;
|
|
1169
|
-
endsOn?: string | null;
|
|
1170
|
-
isActive: boolean;
|
|
1171
|
-
notes?: string | null;
|
|
1172
|
-
createdAt: string;
|
|
1173
|
-
updatedAt: string;
|
|
1174
|
-
}
|
|
1175
|
-
export interface SaveRecurringBillInput {
|
|
1176
|
-
id?: string;
|
|
1177
|
-
direction: RecurringBillDirection;
|
|
1178
|
-
description: string;
|
|
1179
|
-
counterpartyPersonId: string;
|
|
1180
|
-
amount: number;
|
|
1181
|
-
items: CreateInvoiceItemInput[];
|
|
1182
|
-
unitId?: string | null;
|
|
1183
|
-
chartAccountId?: string | null;
|
|
1184
|
-
costCenterId?: string | null;
|
|
1185
|
-
frequency: RecurringBillFrequency;
|
|
1186
|
-
dueDay: number;
|
|
1187
|
-
startsOn: string;
|
|
1188
|
-
endsOn?: string | null;
|
|
1189
|
-
isActive?: boolean;
|
|
1190
|
-
notes?: string | null;
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* A posição financeira de um CLIENTE, que é a pergunta que a recepção faz com a
|
|
1194
|
-
* pessoa na frente dela — e não a de um atendimento isolado.
|
|
1195
|
-
*
|
|
1196
|
-
* `paidToExecute` (o "pago a executar" do V1) é o valor já recebido de serviço
|
|
1197
|
-
* ainda não prestado: num salão isso é PASSIVO, não receita. Fica opcional
|
|
1198
|
-
* porque o V2 ainda não tem o eixo de EXECUÇÃO — modela pagamento e não modela
|
|
1199
|
-
* entrega —, e um zero fixo ali mentiria sobre uma dívida.
|
|
1200
|
-
*/
|
|
1201
|
-
export interface ClientAccount {
|
|
1202
|
-
personId: string;
|
|
1203
|
-
contracted: number;
|
|
1204
|
-
paid: number;
|
|
1205
|
-
open: number;
|
|
1206
|
-
paidToExecute?: number;
|
|
1207
|
-
/**
|
|
1208
|
-
* Contratado, ainda não executado e ainda não pago. Irmão do `paidToExecute`:
|
|
1209
|
-
* um é dívida da casa (recebeu e deve prestar), o outro é dívida do cliente
|
|
1210
|
-
* (vai receber quando prestar). Somar os dois num só número apagaria de que
|
|
1211
|
-
* lado está o risco.
|
|
1212
|
-
*/
|
|
1213
|
-
openToExecute?: number;
|
|
1214
|
-
credits?: number;
|
|
1215
|
-
invoices: ClientAccountInvoice[];
|
|
1216
|
-
}
|
|
1217
|
-
export interface ClientAccountInvoice {
|
|
1218
|
-
id: string;
|
|
1219
|
-
number: string | null;
|
|
1220
|
-
orderId: string | null;
|
|
1221
|
-
competenceDate: string | null;
|
|
1222
|
-
total: number;
|
|
1223
|
-
paid: number;
|
|
1224
|
-
balance: number;
|
|
1225
|
-
status: string;
|
|
1226
|
-
description: string | null;
|
|
1227
|
-
}
|
|
1228
|
-
/**
|
|
1229
|
-
* Uma parcela de cartão a receber, com o que a adquirente vai reter.
|
|
1230
|
-
*
|
|
1231
|
-
* O V1 nunca construiu esta tela — "Cartões de Recebimento: funcionalidade em
|
|
1232
|
-
* desenvolvimento". Mas o dado existe desde o primeiro pagamento em cartão, e é
|
|
1233
|
-
* a resposta para a pergunta que um salão faz toda semana: quanto entra, quando,
|
|
1234
|
-
* e quanto a máquina fica.
|
|
1235
|
-
*/
|
|
1236
|
-
export interface CardReceivable {
|
|
1237
|
-
movementId: string;
|
|
1238
|
-
accountName: string | null;
|
|
1239
|
-
cardBrand: string | null;
|
|
1240
|
-
cardInstallments: number;
|
|
1241
|
-
installmentK: number;
|
|
1242
|
-
paymentDate: string;
|
|
1243
|
-
gross: number;
|
|
1244
|
-
feeRate: number | null;
|
|
1245
|
-
fee: number;
|
|
1246
|
-
net: number;
|
|
1247
|
-
settlementDate: string;
|
|
1248
|
-
/** Sem taxa cadastrada a projeção é o BRUTO, e isso precisa aparecer. */
|
|
1249
|
-
missingFeeConfig: boolean;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Um recibo preso a uma conta.
|
|
1253
|
-
*
|
|
1254
|
-
* `pending` diz que a LINHA atravessou do V1 e os BYTES ainda não — o arquivo
|
|
1255
|
-
* existe, está no storage do V1, e o link daqui ainda não abre. É melhor
|
|
1256
|
-
* mostrar o nome com a ressalva do que esconder: quem precisa do comprovante
|
|
1257
|
-
* fica sabendo que ele existe e onde procurar.
|
|
1258
|
-
*/
|
|
1259
|
-
export interface InvoiceAttachment {
|
|
1260
|
-
id: string;
|
|
1261
|
-
fileName: string;
|
|
1262
|
-
fileSize?: number;
|
|
1263
|
-
mimeType?: string;
|
|
1264
|
-
url?: string;
|
|
1265
|
-
pending: boolean;
|
|
1266
|
-
createdAt?: string;
|
|
1267
|
-
}
|
|
1268
|
-
/** What a payee needs before the bank accepts a line paying them. */
|
|
1269
|
-
export interface CnabPayeeRecord {
|
|
1270
|
-
/** `people.id` — where the document and the account are saved back. */
|
|
1271
|
-
contactId: string;
|
|
1272
|
-
name: string;
|
|
1273
|
-
/** `people.document_number`. */
|
|
1274
|
-
document: string;
|
|
1275
|
-
/** The default row of `public.payee_accounts`, when there is one. */
|
|
1276
|
-
payeeAccountId?: string;
|
|
1277
|
-
bankCode?: string;
|
|
1278
|
-
bankName?: string;
|
|
1279
|
-
agencyNumber?: string;
|
|
1280
|
-
agencyDigit?: string;
|
|
1281
|
-
accountNumber?: string;
|
|
1282
|
-
accountDigit?: string;
|
|
1283
|
-
accountType?: string;
|
|
1284
|
-
pixKey?: string;
|
|
1285
|
-
pixKeyType?: string;
|
|
1286
|
-
street?: string;
|
|
1287
|
-
number?: string;
|
|
1288
|
-
complement?: string;
|
|
1289
|
-
district?: string;
|
|
1290
|
-
city?: string;
|
|
1291
|
-
state?: string;
|
|
1292
|
-
postalCode?: string;
|
|
1293
|
-
}
|
|
1294
|
-
/** Everything the remittance wizard needs that is not already on screen. */
|
|
1295
|
-
export interface CnabContext {
|
|
1296
|
-
/**
|
|
1297
|
-
* A empresa que paga — `public.company_legal_entities`, da unidade da conta.
|
|
1298
|
-
*
|
|
1299
|
-
* Vem SEMPRE, mesmo sem cadastro: `id` nulo diz que a linha ainda não existe
|
|
1300
|
-
* e `name` cai no nome da unidade, para a tela abrir com algo escrito em vez
|
|
1301
|
-
* de dois campos vazios. O CNPJ digitado então CRIA a linha (`saveCompany`),
|
|
1302
|
-
* e a próxima remessa já o encontra.
|
|
1303
|
-
*/
|
|
1304
|
-
company: {
|
|
1305
|
-
id?: string;
|
|
1306
|
-
unitId?: string;
|
|
1307
|
-
name: string;
|
|
1308
|
-
document: string;
|
|
1309
|
-
};
|
|
1310
|
-
/** NSA of the next file for this account. Repeating one is a rejected remittance. */
|
|
1311
|
-
nextSequence: number;
|
|
1312
|
-
payees: CnabPayeeRecord[];
|
|
1313
|
-
}
|
|
1314
|
-
/** A empresa pagadora, cadastrada de dentro da remessa por falta de outra porta. */
|
|
1315
|
-
export interface SaveCompanyInput {
|
|
1316
|
-
id?: string;
|
|
1317
|
-
unitId?: string;
|
|
1318
|
-
name: string;
|
|
1319
|
-
document: string;
|
|
1320
|
-
}
|
|
1321
|
-
/** The payee data the wizard collected, saved back so the next file reuses it. */
|
|
1322
|
-
export interface SaveCnabPayeeInput {
|
|
1323
|
-
contactId: string;
|
|
1324
|
-
payeeAccountId?: string;
|
|
1325
|
-
document?: string;
|
|
1326
|
-
bankCode?: string;
|
|
1327
|
-
bankName?: string;
|
|
1328
|
-
agencyNumber?: string;
|
|
1329
|
-
agencyDigit?: string;
|
|
1330
|
-
accountNumber?: string;
|
|
1331
|
-
accountDigit?: string;
|
|
1332
|
-
accountType?: string;
|
|
1333
|
-
pixKey?: string;
|
|
1334
|
-
pixKeyType?: string;
|
|
1335
|
-
}
|
|
1336
|
-
export interface RecordCnabBatchInput {
|
|
1337
|
-
bankAccountId: string;
|
|
1338
|
-
unitId?: string;
|
|
1339
|
-
layout: string;
|
|
1340
|
-
sequenceNumber: number;
|
|
1341
|
-
totalAmount: number;
|
|
1342
|
-
fileName: string;
|
|
1343
|
-
fileContent: string;
|
|
1344
|
-
items: Array<{
|
|
1345
|
-
/** The installment this line paid. */
|
|
1346
|
-
movementId: string;
|
|
1347
|
-
paymentForm: string;
|
|
1348
|
-
paymentDate: string;
|
|
1349
|
-
amount: number;
|
|
1350
|
-
}>;
|
|
1351
|
-
}
|
|
1352
|
-
/** Uma instituição do catálogo do Bacen — `public.banks` (migration 167). */
|
|
1353
|
-
export interface BankCatalogEntry {
|
|
1354
|
-
/** COMPE de 3 dígitos: o que vai no boleto e no CNAB. Nulo em quem só é PIX. */
|
|
1355
|
-
compe?: string;
|
|
1356
|
-
ispb: string;
|
|
1357
|
-
name: string;
|
|
1358
|
-
legalName?: string;
|
|
1359
|
-
brandColor?: string;
|
|
1360
|
-
logoUrl?: string;
|
|
1361
|
-
}
|
|
1362
|
-
//# sourceMappingURL=types.d.ts.map
|