Skip to content

Commit

Permalink
Moved sql files into subdir. Renamed dagbok to dailyjournal.
Browse files Browse the repository at this point in the history
  • Loading branch information
paalvibe committed Jul 7, 2014
1 parent 7c626d4 commit 552de1a
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]}'"
Expand Down Expand Up @@ -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},"
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions app/views/reports/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -366,14 +366,14 @@


<div class="title">
<%= t(:dagbok, :scope=>:reports) %>
<%= t(:dailyjournal, :scope=>:reports) %>
</div>
<table>
<%= form_tag dagbok_reports_path, :method=>:get do %>
<%= form_tag dailyjournal_reports_path, :method=>:get do %>
<tbody class="even">
<tr>
<td class="report_title" rowspan="9">
<%= t(:dagbok, :scope=>:reports) %>
<%= t(:dailyjournal, :scope=>:reports) %>
</td>
<td class="title">
<%= t(:from_date, :scope=>:reports) %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20111128133532_reports_create_ledger_journal.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
8 changes: 4 additions & 4 deletions db/dagbok_report.sql → db/sql/dailyjournal_report.sql
Original file line number Diff line number Diff line change
@@ -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, --
Expand All @@ -28,7 +28,7 @@
invoice_to varchar, --
sorted_by varchar
)
RETURNS setof dagbokop AS $$
RETURNS setof dailyjournalop AS $$

DECLARE

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 552de1a

Please sign in to comment.