Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104594701
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: DB2/Informix

2008-04-03 21:09:46

sjlr ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\t 请输入职工代号(四位): \c"
read dm
echo "\n\t 请输入存单号码: \c"
read pzhm
dbaccess lctj </dev/null 2>/dev/null
unload to "./zgsj.txt" select dm,xm from lczg where dm="$dm";
unload to "./cxsj.txt" select zh,pzhm,hm,jce from cxsj where pzhm="$pzhm";
END
zh=`cat ./cxsj.txt |awk -F'|' '{print $1}'
[ $zh ] &&  echo "\t存单账号: $zh "
hm=`cat ./cxsj.txt |awk -F'|' '{print $3}'
[ $hm ] &&  echo "\t存单户名: $hm "
jce=`cat ./cxsj.txt |awk -F'|' '{print $4}'
[ $jce ] &&  echo "\t存单金额: $jce "
xm=`cat ./zgsj.txt |awk -F'|' '{print $2}'
[ $xm ] &&  echo "\t职工姓名: $xm "
echo "$dm|$xm|$zh|$pzhm|$hm|$jce" >./cxsj1.txt
cat ./cxsj1.txt |awk -F'|' '{
dm=$1
xm=$2
zh=$3
pzhm=$4
hm=$5
jce=$6
printf("\n\n职工代号:%s\n",dm)
printf("职工姓名:%s\n",xm)
printf("存单账号:%s\n",zh)
printf("凭证号码:%s\n",pzhm)
printf("户名:%s\n",hm)
printf("结存额:%s\n",jce)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
load from "./cxsj1.txt" insert into lctj;
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) sjlr;;
*) break;;
esac
#break
}

sjcx ()
{
while true
do
trap "clear" 0 1 2 3 5 15
clear
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) ;
*) break;;
esac
echo "\n\n\n\n\t 请输入职工代号: \c"
read dm
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb.txt" select lctj.dm,lctj.xm,lctj.zh,lctj.pzhm,lctj.hm,cxsj.jce from lctj,cxsj where lctj.zh=cxsj.zh and dm="$dm";
END
awk 'BEGIN { FS="|"
              dtl = 0 }
                { dtl = dtl + 1
  printf("%s|%s|%s|%s|%s|%s|%s|\n",$1,$2,$3,$4,$5,$6,dtl)>>"./lcb"  
  }' ./lcb.txt
cp lcb lcb.txt
rm lcb
dbaccess lctj </dev/null 2>/dev/null
load from "./lcb.txt" insert into lctj1;
END
for ii in `cat ./lcb.txt | awk -F'|' '{ print $7 }'`
 do
dm=`awk -F'|' '$7=="'$ii'" {print $1}' ./lcb.txt`
xm=`awk -F'|' '$7=="'$ii'" {print $2}' ./lcb.txt`
zh=`awk -F'|' '$7=="'$ii'" {print $3}' ./lcb.txt`
pzhm=`awk -F'|' '$7=="'$ii'" {print $4}' ./lcb.txt`
hm=`awk -F'|' '$7=="'$ii'" {print $5}' ./lcb.txt`
jce=`awk -F'|' '$7=="'$ii'" {print $6}' ./lcb.txt`
echo "$dm|$xm|$zh|$hm|$pzhm|$jce|" >>./lccx.txt
done
awk 'BEGIN { FS="|"
              dtl = 0 
               ff = 0.00
               yh= 1 }
               { if(dtl==0){
  printf("                   职工"$2"储蓄揽存查询明细\n")>>"./lcqd.txt"
                printf("\n                         '$gzrq'                   第%3s页\n",yh)>>"./lcqd.txt"
  printf("+-------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("|序号|    帐      号     |  户  名  |凭证号码|   金      额   |\n")>>"./lcqd.txt"
  printf("|----|-------------------|----------|--------|----------------|\n")>>"./lcqd.txt" }
  dtl = dtl + 1
                ff = ff + $6
  printf("|%4s|%19s|%10s|%8s|%16.2f|\n",dtl,$3,$4,$5,$6)>>"./lcqd.txt" 
  if(dtl==50){
  printf("+-------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("                                            操作员:%s\n","'$czyxm'")>>"./lcqd.txt"
  printf("\014\n")>>"./lcqd.txt"
  dtl = 0 
                yh = yh + 1 }
  }
   END {
  printf("|----|-------------------|----------|--------|----------------|\n")>>"./lcqd.txt" 
                printf("|合计|                   |          |        |%16.2f|\n",ff)>>"./lcqd.txt"
  printf("+-------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("                                            操作员:%s\n","'$czyxm'")>>"./lcqd.txt"
  printf("\014\n")>>"./lcqd.txt"
                printf("'$dm'|%16.2f|\n",ff)>>"./lctj.tmp"
  }' lccx.txt
cat ./lcqd.txt|more
echo "\n\t是 否 打 印 (1-打印): \c"
read me
case $me in
1) ;
*) rm ./*.txt
   break;;
esac
echo "\n\t 1 ---- 主  机  打 印  "
echo "\t 2 ---- 终  端  打  印  "
echo "\t 3 ---- 退          出  "
echo "\n\t 请  选  择:  \c"
read key
case $key in
1) echo "\t准备好主机打印机,按任意键开始打印 ...  \c"
   read me
  cat ./lcqd.txt >/dev/lp0 2>/dev/null
  echo "\t打  印  完  成  !\c"
  read me ;
2) echo "\t请准备好终端打印机,按任意键开始打印 ...  \c"
   read me
  echo "\033[5i"
  cat ./lcqd.txt 2>/dev/null
  echo "\033[4i"
  echo "\t打  印  完  成  !\c"
  read me;;
*) rm ./*.txt
   break;;
esac
rm ./*.txt
#break
done
}

sjtj ()
{
while true
do
trap "clear" 0 1 2 3 5 15
clear
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) ;
*) break;;
esac
echo "\n\n\n\n"
echo "\n\t\t  正在进行数据统计,请稍候......"
echo "\n\n\n"
rm ./cxsb.00
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb.tmp" select lctj.dm,lctj.xm,lctj.zh,lctj.pzhm,lctj.hm,cxsj.jce from lctj,cxsj where lctj.zh=cxsj.zh;
delete from lctj1;
load from "./lcb.tmp" insert into lctj1;
unload to "./lcb01.txt" select sum(jce) from lctj1 where dm="0001";
END
jce=`cat ./lcb01.txt |awk -F'|' '{print $1}'
echo "0001|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb02.txt" select sum(jce) from lctj1 where dm="0002";
END
jce=`cat ./lcb02.txt |awk -F'|' '{print $1}'
echo "0002|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb03.txt" select sum(jce) from lctj1 where dm="0003";
END
jce=`cat ./lcb03.txt |awk -F'|' '{print $1}'
echo "0003|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb04.txt" select sum(jce) from lctj1 where dm="0004";
END
jce=`cat ./lcb04.txt |awk -F'|' '{print $1}'
echo "0004|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb05.txt" select sum(jce) from lctj1 where dm="0005";
END
jce=`cat ./lcb05.txt |awk -F'|' '{print $1}'
echo "0005|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb06.txt" select sum(jce) from lctj1 where dm="0006";
END
jce=`cat ./lcb06.txt |awk -F'|' '{print $1}'
echo "0006|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb07.txt" select sum(jce) from lctj1 where dm="0007";
END
jce=`cat ./lcb07.txt |awk -F'|' '{print $1}'
echo "0007|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb08.txt" select sum(jce) from lctj1 where dm="0008";
END
jce=`cat ./lcb08.txt |awk -F'|' '{print $1}'
echo "0008|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb09.txt" select sum(jce) from lctj1 where dm="0009";
END
jce=`cat ./lcb09.txt |awk -F'|' '{print $1}'
echo "0009|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb10.txt" select sum(jce) from lctj1 where dm="0010";
END
jce=`cat ./lcb10.txt |awk -F'|' '{print $1}'
echo "0010|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb11.txt" select sum(jce) from lctj1 where dm="0011";
END
jce=`cat ./lcb11.txt |awk -F'|' '{print $1}'
echo "0011|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb12.txt" select sum(jce) from lctj1 where dm="0012";
END
jce=`cat ./lcb12.txt |awk -F'|' '{print $1}'
echo "0012|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb13.txt" select sum(jce) from lctj1 where dm="0013";
END
jce=`cat ./lcb13.txt |awk -F'|' '{print $1}'
echo "0013|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb14.txt" select sum(jce) from lctj1 where dm="0014";
END
jce=`cat ./lcb14.txt |awk -F'|' '{print $1}'
echo "0014|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb15.txt" select sum(jce) from lctj1 where dm="0015";
END
jce=`cat ./lcb15.txt |awk -F'|' '{print $1}'
echo "0015|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb16.txt" select sum(jce) from lctj1 where dm="0016";
END
jce=`cat ./lcb16.txt |awk -F'|' '{print $1}'
echo "0016|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb17.txt" select sum(jce) from lctj1 where dm="0017";
END
jce=`cat ./lcb17.txt |awk -F'|' '{print $1}'
echo "0017|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb18.txt" select sum(jce) from lctj1 where dm="0018";
END
jce=`cat ./lcb18.txt |awk -F'|' '{print $1}'
echo "0018|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb19.txt" select sum(jce) from lctj1 where dm="0019";
END
jce=`cat ./lcb19.txt |awk -F'|' '{print $1}'
echo "0019|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb20.txt" select sum(jce) from lctj1 where dm="0020";
END
jce=`cat ./lcb20.txt |awk -F'|' '{print $1}'
echo "0020|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb21.txt" select sum(jce) from lctj1 where dm="0021";
END
jce=`cat ./lcb21.txt |awk -F'|' '{print $1}'
echo "0021|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb22.txt" select sum(jce) from lctj1 where dm="0022";
END
jce=`cat ./lcb22.txt |awk -F'|' '{print $1}'
echo "0022|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb23.txt" select sum(jce) from lctj1 where dm="0023";
END
jce=`cat ./lcb23.txt |awk -F'|' '{print $1}'
echo "0023|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb24.txt" select sum(jce) from lctj1 where dm="0024";
END
jce=`cat ./lcb24.txt |awk -F'|' '{print $1}'
echo "0024|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb25.txt" select sum(jce) from lctj1 where dm="0025";
END
jce=`cat ./lcb25.txt |awk -F'|' '{print $1}'
echo "0025|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb26.txt" select sum(jce) from lctj1 where dm="0026";
END
jce=`cat ./lcb26.txt |awk -F'|' '{print $1}'
echo "0026|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb27.txt" select sum(jce) from lctj1 where dm="0027";
END
jce=`cat ./lcb27.txt |awk -F'|' '{print $1}'
echo "0027|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb28.txt" select sum(jce) from lctj1 where dm="0028";
END
jce=`cat ./lcb28.txt |awk -F'|' '{print $1}'
echo "0028|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb29.txt" select sum(jce) from lctj1 where dm="0029";
END
jce=`cat ./lcb29.txt |awk -F'|' '{print $1}'
echo "0029|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb30.txt" select sum(jce) from lctj1 where dm="0030";
END
jce=`cat ./lcb30.txt |awk -F'|' '{print $1}'
echo "0030|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb31.txt" select sum(jce) from lctj1 where dm="0031";
END
jce=`cat ./lcb31.txt |awk -F'|' '{print $1}'
echo "0031|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb32.txt" select sum(jce) from lctj1 where dm="0032";
END
jce=`cat ./lcb32.txt |awk -F'|' '{print $1}'
echo "0032|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb33.txt" select sum(jce) from lctj1 where dm="0033";
END
jce=`cat ./lcb33.txt |awk -F'|' '{print $1}'
echo "0033|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb34.txt" select sum(jce) from lctj1 where dm="0034";
END
jce=`cat ./lcb34.txt |awk -F'|' '{print $1}'
echo "0034|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb35.txt" select sum(jce) from lctj1 where dm="0035";
END
jce=`cat ./lcb35.txt |awk -F'|' '{print $1}'
echo "0035|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb36.txt" select sum(jce) from lctj1 where dm="0036";
END
jce=`cat ./lcb36.txt |awk -F'|' '{print $1}'
echo "0036|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb37.txt" select sum(jce) from lctj1 where dm="0037";
END
jce=`cat ./lcb37.txt |awk -F'|' '{print $1}'
echo "0037|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb38.txt" select sum(jce) from lctj1 where dm="0038";
END
jce=`cat ./lcb38.txt |awk -F'|' '{print $1}'
echo "0038|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb39.txt" select sum(jce) from lctj1 where dm="0039";
END
jce=`cat ./lcb39.txt |awk -F'|' '{print $1}'
echo "0039|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb40.txt" select sum(jce) from lctj1 where dm="0040";
END
jce=`cat ./lcb40.txt |awk -F'|' '{print $1}'
echo "0040|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb41.txt" select sum(jce) from lctj1 where dm="0041";
END
jce=`cat ./lcb41.txt |awk -F'|' '{print $1}'
echo "0041|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb42.txt" select sum(jce) from lctj1 where dm="0042";
END
jce=`cat ./lcb42.txt |awk -F'|' '{print $1}'
echo "0042|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb43.txt" select sum(jce) from lctj1 where dm="0043";
END
jce=`cat ./lcb43.txt |awk -F'|' '{print $1}'
echo "0043|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb44.txt" select sum(jce) from lctj1 where dm="0044";
END
jce=`cat ./lcb44.txt |awk -F'|' '{print $1}'
echo "0044|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb45.txt" select sum(jce) from lctj1 where dm="0045";
END
jce=`cat ./lcb45.txt |awk -F'|' '{print $1}'
echo "0045|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb46.txt" select sum(jce) from lctj1 where dm="0046";
END
jce=`cat ./lcb46.txt |awk -F'|' '{print $1}'
echo "0046|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb47.txt" select sum(jce) from lctj1 where dm="0047";
END
jce=`cat ./lcb47.txt |awk -F'|' '{print $1}'
echo "0047|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb48.txt" select sum(jce) from lctj1 where dm="0048";
END
jce=`cat ./lcb48.txt |awk -F'|' '{print $1}'
echo "0048|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb49.txt" select sum(jce) from lctj1 where dm="0049";
END
jce=`cat ./lcb49.txt |awk -F'|' '{print $1}'
echo "0049|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb50.txt" select sum(jce) from lctj1 where dm="0050";
END
jce=`cat ./lcb50.txt |awk -F'|' '{print $1}'
echo "0050|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb51.txt" select sum(jce) from lctj1 where dm="0051";
END
jce=`cat ./lcb51.txt |awk -F'|' '{print $1}'
echo "0051|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb52.txt" select sum(jce) from lctj1 where dm="0052";
END
jce=`cat ./lcb52.txt |awk -F'|' '{print $1}'
echo "0052|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb53.txt" select sum(jce) from lctj1 where dm="0053";
END
jce=`cat ./lcb53.txt |awk -F'|' '{print $1}'
echo "0053|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb54.txt" select sum(jce) from lctj1 where dm="0054";
END
jce=`cat ./lcb54.txt |awk -F'|' '{print $1}'
echo "0054|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb55.txt" select sum(jce) from lctj1 where dm="0055";
END
jce=`cat ./lcb55.txt |awk -F'|' '{print $1}'
echo "0055|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb56.txt" select sum(jce) from lctj1 where dm="0056";
END
jce=`cat ./lcb56.txt |awk -F'|' '{print $1}'
echo "0056|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb57.txt" select sum(jce) from lctj1 where dm="0057";
END
jce=`cat ./lcb57.txt |awk -F'|' '{print $1}'
echo "0057|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb58.txt" select sum(jce) from lctj1 where dm="0058";
END
jce=`cat ./lcb58.txt |awk -F'|' '{print $1}'
echo "0058|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb59.txt" select sum(jce) from lctj1 where dm="0059";
END
jce=`cat ./lcb59.txt |awk -F'|' '{print $1}'
echo "0059|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb60.txt" select sum(jce) from lctj1 where dm="0060";
END
jce=`cat ./lcb60.txt |awk -F'|' '{print $1}'
echo "0060|$jce|" >>./lccx1.txt
dbaccess lctj </dev/null 2>/dev/null
delete from lctj2;
load from "./lccx1.txt" insert into lctj2;
unload to "./lctjb.txt" select lctj2.dm,lczg.xm,lctj2.jce from lctj2,lczg where lctj2.dm=lczg.dm;
END
awk 'BEGIN { FS="|"
              dtl = 0 }
                { dtl = dtl + 1
  printf("%s|%s|%s|%s|\n",$1,$2,$3,dtl)>>"./lctjb"  
  }' ./lctjb.txt
cp lctjb lctjb.txt
rm lctjb
for ii in `cat ./lctjb.txt | awk -F'|' '{ print $4 }'`
 do
dm=`awk -F'|' '$4=="'$ii'" {print $1}' ./lctjb.txt`
xm=`awk -F'|' '$4=="'$ii'" {print $2}' ./lctjb.txt`
jce=`awk -F'|' '$4=="'$ii'" {print $3}' ./lctjb.txt`
echo "$dm|$xm|$jce|" >>./lccx2.txt
done
awk 'BEGIN { FS="|"
             dtl = 0
             ff = 0.00
               yh= 1 }
               { if(dtl==0){
  printf("            职工储蓄揽存统计清单\n")>>"./lcqd1.txt"
                printf("\n              '$gzrq'     第%3s页\n",yh)>>"./lcqd1.txt"
  printf("+---------------------------------------+\n")>>"./lcqd1.txt"
  printf("|序号|职工代码|职工姓名|   金      额   |\n")>>"./lcqd1.txt"
  printf("|----|--------|--------|----------------|\n")>>"./lcqd1.txt" }
  dtl = dtl + 1
                ff = ff + $3
  printf("|%4s|%8s|%8s|%16.2f|\n",dtl,$1,$2,$3)>>"./lcqd1.txt"
  printf("%4s,%8s,%8s,%16.2f\n",dtl,$1,$2,$3)>>"./cxsb.00"
  if(dtl==50){
  printf("+----------------------------------------+\n")>>"./lcqd1.txt"
  printf("                       操作员:%s\n","'$czyxm'")>>"./lcqd1.txt"
  printf("\014\n")>>"./lcqd1.txt"
  dtl = 0 
                yh = yh + 1 }
  }
   END {
  printf("|----|--------|--------|----------------|\n")>>"./lcqd1.txt" 
                printf("|合计|        |        |%16.2f|\n",ff)>>"./lcqd1.txt" 
  printf("+---------------------------------------+\n")>>"./lcqd1.txt"
  printf("                       操作员:%s\n","'$czyxm'")>>"./lcqd1.txt"
  printf("\014\n")>>"./lcqd1.txt"
  }' lccx2.txt
cat ./lcqd1.txt|more
echo "\n\t是 否 打 印 (1-打印): \c"
read me
case $me in
1) ;
*) rm ./*.txt
   break;;
esac
echo "\n\t 1 ---- 主  机  打 印  "
echo "\t 2 ---- 终  端  打  印  "
echo "\t 3 ---- 退          出  "
echo "\n\t 请  选  择:  \c"
read key
case $key in
1) echo "\t准备好主机打印机,按任意键开始打印 ...  \c"
   read me
  cat ./lcqd1.txt >/dev/lp0 2>/dev/null
  echo "\t打  印  完  成  !\c"
  read me ;
2) echo "\t请准备好终端打印机,按任意键开始打印 ...  \c"
   read me
  echo "\033[5i"
  cat ./lcqd1.txt 2>/dev/null
  echo "\033[4i"
  echo "\t打  印  完  成  !\c"
  read me;;
*) rm ./*.txt
   break;;
esac
rm ./*.txt
#break
done
}

sjsc ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\n\n"
echo "\t\t 1.删除单笔"
echo ""
echo "\t\t 2.删除全部"
echo ""
echo "\t\t 3.退    出"  
echo "\n"
echo "\t\t请选择:\c"
read key
case $key in
1) clear
echo "\n\n\t 请输入职工代号: \c"
read dm
echo "\n\t 请输入存单号码: \c"
read pzhm
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcsj.txt" select zh,pzhm,hm,jce from lctj where pzhm="$pzhm";
END
zh=`cat ./lcsj.txt |awk -F'|' '{print $1}'
[ $zh ] &&  echo "\t存单账号: $zh "
hm=`cat ./lcsj.txt |awk -F'|' '{print $3}'
[ $hm ] &&  echo "\t存单户名: $hm "
jce=`cat ./lcsj.txt |awk -F'|' '{print $4}'
[ $jce ] &&  echo "\t存单金额: $jce "
echo "$dm|$zh|$pzhm|$hm|$jce" >./lcsj.txt
cat ./lcsj.txt |awk -F'|' '{
dm=$1
zh=$2
pzhm=$3
hm=$4
jce=$5
printf("\n\n职工代号:%s\n",dm)
printf("存单账号:%s\n",zh)
printf("凭证号码:%s\n",pzhm)
printf("户名:%s\n",hm)
printf("结存额:%s\n",jce)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
delete from lctj where dm="$dm" and pzhm="$pzhm";
delete from lctj1 where dm="$dm" and pzhm="$pzhm";
delete from lctj2 where dm="$dm" and pzhm="$pzhm";
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) sjsc;;
*) break;;
esac
break;;
2) clear
dbaccess lctj </dev/null 2>/dev/null
delete from lctj;
delete from lctj1;
delete from lctj2;
END
break;;
3)break;;
esac
#break
}

lczg ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\t 请输入职工代号: \c"
read dm
echo "\n\t 请输入职工姓名: \c"
read xm
echo "$dm|$xm" >./lczg.tmp
cat ./lczg.tmp |awk -F'|' '{
dm=$1
xm=$2
printf("\n\n职工代号:%s\n",dm)
printf("职工姓名:%s\n",xm)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
load from "./lczg.tmp" insert into lczg;
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) lczg;;
*) break;;
esac
#break
}

zgdy ()
{
dbaccess lctj </dev/null 2>/dev/null
unload to "./lczg.txt" select * from lczg;
END
cat ./lczg.txt |awk -F'|' '{
dm=$1
xm=$2
}'
awk 'BEGIN { FS="|"
             dtl = 0
               yh= 1 }
               { if(dtl==0){
  printf("        职工清单\n")>>"./qd1.txt"
                printf("\n    '$gzrq'   第%3s页\n",yh)>>"./qd1.txt"
  printf("+----------------------+\n")>>"./qd1.txt"
  printf("|序号|职工代码|职工姓名|\n")>>"./qd1.txt"
  printf("|----|--------|--------|\n")>>"./qd1.txt" }
  dtl = dtl + 1
  printf("|%4s|%8s|%8s|\n",dtl,$1,$2)>>"./qd1.txt" 
  if(dtl==50){
  printf("+----------------------+\n")>>"./qd1.txt"
  printf("     操作员:%s\n","'$czyxm'")>>"./qd1.txt"
  printf("\014\n")>>"./qd1.txt"
  dtl = 0 
                yh = yh + 1 }
  }
   END {
  printf("+----------------------+\n")>>"./qd1.txt"
  printf("     操作员:%s\n","'$czyxm'")>>"./qd1.txt"
  printf("\014\n")>>"./qd1.txt"
  }' lczg.txt
cat ./qd1.txt|more
echo "\n\t是 否 打 印 (1-打印): \c"
read me
case $me in
1) ;
*) rm ./*.txt
   break;;
esac
echo "\n\t 1 ---- 主  机  打 印  "
echo "\t 2 ---- 终  端  打  印  "
echo "\t 3 ---- 退          出  "
echo "\n\t 请  选  择:  \c"
read key
case $key in
1) echo "\t准备好主机打印机,按任意键开始打印 ...  \c"
   read me
  cat ./qd1.txt >/dev/lp0 2>/dev/null
  echo "\t打  印  完  成  !\c"
  read me ;
2) echo "\t请准备好终端打印机,按任意键开始打印 ...  \c"
   read me
  echo "\033[5i"
  cat ./qd1.txt 2>/dev/null
  echo "\033[4i"
  echo "\t打  印  完  成  !\c"
  read me;;
*) rm ./*.txt
   break;;
esac
rm ./*.txt
#break
}

dgsjlr ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\t 请输入职工代号(四位): \c"
read dm
echo "\n\t 请输入存款户账号: \c"
read zh
dbaccess lctj </dev/null 2>/dev/null
unload to "./zgsj.txt" select dm,xm from lczg where dm="$dm";
unload to "./dgsj.txt" select zh,dwm,ye from zhzd where zh="$zh";
END
zh=`cat ./dgsj.txt |awk -F'|' '{print $1}'
[ $zh ] &&  echo "\t单位账号: $zh "
dwm=`cat ./dgsj.txt |awk -F'|' '{print $2}'
[ $dwm ] &&  echo "\t单位户名: $dwm "
ye=`cat ./dgsj.txt |awk -F'|' '{print $3}'
[ $ye ] &&  echo "\t账户余额: $ye "
xm=`cat ./zgsj.txt |awk -F'|' '{print $2}'
[ $xm ] &&  echo "\t职工姓名: $xm "
echo "$dm|$xm|$zh|$dwm|$ye" >./dgsj1.txt
cat ./dgsj1.txt |awk -F'|' '{
dm=$1
xm=$2
zh=$3
dwm=$4
ye=$5
printf("\n\n职工代号:%s\n",dm)
printf("职工姓名:%s\n",xm)
printf("单位账号:%s\n",zh)
printf("单位户名:%s\n",dwm)
printf("结存额:%s\n",ye)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
load from "./dgsj1.txt" insert into dglctj;
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) dgsjlr;;
*) break;;
esac
#break
}

dgsjcx ()
{
while true
do
trap "clear" 0 1 2 3 5 15
clear
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) ;
*) break;;
esac
echo "\n\n\n\n\t 请输入职工代号: \c"
read dm
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb.txt" select dglctj.dm,dglctj.xm,dglctj.zh,dglctj.dwm,zhzd.ye from dglctj,zhzd where dglctj.zh=zhzd.zh and dm="$dm";
END
awk 'BEGIN { FS="|"
              dtl = 0 }
                { dtl = dtl + 1
  printf("%s|%s|%s|%s|%s|%s|\n",$1,$2,$3,$4,$5,dtl)>>"./lcb"  
  }' ./lcb.txt
cp lcb lcb.txt
rm lcb
dbaccess lctj </dev/null 2>/dev/null
load from "./lcb.txt" insert into dglctj1;
END
for ii in `cat ./lcb.txt | awk -F'|' '{ print $6 }'`
 do
dm=`awk -F'|' '$6=="'$ii'" {print $1}' ./lcb.txt`
xm=`awk -F'|' '$6=="'$ii'" {print $2}' ./lcb.txt`
zh=`awk -F'|' '$6=="'$ii'" {print $3}' ./lcb.txt`
dwm=`awk -F'|' '$6=="'$ii'" {print $4}' ./lcb.txt`
ye=`awk -F'|' '$6=="'$ii'" {print $5}' ./lcb.txt`
echo "$dm|$xm|$zh|$dwm|$ye|" >>./lcdg.txt
done
awk 'BEGIN { FS="|"
              dtl = 0 
               ff = 0.00
               yh= 1 }
               { if(dtl==0){
  printf("                     职工"$2"对公揽存查询明细\n")>>"./lcqd.txt"
                printf("\n                         '$gzrq'                   第%3s页\n",yh)>>"./lcqd.txt"
  printf("+-------------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("|序号|  帐     号   |          户       名         |   金      额   |\n")>>"./lcqd.txt"
  printf("|----|--------------|------------------------------|----------------|\n")>>"./lcqd.txt" }
  dtl = dtl + 1
                ff = ff + $5
  printf("|%4s|%14s|%30s|%16.2f|\n",dtl,$3,$4,$5)>>"./lcqd.txt" 
  if(dtl==50){
  printf("+-------------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("                                            操作员:%s\n","'$czyxm'")>>"./lcqd.txt"
  printf("\014\n")>>"./lcqd.txt"
  dtl = 0 
                yh = yh + 1 }
  }
   END {
  printf("|----|-------------|------------------------------|-----------------|\n")>>"./lcqd.txt" 
                printf("|合计|             |                              | %16.2f|\n",ff)>>"./lcqd.txt"
  printf("+-------------------------------------------------------------------+\n")>>"./lcqd.txt"
  printf("                                            操作员:%s\n","'$czyxm'")>>"./lcqd.txt"
  printf("\014\n")>>"./lcqd.txt"
                printf("'$dm'|%16.2f|\n",ff)>>"./dglctj.tmp"
  }' lcdg.txt
cat ./lcqd.txt|more
echo "\n\t是 否 打 印 (1-打印): \c"
read me
case $me in
1) ;
*) rm ./*.txt
   break;;
esac
echo "\n\t 1 ---- 主  机  打 印  "
echo "\t 2 ---- 终  端  打  印  "
echo "\t 3 ---- 退          出  "
echo "\n\t 请  选  择:  \c"
read key
case $key in
1) echo "\t准备好主机打印机,按任意键开始打印 ...  \c"
   read me
  cat ./lcqd.txt >/dev/lp0 2>/dev/null
  echo "\t打  印  完  成  !\c"
  read me ;
2) echo "\t请准备好终端打印机,按任意键开始打印 ...  \c"
   read me
  echo "\033[5i"
  cat ./lcqd.txt 2>/dev/null
  echo "\033[4i"
  echo "\t打  印  完  成  !\c"
  read me;;
*) rm ./*.txt
   break;;
esac
rm ./*.txt
#break
done
}

dgsjtj ()
{
while true
do
trap "clear" 0 1 2 3 5 15
clear
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) ;
*) break;;
esac
echo "\n\n\n\n"
echo "\n\t\t  正在进行数据统计,请稍候......"
echo "\n\n\n"
rm ./dgsb.00
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb.tmp" select dglctj.dm,dglctj.xm,dglctj.zh,dglctj.dwm,zhzd.ye from dglctj,zhzd where dglctj.zh=zhzd.zh;
delete from dglctj1;
load from "./lcb.tmp" insert into dglctj1;
unload to "./lcb01.txt" select sum(ye) from dglctj1 where dm="0001";
END
ye=`cat ./lcb01.txt |awk -F'|' '{print $1}'
echo "0001|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb02.txt" select sum(ye) from dglctj1 where dm="0002";
END
ye=`cat ./lcb02.txt |awk -F'|' '{print $1}'
echo "0002|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb03.txt" select sum(ye) from dglctj1 where dm="0003";
END
ye=`cat ./lcb03.txt |awk -F'|' '{print $1}'
echo "0003|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb04.txt" select sum(ye) from dglctj1 where dm="0004";
END
ye=`cat ./lcb04.txt |awk -F'|' '{print $1}'
echo "0004|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb05.txt" select sum(ye) from dglctj1 where dm="0005";
END
ye=`cat ./lcb05.txt |awk -F'|' '{print $1}'
echo "0005|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb06.txt" select sum(ye) from dglctj1 where dm="0006";
END
ye=`cat ./lcb06.txt |awk -F'|' '{print $1}'
echo "0006|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb07.txt" select sum(ye) from dglctj1 where dm="0007";
END
ye=`cat ./lcb07.txt |awk -F'|' '{print $1}'
echo "0007|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb08.txt" select sum(ye) from dglctj1 where dm="0008";
END
ye=`cat ./lcb08.txt |awk -F'|' '{print $1}'
echo "0008|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb09.txt" select sum(ye) from dglctj1 where dm="0009";
END
ye=`cat ./lcb09.txt |awk -F'|' '{print $1}'
echo "0009|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb10.txt" select sum(ye) from dglctj1 where dm="0010";
END
ye=`cat ./lcb10.txt |awk -F'|' '{print $1}'
echo "0010|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb11.txt" select sum(ye) from dglctj1 where dm="0011";
END
ye=`cat ./lcb11.txt |awk -F'|' '{print $1}'
echo "0011|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb12.txt" select sum(ye) from dglctj1 where dm="0012";
END
ye=`cat ./lcb12.txt |awk -F'|' '{print $1}'
echo "0012|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb13.txt" select sum(ye) from dglctj1 where dm="0013";
END
ye=`cat ./lcb13.txt |awk -F'|' '{print $1}'
echo "0013|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb14.txt" select sum(ye) from dglctj1 where dm="0014";
END
ye=`cat ./lcb14.txt |awk -F'|' '{print $1}'
echo "0014|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb15.txt" select sum(ye) from dglctj1 where dm="0015";
END
ye=`cat ./lcb15.txt |awk -F'|' '{print $1}'
echo "0015|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb16.txt" select sum(ye) from dglctj1 where dm="0016";
END
ye=`cat ./lcb16.txt |awk -F'|' '{print $1}'
echo "0016|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb17.txt" select sum(ye) from dglctj1 where dm="0017";
END
ye=`cat ./lcb17.txt |awk -F'|' '{print $1}'
echo "0017|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb18.txt" select sum(ye) from dglctj1 where dm="0018";
END
ye=`cat ./lcb18.txt |awk -F'|' '{print $1}'
echo "0018|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb19.txt" select sum(ye) from dglctj1 where dm="0019";
END
ye=`cat ./lcb19.txt |awk -F'|' '{print $1}'
echo "0019|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb20.txt" select sum(ye) from dglctj1 where dm="0020";
END
ye=`cat ./lcb20.txt |awk -F'|' '{print $1}'
echo "0020|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb21.txt" select sum(ye) from dglctj1 where dm="0021";
END
ye=`cat ./lcb21.txt |awk -F'|' '{print $1}'
echo "0021|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb22.txt" select sum(ye) from dglctj1 where dm="0022";
END
ye=`cat ./lcb22.txt |awk -F'|' '{print $1}'
echo "0022|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb23.txt" select sum(ye) from dglctj1 where dm="0023";
END
ye=`cat ./lcb23.txt |awk -F'|' '{print $1}'
echo "0023|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb24.txt" select sum(ye) from dglctj1 where dm="0024";
END
ye=`cat ./lcb24.txt |awk -F'|' '{print $1}'
echo "0024|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb25.txt" select sum(ye) from dglctj1 where dm="0025";
END
ye=`cat ./lcb25.txt |awk -F'|' '{print $1}'
echo "0025|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb26.txt" select sum(ye) from dglctj1 where dm="0026";
END
ye=`cat ./lcb26.txt |awk -F'|' '{print $1}'
echo "0026|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb27.txt" select sum(ye) from dglctj1 where dm="0027";
END
ye=`cat ./lcb27.txt |awk -F'|' '{print $1}'
echo "0027|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb28.txt" select sum(ye) from dglctj1 where dm="0028";
END
ye=`cat ./lcb28.txt |awk -F'|' '{print $1}'
echo "0028|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb29.txt" select sum(ye) from dglctj1 where dm="0029";
END
ye=`cat ./lcb29.txt |awk -F'|' '{print $1}'
echo "0029|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb30.txt" select sum(ye) from dglctj1 where dm="0030";
END
ye=`cat ./lcb30.txt |awk -F'|' '{print $1}'
echo "0030|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb31.txt" select sum(ye) from dglctj1 where dm="0031";
END
ye=`cat ./lcb31.txt |awk -F'|' '{print $1}'
echo "0031|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb32.txt" select sum(ye) from dglctj1 where dm="0032";
END
ye=`cat ./lcb32.txt |awk -F'|' '{print $1}'
echo "0032|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb33.txt" select sum(ye) from dglctj1 where dm="0033";
END
ye=`cat ./lcb33.txt |awk -F'|' '{print $1}'
echo "0033|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb34.txt" select sum(ye) from dglctj1 where dm="0034";
END
ye=`cat ./lcb34.txt |awk -F'|' '{print $1}'
echo "0034|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb35.txt" select sum(ye) from dglctj1 where dm="0035";
END
ye=`cat ./lcb35.txt |awk -F'|' '{print $1}'
echo "0035|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb36.txt" select sum(ye) from dglctj1 where dm="0036";
END
ye=`cat ./lcb36.txt |awk -F'|' '{print $1}'
echo "0036|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb37.txt" select sum(ye) from dglctj1 where dm="0037";
END
ye=`cat ./lcb37.txt |awk -F'|' '{print $1}'
echo "0037|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb38.txt" select sum(ye) from dglctj1 where dm="0038";
END
ye=`cat ./lcb38.txt |awk -F'|' '{print $1}'
echo "0038|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb39.txt" select sum(ye) from dglctj1 where dm="0039";
END
ye=`cat ./lcb39.txt |awk -F'|' '{print $1}'
echo "0039|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb40.txt" select sum(ye) from dglctj1 where dm="0040";
END
ye=`cat ./lcb40.txt |awk -F'|' '{print $1}'
echo "0040|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb41.txt" select sum(ye) from dglctj1 where dm="0041";
END
ye=`cat ./lcb41.txt |awk -F'|' '{print $1}'
echo "0041|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb42.txt" select sum(ye) from dglctj1 where dm="0042";
END
ye=`cat ./lcb42.txt |awk -F'|' '{print $1}'
echo "0042|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb43.txt" select sum(ye) from dglctj1 where dm="0043";
END
ye=`cat ./lcb43.txt |awk -F'|' '{print $1}'
echo "0043|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb44.txt" select sum(ye) from dglctj1 where dm="0044";
END
ye=`cat ./lcb44.txt |awk -F'|' '{print $1}'
echo "0044|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb45.txt" select sum(ye) from dglctj1 where dm="0045";
END
ye=`cat ./lcb45.txt |awk -F'|' '{print $1}'
echo "0045|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb46.txt" select sum(ye) from dglctj1 where dm="0046";
END
ye=`cat ./lcb46.txt |awk -F'|' '{print $1}'
echo "0046|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb47.txt" select sum(ye) from dglctj1 where dm="0047";
END
ye=`cat ./lcb47.txt |awk -F'|' '{print $1}'
echo "0047|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb48.txt" select sum(ye) from dglctj1 where dm="0048";
END
ye=`cat ./lcb48.txt |awk -F'|' '{print $1}'
echo "0048|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb49.txt" select sum(ye) from dglctj1 where dm="0049";
END
ye=`cat ./lcb49.txt |awk -F'|' '{print $1}'
echo "0049|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb50.txt" select sum(ye) from dglctj1 where dm="0050";
END
ye=`cat ./lcb50.txt |awk -F'|' '{print $1}'
echo "0050|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb51.txt" select sum(ye) from dglctj1 where dm="0051";
END
ye=`cat ./lcb51.txt |awk -F'|' '{print $1}'
echo "0051|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb52.txt" select sum(ye) from dglctj1 where dm="0052";
END
ye=`cat ./lcb52.txt |awk -F'|' '{print $1}'
echo "0052|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb53.txt" select sum(ye) from dglctj1 where dm="0053";
END
ye=`cat ./lcb53.txt |awk -F'|' '{print $1}'
echo "0053|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb54.txt" select sum(ye) from dglctj1 where dm="0054";
END
ye=`cat ./lcb54.txt |awk -F'|' '{print $1}'
echo "0054|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb55.txt" select sum(ye) from dglctj1 where dm="0055";
END
ye=`cat ./lcb55.txt |awk -F'|' '{print $1}'
echo "0055|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb56.txt" select sum(ye) from dglctj1 where dm="0056";
END
ye=`cat ./lcb56.txt |awk -F'|' '{print $1}'
echo "0056|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb57.txt" select sum(ye) from dglctj1 where dm="0057";
END
ye=`cat ./lcb57.txt |awk -F'|' '{print $1}'
echo "0057|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb58.txt" select sum(ye) from dglctj1 where dm="0058";
END
ye=`cat ./lcb58.txt |awk -F'|' '{print $1}'
echo "0058|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb59.txt" select sum(ye) from dglctj1 where dm="0059";
END
ye=`cat ./lcb59.txt |awk -F'|' '{print $1}'
echo "0059|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcb60.txt" select sum(ye) from dglctj1 where dm="0060";
END
ye=`cat ./lcb60.txt |awk -F'|' '{print $1}'
echo "0060|$ye|" >>./lcdg1.txt
dbaccess lctj </dev/null 2>/dev/null
delete from dglctj2;
load from "./lcdg1.txt" insert into dglctj2;
unload to "./dglctjb.txt" select dglctj2.dm,lczg.xm,dglctj2.ye from dglctj2,lczg where dglctj2.dm=lczg.dm;
END
awk 'BEGIN { FS="|"
              dtl = 0 }
                { dtl = dtl + 1
  printf("%s|%s|%s|%s|\n",$1,$2,$3,dtl)>>"./dglctjb"  
  }' ./dglctjb.txt
cp dglctjb dglctjb.txt
rm dglctjb
for ii in `cat ./dglctjb.txt | awk -F'|' '{ print $4 }'`
 do
dm=`awk -F'|' '$4=="'$ii'" {print $1}' ./dglctjb.txt`
xm=`awk -F'|' '$4=="'$ii'" {print $2}' ./dglctjb.txt`
ye=`awk -F'|' '$4=="'$ii'" {print $3}' ./dglctjb.txt`
echo "$dm|$xm|$ye|" >>./lcdg2.txt
done
awk 'BEGIN { FS="|"
             dtl = 0
             ff = 0.00
               yh= 1 }
               { if(dtl==0){
  printf("            职工对公揽存统计清单\n")>>"./lcqd1.txt"
                printf("\n              '$gzrq'     第%3s页\n",yh)>>"./lcqd1.txt"
  printf("+---------------------------------------+\n")>>"./lcqd1.txt"
  printf("|序号|职工代码|职工姓名|   金      额   |\n")>>"./lcqd1.txt"
  printf("|----|--------|--------|----------------|\n")>>"./lcqd1.txt" }
  dtl = dtl + 1
                ff = ff + $3
  printf("|%4s|%8s|%8s|%16.2f|\n",dtl,$1,$2,$3)>>"./lcqd1.txt" 
  printf("%4s,%8s,%8s,%16.2f\n",dtl,$1,$2,$3)>>"./dgsb.00" 
  if(dtl==50){
  printf("+----------------------------------------+\n")>>"./lcqd1.txt"
  printf("                       操作员:%s\n","'$czyxm'")>>"./lcqd1.txt"
  printf("\014\n")>>"./lcqd1.txt"
  dtl = 0 
                yh = yh + 1 }
  }
   END {
  printf("|----|--------|--------|----------------|\n")>>"./lcqd1.txt" 
                printf("|合计|        |        |%16.2f|\n",ff)>>"./lcqd1.txt" 
  printf("+---------------------------------------+\n")>>"./lcqd1.txt"
  printf("                      操作员:%s\n","'$czyxm'")>>"./lcqd1.txt"
  printf("\014\n")>>"./lcqd1.txt"
  }' lcdg2.txt
cat ./lcqd1.txt|more
echo "\n\t是 否 打 印 (1-打印): \c"
read me
case $me in
1) ;
*) rm ./*.txt
   break;;
esac
echo "\n\t 1 ---- 主  机  打 印  "
echo "\t 2 ---- 终  端  打  印  "
echo "\t 3 ---- 退          出  "
echo "\n\t 请  选  择:  \c"
read key
case $key in
1) echo "\t准备好主机打印机,按任意键开始打印 ...  \c"
   read me
  cat ./lcqd1.txt >/dev/lp0 2>/dev/null
  echo "\t打  印  完  成  !\c"
  read me ;
2) echo "\t请准备好终端打印机,按任意键开始打印 ...  \c"
   read me
  echo "\033[5i"
  cat ./lcqd1.txt 2>/dev/null
  echo "\033[4i"
  echo "\t打  印  完  成  !\c"
  read me;;
*) rm ./*.txt
   break;;
esac
rm ./*.txt
break
done
}


dgsjsc ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\n\n"
echo "\t\t 1.删除单笔"
echo ""
echo "\t\t 2.删除全部"
echo ""
echo "\t\t 3.退    出"  
echo "\n"
echo "\t\t请选择:\c"
read key
case $key in
1) clear
echo "\n\n\t 请输入职工代号: \c"
read dm
echo "\n\t 请输入单位账号: \c"
read zh
dbaccess lctj </dev/null 2>/dev/null
unload to "./lcsj.txt" select zh,dwm,ye from dglctj where zh="$zh";
END
zh=`cat ./lcsj.txt |awk -F'|' '{print $1}'
[ $zh ] &&  echo "\t单位账号: $zh "
dwm=`cat ./lcsj.txt |awk -F'|' '{print $2}'
[ $hm ] &&  echo "\t单位户名: $hm "
ye=`cat ./lcsj.txt |awk -F'|' '{print $3}'
[ $ye ] &&  echo "\t账户余额: $ye "
echo "$dm|$zh|$dwm|$ye" >./lcsj.txt
cat ./lcsj.txt |awk -F'|' '{
dm=$1
zh=$2
dwm=$3
ye=$4
printf("\n\n职工代号:%s\n",dm)
printf("单位帐号:%s\n",zh)
printf("单位户名:%s\n",dwm)
printf("账户余额:%s\n",ye)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
delete from dglctj where dm="$dm" and zh="$zh";
delete from dglctj1 where dm="$dm" and zh="$zh";
delete from dglctj2 where dm="$dm" and zh="$zh";
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) sjsc;;
*) break;;
esac
break;;
2) clear
dbaccess lctj </dev/null 2>/dev/null
delete from dglctj;
delete from dglctj1;
delete from dglctj2;
END
break;;
3)break;;
esac
#exit
#break
}

zgsc()
{
clear
echo "\n\n\t 请输入职工代号: \c"
read dm
dbaccess lctj </dev/null 2>/dev/null
unload to "./lczg.txt" select dm,xm where dm="$dm";
END
cat ./lczg.txt |awk -F'|' '{
dm=$1
xm=$2
printf("\n\n职工代号:%s\n",dm)
printf("职工姓名:%s\n",xm)
}'
echo "\n\t\t是否正确(Y|N): \c"
read key
case $key in
y|Y);;
*) break;;
esac
dbaccess lctj </dev/null 2>/dev/null
delete from lczg where dm="$dm";
END
echo "\n\t\t是否继续(Y|N): \c"
read key
case $key in
y|Y) zgsc;;
*) break;;
esac
exit
}


sjsb()
{
clear 
echo "\n\n\n\n"
echo "\t\t 是否立即进行揽存业务数据上报(y/n): \c"
read key
if [ "X$key" = "Xy" -o "X$key" = "XY" ]
then clear
echo "\n\n\n\t\t 请插入DOS格式软磁盘,按任意键继续..."
read me
doscp -m cxsb.00 a:
doscp -m dgsb.00 a:
echo "\t\t 上报完成,任意键退出!"
read me
fi
exit


sjbf()
{
clear
rm -r /usr/newbank/lcxt/lctj.exp
echo "\n\n\n\n"
echo "\t\t 正在进行揽存业务数据卸载,请稍候..." 
dbexport lctj
echo "\n\n\n\n\n"
echo "\t\t\t   正在进行文件压缩,请稍候..."
rm -r /usr/newbank/lcxt/lcsj.Z
tar cvf lcsj /usr/newbank/lcxt/lctj.exp
compress lcsj
cp lcsj /usr/tmp/backup
clear
echo "\n\n\n\n\n"
echo "\t\t\t   是否进行磁盘备份(y/n): \c"
read key
case $key in
   y|Y) tar cv6 /usr/newbank/lcxt/lcsj.Z;;
   n|N) break;;
   *) echo "\007"
esac
exit
}

sjhf()
{
clear
echo "\n\n\n\n\n"
echo "\t\t  是否从磁盘恢复(y/n)? \c"
read key
case $key in
     y|Y) tar xv /usr/newbank/lcxt/lcsj.Z;;
     n|N);;
esac     
echo "\t\t   正在进行解压缩,请稍候..."
uncompress lcsj.Z
tar xvf lcsj
echo "\n\n\n\n"
echo "\t\t  正在进行揽存业务数据加载,请稍候..."
 dbaccess - - <<-End
 drop database lctj;
 End
 dbimport lctj  
echo "\t\t恢复成功 ! 按回车键返回...\c" 
read key
exit 
}

main ()
{
trap "clear" 0 1 2 3 5 15
clear
echo "\n\n\n\n"
echo "\t\t **************************************************"
echo "\t\t *                                                *"
echo "\t\t *             农村信用社揽存统计系统             *"
echo "\t\t *                                                *"
echo "\t\t *                     v1.0版                     *"
echo "\t\t *                                                *"
echo "\t\t *             版权所有  ★  禁止拷贝             *"
echo "\t\t *                                                *"
echo "\t\t *        溧水县农村信用合作联社会计科编制        *"
echo "\t\t *                                                *"
echo "\t\t **************************************************"
echo "\n\n"
echo "\n\n\n"
 while true
 do 
 while true
 do 
  echo "\t\t请输入本网点的储蓄所号(七位) : \c"
  read cxsh
  len=`expr length "$cxsh"`
        if [ $len -eq 7 ] 
        then 
        break 
        fi
 done
echo "\n\t\t请输入操作员代码:  \c"
read czyh
dbaccess bankstar </dev/null 2>./loadinfo
unload to "./czy" select dh,xm,cxsh from czy where cxsh="$cxsh" and 
perms="1111"
END
czyxm=`awk -F'|' '$1=="'$czyh'" {print $2}' ./czy`
czydh=`awk -F'|' '$1=="'$czyh'" {print $1}' ./czy`
rm ./czy
[ $czydh ] && break 
echo "\t\t此操作员无此权限!\007"
read me
exit
done
echo "\t操作员姓名: $czyxm            \c"
gzrq=`cat /usr/bankacc/define/ACCDATE |awk -F'|' '{printf("%10s",substr($1,10,10))}'`
nsfile=`echo "$gzrq" |awk -F'/' '{printf("nsmx.%4s.%2s",$1,$2)}'`
echo "当前工作日期为:  $gzrq "
echo "\n\t\t是否正确(Y/N):  \c"
read key
if [ "X$key" = "Xy" -o "X$key" = "XY" ]
then clear
echo "\n\n\n\n"
echo "\n\t\t\t 欢迎使用农村信用社揽存统计系统!"
echo "\t\t  本系统主要提供以下功能:"
echo "\t\t  1.揽存登记只需进行一次,存款户销户后不必进行销账"
echo "\t\t  2.提供揽存数据的明细查询打印功能"
echo "\t\t  3.提供所有职工揽存数据的统计查询打印功能"  
echo "\t\t  4.揽存删除指录入错误或年终清账时进行删除"
echo "\t\t  5.系统提供揽存数据的备份,恢复及数据上报功能"
echo "\t\t  在使用本系统时如有疑问,请与溧水县联社会计科联系"
echo "\t\t  联系电话:025-7210552          联系人:邹强"
echo "\n\n\n"
echo "\t\t\t\t  请按回车键继续!"
read me
rm ./*.tmp
dbaccess bankstar </dev/null 2>/dev/null
unload to "./zzb.tmp" select zh,pzhm,hm,jce from zzb;
unload to "./dhb.tmp" select zh,pzhm,hm,jce from dhb;
unload to "./hdb.tmp" select zh,pzhm,hm,jce from hdb;
unload to "./hzb.tmp" select zh,pzhm,hm,jce from hzb;
unload to "./lzb.tmp" select zh,pzhm,hm,jce from lzb;
END
dbaccess lctj </dev/null 2>/dev/null
delete from cxsj;
load from "./zzb.tmp" insert into cxsj;
load from "./dhb.tmp" insert into cxsj;
load from "./hdb.tmp" insert into cxsj;
load from "./hzb.tmp" insert into cxsj;
load from "./lzb.tmp" insert into cxsj;
END
dbaccess single </dev/null 2>/dev/null
unload to "./zhzd.tmp" select zh,dwm,ye from zhzd;
END
dbaccess lctj </dev/null 2>/dev/null
delete from zhzd;
load from "./zhzd.tmp" insert into zhzd;
END
clear
echo "\n\n\n\n"
echo "\t    ★★★溧水县农村信用合作联社揽存统计系统★★★"
echo "\n"
echo "\t******************************************************"
echo "\t*    1 --- 储蓄数据录入        A --- 职工数据建立    *"
echo "\t*    2 --- 储蓄数据查询        B --- 职工数据删除    *"
echo "\t*    3 --- 储蓄数据统计        C --- 职工数据打印    *"
echo "\t*    4 --- 储蓄数据删除        D --- 揽存数据备份    *"
echo "\t*    5 --- 对公数据录入        E --- 揽存数据恢复    *"
echo "\t*    6 --- 对公数据查询        F --- 揽存数据上报    *"
echo "\t*    7 --- 对公数据统计        G --- 系 统  说 明    *"
echo "\t*    8 --- 对公数据删除        0 --- 退        出    *"
echo "\t******************************************************"
echo "\n"
echo "\t\t\t 请    选    择  :  \c"
read key
case $key in
   1) sjlr;;
   2) sjcx;;
   3) sjtj;;
   4) sjsc;;
   5) dgsjlr;;
   6) dgsjcx;;
   7) dgsjtj;;
   8) dgsjsc;;
   a|A) lczg;;
   b|B) zgsc;;
   c|C) zgdy;;
   d|D) sjbf;;
   e|E) sjhf;;
   f|F) sjsb;;
   g|G) cat ./readme|more;;
   0) break;;
   Q|q) break;;
  *) echo "\007"
esac
fi
exit
}
main
阅读(618) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~