Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

c

  • Loading branch information...
commit 8b6c84f4ab5ccc85c4875045ac0ca1923174716a 1 parent 8e8c973
@f-marais authored
View
10 lib/Schema/Result/E2e.pm
@@ -6,7 +6,7 @@ package Schema::Result::E2e;
=head1 NAME
-X_Db::Schema::Result::E2e
+Schema::Result::E2e
=cut
@@ -57,13 +57,13 @@ __PACKAGE__->add_columns(
Type: belongs_to
-Related object: L<X_Db::Schema::Result::Entity>
+Related object: L<Schema::Result::Entity>
=cut
__PACKAGE__->belongs_to(
"left",
- "X_Db::Schema::Result::Entity",
+ "Schema::Result::Entity",
{ et_id => "left_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
@@ -72,13 +72,13 @@ __PACKAGE__->belongs_to(
Type: belongs_to
-Related object: L<X_Db::Schema::Result::Entity>
+Related object: L<Schema::Result::Entity>
=cut
__PACKAGE__->belongs_to(
"right",
- "X_Db::Schema::Result::Entity",
+ "Schema::Result::Entity",
{ et_id => "right_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
View
42 lib/Schema/Result/EntDetVw.pm
@@ -1,42 +0,0 @@
-package Schema::Result::EntDetVw;
-
-use base qw/DBIx::Class::Core/;
-
-__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
-
-__PACKAGE__->table('entdet_vw');
-__PACKAGE__->result_source_instance->is_virtual(1);
-__PACKAGE__->result_source_instance->view_definition(
- qq{
-select c.name em_nm,b.name tgt_ent_nm,a.name tgt_itm_nm,
- a.type tgt_itm_type, a.scale tgt_itm_scale,
- a.bus_rule,
- ifnull(f.src_itm_nm,' ') src_itm_nm,
- ifnull(f.src_itm_type,' ') src_itm_type,
- ifnull(f.src_itm_scale,' ') src_itm_scale,
- ifnull(f.src_ent_nm,' ') src_ent_nm
- from item a join entity b on a.et_id=b.et_id
- join entity_master c on b.em_id=c.em_id
- join (select c.tgt_id,d.name src_itm_nm,
- d.type src_itm_type, d.scale src_itm_scale,
- e.name src_ent_nm,d.seq src_seq
- from i2i c, item d, entity e
- where c.src_id=d.it_id and d.et_id=e.et_id) f
- on a.it_id=f.tgt_id
- where c.max_version=1
- order by a.seq,f.src_seq
-});
-
-__PACKAGE__->add_columns(
-'em_nm' => { is_numeric=>0,data_type => 'varchar', },
-'tgt_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
-'tgt_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
-'tgt_itm_type' => { is_numeric=>0,data_type => 'varchar', },
-'tgt_itm_scale' => { is_numeric=>0,data_type => 'varchar', },
-'bus_rule' => { is_numeric=>0,data_type => 'varchar', },
-'src_itm_nm' => { is_numeric=>0,data_type => 'varchar', },
-'src_itm_type' => { is_numeric=>0,data_type => 'varchar', },
-'src_itm_scale' => { is_numeric=>0,data_type => 'varchar', },
-'src_ent_nm' => { is_numeric=>0,data_type => 'varchar', },
-);
-1;
View
18 lib/Schema/Result/Entity.pm
@@ -6,7 +6,7 @@ package Schema::Result::Entity;
=head1 NAME
-X_Db::Schema::Result::Entity
+Schema::Result::Entity
=cut
@@ -142,13 +142,13 @@ __PACKAGE__->set_primary_key("et_id");
Type: has_many
-Related object: L<X_Db::Schema::Result::E2e>
+Related object: L<Schema::Result::E2e>
=cut
__PACKAGE__->has_many(
"e2e_lefts",
- "X_Db::Schema::Result::E2e",
+ "Schema::Result::E2e",
{ "foreign.left_id" => "self.et_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
@@ -157,13 +157,13 @@ __PACKAGE__->has_many(
Type: has_many
-Related object: L<X_Db::Schema::Result::E2e>
+Related object: L<Schema::Result::E2e>
=cut
__PACKAGE__->has_many(
"e2e_rights",
- "X_Db::Schema::Result::E2e",
+ "Schema::Result::E2e",
{ "foreign.right_id" => "self.et_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
@@ -172,13 +172,13 @@ __PACKAGE__->has_many(
Type: belongs_to
-Related object: L<X_Db::Schema::Result::EntityMaster>
+Related object: L<Schema::Result::EntityMaster>
=cut
__PACKAGE__->belongs_to(
"em",
- "X_Db::Schema::Result::EntityMaster",
+ "Schema::Result::EntityMaster",
{ em_id => "em_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
@@ -187,13 +187,13 @@ __PACKAGE__->belongs_to(
Type: has_many
-Related object: L<X_Db::Schema::Result::Item>
+Related object: L<Schema::Result::Item>
=cut
__PACKAGE__->has_many(
"items",
- "X_Db::Schema::Result::Item",
+ "Schema::Result::Item",
{ "foreign.et_id" => "self.et_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
View
6 lib/Schema/Result/EntityMaster.pm
@@ -6,7 +6,7 @@ package Schema::Result::EntityMaster;
=head1 NAME
-X_Db::Schema::Result::EntityMaster
+Schema::Result::EntityMaster
=cut
@@ -77,13 +77,13 @@ __PACKAGE__->set_primary_key("em_id");
Type: has_many
-Related object: L<X_Db::Schema::Result::Entity>
+Related object: L<Schema::Result::Entity>
=cut
__PACKAGE__->has_many(
"entities",
- "X_Db::Schema::Result::Entity",
+ "Schema::Result::Entity",
{ "foreign.em_id" => "self.em_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
View
10 lib/Schema/Result/I2i.pm
@@ -6,7 +6,7 @@ package Schema::Result::I2i;
=head1 NAME
-X_Db::Schema::Result::I2i
+Schema::Result::I2i
=cut
@@ -57,13 +57,13 @@ __PACKAGE__->add_columns(
Type: belongs_to
-Related object: L<X_Db::Schema::Result::Item>
+Related object: L<Schema::Result::Item>
=cut
__PACKAGE__->belongs_to(
"src",
- "X_Db::Schema::Result::Item",
+ "Schema::Result::Item",
{ it_id => "src_id" },
{ is_deferrable => 1,
cascade_delete => 1,
@@ -74,13 +74,13 @@ __PACKAGE__->belongs_to(
Type: belongs_to
-Related object: L<X_Db::Schema::Result::Item>
+Related object: L<Schema::Result::Item>
=cut
__PACKAGE__->belongs_to(
"tgt",
- "X_Db::Schema::Result::Item",
+ "Schema::Result::Item",
{ it_id => "tgt_id" },
{ is_deferrable => 1,
cascade_delete => 1,
View
20 lib/Schema/Result/Item.pm
@@ -6,7 +6,7 @@ package Schema::Result::Item;
=head1 NAME
-X_Db::Schema::Result::Item
+Schema::Result::Item
=cut
@@ -81,11 +81,13 @@ __PACKAGE__->add_columns(
"type",
{ data_type => "char", is_nullable => 1, size => 100 },
"scale",
- { data_type => "text", is_nullable => 1 },
+ { data_type => "integer", is_nullable => 1 },
"precision",
- { data_type => "text", is_nullable => 1 },
+ { data_type => "integer", is_nullable => 1 },
"bus_rule",
{ data_type => "text", is_nullable => 1 },
+ "deflt",
+ { data_type => "text", is_nullable => 1 },
);
=head1 PRIMARY KEY
@@ -106,13 +108,13 @@ __PACKAGE__->set_primary_key("it_id");
Type: belongs_to
-Related object: L<X_Db::Schema::Result::Entity>
+Related object: L<Schema::Result::Entity>
=cut
__PACKAGE__->belongs_to(
"et",
- "X_Db::Schema::Result::Entity",
+ "Schema::Result::Entity",
{ et_id => "et_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
@@ -121,13 +123,13 @@ __PACKAGE__->belongs_to(
Type: has_many
-Related object: L<X_Db::Schema::Result::I2i>
+Related object: L<Schema::Result::I2i>
=cut
__PACKAGE__->has_many(
"i2i_srcs",
- "X_Db::Schema::Result::I2i",
+ "Schema::Result::I2i",
{ "foreign.src_id" => "self.it_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
@@ -136,13 +138,13 @@ __PACKAGE__->has_many(
Type: has_many
-Related object: L<X_Db::Schema::Result::I2i>
+Related object: L<Schema::Result::I2i>
=cut
__PACKAGE__->has_many(
"i2i_tgts",
- "X_Db::Schema::Result::I2i",
+ "Schema::Result::I2i",
{ "foreign.tgt_id" => "self.it_id" },
{ cascade_copy => 0, cascade_delete => 1 },
);
View
2  mojo/lib/STM.pm
@@ -68,7 +68,7 @@ sub startup {
# action=>'run', namespace=>'Web::Rpt');
# # Documentation browser under "/perldoc"
#
- $auth->route('/:route', route => [ qw(upload search itmdet entdet) ])
+ $auth->route('/:route', route => [ qw(upload search itmdet stmlist ) ])
->to( cb => sub {
my $self=shift;
return $self->render($self->stash('route'));
View
36 mojo/templates/entdet.html.ep
@@ -1,36 +0,0 @@
-% title 'Entity Detail';
-% my $rs;
-% my $cols= [ qw( tgt_itm_nm tgt_itm_type tgt_itm_scale
-% bus_rule src_itm_nm
-% src_itm_type src_itm_scale src_ent_nm) ];
-<H3> <%= (param('tgt') ? 'Target:' . param('tgt')
- : ' ') . (param('src') ? 'Source:' . param('src') : ' ') %></H3>
-% if (param('src')) {
-% if (param('tgt')) {
-<br><a href=<%= $self->url_for('/entdet?src='
- . param('src')) %>>Show <%= param('src') %> as Source</a>
-% $rs = $self->app->schema->resultset('EntDetVw')->search(
-% { 'tgt_ent_nm' => param('tgt'),
-% 'src_ent_nm' => param('src') },{
-% columns=> [qw(tgt_itm_nm tgt_itm_type tgt_itm_scale
-% bus_rule src_itm_nm src_itm_type src_itm_scale )] ,
-% distinct => 1});
-% } else {
-<br><a href=<%= $self->url_for('/entdet?tgt='
- . param('src')) %>>Show <%= param('src') %> as Target</a>
-% $rs = $self->app->schema->resultset('EntDetVw')->search(
-% { 'src_ent_nm' => param('src') },{
-% columns=> [qw(tgt_ent_nm tgt_itm_nm tgt_itm_type
-% tgt_itm_scale bus_rule src_itm_nm
-% src_itm_type src_itm_scale)],distinct => 1});
-% }
-<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 0 , url => {} %>
-% } else {
-<br><a href=<%= $self->url_for('/entdet?src='
- . param('tgt')) %>>Show <%= param('src') %> as Source</a>
-% $rs = $self->app->schema->resultset('EntDetVw')->search(
-% { 'tgt_ent_nm' => param('tgt') },
-% {columns=> $cols, distinct => 1});
-<%= include 'showrs', partial => 1, rs=> $rs, chk_blanks => 2 , url => {} %>
-% }
-<br>
View
4 mojo/templates/search.html.ep
@@ -23,7 +23,7 @@
% distinct => 1});
<%= include 'showrs', partial => 1,
title => 'Entity', rs=> $rs, chk_blanks => 0 ,
- url => {src_ent_nm => '/entdet?tgt=tgt_ent_nm&src=src_ent_nm'}
+ url => {src_ent_nm => '/stmlist?tgt=tgt_ent_nm&src=src_ent_nm'}
%>
% }
<br>
@@ -44,7 +44,7 @@
<%= include 'showrs', partial => 1,
title => 'Item', rs=> $rs, chk_blanks => 0 ,
url => { src_itm_nm => '/itmdet?tgt=tgt_itm_nm&src=src_itm_nm',
- src_ent_nm => '/entdet?tgt=tgt_ent_nm&src=src_ent_nm'}
+ src_ent_nm => '/stmlist?tgt=tgt_ent_nm&src=src_ent_nm'}
%>
% }
% }
View
4 mojo/templates/showrs.html.ep
@@ -1,6 +1,6 @@
% use Data::Dumper;
-% my %urlfor= ('tgt_ent_nm'=> '/entdet?tgt=tgt_ent_nm',
-% 'src_ent_nm'=>'/entdet?src=src_ent_nm');
+% my %urlfor= ('tgt_ent_nm'=> '/stmlist?tgt=tgt_ent_nm',
+% 'src_ent_nm'=>'/stmlist?src=src_ent_nm');
% $Data::Dumper::Indent=1;
<style>
.th { font-family:"ARIAL"; font-size: 8pt; font-style:"BOLD"; mso-number-format: "\@" }
View
62 script/parsexcel.pl
@@ -2,6 +2,7 @@
use warnings;
use strict;
use Spreadsheet::ParseExcel;
+use Getopt::Std;
use Data::Dumper;
$Data::Dumper::Indent = 2;
$|++;
@@ -9,12 +10,14 @@
BEGIN {
use lib qq{$ENV{MIS}/lib};
use X_Db;
- use X_Db::Schema;
+ use Schema;
}
-my $schema = X_Db::Schema->connect ( sub {X_Db::connect('MIS') });
-# $schema->deploy({ add_drop_table => 1});
-# __END__
+my $schema = Schema->connect ( sub {X_Db::connect('MIS') });
+my %opts;
+getopts('df:', \%opts);
+
+if ($opts{d}) { $schema->deploy({ add_drop_table => 1}); exit 0}
# print Dumper $schema->resultset('EntDetVw')
# ->search({}, { bind => [ 'IDMI01.MI_STB_REWARD_ALLOCATION_T' ] })
@@ -67,7 +70,7 @@ sub assign_val {
}
my $parser = Spreadsheet::ParseExcel->new();
-my $workbook = $parser->parse( $ARGV[0] );
+my $workbook = $parser->parse($opts{f});
if ( !defined $workbook ) {
die $parser->error(), ".\n";
@@ -362,7 +365,7 @@ =head1 Items per entity master
select name, version, max_version from entity_master;
-select a.name from item a, entity b
+select a.* from item a, entity b
where a.et_id=b.et_id and b.name like '%MI_STB_REWARD_ALLOCATION_T%'
order by a.seq;
@@ -377,50 +380,3 @@ =head1 Items per entity master
-SELECT me.tgt_ent_nm, me.tgt_itm_nm, me.tgt_itm_type,
-me.tgt_itm_scale, me.bus_rule, me.src_itm_nm,
-me.src_itm_type, me.src_itm_scale, me.src_ent_nm FROM (
-select b.name tgt_ent_nm,a.name tgt_itm_nm,
- a.type tgt_itm_type, a.scale tgt_itm_scale,
- a.bus_rule,
- ifnull(f.src_itm_nm,' ') src_itm_nm,
- ifnull(f.src_itm_type,' ') src_itm_type,
- ifnull(f.src_itm_scale,' ') src_itm_scale,
- ifnull(f.src_ent_nm,' ') src_ent_nm
- from item a join entity b on a.et_id=b.et_id
- join entity_master c on b.em_id=c.em_id
- join (select c.tgt_id,d.name src_itm_nm,
- d.type src_itm_type, d.scale src_itm_scale,
- e.name src_ent_nm,d.seq src_seq
- from i2i c, item d, entity e
- where c.src_id=d.it_id and d.et_id=e.et_id) f
- on a.it_id=f.tgt_id
- where c.max_version=1
- order by a.seq,f.src_seq
-) me WHERE ( tgt_ent_nm = 'IDMI01.MI_STB_REWARD_ALLOCATION_T' )
-GROUP BY me.tgt_ent_nm, me.tgt_itm_nm, me.tgt_itm_type,
-me.tgt_itm_scale, me.bus_rule, me.src_itm_nm, me.src_itm_type,
-me.src_itm_scale, me.src_ent_nm;
-
-SELECT me.tgt_ent_nm, me.tgt_itm_nm, me.bus_rule, me.src_itm_nm, me.src_ent_nm
-FROM (
-select c.name em_nm,b.name tgt_ent_nm,a.name tgt_itm_nm,
- a.type tgt_itm_type, a.scale tgt_itm_scale,
- a.bus_rule,
- ifnull(f.src_itm_nm,' ') src_itm_nm,
- ifnull(f.src_itm_type,' ') src_itm_type,
- ifnull(f.src_itm_scale,' ') src_itm_scale,
- ifnull(f.src_ent_nm,' ') src_ent_nm
- from item a join entity b on a.et_id=b.et_id
- join entity_master c on b.em_id=c.em_id
- join (select c.tgt_id,d.name src_itm_nm,
- d.type src_itm_type, d.scale src_itm_scale,
- e.name src_ent_nm,d.seq src_seq
- from i2i c, item d, entity e
- where c.src_id=d.it_id and d.et_id=e.et_id) f
- on a.it_id=f.tgt_id
- where c.max_version=1
- order by a.seq,f.src_seq
-) me WHERE ( tgt_itm_nm = 'TOT_POS_PURCH_AMT' )
-GROUP BY me.tgt_ent_nm, me.tgt_itm_nm, me.bus_rule,
-me.src_itm_nm, me.src_ent_nm;
Please sign in to comment.
Something went wrong with that request. Please try again.