Class: LockstepSdk::InvoiceModel
- Inherits:
-
Object
- Object
- LockstepSdk::InvoiceModel
- Defined in:
- lib/lockstep_sdk/models/invoice_model.rb
Overview
An Invoice represents a bill sent from one company to another. The creator of the invoice is identified by the CompanyId field, and the recipient of the invoice is identified by the CustomerId field. Most invoices are uniquely identified both by a Lockstep Platform ID number and a customer ERP “key” that was generated by the system that originated the invoice. Invoices have a total amount and a due date, and when some payments have been made on the Invoice the TotalAmount and the OutstandingBalanceAmount may be different.
Instance Attribute Summary collapse
-
#addresses ⇒ InvoiceAddressModel
All addresses connected to this invoice.
-
#app_enrollment_id ⇒ Uuid
The AppEnrollmentId of the application that imported this record.
-
#attachments ⇒ AttachmentModel
A collection of attachments linked to this record.
-
#company ⇒ CompanyModel
The Company associated to this invoice.
-
#company_id ⇒ Uuid
The ID number of the company that created this invoice.
-
#created ⇒ Date-time
The date on which this invoice record was created.
-
#created_user_id ⇒ Uuid
The ID number of the user who created this invoice.
-
#credit_memos ⇒ CreditMemoInvoiceModel
The credit memos associated to this invoice.
-
#currency_code ⇒ String
The three-character ISO 4217 currency code used for this invoice.
-
#custom_field_definitions ⇒ CustomFieldDefinitionModel
A collection of custom fields linked to this record.
-
#custom_field_values ⇒ CustomFieldValueModel
A collection of custom fields linked to this record.
-
#customer ⇒ CompanyModel
The Customer associated to the invoice customer To retrieve this item, specify
Customerin the “Include” parameter for your query. -
#customer_id ⇒ Uuid
The ID number of the counterparty for the invoice, for example, a customer or vendor.
-
#customer_primary_contact ⇒ ContactModel
The Contact associated to the invoice customer To retrieve this item, specify
Customerin the “Include” parameter for your query. -
#discount_amount ⇒ Double
The total discounts given by the seller to the buyer on this invoice.
-
#discount_date ⇒ Date
The date when discounts were adjusted for this invoice.
-
#erp_key ⇒ String
The unique ID of this record as it was known in its originating financial system.
-
#exclude_from_aging ⇒ Boolean
Should the invoice be excluded from aging calculations?.
-
#group_key ⇒ Uuid
The GroupKey uniquely identifies a single Lockstep Platform account.
-
#imported_date ⇒ Date-time
The date and time when this record was imported from the user’s ERP or accounting system.
-
#in_dispute ⇒ Boolean
Is the invoice in dispute?.
-
#invoice_closed_date ⇒ Date
The date when the invoice was closed and finalized after completion of all payments and delivery of all products and services.
-
#invoice_date ⇒ Date
The reporting date for this invoice.
-
#invoice_id ⇒ Uuid
The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform.
-
#invoice_status_code ⇒ String
A code identifying the status of this invoice.
-
#invoice_type_code ⇒ String
A code identifying the type of this invoice.
-
#is_voided ⇒ Boolean
Is the invoice voided?.
-
#lines ⇒ InvoiceLineModel
All lines attached to this invoice.
-
#modified ⇒ Date-time
The date on which this invoice record was last modified.
-
#modified_user_id ⇒ Uuid
The ID number of the user who most recently modified this invoice.
-
#notes ⇒ NoteModel
A collection of notes linked to this record.
-
#outstanding_balance_amount ⇒ Double
The remaining balance value of this invoice.
-
#payment_due_date ⇒ Date
The date when the remaining outstanding balance is due.
-
#payments ⇒ InvoicePaymentDetailModel
All payments attached to this invoice, the amount of the payment applied to this Invoice, and the date the Payment was applied.
-
#posted_date ⇒ Date
The date when this invoice posted to the company’s general ledger.
-
#preferred_delivery_method ⇒ String
Indicates the preferred delivery method for this invoice.
-
#primary_bill_to_address_id ⇒ Uuid
The ID number of the invoice’s bill-to address.
-
#primary_origin_address_id ⇒ Uuid
The ID number of the invoice’s origination address.
-
#primary_ship_to_address_id ⇒ Uuid
The ID number of the invoice’s ship-to address.
-
#purchase_order_code ⇒ String
The “Purchase Order Code” is a code that is sometimes used by companies to refer to the original PO that was sent that caused this invoice to be written.
-
#reference_code ⇒ String
An additional reference code that is sometimes used to identify this invoice.
-
#sales_tax_amount ⇒ Double
The total sales (or transactional) tax calculated for this invoice.
-
#salesperson_code ⇒ String
A code identifying the salesperson responsible for writing this quote, invoice, or order.
-
#salesperson_name ⇒ String
A name identifying the salesperson responsible for writing this quote, invoice, or order.
-
#special_terms ⇒ String
If the customer negotiated any special terms different from the standard terms above, describe them here.
-
#terms_code ⇒ String
A code identifying the terms given to the purchaser.
-
#total_amount ⇒ Double
The total value of this invoice, inclusive of all taxes and line items.
Instance Method Summary collapse
-
#as_json(options = {}) ⇒ object
This object as a JSON key-value structure.
-
#initialize(params = {}) ⇒ InvoiceModel
constructor
Initialize the InvoiceModel using the provided prototype.
-
#to_json(*options) ⇒ String
This object converted to a JSON string.
Constructor Details
#initialize(params = {}) ⇒ InvoiceModel
Initialize the InvoiceModel using the provided prototype
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 30 def initialize(params = {}) @group_key = params.dig(:group_key) @invoice_id = params.dig(:invoice_id) @company_id = params.dig(:company_id) @customer_id = params.dig(:customer_id) @erp_key = params.dig(:erp_key) @purchase_order_code = params.dig(:purchase_order_code) @reference_code = params.dig(:reference_code) @salesperson_code = params.dig(:salesperson_code) @salesperson_name = params.dig(:salesperson_name) @invoice_type_code = params.dig(:invoice_type_code) @invoice_status_code = params.dig(:invoice_status_code) @terms_code = params.dig(:terms_code) @special_terms = params.dig(:special_terms) @currency_code = params.dig(:currency_code) @total_amount = params.dig(:total_amount) @sales_tax_amount = params.dig(:sales_tax_amount) @discount_amount = params.dig(:discount_amount) @outstanding_balance_amount = params.dig(:outstanding_balance_amount) @invoice_date = params.dig(:invoice_date) @discount_date = params.dig(:discount_date) @posted_date = params.dig(:posted_date) @invoice_closed_date = params.dig(:invoice_closed_date) @payment_due_date = params.dig(:payment_due_date) @imported_date = params.dig(:imported_date) @primary_origin_address_id = params.dig(:primary_origin_address_id) @primary_bill_to_address_id = params.dig(:primary_bill_to_address_id) @primary_ship_to_address_id = params.dig(:primary_ship_to_address_id) @created = params.dig(:created) @created_user_id = params.dig(:created_user_id) @modified = params.dig(:modified) @modified_user_id = params.dig(:modified_user_id) @app_enrollment_id = params.dig(:app_enrollment_id) @is_voided = params.dig(:is_voided) @in_dispute = params.dig(:in_dispute) @exclude_from_aging = params.dig(:exclude_from_aging) @preferred_delivery_method = params.dig(:preferred_delivery_method) @addresses = params.dig(:addresses) @lines = params.dig(:lines) @payments = params.dig(:payments) @notes = params.dig(:notes) @attachments = params.dig(:attachments) @company = params.dig(:company) @customer = params.dig(:customer) @customer_primary_contact = params.dig(:customer_primary_contact) @credit_memos = params.dig(:credit_memos) @custom_field_values = params.dig(:custom_field_values) @custom_field_definitions = params.dig(:custom_field_definitions) end |
Instance Attribute Details
#addresses ⇒ InvoiceAddressModel
Returns All addresses connected to this invoice. To retrieve this collection, specify Addresses in the “Include” parameter for your query.
226 227 228 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 226 def addresses @addresses end |
#app_enrollment_id ⇒ Uuid
Returns The AppEnrollmentId of the application that imported this record. For accounts with more than one financial system connected, this field identifies the originating financial system that produced this record. This value is null if this record was not loaded from an external ERP or financial system.
206 207 208 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 206 def app_enrollment_id @app_enrollment_id end |
#attachments ⇒ AttachmentModel
Returns A collection of attachments linked to this record. To retrieve this collection, specify Attachments in the include parameter when retrieving data. To create an attachment, use the [Upload Attachment](developer.lockstep.io/reference/post_api-v1-attachments) endpoint with the TableKey to Invoice and the ObjectKey set to the InvoiceId for this record. For more information on extensibility, see [linking extensible metadata to objects](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
242 243 244 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 242 def @attachments end |
#company ⇒ CompanyModel
Returns The Company associated to this invoice. To retrieve this item, specify Company in the “Include” parameter for your query.
246 247 248 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 246 def company @company end |
#company_id ⇒ Uuid
Returns The ID number of the company that created this invoice.
90 91 92 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 90 def company_id @company_id end |
#created ⇒ Date-time
Returns The date on which this invoice record was created.
190 191 192 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 190 def created @created end |
#created_user_id ⇒ Uuid
Returns The ID number of the user who created this invoice.
194 195 196 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 194 def created_user_id @created_user_id end |
#credit_memos ⇒ CreditMemoInvoiceModel
Returns The credit memos associated to this invoice. To retrieve this item, specify CreditMemos in the “Include” parameter for your query.
258 259 260 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 258 def credit_memos @credit_memos end |
#currency_code ⇒ String
Returns The three-character ISO 4217 currency code used for this invoice.
134 135 136 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 134 def currency_code @currency_code end |
#custom_field_definitions ⇒ CustomFieldDefinitionModel
Returns A collection of custom fields linked to this record. To retrieve this collection, specify CustomFieldDefinitions in the include parameter when retrieving data. To create a custom field, use the [Create Custom Field](developer.lockstep.io/reference/post_api-v1-customfieldvalues) endpoint with the TableKey to Invoice and the ObjectKey set to the InvoiceId for this record. For more information on extensibility, see [linking extensible metadata to objects](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
266 267 268 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 266 def custom_field_definitions @custom_field_definitions end |
#custom_field_values ⇒ CustomFieldValueModel
Returns A collection of custom fields linked to this record. To retrieve this collection, specify CustomFieldValues in the include parameter when retrieving data. To create a custom field, use the [Create Custom Field](developer.lockstep.io/reference/post_api-v1-customfieldvalues) endpoint with the TableKey to Invoice and the ObjectKey set to the InvoiceId for this record. For more information on extensibility, see [linking extensible metadata to objects](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
262 263 264 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 262 def custom_field_values @custom_field_values end |
#customer ⇒ CompanyModel
Returns The Customer associated to the invoice customer To retrieve this item, specify Customer in the “Include” parameter for your query.
250 251 252 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 250 def customer @customer end |
#customer_id ⇒ Uuid
Returns The ID number of the counterparty for the invoice, for example, a customer or vendor.
94 95 96 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 94 def customer_id @customer_id end |
#customer_primary_contact ⇒ ContactModel
Returns The Contact associated to the invoice customer To retrieve this item, specify Customer in the “Include” parameter for your query.
254 255 256 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 254 def customer_primary_contact @customer_primary_contact end |
#discount_amount ⇒ Double
Returns The total discounts given by the seller to the buyer on this invoice.
146 147 148 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 146 def discount_amount @discount_amount end |
#discount_date ⇒ Date
Returns The date when discounts were adjusted for this invoice.
158 159 160 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 158 def discount_date @discount_date end |
#erp_key ⇒ String
Returns The unique ID of this record as it was known in its originating financial system. If this company record was imported from a financial system, it will have the value ErpKey set to the original primary key number of the record as it was known in the originating financial system. If this record was not imported, this value will be null. For more information, see [Identity Columns](developer.lockstep.io/docs/identity-columns).
98 99 100 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 98 def erp_key @erp_key end |
#exclude_from_aging ⇒ Boolean
Returns Should the invoice be excluded from aging calculations?.
218 219 220 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 218 def exclude_from_aging @exclude_from_aging end |
#group_key ⇒ Uuid
Returns The GroupKey uniquely identifies a single Lockstep Platform account. All records for this account will share the same GroupKey value. GroupKey values cannot be changed once created. For more information, see [Accounts and GroupKeys](developer.lockstep.io/docs/accounts-and-groupkeys).
82 83 84 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 82 def group_key @group_key end |
#imported_date ⇒ Date-time
Returns The date and time when this record was imported from the user’s ERP or accounting system.
174 175 176 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 174 def imported_date @imported_date end |
#in_dispute ⇒ Boolean
Returns Is the invoice in dispute?.
214 215 216 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 214 def in_dispute @in_dispute end |
#invoice_closed_date ⇒ Date
Returns The date when the invoice was closed and finalized after completion of all payments and delivery of all products and services.
166 167 168 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 166 def invoice_closed_date @invoice_closed_date end |
#invoice_date ⇒ Date
Returns The reporting date for this invoice.
154 155 156 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 154 def invoice_date @invoice_date end |
#invoice_id ⇒ Uuid
Returns The unique ID of this record, automatically assigned by Lockstep when this record is added to the Lockstep platform. For the ID of this record in its originating financial system, see ErpKey.
86 87 88 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 86 def invoice_id @invoice_id end |
#invoice_status_code ⇒ String
Returns A code identifying the status of this invoice. Recognized Invoice status codes are: * Open - Represents an invoice that is considered open and needs more work to complete * Closed - Represents an invoice that is considered closed and resolved.
122 123 124 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 122 def invoice_status_code @invoice_status_code end |
#invoice_type_code ⇒ String
Returns A code identifying the type of this invoice. Recognized Invoice types are: * ‘AR Invoice` - Represents an invoice sent by Company to the Customer * `AP Invoice` - Represents an invoice sent by Vendor to the Company * `AR Credit Memo` - Represents a credit memo generated by Company given to Customer * `AP Credit Memo` - Represents a credit memo generated by Vendor given to Company.
118 119 120 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 118 def invoice_type_code @invoice_type_code end |
#is_voided ⇒ Boolean
Returns Is the invoice voided?.
210 211 212 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 210 def is_voided @is_voided end |
#lines ⇒ InvoiceLineModel
Returns All lines attached to this invoice. To retrieve this collection, specify Lines in the “Include” parameter for your query.
230 231 232 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 230 def lines @lines end |
#modified ⇒ Date-time
Returns The date on which this invoice record was last modified.
198 199 200 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 198 def modified @modified end |
#modified_user_id ⇒ Uuid
Returns The ID number of the user who most recently modified this invoice.
202 203 204 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 202 def modified_user_id @modified_user_id end |
#notes ⇒ NoteModel
Returns A collection of notes linked to this record. To retrieve this collection, specify Notes in the include parameter when retrieving data. To create a note, use the [Create Note](developer.lockstep.io/reference/post_api-v1-notes) endpoint with the TableKey to Invoice and the ObjectKey set to the InvoiceId for this record. For more information on extensibility, see [linking extensible metadata to objects](developer.lockstep.io/docs/custom-fields#linking-metadata-to-an-object).
238 239 240 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 238 def notes @notes end |
#outstanding_balance_amount ⇒ Double
Returns The remaining balance value of this invoice.
150 151 152 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 150 def outstanding_balance_amount @outstanding_balance_amount end |
#payment_due_date ⇒ Date
Returns The date when the remaining outstanding balance is due.
170 171 172 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 170 def payment_due_date @payment_due_date end |
#payments ⇒ InvoicePaymentDetailModel
Returns All payments attached to this invoice, the amount of the payment applied to this Invoice, and the date the Payment was applied. To retrieve this collection, specify Payments in the “Include” parameter for your query.
234 235 236 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 234 def payments @payments end |
#posted_date ⇒ Date
Returns The date when this invoice posted to the company’s general ledger.
162 163 164 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 162 def posted_date @posted_date end |
#preferred_delivery_method ⇒ String
Returns Indicates the preferred delivery method for this invoice. Examples include Print, Email, Fax.
222 223 224 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 222 def preferred_delivery_method @preferred_delivery_method end |
#primary_bill_to_address_id ⇒ Uuid
Returns The ID number of the invoice’s bill-to address.
182 183 184 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 182 def primary_bill_to_address_id @primary_bill_to_address_id end |
#primary_origin_address_id ⇒ Uuid
Returns The ID number of the invoice’s origination address.
178 179 180 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 178 def primary_origin_address_id @primary_origin_address_id end |
#primary_ship_to_address_id ⇒ Uuid
Returns The ID number of the invoice’s ship-to address.
186 187 188 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 186 def primary_ship_to_address_id @primary_ship_to_address_id end |
#purchase_order_code ⇒ String
Returns The “Purchase Order Code” is a code that is sometimes used by companies to refer to the original PO that was sent that caused this invoice to be written. If a customer sends a purchase order to a vendor, the vendor can then create an invoice and refer back to the originating purchase order using this field.
102 103 104 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 102 def purchase_order_code @purchase_order_code end |
#reference_code ⇒ String
Returns An additional reference code that is sometimes used to identify this invoice. The meaning of this field is specific to the ERP or accounting system used by the user.
106 107 108 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 106 def reference_code @reference_code end |
#sales_tax_amount ⇒ Double
Returns The total sales (or transactional) tax calculated for this invoice.
142 143 144 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 142 def sales_tax_amount @sales_tax_amount end |
#salesperson_code ⇒ String
Returns A code identifying the salesperson responsible for writing this quote, invoice, or order.
110 111 112 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 110 def salesperson_code @salesperson_code end |
#salesperson_name ⇒ String
Returns A name identifying the salesperson responsible for writing this quote, invoice, or order.
114 115 116 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 114 def salesperson_name @salesperson_name end |
#special_terms ⇒ String
Returns If the customer negotiated any special terms different from the standard terms above, describe them here.
130 131 132 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 130 def special_terms @special_terms end |
#terms_code ⇒ String
Returns A code identifying the terms given to the purchaser. This field is imported directly from the originating financial system and does not follow a specified format.
126 127 128 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 126 def terms_code @terms_code end |
#total_amount ⇒ Double
Returns The total value of this invoice, inclusive of all taxes and line items.
138 139 140 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 138 def total_amount @total_amount end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 270 def as_json(={}) { 'groupKey' => @group_key, 'invoiceId' => @invoice_id, 'companyId' => @company_id, 'customerId' => @customer_id, 'erpKey' => @erp_key, 'purchaseOrderCode' => @purchase_order_code, 'referenceCode' => @reference_code, 'salespersonCode' => @salesperson_code, 'salespersonName' => @salesperson_name, 'invoiceTypeCode' => @invoice_type_code, 'invoiceStatusCode' => @invoice_status_code, 'termsCode' => @terms_code, 'specialTerms' => @special_terms, 'currencyCode' => @currency_code, 'totalAmount' => @total_amount, 'salesTaxAmount' => @sales_tax_amount, 'discountAmount' => @discount_amount, 'outstandingBalanceAmount' => @outstanding_balance_amount, 'invoiceDate' => @invoice_date, 'discountDate' => @discount_date, 'postedDate' => @posted_date, 'invoiceClosedDate' => @invoice_closed_date, 'paymentDueDate' => @payment_due_date, 'importedDate' => @imported_date, 'primaryOriginAddressId' => @primary_origin_address_id, 'primaryBillToAddressId' => @primary_bill_to_address_id, 'primaryShipToAddressId' => @primary_ship_to_address_id, 'created' => @created, 'createdUserId' => @created_user_id, 'modified' => @modified, 'modifiedUserId' => @modified_user_id, 'appEnrollmentId' => @app_enrollment_id, 'isVoided' => @is_voided, 'inDispute' => @in_dispute, 'excludeFromAging' => @exclude_from_aging, 'preferredDeliveryMethod' => @preferred_delivery_method, 'addresses' => @addresses, 'lines' => @lines, 'payments' => @payments, 'notes' => @notes, 'attachments' => @attachments, 'company' => @company, 'customer' => @customer, 'customerPrimaryContact' => @customer_primary_contact, 'creditMemos' => @credit_memos, 'customFieldValues' => @custom_field_values, 'customFieldDefinitions' => @custom_field_definitions, } end |
#to_json(*options) ⇒ String
Returns This object converted to a JSON string.
324 325 326 |
# File 'lib/lockstep_sdk/models/invoice_model.rb', line 324 def to_json(*) "[#{as_json(*).to_json(*)}]" end |