Class: QuickbooksInvoiceHeader

Inherits:
ApplicationRecord show all
Includes:
QuickbooksInvoiceHeaderProcedures
Defined in:
app/models/quickbooks_invoice_header.rb

Overview

QuickbooksInvoiceHeader represents invoice data from QuickBooks

This model stores the header information from QuickBooks invoices, including customer information, dates, totals, and status. It serves as the parent record for QuickbooksInvoiceDetail records, which represent the line items on the invoice.

The model includes procedures for creating and updating invoice headers via stored procedures.

Example usage:

# Find an invoice by invoice number
invoice = QuickbooksInvoiceHeader.find_by(invoice_no: 'INV-12345')

# Access the invoice details (line items)
line_items = invoice.quickbooks_invoice_detail

# Create a new invoice header
header = QuickbooksInvoiceHeader.create!(
  customer_id: 123,
  company_id: 456,
  invoice_no: 'INV-12345',
  invoice_type: 'Invoice',
  txn_date: Date.today,
  due_date: Date.today + 30.days,
  total_amount: 123.45
)

Method Summary

Methods inherited from ApplicationRecord

define_decrypted_attribute, define_decrypted_attributes, #errors_in_bullet_points, primary_connection, special_connection