Skip to main content

Reimbursement Mutations

CreateReembolsoA

Create a new reimbursement request. Mutation:
mutation {
  createReembolsoA(value: {
    id_catalogo: 5
    cedula: "1234567890"
    nombres: "Juan"
    apellidos: "Pérez"
    correo: "[email protected]"
    localidad: "Quito"
    area: "Ventas"
    desde: "2024-03-01"
    hasta: "2024-03-05"
    descripcion: "Viaje de negocios a reunión con cliente"
    id_aprobador: 10
    id_compania: 1
    id_creador: 5
    idAnticipos: "123,456"
    estado: "INGRESADO"
    director: "María González"
  }) {
    idReembolso
    nombres
    apellidos
    estado
    fechaCreacion
  }
}
Parameters:
Catalog ID for reimbursement classification/type
cedula
string
required
Employee identification number (ID card)
nombres
string
required
Employee first name(s)
apellidos
string
required
Employee last name(s)
correo
string
required
Employee email address
localidad
string
required
Location/city where expenses were incurred
area
string
required
Department or business area
desde
datetime
Start date of the trip or expense period
hasta
datetime
End date of the trip or expense period
descripcion
string
required
Detailed description of the reimbursement purpose
id_aprobador
integer
required
User ID of the designated approver
id_compania
integer
required
Company ID (for multi-company support)
id_creador
integer
required
User ID of the employee creating the request
idAnticipos
string
Comma-separated list of related advance payment IDs
estado
string
required
Initial status (typically “INGRESADO” for new requests)
director
string
Name of the director in the approval chain
Response:
idReembolso
integer
Unique identifier assigned to the new reimbursement
fechaCreacion
datetime
Timestamp when the reimbursement was created (UTC-5)
Notes:
  • The fechaCreacion field is automatically set to the current timestamp (UTC-5)
  • All other provided fields are stored as-is
Source: Schema/Mutation/Mutation.cs:2220-2246

UpdateReembolso

Update an existing reimbursement request. Mutation:
mutation {
  updateReembolso(reembolso: {
    idReembolso: 123
    id_catalogo: 5
    cedula: "1234567890"
    nombres: "Juan"
    apellidos: "Pérez"
    correo: "[email protected]"
    localidad: "Quito"
    area: "Ventas"
    desde: "2024-03-01"
    hasta: "2024-03-05"
    descripcion: "Viaje actualizado"
    id_aprobador: 10
    id_compania: 1
    id_creador: 5
    idAnticipos: "123"
    fechaCreacion: "2024-03-01T10:00:00"
    estado: "EN_VALIDACIÓN"
    observaciones: "Documentos actualizados"
  }) {
    idReembolso
    estado
    observaciones
  }
}
Parameters:
idReembolso
integer
required
The ID of the reimbursement to update
id_catalogo
integer
Updated catalog classification
estado
string
Updated status (INGRESADO, EN_VALIDACIÓN, APROBADO, RECHAZADO, DEVUELTO)
observaciones
string
Additional notes or comments
Response: Returns the updated reimbursement object. Error Handling:
  • Returns IndReReembolsoDTO_NOT_FOUND error if the reimbursement ID doesn’t exist
Source: Schema/Mutation/Mutation.cs:3471-3499

UpdateReembolsoIngreso

Update a reimbursement and trigger notification email. Mutation:
mutation {
  updateReembolsoIngreso(
    reembolso: {
      idReembolso: 123
      estado: "APROBADO"
      # ... other fields
    }
    nombre: "Juan Pérez"
    motivo: "Aprobación de reembolso"
    valor: "$250.00"
    correo: "[email protected]"
  ) {
    idReembolso
    estado
  }
}
Parameters:
reembolso
IndReReembolsoDTO
required
Complete reimbursement object with updates
nombre
string
required
Name of the person processing the update
motivo
string
required
Reason for the update/status change
valor
string
required
Total value of the reimbursement
correo
string
required
Email address for notification
Response: Returns the updated reimbursement object. Notes:
  • This mutation updates the reimbursement and sends an automated email notification
  • Generates a PDF report of the reimbursement
  • Used for status transitions that require stakeholder notification
Source: Schema/Mutation/Mutation.cs:3501-3530

Expense Detail Mutations

CreateDetallesA

Create multiple expense details for a reimbursement request. Mutation:
mutation {
  createDetallesA(detalles: [
    {
      id_tipo_gasto: 15
      id_reembolso: 123
      fechaRegistro: "2024-03-01T10:00:00"
      fechaEmision: "2024-02-28"
      totalFactura: 45.50
      id_tipo_documento: 8
      id_grupo_documento: 12
      id_grupo_gasto: 20
      baseIvaCero: 40.62
      baseIva: 0
      totalIva: 0
      numDocumento: "001-001-000123456"
      autorizacion: "1234567890123"
      ruc: "1234567890001"
      archivo: "/uploads/receipts/receipt123.pdf"
      actividad: "Almuerzo con cliente"
      invitado: "Cliente XYZ"
      observaciones: "Reunión de negocios"
    },
    {
      id_tipo_gasto: 18
      id_reembolso: 123
      fechaRegistro: "2024-03-02T14:00:00"
      fechaEmision: "2024-03-01"
      totalFactura: 120.00
      id_tipo_documento: 8
      id_grupo_documento: 12
      id_grupo_gasto: 21
      baseIvaCero: 120.00
      baseIva: 0
      totalIva: 0
      numDocumento: "002-001-000456789"
      ruc: "9876543210001"
      archivo: "/uploads/receipts/receipt124.pdf"
    }
  ]) {
    idDetalle
    totalFactura
    numDocumento
  }
}
Parameters:
detalles
array
required
Array of expense detail objects to create
id_tipo_gasto
integer
required
Catalog ID for expense type (meals, transport, lodging, etc.)
id_reembolso
integer
required
Parent reimbursement request ID
fechaRegistro
datetime
required
Date the expense was registered in the system
fechaEmision
datetime
required
Date on the receipt/invoice document
totalFactura
decimal
required
Total amount on the invoice/receipt
id_tipo_documento
integer
required
Document type catalog ID (invoice, receipt, ticket, etc.)
id_grupo_documento
integer
required
Document group catalog ID
id_grupo_gasto
integer
required
Expense group catalog ID for categorization
baseIvaCero
decimal
Base amount subject to 0% IVA/VAT rate
baseIva
decimal
Base amount subject to standard IVA/VAT rate
totalIva
decimal
Total IVA/VAT amount
numDocumento
string
Document/invoice number (format: 001-001-000123456)
autorizacion
string
Tax authorization number from the receipt
ruc
string
Vendor’s tax identification number (RUC)
archivo
string
required
File path to the uploaded receipt/invoice image or PDF
actividad
string
Description of the business activity
invitado
string
Name of guest/client (for meal expenses)
numTicket
string
Ticket number (for transportation expenses)
observaciones
string
Additional notes or observations
cantidadKm
decimal
Distance in kilometers (for mileage reimbursements)
origen
string
Starting location (for transportation expenses)
destino
string
Destination location (for transportation expenses)
vehiculoPlaca
string
Vehicle license plate (for personal vehicle use)
Response: Returns an array of created expense detail objects. Notes:
  • Creates multiple expense line items in a single operation
  • Each detail is individually validated and saved
  • All details must belong to the same parent reimbursement
Source: Schema/Mutation/Mutation.cs:3388-3424

UpdateDetalle

Update an existing expense detail. Mutation:
mutation {
  updateDetalle(detalle: {
    idDetalle: 456
    id_tipo_gasto: 15
    id_reembolso: 123
    fechaRegistro: "2024-03-01T10:00:00"
    fechaEmision: "2024-02-28"
    totalFactura: 50.00
    id_tipo_documento: 8
    id_grupo_documento: 12
    id_grupo_gasto: 20
    baseIvaCero: 44.64
    baseIva: 0
    totalIva: 0
    autorizacion: "1234567890123"
    ruc: "1234567890001"
    archivo: "/uploads/receipts/receipt123_updated.pdf"
    archivo2: "/uploads/receipts/receipt123_page2.pdf"
    numDocumento: "001-001-000123456"
  }) {
    idDetalle
    totalFactura
    archivo
  }
}
Parameters:
idDetalle
integer
required
The ID of the expense detail to update
archivo2
string
Optional second file attachment (for multi-page receipts)
Response: Returns the updated expense detail object. Error Handling:
  • Returns IndReDetalleDTO_NOT_FOUND error if the detail ID doesn’t exist
Source: Schema/Mutation/Mutation.cs:3426-3453

DeleteDetalles

Delete all expense details for a reimbursement request. Mutation:
mutation {
  deleteDetalles(id: 123) {
    idDetalle
    totalFactura
  }
}
Parameters:
id
integer
required
The reimbursement ID whose details should be deleted
Response: Returns an array of deleted expense detail objects. Notes:
  • Deletes all expense details associated with the reimbursement
  • Also deletes related percentage distribution records (porcentajes)
  • This is a cascading delete operation
Source: Schema/Mutation/Mutation.cs:3455-3461

DeleteDetalles2

Delete specific expense details by their IDs. Mutation:
mutation {
  deleteDetalles2(ids: [456, 457, 458]) {
    idDetalle
    totalFactura
  }
}
Parameters:
ids
array
required
Array of expense detail IDs to delete
Response: Returns an array of deleted expense detail objects. Notes:
  • Allows selective deletion of specific expense items
  • Also removes related percentage distributions
  • Useful for removing individual line items without affecting the entire reimbursement
Source: Schema/Mutation/Mutation.cs:3463-3467

Best Practices

Creating a Complete Reimbursement

  1. Create the Reimbursement: Use CreateReembolsoA to create the main reimbursement record
  2. Add Expense Details: Use CreateDetallesA to add all expense line items with receipts
  3. Validate: System automatically validates against business rules
  4. Submit for Approval: Update status to trigger approval workflow

Status Workflow

Typical status transitions:
INGRESADO → EN_VALIDACIÓN → APROBADO → PROCESADO

         RECHAZADO

         DEVUELTO (for corrections)

Expense Categories

Common expense types (id_tipo_gasto):
  • Meals and entertainment
  • Transportation (taxi, bus, flight)
  • Lodging
  • Mileage reimbursement
  • Office supplies
  • Client gifts

Document Requirements

For each expense detail:
  • Valid receipt or invoice (archivo)
  • Complete tax information (ruc, autorizacion, numDocumento)
  • Proper categorization (id_tipo_gasto, id_grupo_gasto)
  • Accurate IVA/VAT breakdown

Error Handling

Common validation errors:
  • Missing required receipts
  • Expenses outside business rules limits
  • Invalid approver assignments
  • Duplicate document numbers
  • Expenses outside date range

Build docs developers (and LLMs) love