一种新的编程思路(中): (转)

一种新的编程思路(中): (转)[@more@]

一种新的编程思路(中):
  难得糊涂编程法 GBDP (适用JSPASP等编程)

GBDP技术实现设想:(General Blackbox Dynamic Programming)
  开发速度快、代码量少、通用,数据库表自动生成,记录自动增加,
  修改,删除,系统设计工作量少,可以在需求不明确的情况下开工,
  渐进式开发,拥有需求频繁更改、代码基本不动的自适应能力。特
  别适合国内软件乱序开发的国情

主要解决问题:
  系统设计工作量大,需求更改影响大,项目交接困难,编程风格各
  异,数据库备份困难的问题

已经实现功能:
  数据表自动生成,记录自动增加,修改,删除,自动文件上传

注:发表后代码//都变成了file://  , 请改正


一个复杂的实现范例:

ntGBDPScript.jsp  自动记录载入模块  (“上”包含源代码
ntdb.Java  数据库存取模块  (本文包含源代码)
ntGBDPDefine.jsp
ntGBDPUPLOAD2-1.jsp 自动数据分析处理模块(“上”包含源代码) 
ntGBDPUpload2-2.jsp 自动数据保存处理模块(“上”包含源代码) 
-------------------------------------------------------
_jh_in.jsp 录入和修改页面,涉及计算



.NET.*,java.sql.*,java.text.*,java.util.*" %>
dba.ntDB" %>

  file://全局变量定义
  globalTableName = "_jh_in";
  parentKey  = "买入外汇统计卡";
  parentValue  = "";
  dbName  = "myDB";
%>

  String errorString = "";
  if( isPost && requestHt.get("numeric汇入金额").equals("") )
  errorString = "请填写汇入金额";
  else if( isPost && requestHt.get("numeric牌价").equals("") )
  errorString = "请填写牌价";

  String entpName = (String)requestHt.get("全称");
  String entpAccount = (String)requestHt.get("帐号");
  if( entpName == null ) entpName = "";
  if( entpAccount == null ) entpAccount = "";
  int entpId = 0; 
 
  if( !entpName.equals("") || !entpAccount.equals("") )
  {
  nt.executeQuery(dbName,
  "select pid from _jh where "+
  "  ( k='企业名称' and v = '"+ entpName.trim() +"' )"+
  "  or ( k='帐号'  and v = '"+ entpAccount.trim() +"' )"+
  "");
 
  if( nt.rowCount > 0 ){
  entpId = Integer.parseInt( nt.data[0][0] );
  requestHt.put("企业id",""+ entpId );
  requestHt.put("企业隶属单位", nt.getKV("_jh",entpId,"隶属单位") );
  } 
  else
  errorString = "没有找到这个企业"; 
  } 
 
  if( !errorString.equals("") )
  {
  out.println("");
  return;
  }
%>

  if( isPost && !requestHt.get("submit_auto").equals("")  )
  {
  file://导入数据
  double hrje = Double.parseDouble((String)requestHt.get("numeric汇入金额")); 
  double pj = Double.parseDouble((String)requestHt.get("numeric牌价"));
 
  file://计算数据
  double yhsxf = hrje * 0.25 * 0.01 ; // 银行手续费 
  double gssxf = hrje * 3 * 0.01 ; // 公司手续费 
  double whje  = hrje * ( 1 - 0.25*0.01 - 3 * 0.01 );// 外汇金额 
  double rmbje = hrje * pj ; // 人民币金额
  double qcz  = rmbje * 0.11 ; // 区财政
  double zcz  = rmbje * 0.08 ; // 镇财政 -- 村属8% 镇属9%
  if( nt.getKV("_jh", entpId , "企业隶属").equals("镇属企业") )
  zcz  = rmbje * 0.09 ;
  double csr  = rmbje * 0.06 ; file://村收入 村属6% 镇属0
  if( nt.getKV("_jh", entpId , "企业隶属").equals("镇属企业") )
  csr  = 0.0 ;
  double zqy  = 0.0 ; file://镇企业 村属0 镇属5%0
  if( nt.getKV("_jh", entpId , "企业隶属").equals("镇属企业") )
  zqy = rmbje * 0.05 ;
  double je = rmbje -qcz - zcz - zqy - csr ; file://净额 
 
  file://导出数据
  requestHt.put("numeric银行手续费",""+ yhsxf );
  requestHt.put("numeric公司手续费",""+ gssxf );
  requestHt.put("numeric外汇金额"  ,""+ whje  );
  requestHt.put("numeric人民币金额",""+ rmbje );
  requestHt.put("numeric区财政"  ,""+ qcz  );
  requestHt.put("numeric镇财政"  ,""+ zcz  );
  requestHt.put("numeric村收入"  ,""+ csr  );
  requestHt.put("numeric镇企业"  ,""+ zqy  );
  requestHt.put("numeric净额"  ,""+ je  );
  file://requestHt.put("numeric",""+ );
 
  file://requestHt.remove("全称"); file://冗余数据 由"企业id"代替->row 45
  file://requestHt.remove("帐号"); file://冗余数据
  }
%>



买入外汇统计卡

web.css" type="text/css">


买入外汇统计卡



 

 
业务编号:

  " value="" >
 
DC45C
 
 

 
日期:

 

  ">
 

 
票号:

 

 
 

 

 


  汇

  单

  位

 

 
全称

 

 
 
 

 
帐号

 

 
     Javascript:;" onClick="javascript:window.open('_jh_eq.jsp','newtower','resizable=yes,width=450,height=150,status=yes');" >企业选择
 

 
汇入金额

 
HKD
 
 

 
银行手续费

 
HKD
 
 

 
公司手续费

 
HKD
 
 

 
外汇金额

 

 
牌价

 

 
人民币金额

 

 
HKD
 
 

 

 

 
 

 

 

 
 

 

 
缴市财政:¥
 
 

 

 
区财政:¥
 
 

 

 
托收手续费:¥
 
 

 

 
镇 财 政:¥
 
 

 

 
区企业:¥
 
 

 

 
净  额:¥
 
 

 

 
镇 企 业:¥
 
 

 

 
村收入:¥
 
 

 

 

 
 
  自动计算
 

 
复核:

 

 
 
操作员:
 
 
录入日期:
  ">
 

 


 

 

 

  " value="确定" class="bd">
    

 

 

 
 


-------------------------------------------------------
_jh_fc.jsp 用于统计显示





  String y,m,d,h;
  y=(new SimpleDateFormat("yyyy")).format(new java.util.Date());
  m=(new SimpleDateFormat("MM")).format(new java.util.Date());
  d=(new SimpleDateFormat("dd")).format(new java.util.Date());
  h=(new SimpleDateFormat("HH")).format(new java.util.Date());

  int year,month;
  year = Integer.parseInt( y );
  month= Integer.parseInt( m );
  try{
  if( request.getParameter("year")!=null )
  year = Integer.parseInt( request.getParameter("year") );
  if( request.getParameter("month")!=null )
  month = Integer.parseInt( request.getParameter("month") );
  }catch(Exception e){
  year = Integer.parseInt(y);
  month = Integer.parseInt(m);
  }
%>

  file://结汇总额
  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric汇入金额' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  double JieHuiZongE = Double.parseDouble( nt.data[0][0] ) ;
  file://村分配金额
  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric村收入' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  double CunFenPeiJinE = Double.parseDouble( nt.data[0][0] ) ;
  file://中国银行
  double ZhongGuoYinHang = JieHuiZongE * 0.25 * 0.01 ;
  file://商务单位
  double ShangWuDanWei = JieHuiZongE * 0.03 ;
  file://区财政
  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric区财政' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  double QuCaiZheng = Double.parseDouble( nt.data[0][0] ) ;
  file://镇财政
  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric镇财政' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  double ZhenCaiZheng = Double.parseDouble( nt.data[0][0] ) ;
  file://主管单位分配金额
  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric镇企业' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  double zhuGuanDanWeiFenPeiJinE = Double.parseDouble( nt.data[0][0] ) ;
  file://村主管单位
  double CunZhuGuanDanWei =
  CunFenPeiJinE + zhuGuanDanWeiFenPeiJinE ;
  file://返拨镇 外汇分成款总额 
  double FanBoZhen =
  CunFenPeiJinE + zhuGuanDanWeiFenPeiJinE + ZhenCaiZheng ;
 
%>

  file://取出村定义
  ntDB ntCun = new ntDB();
  ntCun.executeQuery(dbName,
  "select v , 'null' as x from _jh_define where k='名称' "+
  "  and pid in "+
  "  ( select pid from _jh_define where k='属性' and v='村' "+
  "  )"+
  "  order by id desc "+
  "");
  file://取出主管单位定义
  ntDB ntZGDW = new ntDB();
  ntZGDW.executeQuery(dbName,
  "select v , 'null' as x from _jh_define where k='名称' "+
  "  and pid in "+
  "  ( select pid from _jh_define where k='属性' and v='主管单位' "+
  "  )"+
  "  order by id desc "+
  "");
  file://用金额替换x 
  for(int i=0;i  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric村收入' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "  and pid in "+
  "  ( select pid from _jh_in "+
  "  where k='企业隶属单位' and v = '"+ ntCun.data[i][0] +"'"+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  ntCun.data[i][1] = (new DecimalFormat("#,##0.00")).format(Double.parseDouble( nt.data[0][0] )) ;
  }
  for(int i=0;i  sql=
  " select isNull(sum(v),0.0) from _jh_in_numeric "+
  "  where k='numeric镇企业' "+
  "  and pid in "+
  "  ( select pid from _jh_in_datetime "+
  "  where k='date日期' and v >= '"+year+"-"+month+"-01' "+
  "  and v <= '"+year+"-"+month+"-"+nt.ntGetMonthDayCount(year,month) +"' "+
  "  )  "+
  "  and pid in "+
  "  ( select pid from _jh_in "+
  "  where k='企业隶属单位' and v = '"+ ntZGDW.data[i][0] +"'"+
  "  )  "+
  "";
  nt.executeQuery(dbName,sql);
  ntZGDW.data[i][1] = (new DecimalFormat("#,##0.00")).format(Double.parseDouble( nt.data[0][0] ));
  }

%>



深圳市坪山镇外商结汇分成表



深圳市坪山镇外商结汇分成表


 

 

 
  年
 
  月  提交   结汇总额:
  港币

 

 
返拨镇外汇分成款总额:
  元

 

 
单位名称

 

 
分配率

 

 
金额

 

 
其中村委分配金额:

 
  元

 

 
各主管单位分配金额:

 
  元

 

 
村委

 

 
金额

 

 
主管单位

 

 
金额

 

 
主管单位

 

 
金额

 
中国银行(港币)
 
0.25%

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
商务单位(港币)
 
3.00%

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
增值税
 
6%

 
 
 

 

 

 

 

 

 

 

 

 

 

 
外商
 
75%

 
 
 

 

 

 

 

 

 

 

 

 

 

 
市财政
 

 
 
 

 

 

 

 

 

 

 

 

 

 

 
区财政
 
11.00%

 

 

 

 

 

 

 

 

 

 

 

 

 
镇财政
 
8-9%

 

 

 

 

 

 

 

 

 

 

 

 

 
村、主管单位
 
5-6%

 

 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 
   
 

 

 

 

 

 

 

 

 

 

 

 

 
经发办负责人: 单位负责人: 复核人: 制表人: 制表日期:

 
 



 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10748419/viewspace-989990/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10748419/viewspace-989990/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值