Module: InvoicesHelper

Defined in:
app/helpers/invoices_helper.rb

Overview

== Schema Information

Table name: invoices

id :integer not null, primary key
order_id :integer
jde_number :integer
total :decimal(8, 2)
created_at :datetime
updated_at :datetime
due_date :date
currency :string(255)
invoice_type :string(255)
discount :decimal(8, 2) default(0.0)
discount_code :string(255)
line_total :decimal(8, 2)
completion_date :date
state :string(255)
billing_address_id :integer
shipping_address_id :integer
tax_total :decimal(8, 2)
shipping_cost :decimal(8, 2)
reference_number :string(255)
terms :string(255)
shipped_date :date
uploads_count :integer
transmission_state :string(255)
customer_id :integer
company_id :integer
early_payment_discount :integer
early_payment_timescale :integer
local_sales_rep_id :integer
primary_sales_rep_id :integer
secondary_sales_rep_id :integer
buying_group_id :integer
shipping_coupon :decimal(8, 2)
creator_id :integer
updater_id :integer
document_date :date
gl_date :date
tax_date :date
po_number :string(255)
store_id :integer
gl_offset_account_id :integer
business_unit_id :integer
taxable_total :decimal(12, 2)
legacy_taxes :boolean
line_total_discounted :decimal(8, 2)
delivery_id :integer
old_total :decimal(8, 2)
old_tax_total :decimal(8, 2)
old_shipping_cost :decimal(8, 2)
revenue_consolidated :decimal(8, 2)
consolidated_exchange_rate :float
profile_id :integer
report_grouping :string(255)
billing_customer_id :integer
account_specialist_id :integer
profit :decimal(8, 2) default(0.0)
profit_consolidated :decimal(8, 2) default(0.0)
source_id :integer
technical_support_rep_id :integer

Instance Method Summary collapse

Instance Method Details

#invoice_command_options(invoice) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'app/helpers/invoices_helper.rb', line 67

def invoice_command_options(invoice)
  [].tap do |links|
    links << fa_icon('shuffle', text: "#{invoice.human_state_name.titleize} and #{invoice.human_transmission_state_name.titleize}"  )
    links << link_to("Edit", edit_invoice_path(@invoice)) unless @invoice.editing_locked?
    links << link_to("Delete", invoice_path(@invoice), data: { turbo_method: :delete }) unless @invoice.editing_locked?
    links << link_to("Approve", approve_invoice_path(@invoice), data: { turbo_method: :put }) if @invoice.draft?
    links << link_to("Transmit", transmit_invoice_path)
    links << link_to("Regenerate PDF", regenerate_pdf_invoice_path(@invoice))
    links << link_to("Regenerate Receipts", regenerate_receipts_invoice_path(@invoice))
    if @invoice.order&.edi_transaction_id.present?
      links << link_to("Regenerate EDI Documents", regenerate_edi_documents_invoice_path(@invoice), data: { turbo_method: :post })
    end
    links << link_to("Capture linked payment", capture_payment_invoice_path(@invoice), data: { turbo_method: :post }) if @invoice.unpaid?
    links << link_to("Exclude from Fund Capture Notification", exclude_notification_invoice_path(@invoice), data: { turbo_method: :post }) unless @invoice.exclude_fund_capture_notification.present?
    links << link_to("Include in Fund Capture Notification", include_notification_invoice_path(@invoice), data: { turbo_method: :post }) if @invoice.exclude_fund_capture_notification.present?
  end
end

#invoice_payment_options(invoice) ⇒ Object



85
86
87
88
89
90
91
# File 'app/helpers/invoices_helper.rb', line 85

def invoice_payment_options(invoice)
  [].tap do |links|
    links << fa_icon('credit-card', text: "Take a Payment"  )
    links << link_to("New payment", new_payment_receipts_path('customer_id' => @invoice.billing_customer_id, 'invoices' => [@invoice.id], :return_path => invoice_path(@invoice)))
    links << link_to("Send payment link", payment_link_invoice_path(@invoice))
  end
end