diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index e1336b0..0c30308 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -183,8 +183,8 @@ def open_closed_operations end - def dagbok - @journal_operations,from_period,to_period,unit,project,car,journal_type = Report.report_dagbok(params,current_user.current_company.id) + def dailyjournal + @journal_operations,from_period,to_period,unit,project,car,journal_type = Report.report_dailyjournal(params,current_user.current_company.id) @from_period = (from_period == 'null' ? nil : Period.find(from_period)) @to_period = (to_period == 'null' ? nil : Period.find(to_period)) @unit = (unit == 'null' ? nil : Unit.find(unit)) diff --git a/app/models/report.rb b/app/models/report.rb index e60c8c1..7e7e57b 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -58,7 +58,7 @@ def self.report_subsidiary_ledger_journal(periods,ledger_account,from_ledger,to_ return journal_operations end - def self.report_dagbok(options,company) + def self.report_dailyjournal(options,company) from_date = (options[:from_date].blank? or (! options[:from_date] =~ /\d{2}\-\d{2}\-\d{4}/)) ? 'null' : "'#{options[:from_date]}'" to_date = (options[:to_date].blank? or (! options[:to_date] =~ /\d{2}\-\d{2}\-\d{4}/)) ? 'null' : "'#{options[:to_date]}'" @@ -90,7 +90,7 @@ def self.report_dagbok(options,company) invoice_number_from = options[:invoice_number_from].blank? ? 'null' : "'#{options[:invoice_number_from]}'" #determine how to do it invoice_number_to = options[:invoice_number_to].blank? ? 'null' : "'#{options[:invoice_number_to]}'" #determine how to do it sort_by = options[:sort_by].blank? ? "'date'" : "'#{options[:sort_by]}'" - func = "report_dagbok( #{company}," + func = "report_dailyjournal( #{company}," func << "#{from_date}," func << "#{to_date}," func << "#{from_period}," diff --git a/app/views/reports/dagbok.html.erb b/app/views/reports/dailyjournal.html.erb similarity index 100% rename from app/views/reports/dagbok.html.erb rename to app/views/reports/dailyjournal.html.erb diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb index cff4a0c..247395a 100644 --- a/app/views/reports/index.html.erb +++ b/app/views/reports/index.html.erb @@ -366,14 +366,14 @@
- <%= t(:dagbok, :scope=>:reports) %> + <%= t(:dailyjournal, :scope=>:reports) %>
- <%= form_tag dagbok_reports_path, :method=>:get do %> + <%= form_tag dailyjournal_reports_path, :method=>:get do %>
- <%= t(:dagbok, :scope=>:reports) %> + <%= t(:dailyjournal, :scope=>:reports) %> <%= t(:from_date, :scope=>:reports) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 3d37b1b..d757a41 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -484,7 +484,7 @@ en: ledger_balance_period: Ledger Balance Period details: Details ledgers_from_account: Ledgers from Account - dagbok: Dagbok + dailyjournal: Dagbok kid: KID bill: Invoice sort_by: Sort By diff --git a/config/routes.rb b/config/routes.rb index 09a1924..4d18a18 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,7 +74,7 @@ get :ledger_journal get :subsidiary_ledger_balance get :subsidiary_ledger_journal - get :dagbok + get :dailyjournal get :open_closed_operations end end diff --git a/db/migrate/20111124091705_reports_create_ledger_balance_proc.rb b/db/migrate/20111124091705_reports_create_ledger_balance_proc.rb index 9cd9f6b..57861ba 100644 --- a/db/migrate/20111124091705_reports_create_ledger_balance_proc.rb +++ b/db/migrate/20111124091705_reports_create_ledger_balance_proc.rb @@ -1,7 +1,7 @@ class ReportsCreateLedgerBalanceProc < ActiveRecord::Migration def self.up - procedure_creation = File.read("db/ledger_report_balance.sql") + procedure_creation = File.read("db/sql/ledger_report_balance.sql") ActiveRecord::Base.connection.execute("#{procedure_creation}") end diff --git a/db/migrate/20111128133532_reports_create_ledger_journal.rb b/db/migrate/20111128133532_reports_create_ledger_journal.rb index f1ab537..289c62d 100644 --- a/db/migrate/20111128133532_reports_create_ledger_journal.rb +++ b/db/migrate/20111128133532_reports_create_ledger_journal.rb @@ -1,7 +1,7 @@ class ReportsCreateLedgerJournal < ActiveRecord::Migration def self.up - procedure_creation = File.read("db/ledger_report_journal.sql") + procedure_creation = File.read("db/sql/ledger_report_journal.sql") ActiveRecord::Base.connection.execute("#{procedure_creation}") end diff --git a/db/migrate/20111202114009_reports_create_subsidiary_ledger_balance_proc.rb b/db/migrate/20111202114009_reports_create_subsidiary_ledger_balance_proc.rb index 3ded028..83b9b49 100644 --- a/db/migrate/20111202114009_reports_create_subsidiary_ledger_balance_proc.rb +++ b/db/migrate/20111202114009_reports_create_subsidiary_ledger_balance_proc.rb @@ -1,7 +1,7 @@ class ReportsCreateSubsidiaryLedgerBalanceProc < ActiveRecord::Migration def self.up - procedure_creation = File.read("db/subsidiary_ledger_balance.sql") + procedure_creation = File.read("db/sql/subsidiary_ledger_balance.sql") ActiveRecord::Base.connection.execute("#{procedure_creation}") end diff --git a/db/migrate/20111208093224_reports_create_subsidiary_ledger_journal_proc.rb b/db/migrate/20111208093224_reports_create_subsidiary_ledger_journal_proc.rb index 3967cc9..3a23f12 100644 --- a/db/migrate/20111208093224_reports_create_subsidiary_ledger_journal_proc.rb +++ b/db/migrate/20111208093224_reports_create_subsidiary_ledger_journal_proc.rb @@ -2,7 +2,7 @@ class ReportsCreateSubsidiaryLedgerJournalProc < ActiveRecord::Migration def self.up - procedure_creation = File.read("db/subsidiary_ledger_journal.sql") + procedure_creation = File.read("db/sql/subsidiary_ledger_journal.sql") ActiveRecord::Base.connection.execute("#{procedure_creation}") end diff --git a/db/migrate/20111215111721_reports_create_dagbok_proc.rb b/db/migrate/20111215111721_reports_create_dailyjournal_proc.rb similarity index 89% rename from db/migrate/20111215111721_reports_create_dagbok_proc.rb rename to db/migrate/20111215111721_reports_create_dailyjournal_proc.rb index 9fb215f..48a52a9 100644 --- a/db/migrate/20111215111721_reports_create_dagbok_proc.rb +++ b/db/migrate/20111215111721_reports_create_dailyjournal_proc.rb @@ -1,12 +1,12 @@ -class ReportsCreateDagbokProc < ActiveRecord::Migration +class ReportsCreateDailyjournalProc < ActiveRecord::Migration def self.up - procedure_creation = File.read("db/dagbok_report.sql") + procedure_creation = File.read("db/sql/dailyjournal_report.sql") ActiveRecord::Base.connection.execute("#{procedure_creation}") end def self.down - ActiveRecord::Base.connection.execute("DROP FUNCTION report_dagbok( + ActiveRecord::Base.connection.execute("DROP FUNCTION report_dailyjournal( company int, from_date date, to_date date, @@ -33,7 +33,7 @@ def self.down invoice_to varchar, sorted_by varchar );") - ActiveRecord::Base.connection.execute("DROP TYPE dagbokop ;") + ActiveRecord::Base.connection.execute("DROP TYPE dailyjournalop ;") end end \ No newline at end of file diff --git a/db/dagbok_report.sql b/db/sql/dailyjournal_report.sql similarity index 93% rename from db/dagbok_report.sql rename to db/sql/dailyjournal_report.sql index e6f9d5c..af8de7a 100644 --- a/db/dagbok_report.sql +++ b/db/sql/dailyjournal_report.sql @@ -1,7 +1,7 @@ - -- create dagbok journal operations row type for returning - CREATE TYPE dagbokop AS (joid int, jtypeid int,jid int, jnumber int, jdate date, jperiod text,accnumber integer, joamount numeric(20,2), jkid varchar(255), invoice_number varchar(255), jdescription varchar(255) ); + -- create daily journal operations row type for returning + CREATE TYPE dailyjournalop AS (joid int, jtypeid int,jid int, jnumber int, jdate date, jperiod text,accnumber integer, joamount numeric(20,2), jkid varchar(255), invoice_number varchar(255), jdescription varchar(255) ); - CREATE OR REPLACE FUNCTION report_dagbok( + CREATE OR REPLACE FUNCTION report_dailyjournal( company int, -- from_date date, -- to_date date, -- @@ -28,7 +28,7 @@ invoice_to varchar, -- sorted_by varchar ) - RETURNS setof dagbokop AS $$ + RETURNS setof dailyjournalop AS $$ DECLARE diff --git a/db/ledger_report_balance.sql b/db/sql/ledger_report_balance.sql similarity index 100% rename from db/ledger_report_balance.sql rename to db/sql/ledger_report_balance.sql diff --git a/db/ledger_report_journal.sql b/db/sql/ledger_report_journal.sql similarity index 100% rename from db/ledger_report_journal.sql rename to db/sql/ledger_report_journal.sql diff --git a/db/subsidiary_ledger_balance.sql b/db/sql/subsidiary_ledger_balance.sql similarity index 100% rename from db/subsidiary_ledger_balance.sql rename to db/sql/subsidiary_ledger_balance.sql diff --git a/db/subsidiary_ledger_journal.sql b/db/sql/subsidiary_ledger_journal.sql similarity index 100% rename from db/subsidiary_ledger_journal.sql rename to db/sql/subsidiary_ledger_journal.sql