Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/MultiSas/llms.txt

Use this file to discover all available pages before exploring further.

The briefcase module manages invoices and accounts receivable (cartera). An invoice ties together an order (pedido) and a client, records total and balance amounts, and tracks payment history. Use these endpoints to generate client-facing invoices and log payments against them — the invoice balance decrements with each recorded payment and the status updates automatically.
All briefcase endpoints require TokenAny plus TokenAuthorize('Admin', 'Super Admin'). Pass your token using token-access: Bearer $TOKEN.

POST /api/briefcase/invoice/:company_id/:pedido_id/:client_id

Creates an invoice (factura) linked to a specific order and client. The total and balance are derived from pedido.price_pedido; the total body field is accepted but the controller reads the price directly from the pedido record. Path parameters
company_id
string
required
MongoDB ObjectId of the company issuing the invoice.
pedido_id
string
required
MongoDB ObjectId of the order being invoiced.
client_id
string
required
MongoDB ObjectId of the client receiving the invoice.
Body parameters
issue_date
string
required
Invoice issue date (ISO 8601 date string, e.g., "2024-08-15").
due_date
string
required
Invoice payment due date (ISO 8601 date string, e.g., "2024-09-15").
is_credit
boolean
Whether this invoice is issued on credit (true) or collected immediately (false). Defaults to false.
Response
msj
string
"Factura generada exitosamente" on success.
status
boolean
true on success.
save_invoice
object
The created invoice document.
curl -X POST https://api.example.com/api/briefcase/invoice/64a1f2e3b5c8d90012345678/64d4c5e6f8a9b00045678901/64b2a3c4d6e7f80023456789 \
  -H "token-access: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "issue_date": "2024-08-15",
    "due_date": "2024-09-15",
    "is_credit": true
  }'
{
  "msj": "Factura generada exitosamente",
  "status": true,
  "save_invoice": {
    "_id": "64e5d6f7a8b9c00056789012",
    "company": "64a1f2e3b5c8d90012345678",
    "client": "64b2a3c4d6e7f80023456789",
    "pedido": {
      "_id": "64d4c5e6f8a9b00045678901",
      "bill_counter": "PD-0001",
      "date_pedido": "15/7/2024",
      "hour_pedido": "10:45:30 a. m.",
      "quantity_pedido": "10",
      "price_pedido": "350000"
    },
    "total": 350000,
    "balance": 350000,
    "status": "Pendiente",
    "issue_date": "2024-08-15T00:00:00.000Z",
    "due_date": "2024-09-15T00:00:00.000Z",
    "is_credit": true
  }
}

POST /api/briefcase/record/:company_id/payments/:invoice_id

Records a payment against an existing invoice. The invoice’s balance is decremented by amount. If balance reaches zero or below, status is set to "Pagado". If the balance remains positive but the current date exceeds due_date, status is set to "Atrasado". Path parameters
company_id
string
required
MongoDB ObjectId of the company.
invoice_id
string
required
MongoDB ObjectId of the invoice to record a payment against.
Body parameters
amount
number
required
Payment amount being applied to the invoice balance.
method
string
required
Payment method (e.g., Efectivo, Transferencia, Tarjeta de credito).
Response
msj
string
"Pago registrado exitosamente" on success.
status
boolean
true on success.
save_payment
object
The created payment record with company, invoice, client, amount, and method.
save_invoice
object
The updated invoice document reflecting the new balance and status.
curl -X POST https://api.example.com/api/briefcase/record/64a1f2e3b5c8d90012345678/payments/64e5d6f7a8b9c00056789012 \
  -H "token-access: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 175000,
    "method": "Transferencia"
  }'
{
  "msj": "Pago registrado exitosamente",
  "status": true,
  "save_payment": {
    "_id": "64f6e7f8a9b0c00167890123",
    "company": "64a1f2e3b5c8d90012345678",
    "invoice": "64e5d6f7a8b9c00056789012",
    "client": "64b2a3c4d6e7f80023456789",
    "amount": 175000,
    "method": "Transferencia"
  },
  "save_invoice": {
    "_id": "64e5d6f7a8b9c00056789012",
    "balance": 175000,
    "status": "Pendiente"
  }
}

GET /api/briefcase/:company_id

Returns a paginated list of all invoices for a company, sorted by most recent first. Pagination is handled by the Paginate middleware; pass pag and perpage as query parameters. Path parameters
company_id
string
required
MongoDB ObjectId of the company.
Response
msj
string
"Cargando cartera" on success.
status
boolean
true on success.
data
array
Array of invoice documents for the current page, sorted by _id descending. Each document contains _id, company, client, pedido, total, balance, status, issue_date, due_date, is_credit, createdAt, and updatedAt.
pagination
object
curl -X GET "https://api.example.com/api/briefcase/64a1f2e3b5c8d90012345678?pag=1&perpage=10" \
  -H "token-access: Bearer $TOKEN"
{
  "msj": "Cargando cartera",
  "status": true,
  "data": [
    {
      "_id": "64e5d6f7a8b9c00056789012",
      "company": "64a1f2e3b5c8d90012345678",
      "client": "64b2a3c4d6e7f80023456789",
      "pedido": {
        "_id": "64d4c5e6f8a9b00045678901",
        "bill_counter": "PD-0001",
        "price_pedido": "350000"
      },
      "total": 350000,
      "balance": 175000,
      "status": "Pendiente",
      "issue_date": "2024-08-15T00:00:00.000Z",
      "due_date": "2024-09-15T00:00:00.000Z",
      "is_credit": true
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 1
  }
}

Invoice Status Reference

StatusDescription
PendienteInvoice issued but not yet fully paid
PagadoInvoice fully paid (balance reached zero)
AtrasadoBalance remains but due date has passed

Build docs developers (and LLMs) love