|
看完之後不要K我阿~~~
因為我今天為了下面這些程式差點頭腦開花~~~
我只不過修正了一些BUG...花了我5多小時..
而修正的部分..就是租還片的時候要能正確扣除或是增加數量..
之前的問題就是在還片的時喉沒有及時增加數量...
造成有些人看到客戶還的新片要租..卻無法出租..
原因就出在我之前是採客戶結帳之後才重新統計數量的...
現在下面這程式是改好的...
想看沒改過的..直要回覆數高達14篇第15篇我就把有問題的程式碼PO出來..
但~~應該有人會看的頭暈吧....
#####################################
# 興紋商務軟體 #
# 本軟體版權為鄭順興個人所有 #
# 若沒有本人書面同意 #
# 請勿仿冒或修改否則依法究辦 #
#####################################
sub rentaswellscanadmin2dall { #更改出租或歸還物品設定
#######################################################################
$regcolor = "syscolor.txt";
@consc=&readtxtfile("$filehead$regcolor",2);
@consc=sort @consc;
foreach (@consc) {
($coloret ,$ca ,$cb ,$cc ,$cd ,$ce ,$cf ,$cg ,$ch ,$ci ,$cj)=split(/∥/,$_);
chomp($cj);
if ($syscolors eq $coloret){
$color1 = "$coloret"; #顏色識別
$color2 = "$ca"; #箭頭顏色
$color3 = "$cb"; #轉軸外部外框顏色
$color4 = "$cc"; #轉軸內部背景顏色
$color5 = "$cd"; #轉軸外部背景顏色
$color6 = "$ce"; #轉軸內部外框顏色
$color7 = "$cf"; #背景顏色
$color8 = "$cg"; #文字顏色
$color9 = "$ch"; #連接顏色
$color10 = "$ci"; #瀏覽過的連接顏色
$color11 = "$cj"; #使用中的連接顏色
}
}
$adminusertid =&get_var('adminusertid' ,'\n|"|<|>|∥');
$scandatain =&get_var('scandatain' ,'\n|"|<|>|∥');
if ($adminusertid =~ /[^a-zA-Z0-9]/) { &errorjava("請勿非法修改程式"); }
if ($adminusertid eq "") { &errorjava("客戶ID錯誤請登入客戶資料"); }
if ($scandatain eq "") { &errorjava("商品條碼空白請重新輸入"); }
$scandatain=~ tr/a-z/A-Z/;
$userfortup = "userformat"; #客戶資料夾名稱
$mdretyu = "$filehead$userfortup";
unless(-d $mdretyu) { #檢查是否存在客戶資料夾
mkdir("$mdretyu",0777); #建立客戶資料夾並修改檔案屬性
}
$rentaswell = "rentaswell"; #客戶出租確認資料夾名稱
$mdretyus = "$mdretyu/$adminusertid/$rentaswell";
unless(-d $mdretyus) { #檢查是否存在客戶出租確認資料夾
mkdir("$mdretyus",0777); #建立客戶出租確認資料夾並修改檔案屬性
}
$datafortup = "dataformat"; #資料庫資料夾名稱
$dataformattxt = "$userfortup/$adminusertid/rentaswelluserdataformat.txt"; #客戶租片資料暫存區
$peo="$filehead$dataformattxt"; #檢查是否有客戶租片資料暫存區檔案存在並建立檔案
unless(-f $peo){
open(TMP,">$peo");
close(TMP);
chmod(0666,$peo);
}
$dataformattxt1 = "$datafortup/$scandatain/rentaswelldataformat.txt"; #租還系統已出租資料索引區
$peo1="$filehead$dataformattxt1"; #
unless(-f $peo1){
open(TMP,">$peo1");
close(TMP);
chmod(0666,$peo1);
}
@categorysi=&readtxtfile("$peo");
@categorysi=sort @categorysi;
open (FILE, ">$peo");
foreach (@categorysi) {
($messtimenlisre,$datare1ste,$datare2ste,$datare3ste,$datare4ste,$datare5ste,$datare6ste,$datare7ste,$datare8ste,$datare9ste,$datare10ste,$datare11ste)=split(/∥/,$_);
if ($scandatain eq $messtimenlisre) {
$dataformattxt2 = "$filehead$datafortup/$messtimenlisre/quantity.txt"; #租還數量管制
@categorysis1=&readtxtfile("$dataformattxt2");
@categorysis1=sort @categorysis1;
if ($datare4ste eq "no") {
foreach (@categorysis1) {
($messtimenlishqm,$dataqm1,$dataqm2)=split(/∥/,$_);
if ($dataqm2 <= 0) {
$GPD = "yes";
$datare4stes = "no";
$datatimeschos = $datare6ste;
$datatimes = $datare8ste;
}
}
if ($GPD ne "yes") {
$datare4stes = "yes";
$datatimeschos = 0;
$datatimes =0;
open (FILETSA, ">$dataformattxt2");
foreach (@categorysis1) {
($messtimenlishqmS,$dataqm1S,$dataqm2S)=split(/∥/,$_);
$mdmdqmS = $dataqm2S-1;
print FILETSA "$messtimenlishqmS∥$dataqm1S∥$mdmdqmS∥\n";
}
close (FILETSA);
}
}
if ($datare4ste eq "yes") {
$datare4stes = "no";
$datatimest = time; #目前時間
$datatimes = $datatimest - $datare5ste; #目前時間扣除先前租片時間
$datatimes = $datatimes / 86400; #剩餘時間除以1天取得租片時的正確時間
$datatimes = sprintf "%.2f",$datatimes; #取小數點2位數
chop($datatimes);
chop($datatimes);
chop($datatimes); #取整數
$datare7stets = $datare7ste - 1;
$datatimes = $datatimes - $datare7stets; #將取得的天數扣除可租天數
if ($datatimes >= 1) {
if ($hourn <= 23) {$datatimes = $datatimes - 1;} #當天數大於1且在當天的11點前不算超過
}
if ($datatimes <= 0) { $datatimes=0; }
$datatimeschos = $datare9ste * $datatimes;
open (FILETSH, ">$dataformattxt2");
foreach (@categorysis1) {
($messtimenlishqm,$dataqm1,$dataqm2)=split(/∥/,$_);
$mdmdqm = $dataqm2+1;
print FILETSH "$messtimenlishqm∥$dataqm1∥$mdmdqm∥\n";
}
close (FILETSH);
}
chomp($datamine11ste);
print FILE "$messtimenlisre∥$datare1ste∥$datare2ste∥$datare3ste∥$datare4stes∥$datare5ste∥$datatimeschos∥$datare7ste∥$datatimes∥$datare9ste∥$datare10ste∥$datare11ste∥\n";}
else {print FILE "$_";}
}
close (FILE);
@categorysis=&readtxtfile("$peo1");
@categorysis=sort @categorysis;
open (FILET, ">$peo1");
foreach (@categorysis) {
($messtimenlish,$datamine1steh,$datamine2steh,$datamine3steh,$datamine4steh,$datamine5steh,$datamine6steh)=split(/∥/,$_);
if ($scandatain eq $messtimenlish) {
chomp($datamine6steh);
print FILET "$messtimenlish∥$datamine1steh∥$datamine2steh∥$datamine3steh∥$datare4stes∥$datamine5steh∥$datamine6steh∥\n";}
else {print FILET "$_";}
}
close (FILET);
if ($GPD eq "yes") {
&errorjava("該物品出租數量不足或已被出租");
}
print <<EOFsssrtc;
<html>
<script language="JavaScript">
function admindataruallslu() {
document.forms[0].submit();
}
</script>
<head>
<STYLE TYPE="text/css">
<!--
TD { FONT-SIZE: 16px }
body {scrollbar-arrow-color:#FFFFFF;scrollbar-base-color:#FFFFFF;scrollbar-face-color:#222222;scrollbar-highlight-color:#222222;scrollbar-shadow-color:#FFFFFF}
-->
</STYLE>
<meta http-equiv="Content-Language" content="zh-tw">
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
</head>
<body onload="admindataruallslu();" ONDRAGSTART="window.event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" bgcolor="#000000" text="#FFFFFF" link="#0000FF" vlink="#FF00FF" alink="#00FF00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form method=post action=rentaswell.cgi?$userinfo target='rentaswell3'>
<input type=hidden name='main' value='rentaswellscanadmin2'>
<input type=hidden name='adminusertid' value='$adminusertid'>
</form>
</center>
</body>
</html>
EOFsssrtc
}
##########
sub errorjava { #錯誤函式庫
print "<html><head><title></title>\n";
print "<script Language='JavaScript'>\n";
print "function erorwe() {\n";
print " alert('$_[0]');\n";
print " return false;\n";
print " }\n";
print "erorwe();\n";
print "</script>\n";
print "<body bgcolor='#000000' text='#FFFFFF''>\n";
print "</head></html>\n";
exit 0;
}
#####################################
# 興紋商務軟體 #
# 本軟體版權為鄭順興個人所有 #
# 若沒有本人書面同意 #
# 請勿仿冒或修改否則依法究辦 #
#####################################
sub rentaswellrentin { #客戶出租資料處理
#######################################################################
$regcolor = "syscolor.txt";
@consc=&readtxtfile("$filehead$regcolor",2);
@consc=sort @consc;
foreach (@consc) {
($coloret ,$ca ,$cb ,$cc ,$cd ,$ce ,$cf ,$cg ,$ch ,$ci ,$cj)=split(/∥/,$_);
chomp($cj);
if ($syscolors eq $coloret){
$color1 = "$coloret"; #顏色識別
$color2 = "$ca"; #箭頭顏色
$color3 = "$cb"; #轉軸外部外框顏色
$color4 = "$cc"; #轉軸內部背景顏色
$color5 = "$cd"; #轉軸外部背景顏色
$color6 = "$ce"; #轉軸內部外框顏色
$color7 = "$cf"; #背景顏色
$color8 = "$cg"; #文字顏色
$color9 = "$ch"; #連接顏色
$color10 = "$ci"; #瀏覽過的連接顏色
$color11 = "$cj"; #使用中的連接顏色
}
}
$udditt=0;
$adminusertid =&get_var('adminusertid' ,'\n|"|<|>|∥');
$scandatain =&get_var('scandatain' ,'\n|"|<|>|∥');
if ($adminusertid =~ /[^a-zA-Z0-9]/) { &errorjava("請勿非法修改程式"); }
if ($adminusertid eq "") { &errorjava("客戶ID錯誤請登入客戶資料"); }
if ($scandatain eq "") { &errorjava("商品條碼空白請重新輸入"); }
$scandatain=~ tr/a-z/A-Z/;
$userfortup = "userformat"; #客戶資料夾名稱
$mdretyu = "$filehead$userfortup";
unless(-d $mdretyu) { #檢查是否存在客戶資料夾
mkdir("$mdretyu",0777); #建立客戶資料夾並修改檔案屬性
}
$rentaswell = "rentaswell"; #客戶出租確認資料夾名稱
$mdretyus = "$mdretyu/$adminusertid/$rentaswell";
unless(-d $mdretyus) { #檢查是否存在客戶出租確認資料夾
mkdir("$mdretyus",0777); #建立客戶出租確認資料夾並修改檔案屬性
}
$datafortup = "dataformat"; #資料庫資料夾名稱
$rentaswellopp = "$mdretyus/rentaswell.txt";
$dataformattxt = "$userfortup/$adminusertid/rentaswelluserdatauptest.txt"; #客戶出租租片資料暫存區
$peo="$filehead$dataformattxt"; #檢查是否有客戶出租租片資料暫存區檔案存在並建立檔案
unless(-f $peo){
open(TMP,">$peo");
close(TMP);
chmod(0666,$peo);
}
@usertyutvsp=&readtxtfile($peo,2);
@usertyutvsp=sort @usertyutvsp;
foreach (@usertyutvsp) { #讀取資料庫資料並比對
($messtimenlisup,$datamine1steup,$datamine2steup,$datamine3steup,$datamine4steup,$datamine5steup,$datamine6steup,$datamine7steup,$datamine8steup,$datamine9steup)=split(/∥/,$_);
chomp($datamine9steup);
if ($scandatain eq $datamine2steup) {
&errorjava("已有相同出租商品");
}
}
$peos="$filehead$userfortup/$adminusertid/$adminusertid.txt"; #會員ID檔案
@usertyutvf=&readtxtfile($peos,2);
@usertyutvf=sort @usertyutvf;
foreach (@usertyutvf) {
($messtimenaa,$datenaa,$timenaa,$usernameaa,$userpassaa,$useremailaa,$usernameuseraa,$useruidaa,$useryyddaa,$userSexaa,$usertelaa,$userfaxaa,$userteluroaa,$usersataaa,$usermailpassaa,$usermailaa,$usermaildfeaa,$userhttpaa,$usericqaa,$usermsnaa,$useryahooaa,$userphopoaa,$usermembercodeaa,$userlovelaa,$useraddjyaa,$usermeiliaa,$usermymoneyaa,$userasdrtewaa,$usereducationaa,$usermarryaa,$userworkaa,$userxzaa,$usersxaa,$userebankdata1aa,$userebankdata2aa,$userebankdata3aa,$userebankdata4aa,$useronlinetimeaa,$userawardsaa,$useradd1aa,$useradd2aa,$useradd3aa,$useradd4aa,$useradd5aa,$useradd6aa,$useradd7aa,$useradd8aa,$useradd9aa,$useradd10aa,$useradd11aa,$useradd12aa,$useradd13aa,$useradd14aa,$useradd15aa)=split(/∥/,$_);
chomp($useradd15aa);
$temps="$useradd15aa";
if ($messtimenaa eq $adminusertid) {
$udditt++;
}
}
if ($usermembercodeaa eq "banned") { &errorjava("該用戶被限制無法租買任何物品"); }
$scardatafont = "$filehead$datafortup/dataformats.txt";
@usertyutvs=&readtxtfile($scardatafont,2);
@usertyutvs=sort @usertyutvs;
foreach (@usertyutvs) { #讀取資料庫資料並比對
($messtimenlisu,$datamine1steu,$datamine2steu,$datamine3steu,$datamine4steu,$datamine5steu,$datamine6steu)=split(/∥/,$_);
chomp($datamine6steu);
if ($scandatain eq $datamine2steu) {
$messtimenlisuddds = $messtimenlisu;
$peo1 = "$filehead$datafortup/$messtimenlisuddds/$messtimenlisu.txt";
$dataaayud = $datamine1steu;
}
}
if ($messtimenlisuddds eq "") { &errorjava("查無該商品資料或條碼錯誤"); }
@usertyutvsfduu=&readtxtfile($rentaswellopp,2);
@usertyutvsfduu=sort @usertyutvsfduu;
foreach (@usertyutvsfduu) { #讀取資料庫資料並比對
($messtimenlisretuu,$datare1stetuu)=split(/∥/,$_);
$rentaswellopp1 = "$mdretyus/$messtimenlisretuu.txt"; #檢查是否有客戶租還資料比對紀錄檔檔案存在並建立檔案
@usertyutvsfuu=&readtxtfile($rentaswellopp1,2);
@usertyutvsfuu=sort @usertyutvsfuu;
foreach (@usertyutvsfuu) { #讀取資料庫資料並比對
($messtimenlisreuu,$datare1steuu,$datare2steuu,$datare3steuu,$datare4steuu,$datare5steuu,$datare6steuu,$datare7steuu,$datare8steuu,$datare9steuu)=split(/∥/,$_);
chomp($datare9steuu);
if (($scandatain eq $datare1steuu) || ($dataaayud eq $datare1steuu)) {
$dataadminyesno="yes";
$dataadminyesnopp=$datare2steuu;
}
}
}
@usertyutv=&readtxtfile($peo1,2);
@usertyutv=sort @usertyutv;
foreach (@usertyutv) { #讀取資料庫資料並比對
($messtimenli,$datamine1li,$datamine2li,$datamine3li,$datamine4li,$datamine5li,$datamine6li,$datamine7li,$datamine8li,$datamine9li,$datamine10li,$datamine11li,$datamine12li,$datamine13li,$datamine14li,$datamine15li,$dataadd1li,$dataadd2li,$dataadd3li,$dataadd4li,$dataadd5li,$dataadd6li,$dataadd7li,$dataadd8li,$dataadd9li,$dataadd10li,$dataadd11li,$dataadd12li,$dataadd13li,$dataadd14li,$dataadd15li)=split(/∥/,$_);
chomp($dataadd15li);
if ($messtimenli eq $messtimenlisuddds) {
$udditt++;
}
}
$peo2 = "$filehead$datafortup/$messtimenlisuddds/cost.txt"; #資料庫商品價格檔案
@usertyutvsa=&readtxtfile($peo2,2);
@usertyutvsa=sort @usertyutvsa;
foreach (@usertyutvsa) { #讀取資料庫資料並比對
($messtimenlis,$datamine16li,$datamine17li,$datamine18li,$datamine19li,$datamine20li,$datamine21li,$datamine22li,$datamine23li,$datamine24li)=split(/∥/,$_);
chomp($datamine24li);
if ($messtimenlis eq $messtimenlisuddds) {
$udditt++;
}
}
if ($datamine4li ne "rent") { &errorjava("該商品不得用於出租"); }
if ($datamine4li eq "rent") {
$datatimest = time; #目前時間
$datatimes = $datatimest - $dataadd14li;
$datatimes = $datatimes / 86400; #除以1天
$datatimes = sprintf "%.2f",$datatimes; #取小數點2位數
chop($datatimes);
chop($datatimes);
chop($datatimes); #取整數
if ($datatimes < $datamine13li) { $rentdatatimes = $datamine14li; }
if ($datatimes >= $datamine13li) { $rentdatatimes = $datamine15li; }
if ($usermembercodeaa eq "userme") { $rentmieerds = $datamine22li; }
if (($usermembercodeaa eq "amo") || ($usermembercodeaa eq "admuser")) { $rentmieerds = $datamine23li; }
$dataformattxt21 = "$filehead$datafortup/$messtimenlisuddds/quantity.txt"; #租還數量管制
@categorysis11=&readtxtfile("$dataformattxt21");
@categorysis11=sort @categorysis11;
foreach (@categorysis11) {
($messtimenlishqm,$dataqm1,$dataqm2)=split(/∥/,$_);
if ($dataqm2 <= 0) { &errorjava("該物品出租數量不足或已被出租"); }
}
$message="$messtimenli∥$daten $timen∥$datamine2li∥$datamine1li∥yes∥$datatimest∥$rentmieerds∥$rentdatatimes∥$datamine24li∥$username∥"; #將資料寫入資料庫索引檔中(針對名稱及條碼作搜尋用)
open (DATA,">>$peo") ||die &!;
print DATA "$message\n";
close(DATA);
open (FILETSHA, ">$dataformattxt21");
foreach (@categorysis11) {
($messtimenlishqm,$dataqm1,$dataqm2)=split(/∥/,$_);
$mdmdqm = $dataqm2-1;
print FILETSHA "$messtimenlishqm∥$dataqm1∥$mdmdqm∥\n";
}
close (FILETSHA);
print <<EOFsssrtc;
<html>
<script language="JavaScript">
function admindataruallslu() {
document.forms[0].submit();
}
EOFsssrtc
if ($dataadminyesno eq "yes") {
print <<EOFsssrtc;
function erorwes() {
alert('$dataadminyesnopp 以租過');
}
erorwes();
EOFsssrtc
}
print <<EOFsssrtc;
</script>
<head>
<STYLE TYPE="text/css">
<!--
TD { FONT-SIZE: 16px }
body {scrollbar-arrow-color:#FFFFFF;scrollbar-base-color:#FFFFFF;scrollbar-face-color:#222222;scrollbar-highlight-color:#222222;scrollbar-shadow-color:#FFFFFF}
-->
</STYLE>
<meta http-equiv="Content-Language" content="zh-tw">
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
</head>
<body onload="admindataruallslu();" ONDRAGSTART="window.event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" bgcolor="#000000" text="#FFFFFF" link="#0000FF" vlink="#FF00FF" alink="#00FF00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form method=post action=rentaswell.cgi?$userinfo target='rentaswell4'>
<input type=hidden name='main' value='rentaswellscanadmin3'>
<input type=hidden name='adminusertid' value='$adminusertid'>
</form>
</center>
</body>
</html>
EOFsssrtc
}
}
##########
sub errorjava { #錯誤函式庫
print "<html><head><title></title>\n";
print "<script Language='JavaScript'>\n";
print "function erorwe() {\n";
print " alert('$_[0]');\n";
print " return false;\n";
print " }\n";
print "erorwe();\n";
print "</script>\n";
print "<body bgcolor='#000000' text='#FFFFFF''>\n";
print "</head></html>\n";
exit 0;
}
#####################################
# 興紋商務軟體 #
# 本軟體版權為鄭順興個人所有 #
# 若沒有本人書面同意 #
# 請勿仿冒或修改否則依法究辦 #
#####################################
sub rentaswelluserdataendsis { #結算後確認
#######################################################################
$regcolor = "syscolor.txt";
@consc=&readtxtfile("$filehead$regcolor",2);
@consc=sort @consc;
foreach (@consc) {
($coloret ,$ca ,$cb ,$cc ,$cd ,$ce ,$cf ,$cg ,$ch ,$ci ,$cj)=split(/∥/,$_);
chomp($cj);
if ($syscolors eq $coloret){
$color1 = "$coloret"; #顏色識別
$color2 = "$ca"; #箭頭顏色
$color3 = "$cb"; #轉軸外部外框顏色
$color4 = "$cc"; #轉軸內部背景顏色
$color5 = "$cd"; #轉軸外部背景顏色
$color6 = "$ce"; #轉軸內部外框顏色
$color7 = "$cf"; #背景顏色
$color8 = "$cg"; #文字顏色
$color9 = "$ch"; #連接顏色
$color10 = "$ci"; #瀏覽過的連接顏色
$color11 = "$cj"; #使用中的連接顏色
}
}
$adminusertid =&get_var('adminusertid' ,'\n|"|<|>|∥');
$chinsidsi =&get_var('chinsidsi' ,'\n|"|<|>|∥'); #押金
$adminchins =&get_var('adminchins' ,'\n|"|<|>|∥'); #已付費用
$chinsaddudd =&get_var('chinsaddudd' ,'\n|"|<|>|∥'); #繳費扣款
$adminusertidnime =&get_var('adminusertidnime' ,'\n|"|<|>|∥');
$adminchiyesno =&get_var('adminchiyesno' ,'\n|"|<|>|∥');
$conttext =&get_var('conttext' ,'\n|"|<|>|∥');
$chinsidsigiyesno =&get_var('chinsidsigiyesno' ,'\n|"|<|>|∥');
if ($adminusertid =~ /[^a-zA-Z0-9]/) { &error("請勿非法修改程式"); }
if ($adminusertid eq "") { &error("客戶ID錯誤請登入客戶資料"); }
if ($chinsidsi =~ /[^0-9]/) { &error("請勿非法修改程式"); }
if ($adminchins =~ /[^0-9]/) { &error("請勿非法修改程式"); }
if ($adminusertidnime eq "") { &error("請勿非法修改程式"); }
if ($chinsidsi eq "") { $chinsidsi=0; }
if ($adminchins eq "") { $adminchins=0; }
if ($chinsaddudd eq "yes") { $adminchins="-$adminchins"; }
$userfortup = "userformat"; #客戶資料夾名稱
$mdretyu = "$filehead$userfortup";
unless(-d $mdretyu) { #檢查是否存在客戶資料夾
mkdir("$mdretyu",0777); #建立客戶資料夾並修改檔案屬性
}
$rentaswell = "rentaswell"; #客戶租還紀錄資料夾名稱
$mdretyus = "$mdretyu/$adminusertid/$rentaswell";
unless(-d $mdretyus) { #檢查是否存在客戶租還紀錄資料夾
mkdir("$mdretyus",0777); #建立客戶租還紀錄資料夾並修改檔案屬性
}
$datafortup = "dataformat"; #資料庫資料夾名稱
$rentaswelloppss = "$mdretyus/$rentaswell.txt"; #檢查是否有客戶租還資料比對紀錄檔檔案存在並建立檔案
unless(-f $rentaswelloppss){
open(TMP,">$rentaswelloppss");
close(TMP);
chmod(0666,$rentaswelloppss);
}
$rentaswellopp = "$mdretyus/$yearn.txt"; #檢查是否有客戶租還資料比對紀錄檔檔案存在並建立檔案
unless(-f $rentaswellopp){
open(TMP,">$rentaswellopp");
close(TMP);
chmod(0666,$rentaswellopp);
open (ASDF, ">>$rentaswelloppss");
print ASDF "$yearn∥\n";
close (ASDF);
}
$dataformattxt = "$userfortup/$adminusertid/rentaswelluserdataformat.txt"; #客戶租片資料暫存區
$peo="$filehead$dataformattxt"; #檢查是否有客戶租片資料暫存區檔案存在並建立檔案
unless(-f $peo){
open(TMP,">$peo");
close(TMP);
chmod(0666,$peo);
}
$Invoice = "Invoicedata"; #租還報表資料夾名稱
$Invoicedata = "$filehead$userfortup/$adminusertid/$Invoice";
unless(-d $Invoicedata) { #檢查是否存在租還報表資料夾
mkdir("$Invoicedata",0777); #建立租還報表資料夾並修改檔案屬性
}
$Invoicedata1 = "$filehead$userfortup/$adminusertid/$Invoice/$yearn";
unless(-d $Invoicedata1) { #檢查是否存在租還報表資料夾
mkdir("$Invoicedata1",0777); #建立租還報表資料夾並修改檔案屬性
}
$peopsp="$filehead$userfortup/$adminusertid/$Invoice/$yearn/$messtimen.txt"; #檢查是否有發票資料檔案存在並建立檔案
unless(-f $peopsp){
open(TMP,">$peopsp");
close(TMP);
chmod(0666,$peopsp);
}
$ruall1=0;
$ruall2=0;
$chien=0;
@usertyutvsf=&readtxtfile($peo,2);
@usertyutvsf=sort @usertyutvsf;
open (FILE, ">$peo");
foreach (@usertyutvsf) { #讀取資料庫資料並比對
($messtimenlisre,$datare1ste,$datare2ste,$datare3ste,$datare4ste,$datare5ste,$datare6ste,$datare7ste,$datare8ste,$datare9ste,$datare10ste,$datare11ste)=split(/∥/,$_);
$chien = $chien+$datare6ste;
if ($datare4ste eq "no") {
$dataformattxt1g = "$filehead$datafortup/$messtimenlisre/rentaswelldataformat.txt"; #租還系統已出租資料索引區
@categorysis=&readtxtfile("$dataformattxt1g");
@categorysis=sort @categorysis;
open (FILETS, ">$dataformattxt1g");
foreach (@categorysis) {
($messtimenlishgs,$datamine1stehgs,$datamine2stehgs,$datamine3stehgs,$datamine4stehgs,$datamine5stehgs,$datamine6stehgs)=split(/∥/,$_);
if ($datamine4stehgs eq "no") {
if ($adminusertid eq $datamine2stehgs) {
$adcfgyw = $messtimenlishgs;
}
}
else {print FILETS "$_";}
}
close (FILETS);
$dataformattxt3s = "$filehead$datafortup/$messtimenlisre/letouttakedown/letouttakedown.txt"; #在商品資料下方建立出租紀錄
unless(-f $dataformattxt3s){
open(TMP,">$dataformattxt3s");
close(TMP);
}
$dataformattxt3 = "$filehead$datafortup/$messtimenlisre/letouttakedown/$yearn.txt"; #在商品資料下方建立出租紀錄
unless(-f $dataformattxt3){
open(TMP,">$dataformattxt3");
close(TMP);
chmod(0666,$dataformattxt3);
open (ASDFS, ">>$dataformattxt3s");
print ASDFS "$yearn∥\n";
close (ASDFS);
}
open (FILETSHC, ">>$dataformattxt3");
print FILETSHC "$messtimenlisre∥$datare2ste∥$datare3ste∥$datare1ste∥$daten $timen∥$datare8ste∥$datare6ste∥$datare11ste∥$datare10ste∥$username∥$adminusertid∥$adminusertidnime∥\n";
close (FILETSHC);
open (FILEG, ">>$rentaswellopp");
print FILEG "$messtimenlisre∥$datare2ste∥$datare3ste∥$datare1ste∥$daten $timen∥$datare8ste∥$datare6ste∥$datare11ste∥$datare10ste∥$username∥\n";
close (FILEG);
}
else {
print FILE "$_";
$ruall1++; }
}
close (FILE);
open(FILEGDE,">>$peopsp");
print FILEGDE "$messtimen∥ED99999998∥歸還過期費用∥$chien∥1∥\n";
close(FILEGDE);
$peo1="$filehead$userfortup/$adminusertid/rentaswelluserdatauptest.txt"; #檢查是否有客戶出租租片資料暫存區檔案存在並建立檔案
unless(-f $peo1){
open(TMP,">$peo1");
close(TMP);
chmod(0666,$peo1);
}
$chien1=0;
@usertyutvsf1=&readtxtfile($peo1,2);
@usertyutvsf1=sort @usertyutvsf1;
foreach (@usertyutvsf1) { #讀取資料庫資料並比對
($messtimenlisre1,$datare1ste1,$datare2ste1,$datare3ste1,$datare4ste1,$datare5ste1,$datare6ste1,$datare7ste1,$datare8ste1,$datare9ste1,$datare10ste1)=split(/∥/,$_);
chomp($datamine10ste1);
$ruall1++;
$ruall2++;
$chien1 = $chien1+$datare6ste1;
open (FILEGDBB, ">>$peo");
print FILEGDBB "$messtimenlisre1∥$datare1ste1∥$datare2ste1∥$datare3ste1∥$datare4ste1∥$datare5ste1∥0∥$datare7ste1∥0∥$datare8ste1∥$datare9ste1∥$datare6ste1∥\n";
close (FILEGDBB);
$dataformattxt11 = "$filehead$datafortup/$messtimenlisre1/rentaswelldataformat.txt"; #租還系統已出租資料索引區
open (FILEGDB, ">>$dataformattxt11");
print FILEGDB "$messtimenlisre1∥$datare1ste1∥$adminusertid∥$adminusertidnime∥$datare4ste1∥$datare5ste1∥$datare9ste1∥\n";
close (FILEGDB);
open(FILEGDE,">>$peopsp");
print FILEGDE "$messtimen∥$datare2ste1∥$datare3ste1∥$datare6ste1∥1∥\n";
close(FILEGDE);
}
open (FILEGDA, ">$peo1");
close (FILEGDA);
$scardata = "$filehead$userfortup/$adminusertid/rentaswellchien.txt";
unless(-f $scardata){
open(TMP,">$scardata");
close(TMP);
chmod(0666,$scardata);
}
@usertyutvs=&readtxtfile($scardata,2);
@usertyutvs=sort @usertyutvs;
foreach (@usertyutvs) { #讀取資料庫資料並比對
($datamine1ste2,$datamine2ste2,$datamine3ste2,$datamine4ste2)=split(/∥/,$_);
chomp($datamine4ste2);
}
if ($datamine3ste2 eq "") {$datamine3ste2=0;}
open(FILEGDE,">>$peopsp");
print FILEGDE "$messtimen∥ED99999999∥上期租金未還∥$datamine3ste2∥1∥\n";
close(FILEGDE);
if ($datamine1ste2 eq "") { $datamine1ste2=0;}
if ($datamine2ste2 eq "") { $datamine2ste2=0;}
if ($datamine3ste2 eq "") { $datamine3ste2=0;}
if ($datamine4ste2 eq "") { $datamine4ste2=0;}
if ($datamine4ste2 ne 0) { $ruallcchi = $datamine4ste2;}
if ($datamine4ste2 eq 0) { $ruallcchi = $chinsidsi;}
if ($chinsidsigiyesno eq "yes") {$ruallcchi=0;}
$chinxchin = $chien+$chien1+$datamine3ste2;
$chinxchins = $chinxchin-$adminchins;
if ($adminchiyesno eq "yes") {$chinxchins=0;}
open(FILEGDC,">$scardata");
print FILEGDC "$ruall1∥$ruall2∥$chinxchins∥$ruallcchi∥\n";
close(FILEGDC);
$statistic = "statisticsreport"; #統計報表資料夾名稱
$statisticsreport = "$filehead$statistic";
unless(-d $statisticsreport) { #檢查是否存在統計報表資料夾
mkdir("$statisticsreport",0777); #建立統計報表資料夾並修改檔案屬性
}
$aswellcointaked = "rentaswellcointakedown"; #租還報表資料夾名稱
$rentaswellcointakedown = "$filehead$statistic/$aswellcointaked";
unless(-d $rentaswellcointakedown) { #檢查是否存在租還報表資料夾
mkdir("$rentaswellcointakedown",0777); #建立租還報表資料夾並修改檔案屬性
}
$peop1="$filehead$statistic/$aswellcointaked/$aswellcointaked.txt"; #檢查是否有租還金額月報表檔案存在並建立檔案
unless(-f $peop1){
open(TMP,">$peop1");
close(TMP);
chmod(0666,$peop1);
}
$peop="$filehead$statistic/$aswellcointaked/$yearn$monn.txt"; #檢查是否有租還金額月報表檔案存在並建立檔案
unless(-f $peop){
open(TMP,">$peop");
close(TMP);
chmod(0666,$peop);
open(FILEGDDF,">>$peop1");
print FILEGDDF "$yearn$monn∥\n";
close(FILEGDDF);
}
open(FILEGDD,">>$peop");
print FILEGDD "$messtimen∥$yearn∥$monn∥$dayn∥$timen∥$adminusertid∥出租歸還費用統計∥$chinxchin∥$adminchins∥∥出租歸還費用統計<br>$conttext∥$ruallcchi∥$username∥\n";
close(FILEGDD);
$statistic1 = "statisticsreport"; #統計報表資料夾名稱
$statisticsreport1 = "$filehead$userfortup/$adminusertid/$statistic1";
unless(-d $statisticsreport1) { #檢查是否存在統計報表資料夾
mkdir("$statisticsreport1",0777); #建立統計報表資料夾並修改檔案屬性
}
$peopce1="$statisticsreport1/$statistic1.txt"; #檢查是否有租還金額月報表檔案存在並建立檔案
unless(-f $peopce1){
open(TMP,">$peopce1");
close(TMP);
chmod(0666,$peopce1);
}
$peopce="$statisticsreport1/$yearn$monn.txt"; #檢查是否有租還金額月報表檔案存在並建立檔案
unless(-f $peopce){
open(TMP,">$peopce");
close(TMP);
chmod(0666,$peopce);
open(FILEGDDSFF,">>$peopce1");
print FILEGDDSFF "$yearn$monn∥\n";
close(FILEGDDSFF);
}
open(FILEGDDS,">>$peopce");
print FILEGDDS "$messtimen∥$yearn∥$monn∥$dayn∥$timen∥$adminusertid∥出租歸還費用統計∥$chinxchin∥$adminchins∥∥出租歸還費用統計<br>$conttext∥$ruallcchi∥$username∥\n";
close(FILEGDDS);
$peouserasd="$filehead$userfortup/rentaswelluserformat.txt"; #檢查是否有租還系統客戶暫存區檔案存在並建立檔案
unless(-f $peouserasd){
open(TMP,">$peouserasd");
close(TMP);
chmod(0666,$peouserasd);
}
@ouserasd=&readtxtfile($peouserasd,2);
@ouserasd=sort @ouserasd;
open(FDGTYE,">$peouserasd");
foreach (@ouserasd) { #讀取資料庫資料並比對
($aid,$aidmine)=split(/∥/,$_);
chomp($aidmine);
if ($adminusertid eq $aid) { chomp($aidmine); }
else { print FDGTYE "$_"; }
}
close(FDGTYE);
$dataconstxt = "$userfortup/$adminusertid/rentaswellusercons.txt"; #暫時收款
$peocons="$filehead$dataconstxt"; #檢查是否有暫時收款資料暫存區檔案存在並建立檔案
unless(-f $peocons){
open(TMP,">$peocons");
close(TMP);
chmod(0666,$peocons);
}
open(FILEGCONS,">$peocons");
print FILEGCONS "\n";
close(FILEGCONS);
print <<EOFsssrtc;
<html>
<script language="javascript">
function datainegs() {
opener.document.forms[5].submit();
window.close();
}
</script>
<head>
<STYLE TYPE="text/css">
<!--
TD { FONT-SIZE: 16px }
body {scrollbar-arrow-color:#FFFFFF;scrollbar-base-color:#FFFFFF;scrollbar-face-color:#222222;scrollbar-highlight-color:#222222;scrollbar-shadow-color:#FFFFFF}
-->
</STYLE>
<meta http-equiv="Content-Language" content="zh-tw">
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>結算統計觀看頁面</title>
</head>
<body ONDRAGSTART="window.event.returnValue=false" ONCONTEXTMENU="window.event.returnValue=false" onSelectStart="event.returnValue=false" bgcolor="#000000" text="#FFFFFF" link="#0000FF" vlink="#FF00FF" alink="#00FF00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<table border="1" width="680" bgcolor="#000000" bordercolor="#C0C0C0" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">
<form>
<tr>
<td width="680" bgcolor="#000000" bordercolor="#C0C0C0" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" colspan="8" align="center" height="25"><font color="#00FF00">客戶 $adminusertidnime 租用物品總結算已完成</font></td>
</tr>
<tr>
<td width="680" bgcolor="#000000" bordercolor="#C0C0C0" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" colspan="8" align="center" height="25"><font color="#00FF00">
<input type=button value='返回並關閉此頁面' onclick='datainegs();' style="WIDTH:200px;height:20px;font-family: 新細明體, Arial; font-size: 12pt; background-color: #000000; color: #FEF5C2; text-align: center; vertical-align: middle; border: 1 double" padding-bottom:1px" onmouseover="this.style.color='#FF0000'" onmouseout="this.style.color='#FEF5C2'"></font></td>
</tr>
</table>
</form>
</center>
</body>
</html>
EOFsssrtc
} |
|