# == General# This entity represents expenses, such as a purchase made from a vendor.# There are three types of Purchases: Cash, Check, and Credit Card.# * Cash Purchase contains information regarding a payment made in cash.# * Check Purchase contains information regarding a payment made by check.# * Credit Card Purchase contains information regarding a payment made by credit card.## == Business Rules# * You must specify an AccountRef for all puchases.# * TotalAmt attribute must add up to sum of Line.Amount attributesmoduleQuickbooksmoduleModelclassPurchase<BaseModelincludeGlobalTaxCalculationincludeHasLineItems#== ConstantsREST_RESOURCE='purchase'XML_COLLECTION_NODE="Purchase"XML_NODE="Purchase"xml_accessor:id,:from=>'Id'xml_accessor:sync_token,:from=>'SyncToken',:as=>Integerxml_accessor:meta_data,:from=>'MetaData',:as=>MetaDataxml_accessor:doc_number,:from=>'DocNumber'xml_accessor:txn_date,:from=>'TxnDate',:as=>Datexml_accessor:private_note,:from=>'PrivateNote'xml_accessor:line_items,:from=>'Line',:as=>[PurchaseLineItem]xml_accessor:account_ref,:from=>'AccountRef',:as=>BaseReferencexml_accessor:txn_tax_detail,:from=>'TxnTaxDetail',:as=>TransactionTaxDetailxml_accessor:payment_type,:from=>'PaymentType'xml_accessor:payment_method_ref,:from=>'PaymentMethodRef',:as=>BaseReferencexml_accessor:entity_ref,:from=>'EntityRef',:as=>BaseReferencexml_accessor:remit_to_address,:from=>'RemitToAddr',:as=>PhysicalAddressxml_accessor:total,:from=>'TotalAmt',:as=>BigDecimal,:to_xml=>to_xml_big_decimalxml_accessor:print_status,:from=>'PrintStatus'xml_accessor:department_ref,:from=>'DepartmentRef',:as=>BaseReferencexml_accessor:currency_ref,:from=>'CurrencyRef',:as=>BaseReferencexml_accessor:exchange_rate,:from=>'ExchangeRate',:as=>BigDecimal,:to_xml=>to_xml_big_decimalxml_accessor:linked_transactions,:from=>'LinkedTxn',:as=>[LinkedTransaction]xml_accessor:credit?,:from=>'Credit'reference_setters#== Validationsvalidate:line_item_size#== This adds aliases for backwards compatability to old attributes namesalias_method:total_amount,:totalalias_method:total_amount=,:total=endendend