diff --git a/app/controllers/invoice_items_controller.rb b/app/controllers/invoice_items_controller.rb index 0e866d3d..06241aa0 100644 --- a/app/controllers/invoice_items_controller.rb +++ b/app/controllers/invoice_items_controller.rb @@ -45,6 +45,6 @@ def destroy private def ii_params - params.require(:invoice_item).permit(:memo, :category, :price, :line_no) + params.require(:invoice_item).permit(:memo, :category, :price, :corporate, :line_no) end end diff --git a/app/models/invoice_item.rb b/app/models/invoice_item.rb index 22f0a473..d2a4a69f 100644 --- a/app/models/invoice_item.rb +++ b/app/models/invoice_item.rb @@ -1,5 +1,5 @@ class InvoiceItem < ApplicationRecord - validates_presence_of :memo, :category, :price + validates_presence_of :memo, :category, :price, :corporate validates_inclusion_of :category, :in => InvoiceLine::Invoice_Categories - validates_numericality_of :price + validates_numericality_of :price, :corporate end diff --git a/app/views/events/reference.html.erb b/app/views/events/reference.html.erb index cfc418c0..4b2d69b4 100644 --- a/app/views/events/reference.html.erb +++ b/app/views/events/reference.html.erb @@ -11,12 +11,17 @@ diff --git a/app/views/invoice_items/_form.html.erb b/app/views/invoice_items/_form.html.erb index 53b0f880..7234071b 100644 --- a/app/views/invoice_items/_form.html.erb +++ b/app/views/invoice_items/_form.html.erb @@ -23,6 +23,10 @@ <%= f.label :price %>: <%= f.text_field :price %> + + <%= f.label :corporate %>: + <%= f.text_field :corporate %> + <%= f.submit %> diff --git a/app/views/invoice_items/index.html.erb b/app/views/invoice_items/index.html.erb index e1531101..b672bc08 100644 --- a/app/views/invoice_items/index.html.erb +++ b/app/views/invoice_items/index.html.erb @@ -5,6 +5,7 @@ Memo Category Price + Corporate <% if can? :update, InvoiceItem %> <% end %> @@ -18,6 +19,7 @@ <%= item.memo %> <%= item.category %> <%= number_to_currency item.price %> + <%= number_to_currency item.corporate %> <% if can? :update, item %> <%= link_to 'Edit', edit_invoice_item_url(item) %> <% end %> diff --git a/app/views/invoices/_invoice_line_fields.html.erb b/app/views/invoices/_invoice_line_fields.html.erb index 1a21ea50..514e8a6c 100644 --- a/app/views/invoices/_invoice_line_fields.html.erb +++ b/app/views/invoices/_invoice_line_fields.html.erb @@ -8,7 +8,11 @@ <% InvoiceItem.all.each do |item| %> - + <% if @invoice.payment_type == "Oracle" %> + + <% else %> + + <% end %> <% end %> diff --git a/db/migrate/20240312001550_change_invoice_item_price_to_float.rb b/db/migrate/20240312001550_change_invoice_item_price_to_float.rb new file mode 100644 index 00000000..02a0d62e --- /dev/null +++ b/db/migrate/20240312001550_change_invoice_item_price_to_float.rb @@ -0,0 +1,4 @@ +class ChangeInvoiceItemPriceToFloat < ActiveRecord::Migration[6.1] + def change + end +end diff --git a/db/schema.rb b/db/schema.rb index 4f300bfb..d5b85df4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_08_01_123836) do +ActiveRecord::Schema.define(version: 2024_03_12_001550) do create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "name", limit: 255, null: false @@ -217,7 +217,8 @@ create_table "invoice_items", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "memo", limit: 255, null: false t.string "category", limit: 255, null: false - t.integer "price", null: false + t.float "price", null: false + t.float "corporate", null: false t.datetime "created_at" t.datetime "updated_at" end