Business-AU-Ledger

 view release on metacpan or  search on metacpan

lib/Business/AU/Ledger/Util/Create.pm  view on Meta::CPAN

	my($self)        = @_;
	my($table_name)  = 'months';
	my($primary_key) = $self -> creator -> generate_primary_key_sql($table_name);

	$self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
code varchar(255) not null,
name varchar(255) not null
)
SQL
	$self -> log("Created table $table_name");

}	# End of create_months_table.

# --------------------------------------------------

sub create_payment_methods_table
{
	my($self)        = @_;
	my($table_name)  = 'payment_methods';
	my($primary_key) = $self -> creator -> generate_primary_key_sql($table_name);

	$self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
code varchar(255) not null,
name varchar(255) not null
)
SQL
	$self -> log("Created table $table_name");

}	# End of create_payment_methods_table.

# --------------------------------------------------

sub create_payments_table
{
	my($self)        = @_;
	my($table_name)  = 'payments';
	my($time_option) = $self -> time_option;
	my($primary_key) = $self -> creator -> generate_primary_key_sql($table_name);

	$self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
category_code_id integer not null references category_codes(id),
gst_code_id integer not null references gst_codes(id),
month_id integer not null references months(id),
payment_method_id integer not null references payment_methods(id),
tx_detail_id integer not null references tx_details(id),
amount numeric(10, 2) not null,
comment varchar(255) not null,
gst_amount numeric(10, 2) not null,
petty_cash_in numeric(10, 2) not null,
petty_cash_out numeric(10, 2) not null,
private_use_amount numeric(10, 2) not null,
private_use_percent numeric(6, 2) not null,
reference varchar(255) not null,
timestamp timestamp $time_option not null
)
SQL
	$self -> log("Created table $table_name");

}	# End of create_payments_table.

# --------------------------------------------------

sub create_receipts_table
{
	my($self)        = @_;
	my($table_name)  = 'receipts';
	my($time_option) = $self -> time_option;
	my($primary_key) = $self -> creator -> generate_primary_key_sql($table_name);

	$self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
category_code_id integer not null references category_codes(id),
gst_code_id integer not null references gst_codes(id),
month_id integer not null references months(id),
tx_detail_id integer not null references tx_details(id),
amount numeric(10, 2) not null,
bank_amount numeric(10, 2) not null,
comment varchar(255) not null,
gst_amount numeric(10, 2) not null,
reference varchar(255) not null,
timestamp timestamp $time_option not null
)
SQL
	$self -> log("Created table $table_name");

}	# End of create_receipts_table.

# --------------------------------------------------

sub create_reconciliations_table
{
	my($self)        = @_;
	my($table_name)  = 'reconciliations';
	my($primary_key) = $self -> creator -> generate_primary_key_sql($table_name);

	$self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
code varchar(255) not null,
name varchar(255) not null
)
SQL
	$self -> log("Created table $table_name");

}	# End of create_reconciliations_table.

# -----------------------------------------------

sub create_sessions_table



( run in 1.838 second using v1.01-cache-2.11-cpan-364913b4093 )