MySQL操作程序三十八(Order summary网页程序2,整理2)
返回
作业内容
- 船东中心的管理界面(mysql_test39.htm)
- 购入工厂中心的管理界面(mysql_test40.htm)
- ******************************
- 重新计算程序(mscsum_cal)的Debug
# 处理指定年度的ORDER,计算价格和其他费用==>执行时间过长,一条一条检查
==>看来要重新设计,离线计算,在线只有追加的功能
- msc0.htm修改,增加ORDER SUMMARY按钮
modesum
msc.pm修改,增加mode
- mscsum.pl==>显示程序试验
- mscsum.pl==>显示程序在线
- mscsum.htm,ORDER SUMMARY的HTML画面
表格的项目
时间选择画面
外汇换算输入画面
- ORDER SUMMARY画面直接跳到ORDER画面功能
- form画面的横排
mysql> show columns from sum;
+--------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| year | int(11) | YES | | NULL | |
| time | text | YES | | NULL | |
| ref | text | YES | | NULL | |
| owner | text | YES | | NULL | |
| shipname | text | YES | | NULL | |
| orderno | text | YES | | NULL | |
| ordermoneyid | text | YES | | NULL | |
| ordermoney | text | YES | | NULL | |
| enq2name | text | YES | | NULL | |
| enq2moneyid | text | YES | | NULL | |
| enq2money | text | YES | | NULL | |
| enq2no | text | YES | | NULL | |
| enq2delivery | text | YES | | NULL | |
| enq2pay | text | YES | | NULL | |
| post | text | YES | | NULL | |
| paytime | text | YES | | NULL | |
+--------------+---------+------+-----+---------+----------------+
17 rows in set (0.34 sec)
# mscsum.pl
use strict;
use DBI;
my(%t,@rec,$pref,$n,$n1,$n2);
print "This is mscsum.pl.\n";
# 连接数据库
$$pref{dsn} = "DBI:mysql:host=localhost;database=cookbook";
$$pref{dbh} = DBI->connect($$pref{dsn}, "cbuser", "cbpass") or die "Cannot connect to server\n";
$$pref{dbh}->do("SET NAMES utf8");
if(!$$pref{dbh}){
print "SQL read ERROR!\n";
exit;
}
@{ $t{ylist} } = qw/1 2 3 4/;
print "Please input the year 2008=>1;2009=>2;2010=>3;2011=>4;select=>";
chop($t{y1}=);
if ( $t{ylist}[$t{y1}-1] ) {
print "You selection $t{y1} exists!\n";
} else {
print "You selection $t{y1} does not exist!\n";
exit;
}
# 处理sum
@{ $t{sumlist} } = $$pref{dbh}->selectrow_array("SELECT * FROM sum WHERE id = $t{y1}");
@{ $t{time} } = split(/==/,$t{sumlist}[2]);
@{ $t{ref} } = split(/==/,$t{sumlist}[3]);
@{ $t{owner} } = split(/==/,$t{sumlist}[4]);
@{ $t{shipname} } = split(/==/,$t{sumlist}[5]);
@{ $t{orderno} } = split(/==/,$t{sumlist}[6]);
@{ $t{ordermoneyid} } = split(/==/,$t{sumlist}[7]);
@{ $t{ordermoney} } = split(/==/,$t{sumlist}[8]);
@{ $t{enq2name} } = split(/==/,$t{sumlist}[9]);
@{ $t{enq2moneyid} } = split(/==/,$t{sumlist}[10]);
@{ $t{enq2money} } = split(/==/,$t{sumlist}[11]);
@{ $t{enq2no} } = split(/==/,$t{sumlist}[12]);
@{ $t{enq2delivery} } = split(/==/,$t{sumlist}[13]);
@{ $t{enq2pay} } = split(/==/,$t{sumlist}[14]);
@{ $t{post} } = split(/==/,$t{sumlist}[15]);
@{ $t{paytime} } = split(/==/,$t{sumlist}[16]);
print "id=$t{y1},time=$#{ $t{time} }\n";
print "id=$t{y1},ref=$#{ $t{ref} }\n";
print "id=$t{y1},owner=$#{ $t{owner} }\n";
print "id=$t{y1},shipname=$#{ $t{shipname} }\n";
print "id=$t{y1},orderno=$#{ $t{orderno} }\n";
print "id=$t{y1},ordermoneyid=$#{ $t{ordermoneyid} }\n";
print "id=$t{y1},ordermoney=$#{ $t{ordermoney} }\n";
print "id=$t{y1},enq2name=$#{ $t{enq2name} }\n";
print "id=$t{y1},enq2moneyid=$#{ $t{enq2moneyid} }\n";
print "id=$t{y1},enq2money=$#{ $t{enq2money} }\n";
print "id=$t{y1},enq2no=$#{ $t{enq2no} }\n";
print "id=$t{y1},enq2delivery=$#{ $t{enq2delivery} }\n";
print "id=$t{y1},enq2pay=$#{ $t{enq2pay} }\n";
print "id=$t{y1},post=$#{ $t{post} }\n";
print "id=$t{y1},paytime=$#{ $t{paytime} }\n";
# 关闭数据库
$$pref{dbh}->disconnect;
print "End.\n";
form画面的横排
返回