选择复数个项目的界面和程序
戻る
mscparts_gd.pl
sub mscparts_gd {
my $self = shift;
my(%t,@loop,$n,@rec);
# Get CGI query object
$t{q} = $self->query();
$t{html} = $t{q}->param("tmpl");
$t{html} = $t{html} . '.htm';
$t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{id} = $t{q}->param("id");
$t{GNO} = $t{q}->param("NO");
$t{table} = $t{q}->param("table");
$t{item} = $t{q}->param("item");
$t{name} = $t{q}->param("name");
# パーツテーブルを読む
$t{sth} = $self->dbh->prepare("SELECT id, name, code FROM $t{table}");
$t{sth}->execute;
while ( @rec = $t{sth}->fetchrow_array ) {
$t{NO} = 'ss' . $rec[0];
my %row = (
NO => $t{NO},
id => $rec[0],
name => $rec[1],
code => $rec[2]
);
push(@loop, \%row);
}
$t{sth}->finish;
if ( $t{item} eq 'GR' ) {
$t{tmpl0} = 'mscengine_gr';
} else {
$t{tmpl0} = 'mscengine_dwg';
}
$t{template}->param(LOOP => \@loop);
$t{template}->param(id => $t{id});
$t{template}->param(GNO => $t{GNO});
$t{template}->param(table => $t{table});
$t{template}->param(item => $t{item});
$t{template}->param(tmpl0 => $t{tmpl0});
$t{template}->param(name => $t{name});
return $t{template}->output;
}
1;
mscparts_gd.htm
Partsの選択
Partsの選択
mode:modeparts_gd
id=>
table=>
=>
">
">
">
">
mscparts_gd1.pl
sub mscparts_gd1 {
my $self = shift;
my(%t,@loop,$n,@rec);
# Get CGI query object
$t{q} = $self->query();
$t{html} = $t{q}->param("tmpl");
$t{item} = $t{q}->param("item");
$t{GNO} = $t{q}->param("GNO");
$t{html} = $t{html} . '.htm';
$t{template} = $self->load_tmpl("$t{html}") || die "error loading tmpl";
$t{id} = $t{q}->param("id");
$t{table} = $t{q}->param("table");
# パーツ数を取得
$t{sth} = $self->dbh->prepare("SELECT id FROM $t{table}");
$t{sth}->execute;
$t{s} = '';
while ( @rec = $t{sth}->fetchrow_array ) {
$t{NO} = 'ss' . $rec[0];
$t{s1} = $t{q}->param($t{NO});
push(@{ $t{slist} },$t{s1});
}
$t{sth}->finish;
if ( $t{item} eq 'GR' ) {
$t{item1} = 'group_id';
} else {
$t{item1} = 'dwg_id';
}
# GR/DWGを書く
for $n ( 0 .. $#{ $t{slist} } ) {
$t{id1} = $n + 1;
if ( $t{slist}[$n] eq 'on' ) {
$t{sql} = 'UPDATE ' . $t{table} . ' set ' . $t{item1} . ' = "';
$t{sql} .= $t{GNO} . '" where id = ' . $t{id1};
$t{DO} = $self->dbh->do($t{sql});
}
}
if ( $t{item} eq 'GR' ) {
$t{tmpl0} = 'mscengine_gr';
} else {
$t{tmpl0} = 'mscengine_dwg';
}
$t{template}->param(id => $t{id});
$t{template}->param(item => $t{item});
$t{template}->param(GNO => $t{GNO});
$t{template}->param(DO => $t{DO});
$t{template}->param(tmpl0 => $t{tmpl0});
return $t{template}->output;
}
1;
mscparts_gd1.htm
選択完了
選択完了
mode:modeparts_gd1
id==>
GNO==>
DO==>
戻る