js 代码:
expfilter = " 1=1 ";
var xzffdw = document.getElementById('xzffdw').value;//获取查询项 项目类型
if(null!=xzffdw&&""!=xzffdw){
filter = filter + " and wsbx_wsbxcx.num_id = '"+xzffdw+"'";
expfilter = expfilter + " and t.num_id = '"+xzffdw+"' ";
}
var yjbm = document.getElementById('yjbm').value;//获取查询项 项目类型
if(null!=yjbm&&""!=yjbm){
filter = filter + " and wsbx_wsbxcx.dept_id = '"+yjbm+"' ";
expfilter = expfilter + " and t.dept_id = '"+yjbm+"' ";
}
var ejbm = document.getElementById('ejbm').value;//获取查询项 项目类型
if(null!=ejbm&&""!=ejbm){
filter = filter + " and wsbx_wsbxcx.ejbmbh = '"+ejbm+"' ";
expfilter = expfilter + " and t.ejbmbh = '"+ejbm+"' ";
}
var mjbm = document.getElementById('mjbm').value;//获取查询项 项目类型
if(null!=mjbm&&""!=mjbm){
filter = filter + " and wsbx_wsbxcx.sec_dept_id = '"+mjbm+"' ";
expfilter = expfilter + " and t.sec_dept_id = '"+mjbm+"' ";
}
var djzt = document.getElementById('djzt').value;//获取查询项 项目类型
if(null!=djzt&&""!=djzt){
filter = filter + " and wsbx_wsbxcx.bill_status = '"+djzt+"' ";
expfilter = expfilter + " and t.bill_status = '"+djzt+"' ";
}
var sjq = document.getElementById('sjq').value;//获取查询项 项目类型
if(null!=sjq&&""!=sjq){
var dj = document.getElementById('djzt').value;
filter = filter + " and to_char(wsbx_wsbxcx."+Bydjzt(dj)+",'yyyy-mm-dd') >= '"+sjq+"' ";
expfilter = expfilter + " and to_char(t."+Bydjzt(dj)+",'yyyy-mm-dd') >= '"+sjq+"' ";
}
var sjz = document.getElementById('sjz').value;//获取查询项 项目类型
if(null!=sjz&&""!=sjz){
var dj = unieap.byId('djzt').getValue();
filter = filter + " and to_char(wsbx_wsbxcx."+Bydjzt(dj)+",'yyyy-mm-dd') <= '"+sjz+"' ";
expfilter = expfilter + " and to_char(t."+Bydjzt(dj)+",'yyyy-mm-dd') <= '"+sjz+"' ";
}
var hyx = document.getElementById('hyx').value;//获取查询项 项目类型
if(null!=hyx&&""!=hyx){
filter = filter + " and wsbx_wsbxcx.hyxid = '"+hyx+"' ";
expfilter = expfilter + " and t.hyxid = '"+hyx+"' ";
}
var djbh = document.getElementById('djbh').value;//获取查询项 项目类型
if(null!=djbh&&""!=djbh){
filter = filter + " and wsbx_wsbxcx.bill_code = '"+djbh+"' ";
expfilter = expfilter + " and t.bill_code = '"+djbh+"' ";
}
var xmbh = document.getElementById('xmbh').value;//获取查询项 项目类型
if(null!=xmbh&&""!=xmbh){
filter = filter + " and wsbx_wsbxcx.project_code = '"+xmbh+"' ";
expfilter = expfilter + " and t.project_code = '"+xmbh+"' ";
}
var sqrxm = document.getElementById('sqrxm').value;//获取查询项 项目类型
if(null!=sqrxm&&""!=sqrxm){
filter += " and wsbx_wsbxcx.NAME LIKE '%"+sqrxm+"%'";
expfilter += " and t.NAME LIKE '%"+sqrxm+"%'";
}
function exportExcel() {
lnk = document.getElementById("explnk");
var href= appPath + "/reimbursementCheckActionNEW.do?method=reportExcel&expfilter="+expfilter;
href = encodeURI(href);
href = encodeURI(href);
lnk.href = href;
lnk.click();
}
action:
@SuppressWarnings("unchecked")
public ActionForward reportExcel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException,Exception {
// 创建当前日子
Date date = new Date();
// 格式化日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dcsdf = new SimpleDateFormat("yyyyMMdd");
// // 格式化日期(产生文件名)
// String filename = sdf.format(date);
String filename = "导出有问题这是错误的模板";
System.out.println(request.getParameter("expfilter"));
System.out.println(request.getParameter("expfilter").getBytes("ISO-8859-1"));
System.out.println(new String(request.getParameter("expfilter").getBytes("ISO-8859-1"), "UTF-8"));
// String expfilter = new String(request.getParameter("expfilter").getBytes("ISO-8859-1"), "UTF-8");
String expfilter = request.getParameter("expfilter");
expfilter = java.net.URLDecoder.decode(expfilter,"UTF-8");
ReimbursementCheckInteractionNEW reimbursementCheckInteraction = getReimbursementCheckInteractionNEW(request);
System.out.println(request.getRealPath("file"));
// 创建文件
File f = new File(request.getRealPath("file")+ File.separatorChar + "报销单" + ".xls");
f.createNewFile();
// 生成excel文件(保存在服务器机上)
try {
reimbursementCheckInteraction.writeExcel(new FileOutputStream(f), expfilter);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 导出文件(下载到客户机上,并删除服务器机上的excel文件)
Files.exportFile(request,response, f, true);
return null;
}
impl:
@Override
public void writeExcel(OutputStream os, String expfilter)throws IOException, RowsExceededException, WriteException {
DataSet dset = null;
DataSet qt_dset = null;
DataSet cl_dset = null;
DataSet jt_dset = null;
DataSet jj_dset = null;
DataSet zl_dset = null;
DataSet hy_dset = null;
String qtlx ="";
User user = ((OrgnizationContext) OrgnizationContextHolder
.getContext()).getCurrentUser();
CommonApplogic commonApplogic = new CommonApplogicImpl();
try {
String sql = "select * from nuip_wsbx.wsbx_wsbxcx_rd t where "+expfilter+" "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //A) 报销单信息
String qt_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.*, t2.base_inf_name P_base_inf_name, t3.base_inf_name M_base_inf_name from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_OTHER_INF t1, nuip_wsbx.code_list t2, nuip_wsbx.code_list t3 " +
"where "+expfilter+" and t.bill_type in ('QT') and t.id = t1.BILL_ID and t2.base_grp_code = 'COST_TYPE' and t3.base_grp_code = 'MCOST_TYPE' and t1.P_TYPE = t2.base_inf_code and t1.M_TYPE = t3.base_inf_code "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"+//B) 其他报销明细
" UNION ALL select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.*, t2.base_inf_name P_base_inf_name, t3.base_inf_name M_base_inf_name from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_OTHER_INF t1, nuip_wsbx.code_list t2, nuip_wsbx.code_list t3 " +
"where "+expfilter+" and t.bill_type in ('PQT') and t.id = t1.BILL_ID and t2.base_grp_code = 'COST_TYPEOP' and t3.base_grp_code = 'MCOST_TYPE' and t1.P_TYPE = t2.base_inf_code and t1.M_TYPE = t3.base_inf_code "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //B) 其他报销明细
String cl_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.* from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_EVECTION_INF t1 " +
"where "+expfilter+" and t.bill_type in ('CL','PCL') and t.id = t1.BILL_ID "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //C) 差旅费报销明细
String jt_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.* from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_TRFFIC_INF t1 " +
"where "+expfilter+" and t.bill_type in ('JT','PJT') and t.id = t1.BILL_ID "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //D) 交通费报销明细
String jj_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.* from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_SOCIETY_INF t1 " +
"where "+expfilter+" and t.bill_type in ('JJ','PJJ') and t.id = t1.BILL_ID "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //E) 交际费报销明细
String zl_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.* from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_EXHIBIT_INF t1 " +
"where "+expfilter+" and t.bill_type = 'ZL' and t.id = t1.BILL_ID "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //F) 展览费报销明细
String hy_sql = "select t.ehr_code,t.name,t.bill_type_name,t.bill_code, t1.* from nuip_wsbx.wsbx_wsbxcx_rd t, nuip_wsbx.TB_BILL_CONFERENCE_INF t1 " +
"where "+expfilter+" and t.bill_type = 'HY' and t.id = t1.BILL_ID "
+"and to_char(num_id) in(select up_org_station.station_id from up_org_station, up_org_user_station "
+"where up_org_station.station_id = up_org_user_station.station_id "
+"and up_org_station.unit_id = 'ztzt' "
+"and up_org_user_station.user_id = '"+user.getId()+"')"; //G) 会议费报销明细
dset = commonApplogic.queryBySql(sql,null);
qt_dset = commonApplogic.queryBySql(qt_sql,null);
cl_dset = commonApplogic.queryBySql(cl_sql,null);
jt_dset = commonApplogic.queryBySql(jt_sql,null);
jj_dset = commonApplogic.queryBySql(jj_sql,null);
zl_dset = commonApplogic.queryBySql(zl_sql,null);
hy_dset = commonApplogic.queryBySql(hy_sql,null);
commonApplogic = null;
} catch (Exception e) {
e.printStackTrace();
}
// 创建可以写入的Excel工作薄(默认运行生成的文件在tomcat/bin下 )
WritableWorkbook wwb = Workbook.createWorkbook(os);
// 生成工作表,(name:First Sheet,参数0表示这是第一页)
WritableSheet sheet = wwb.createSheet("报销单信息", 0);
WritableSheet qt_sheet = wwb.createSheet("其他报销明细", 1);
WritableSheet cl_sheet = wwb.createSheet("差旅费报销明细", 2);
WritableSheet jt_sheet = wwb.createSheet("交通费报销明细", 3);
WritableSheet jj_sheet = wwb.createSheet("交际费报销明细", 4);
WritableSheet zl_sheet = wwb.createSheet("展览费报销明细", 5);
WritableSheet hy_sheet = wwb.createSheet("会议费报销明细", 6);
WritableFont wf_title = new WritableFont(WritableFont.ARIAL, 18,
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_title = new WritableCellFormat(wf_title); // 单元格定义
// wcf_title.setBackground(jxl.format.Colour.BLACK); // 设置单元格的背景颜色
wcf_title.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
wcf_title.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
WritableFont wf_head = new WritableFont(WritableFont.TIMES, 10,
WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_head = new WritableCellFormat(wf_head); // 单元格定义
wcf_head.setBackground(jxl.format.Colour.ICE_BLUE); // 设置单元格的背景颜色
wcf_head.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
wcf_head.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
WritableFont wf_sm = new WritableFont(WritableFont.TIMES, 10,
WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_sm = new WritableCellFormat(wf_sm); // 单元格定义
// wcf_sm.setBackground(jxl.format.Colour.GREY_25_PERCENT); //
// 设置单元格的背景颜色
wcf_sm.setAlignment(jxl.format.Alignment.GENERAL); // 设置对齐方式
wcf_sm.setVerticalAlignment(jxl.format.VerticalAlignment.JUSTIFY);
wcf_sm.setBorder(Border.ALL, BorderLineStyle.NONE,
jxl.format.Colour.BLACK);
WritableFont wf_table = new WritableFont(WritableFont.TIMES, 10,
WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_table = new WritableCellFormat(wf_table); // 单元格定义
// wcf_table.setBackground(jxl.format.Colour.GREY_25_PERCENT); //
// 设置单元格的背景颜色
wcf_table.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
wcf_table.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
wcf_table.setBorder(Border.ALL, BorderLineStyle.THIN,
jxl.format.Colour.BLACK);
WritableFont wf_zb = new WritableFont(WritableFont.TIMES, 10,
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_zb = new WritableCellFormat(wf_zb); // 单元格定义
wcf_zb.setBackground(jxl.format.Colour.GREY_25_PERCENT); //设置单元格的背景颜色
wcf_zb.setAlignment(jxl.format.Alignment.CENTRE); // 设置对齐方式
wcf_zb.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
wcf_zb.setBorder(Border.ALL, BorderLineStyle.THIN,
jxl.format.Colour.BLACK);
WritableFont wf_nr = new WritableFont(WritableFont.TIMES, 10,
WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK); // 定义格式 字体 下划线 斜体 粗体 颜色
WritableCellFormat wcf_nr = new WritableCellFormat(wf_nr); // 单元格定义
// wcf_nr.setBackground(jxl.format.Colour.GREY_25_PERCENT); //
// 设置单元格的背景颜色
wcf_nr.setAlignment(jxl.format.Alignment.LEFT); // 设置对齐方式
wcf_nr.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
wcf_nr.setBorder(Border.ALL, BorderLineStyle.THIN,
jxl.format.Colour.BLACK);
//报销单信息
sheet.addCell(new Label(0, 0, "单据号", wcf_head));
sheet.addCell(new Label(1, 0, "申请人", wcf_head));
sheet.addCell(new Label(2, 0, "员工编号", wcf_head));
sheet.addCell(new Label(3, 0, "代理人", wcf_head));
sheet.addCell(new Label(4, 0, "帐套", wcf_head));
sheet.addCell(new Label(5, 0, "部门", wcf_head));
sheet.addCell(new Label(6, 0, "日期", wcf_head));
sheet.addCell(new Label(7, 0, "类型", wcf_head));
sheet.addCell(new Label(8, 0, "金额", wcf_head));
sheet.addCell(new Label(9, 0, "行业线", wcf_head));
sheet.addCell(new Label(10, 0, "项目编号", wcf_head));
sheet.addCell(new Label(11, 0, "项目名称", wcf_head));
sheet.addCell(new Label(12, 0, "状态", wcf_head));
//add by 史建楠
sheet.addCell(new Label(13, 0, "客户项目编号", wcf_head));
sheet.addCell(new Label(14, 0, "客户项目名称", wcf_head));
while(dset.next()){
int i = sheet.getRows();
sheet.addCell(new Label(0, i, dset.getString("bill_code")));
sheet.addCell(new Label(1, i, dset.getString("name")));
sheet.addCell(new Label(2, i, dset.getString("ehr_code")));
sheet.addCell(new Label(3, i, dset.getString("proxy")));
sheet.addCell(new Label(4, i, dset.getString("ztmc")));
sheet.addCell(new Label(5, i, dset.getString("mc")));
sheet.addCell(new Label(6, i, dset.getString("check_time")));
sheet.addCell(new Label(7, i, dset.getString("bill_type_name")));
sheet.addCell(new Label(8, i, dset.getString("bill_amount")));
sheet.addCell(new Label(9, i, dset.getString("hyx")));
sheet.addCell(new Label(10, i, dset.getString("project_code")));
sheet.addCell(new Label(11, i, dset.getString("project_name")));
sheet.addCell(new Label(12, i, dset.getString("base_inf_name")));
//add by 史建楠
// sheet.addCell(new Label(12, i, dset.getString("KHXMBH")));
// sheet.addCell(new Label(13, i, dset.getString("KHXMMC")));
sheet.addCell(new Label(13, i, dset.getString("KHXMBH")));
sheet.addCell(new Label(14, i, dset.getString("KHXMMC")));
}
//其他报销明细
qt_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
qt_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
qt_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
qt_sheet.addCell(new Label(3, 0, "项目编号", wcf_head));
qt_sheet.addCell(new Label(4, 0, "项目名称", wcf_head));
qt_sheet.addCell(new Label(5, 0, "任务名称", wcf_head));
qt_sheet.addCell(new Label(6, 0, "报销内容说明", wcf_head));
qt_sheet.addCell(new Label(7, 0, "票据类别", wcf_head));
qt_sheet.addCell(new Label(8, 0, "管理类别", wcf_head));
qt_sheet.addCell(new Label(9, 0, "报销起始时间", wcf_head));
qt_sheet.addCell(new Label(10, 0, "票据金额", wcf_head));
qt_sheet.addCell(new Label(11, 0, "审核金额", wcf_head));
//add by 史建楠
qt_sheet.addCell(new Label(12, 0, "客户项目编号", wcf_head));
qt_sheet.addCell(new Label(13, 0, "客户项目名称", wcf_head));
while(qt_dset.next()){
int i = qt_sheet.getRows();
qt_sheet.addCell(new Label(0, i, qt_dset.getString("ehr_code")));
qt_sheet.addCell(new Label(1, i, qt_dset.getString("name")));
qt_sheet.addCell(new Label(2, i, qt_dset.getString("bill_code")));
qt_sheet.addCell(new Label(3, i, qt_dset.getString("project_code")));
qt_sheet.addCell(new Label(4, i, qt_dset.getString("project_name")));
qt_sheet.addCell(new Label(5, i, qt_dset.getString("RWMC")));
qt_sheet.addCell(new Label(6, i, qt_dset.getString("REMARK")));
qt_sheet.addCell(new Label(7, i, qt_dset.getString("P_base_inf_name")));
qt_sheet.addCell(new Label(8, i, qt_dset.getString("M_base_inf_name")));
qt_sheet.addCell(new Label(9, i, qt_dset.getString("START_TIME")));
qt_sheet.addCell(new Label(10, i, qt_dset.getString("AMOUNT")));
qt_sheet.addCell(new Label(11, i, qt_dset.getString("CONFIRM_AMOUNT")));
//add by 史建楠
qt_sheet.addCell(new Label(12, i, qt_dset.getString("KHXMBH")));
qt_sheet.addCell(new Label(13, i, qt_dset.getString("KHXMMC")));
}
//差旅费报销明细
cl_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
cl_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
cl_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
cl_sheet.addCell(new Label(3, 0, "项目编号", wcf_head));
cl_sheet.addCell(new Label(4, 0, "项目名称", wcf_head));
cl_sheet.addCell(new Label(5, 0, "出发日期", wcf_head));
cl_sheet.addCell(new Label(6, 0, "出发地", wcf_head));
cl_sheet.addCell(new Label(7, 0, "到达日期", wcf_head));
cl_sheet.addCell(new Label(8, 0, "到达地", wcf_head));
cl_sheet.addCell(new Label(9, 0, "飞机费", wcf_head));
cl_sheet.addCell(new Label(10, 0, "车船费", wcf_head));
cl_sheet.addCell(new Label(11, 0, "安排食宿", wcf_head));
cl_sheet.addCell(new Label(12, 0, "签约宾馆", wcf_head));
cl_sheet.addCell(new Label(13, 0, "是否合住", wcf_head));
cl_sheet.addCell(new Label(14, 0, "住宿天数", wcf_head));
cl_sheet.addCell(new Label(15, 0, "宿费单价", wcf_head));
cl_sheet.addCell(new Label(16, 0, "宿费其他", wcf_head));
cl_sheet.addCell(new Label(17, 0, "宿费", wcf_head));
cl_sheet.addCell(new Label(18, 0, "其他杂项", wcf_head));
cl_sheet.addCell(new Label(19, 0, "市内交通费", wcf_head));
cl_sheet.addCell(new Label(20, 0, "外埠交通费", wcf_head));
cl_sheet.addCell(new Label(21, 0, "出差天数", wcf_head));
cl_sheet.addCell(new Label(22, 0, "伙食补助", wcf_head));
cl_sheet.addCell(new Label(23, 0, "交通补助", wcf_head));
cl_sheet.addCell(new Label(24, 0, "住宿补助", wcf_head));
cl_sheet.addCell(new Label(25, 0, "其他补助", wcf_head));
cl_sheet.addCell(new Label(26, 0, "合计", wcf_head));
//add by 史建楠
cl_sheet.addCell(new Label(27, 0, "客户项目编号", wcf_head));
cl_sheet.addCell(new Label(28, 0, "客户项目名称", wcf_head));
cl_sheet.addCell(new Label(29, 0, "宾馆名称", wcf_head));
cl_sheet.addCell(new Label(30, 0, "是否合住", wcf_head));
while(cl_dset.next()){
int i = cl_sheet.getRows();
cl_sheet.addCell(new Label(0, i, cl_dset.getString("ehr_code")));
cl_sheet.addCell(new Label(1, i, cl_dset.getString("name")));
cl_sheet.addCell(new Label(2, i, cl_dset.getString("bill_code")));
cl_sheet.addCell(new Label(3, i, cl_dset.getString("project_code")));
cl_sheet.addCell(new Label(4, i, cl_dset.getString("project_name")));
cl_sheet.addCell(new Label(5, i, cl_dset.getString("START_DATE")));
cl_sheet.addCell(new Label(6, i, cl_dset.getString("START_ADDRESS")));
cl_sheet.addCell(new Label(7, i, cl_dset.getString("ARRIVE_DATE")));
cl_sheet.addCell(new Label(8, i, cl_dset.getString("ARRIVE_ADDRESS")));
cl_sheet.addCell(new Label(9, i, cl_dset.getString("PLEAN")));
cl_sheet.addCell(new Label(10, i, cl_dset.getString("CAR")));
cl_sheet.addCell(new Label(11, i, decode(cl_dset.getString("ES_FLG"))));
cl_sheet.addCell(new Label(12, i, decode(cl_dset.getString("HOTAL_FLG"))));
cl_sheet.addCell(new Label(13, i, decode(cl_dset.getString("COMBINE_FLG"))));
cl_sheet.addCell(new Label(14, i, cl_dset.getString("S_NUM")));
cl_sheet.addCell(new Label(15, i, cl_dset.getString("S_PRICE")));
cl_sheet.addCell(new Label(16, i, cl_dset.getString("S_OTHER")));
cl_sheet.addCell(new Label(17, i, cl_dset.getString("S_AMOUNT")));
cl_sheet.addCell(new Label(18, i, cl_dset.getString("OTHER")));
cl_sheet.addCell(new Label(19, i, cl_dset.getString("INNER_TRFFIC")));
cl_sheet.addCell(new Label(20, i, cl_dset.getString("OUTER_TRFFIC")));
cl_sheet.addCell(new Label(21, i, cl_dset.getString("OUT_DAY")));
cl_sheet.addCell(new Label(22, i, cl_dset.getString("B_EATEN")));
cl_sheet.addCell(new Label(23, i, cl_dset.getString("B_TRFFIC")));
cl_sheet.addCell(new Label(24, i, cl_dset.getString("B_SLEEP")));
cl_sheet.addCell(new Label(25, i, cl_dset.getString("B_OTHER")));
cl_sheet.addCell(new Label(26, i, cl_dset.getString("AMOUNT")));
//add by 史建楠
cl_sheet.addCell(new Label(27, i, cl_dset.getString("KHXMBH")));
cl_sheet.addCell(new Label(28, i, cl_dset.getString("KHXMMC")));
cl_sheet.addCell(new Label(29, i, cl_dset.getString("HOTAL_NAME")));//宾馆名称
cl_sheet.addCell(new Label(30, i, decode(cl_dset.getString("COMBINE_FLG"))));//是否合住
}
//交通费报销明细
jt_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
jt_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
jt_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
jt_sheet.addCell(new Label(3, 0, "乘车日期", wcf_head));
jt_sheet.addCell(new Label(4, 0, "上车时间", wcf_head));
jt_sheet.addCell(new Label(5, 0, "下车时间", wcf_head));
jt_sheet.addCell(new Label(6, 0, "乘车人", wcf_head));
jt_sheet.addCell(new Label(7, 0, "起点", wcf_head));
jt_sheet.addCell(new Label(8, 0, "终点", wcf_head));
jt_sheet.addCell(new Label(9, 0, "报销金额", wcf_head));
jt_sheet.addCell(new Label(10, 0, "项目编号", wcf_head));
jt_sheet.addCell(new Label(11, 0, "项目名称", wcf_head));
jt_sheet.addCell(new Label(12, 0, "任务名称", wcf_head));
jt_sheet.addCell(new Label(13, 0, "情况说明", wcf_head));
//add by 史建楠
jt_sheet.addCell(new Label(14, 0, "客户项目编号", wcf_head));
jt_sheet.addCell(new Label(15, 0, "客户项目名称", wcf_head));
while(jt_dset.next()){
int i = jt_sheet.getRows();
jt_sheet.addCell(new Label(0, i, jt_dset.getString("ehr_code")));
jt_sheet.addCell(new Label(1, i, jt_dset.getString("name")));
jt_sheet.addCell(new Label(2, i, jt_dset.getString("bill_code")));
jt_sheet.addCell(new Label(3, i, jt_dset.getString("TRFFICE_DATE")));
jt_sheet.addCell(new Label(4, i, jt_dset.getString("START_TIME")));
jt_sheet.addCell(new Label(5, i, jt_dset.getString("END_TIME")));
jt_sheet.addCell(new Label(6, i, jt_dset.getString("PERSON_NAME")));
jt_sheet.addCell(new Label(7, i, jt_dset.getString("START_ADDRESS")));
jt_sheet.addCell(new Label(8, i, jt_dset.getString("END_ADDRESS")));
jt_sheet.addCell(new Label(9, i, jt_dset.getString("AMOUNT")));
jt_sheet.addCell(new Label(10, i, jt_dset.getString("project_code")));
jt_sheet.addCell(new Label(11, i, jt_dset.getString("project_name")));
jt_sheet.addCell(new Label(12, i, jt_dset.getString("RWMC")));
jt_sheet.addCell(new Label(13, i, jt_dset.getString("REMARK")));
//add by 史建楠
// mod by yinjq bug 3515 2014/08/21 begin
// jt_sheet.addCell(new Label(13, i, jt_dset.getString("KHXMBH")));
// jt_sheet.addCell(new Label(13, i, jt_dset.getString("KHXMMC")));
jt_sheet.addCell(new Label(14, i, jt_dset.getString("KHXMBH")));
jt_sheet.addCell(new Label(15, i, jt_dset.getString("KHXMMC")));
// mod by yinjq bug 3515 2014/08/21 end
}
//交际费报销明细
jj_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
jj_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
jj_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
jj_sheet.addCell(new Label(3, 0, "招待日期", wcf_head));
jj_sheet.addCell(new Label(4, 0, "项目编号", wcf_head));
jj_sheet.addCell(new Label(5, 0, "项目名称", wcf_head));
jj_sheet.addCell(new Label(6, 0, "任务名称", wcf_head));
jj_sheet.addCell(new Label(7, 0, "客户信息", wcf_head));
jj_sheet.addCell(new Label(8, 0, "陪同人员信息", wcf_head));
jj_sheet.addCell(new Label(9, 0, "总消费人数", wcf_head));
jj_sheet.addCell(new Label(10, 0, "消费金额", wcf_head));
jj_sheet.addCell(new Label(11, 0, "人均消费", wcf_head));
jj_sheet.addCell(new Label(12, 0, "招待地点", wcf_head));
jj_sheet.addCell(new Label(13, 0, "招待事项说明", wcf_head));
//add by 史建楠
jj_sheet.addCell(new Label(14, 0, "客户项目编号", wcf_head));
jj_sheet.addCell(new Label(15, 0, "客户项目名称", wcf_head));
while(jj_dset.next()){
int i = jj_sheet.getRows();
jj_sheet.addCell(new Label(0, i, jj_dset.getString("ehr_code")));
jj_sheet.addCell(new Label(1, i, jj_dset.getString("name")));
jj_sheet.addCell(new Label(2, i, jj_dset.getString("bill_code")));
jj_sheet.addCell(new Label(3, i, jj_dset.getString("SOCIETY_DATE")));
jj_sheet.addCell(new Label(4, i, jj_dset.getString("project_code")));
jj_sheet.addCell(new Label(5, i, jj_dset.getString("project_name")));
jj_sheet.addCell(new Label(6, i, jj_dset.getString("RWMC")));
jj_sheet.addCell(new Label(7, i, jj_dset.getString("CUSTOM_INF")));
jj_sheet.addCell(new Label(8, i, jj_dset.getString("PERSON_INF")));
jj_sheet.addCell(new Label(9, i, jj_dset.getString("ALL_NUM")));
jj_sheet.addCell(new Label(10, i, jj_dset.getString("ALL_AMOUNT")));
Double all_amount = new Double(jj_dset.getString("ALL_AMOUNT"));
Double all_unm = new Double(jj_dset.getString("ALL_NUM"));
DecimalFormat df = new DecimalFormat("#.00");
jj_sheet.addCell(new Label(11, i, df.format(all_amount/all_unm)));
jj_sheet.addCell(new Label(12, i, jj_dset.getString("SOCIETY_ADDRESS")));
jj_sheet.addCell(new Label(13, i, jj_dset.getString("REMARK")));
//add by 史建楠
jj_sheet.addCell(new Label(14, i, jj_dset.getString("KHXMBH")));
jj_sheet.addCell(new Label(15, i, jj_dset.getString("KHXMMC")));
}
//展览费报销明细
zl_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
zl_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
zl_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
zl_sheet.addCell(new Label(3, 0, "展览会名称", wcf_head));
zl_sheet.addCell(new Label(4, 0, "起始时间", wcf_head));
zl_sheet.addCell(new Label(5, 0, "地点", wcf_head));
zl_sheet.addCell(new Label(6, 0, "主办部门", wcf_head));
zl_sheet.addCell(new Label(7, 0, "简要说明", wcf_head));
zl_sheet.addCell(new Label(8, 0, "本单位参加人数", wcf_head));
zl_sheet.addCell(new Label(9, 0, "场租费", wcf_head));
zl_sheet.addCell(new Label(10, 0, "布展费", wcf_head));
zl_sheet.addCell(new Label(11, 0, "资料费", wcf_head));
zl_sheet.addCell(new Label(12, 0, "礼品费", wcf_head));
zl_sheet.addCell(new Label(13, 0, "其他", wcf_head));
zl_sheet.addCell(new Label(14, 0, "合计", wcf_head));
zl_sheet.addCell(new Label(15, 0, "说明", wcf_head));
while(zl_dset.next()){
int i = zl_sheet.getRows();
zl_sheet.addCell(new Label(0, i, zl_dset.getString("ehr_code")));
zl_sheet.addCell(new Label(1, i, zl_dset.getString("name")));
zl_sheet.addCell(new Label(2, i, zl_dset.getString("bill_code")));
zl_sheet.addCell(new Label(3, i, zl_dset.getString("EXHIBIT_NAME")));
zl_sheet.addCell(new Label(4, i, zl_dset.getString("START_TIME")));
zl_sheet.addCell(new Label(5, i, zl_dset.getString("ADDRESS")));
zl_sheet.addCell(new Label(6, i, zl_dset.getString("DEPT_CONTENT")));
zl_sheet.addCell(new Label(7, i, zl_dset.getString("EXHIBIT_CONTENT")));
zl_sheet.addCell(new Label(8, i, zl_dset.getString("PERSON_COUNT")));
zl_sheet.addCell(new Label(9, i, zl_dset.getString("CZ")));
zl_sheet.addCell(new Label(10, i, zl_dset.getString("BZ")));
zl_sheet.addCell(new Label(11, i, zl_dset.getString("ZL")));
zl_sheet.addCell(new Label(12, i, zl_dset.getString("LP")));
zl_sheet.addCell(new Label(13, i, zl_dset.getString("OTHER")));
zl_sheet.addCell(new Label(14, i, zl_dset.getString("AMOUNT")));
zl_sheet.addCell(new Label(15, i, zl_dset.getString("REMARK")));
}
//会议费报销明细
hy_sheet.addCell(new Label(0, 0, "员工编号", wcf_head));
hy_sheet.addCell(new Label(1, 0, "员工姓名", wcf_head));
hy_sheet.addCell(new Label(2, 0, "单据编号", wcf_head));
hy_sheet.addCell(new Label(3, 0, "会议名称", wcf_head));
hy_sheet.addCell(new Label(4, 0, "起始时间", wcf_head));
hy_sheet.addCell(new Label(5, 0, "地点", wcf_head));
hy_sheet.addCell(new Label(6, 0, "主办部门", wcf_head));
hy_sheet.addCell(new Label(7, 0, "简要说明", wcf_head));
hy_sheet.addCell(new Label(8, 0, "本单位参加人数", wcf_head));
hy_sheet.addCell(new Label(9, 0, "场租费", wcf_head));
hy_sheet.addCell(new Label(10, 0, "设备租用费", wcf_head));
hy_sheet.addCell(new Label(11, 0, "资料费", wcf_head));
hy_sheet.addCell(new Label(12, 0, "礼品费", wcf_head));
hy_sheet.addCell(new Label(13, 0, "其他", wcf_head));
hy_sheet.addCell(new Label(14, 0, "合计", wcf_head));
hy_sheet.addCell(new Label(15, 0, "备注", wcf_head));
while(hy_dset.next()){
int i = hy_sheet.getRows();
hy_sheet.addCell(new Label(0, i, hy_dset.getString("ehr_code")));
hy_sheet.addCell(new Label(1, i, hy_dset.getString("name")));
hy_sheet.addCell(new Label(2, i, hy_dset.getString("bill_code")));
hy_sheet.addCell(new Label(3, i, hy_dset.getString("CONFERENCE_NAME")));
hy_sheet.addCell(new Label(4, i, hy_dset.getString("START_TIME")));
hy_sheet.addCell(new Label(5, i, hy_dset.getString("ADDRESS")));
hy_sheet.addCell(new Label(6, i, hy_dset.getString("DEPT_CONTENT")));
hy_sheet.addCell(new Label(7, i, hy_dset.getString("CONFERENCE_CONTENT")));
hy_sheet.addCell(new Label(8, i, hy_dset.getString("PERSON_COUNT")));
hy_sheet.addCell(new Label(9, i, hy_dset.getString("CZ")));
hy_sheet.addCell(new Label(10, i, hy_dset.getString("BZ")));
hy_sheet.addCell(new Label(11, i, hy_dset.getString("ZL")));
hy_sheet.addCell(new Label(12, i, hy_dset.getString("LP")));
hy_sheet.addCell(new Label(13, i, hy_dset.getString("OTHER")));
hy_sheet.addCell(new Label(14, i, hy_dset.getString("AMOUNT")));
hy_sheet.addCell(new Label(15, i, hy_dset.getString("REMARK")));
}
// sheet.setColumnView(0, 2); // 设置列的宽度
// sheet.mergeCells(5, totalRows + row, 8, totalRows + row); // 合并单元格
// 写入数据
wwb.write();
// 关闭文件
wwb.close();
// 关闭输出流
os.close();
}
处理uri %乱码
猜你喜欢
转载自blog.csdn.net/plazyj/article/details/78367322
今日推荐
周排行