/** * 打开打印零售单页面 pdf * * @return */ public String printLsd() { try { lsd = (Lsd) lsdService.getLsd(id); client_name = StringUtils.nullToStr(lsd.getClient_name()) + " " + StringUtils.nullToStr(lsd.getLxr()); client_tel = StringUtils.nullToStr(lsd.getLxdh()) + " " + StringUtils.nullToStr(lsd.getMobile()) + " " + StringUtils.nullToStr(lsd.getMail()); dept_name = StaticParamDo.getDeptNameById(((SysUser) userService.getUser(lsd.getXsry())).getDept()); xsry_name = StaticParamDo.getRealNameById(lsd.getXsry()); skfs = StringUtils.nullToStr(lsd.getFkfs()); skzh_name = StaticParamDo.getAccountNameById(lsd.getSkzh()); address = StringUtils.nullToStr(lsd.getAddress()); remark = StringUtils.nullToStr(lsd.getMs()); jexj_dx = MoneyUtil.toChinese(lsd.getLsdje() + ""); creatdate = StringUtils.nullToStr(lsd.getCreatdate()); Map map = sysInitSetService.getReportSet(); if (map != null) { title_name = StringUtils.nullToStr(map.get("title_name")) + "零售单"; foot_name = StringUtils.nullToStr(map.get("foot_name")); } lsdProducts = lsdService.getLsdProducts(id); } catch (Exception e) { log.error("打印零售单出错,原因:" + e.getMessage()); return ERROR; } return "success"; }
@Override public void writeExcelFile(HttpServletRequest request, WritableSheet sheet) { try { String start_date = StringUtils.nullToStr(request.getParameter("start_date")); String end_date = StringUtils.nullToStr(request.getParameter("end_date")); String dept_id = StringUtils.nullToStr(request.getParameter("dept_id")); String clientId = StringUtils.nullToStr(request.getParameter("clientId")); String client_name = StringUtils.nullToStr(request.getParameter("client_name")); String product_name = StringUtils.nullToStr(request.getParameter("product_name")); String product_kind = StringUtils.nullToStr(request.getParameter("product_kind")); String xsry_name = StringUtils.nullToStr(request.getParameter("xsry_name")); String con = ""; con = "日期:" + start_date + "至" + end_date; if (!clientId.equals("")) { con += " 客户名称:" + clientId; } if (!dept_id.equals("")) { con += " 部门:" + StaticParamDo.getDeptNameById(dept_id); } if (!product_kind.equals("")) { con += " 商品类别:" + StaticParamDo.getProductKindNameById(product_kind); } con += " 报表生成时间:" + DateComFunc.getCurTime(); Label label = null; // 写统计表标题 sheet.mergeCells(0, 0, 7, 0); label = new Label(0, 0, "商品序列号销售汇总", this.getFt_title()); sheet.addCell(label); // 写统计条件 sheet.mergeCells(0, 1, 7, 1); label = new Label(0, 1, con, this.getFt_item_center()); sheet.addCell(label); // 写统计表头 label = new Label(0, 2, "日期", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(1, 2, "序列号", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(2, 2, "商品名称", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(3, 2, "商品规格", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(4, 2, "客户名称", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(5, 2, "客户电话", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(6, 2, "销售员", this.getFt_item_center_bold()); sheet.addCell(label); label = new Label(7, 2, "销售价格", this.getFt_item_center_bold()); sheet.addCell(label); List resultList = productSerialNumXsHzService.getSerialNumXsList( start_date, end_date, product_kind, product_name, dept_id, xsry_name, clientId); int hj_nums = 0; double hj_je = 0; int k = 3; // 写统计内容 if (resultList != null && resultList.size() > 0) { for (int i = 0; i < resultList.size(); i++) { Map map = (Map) resultList.get(i); double je = map.get("xsdj") == null ? 0 : ((Double) map.get("xsdj")).doubleValue(); label = new Label(0, k, StringUtils.nullToStr(map.get("fs_date")), this.getFt_item_left()); sheet.addCell(label); label = new Label(1, k, StringUtils.nullToStr(map.get("serial_num")), this.getFt_item_left()); sheet.addCell(label); label = new Label( 2, k, StringUtils.nullToStr(map.get("product_name")), this.getFt_item_left()); sheet.addCell(label); label = new Label(3, k, StringUtils.nullToStr(map.get("product_xh")), this.getFt_item_left()); sheet.addCell(label); label = new Label( 4, k, StringUtils.nullToStr(map.get("client_name")), this.getFt_item_left()); sheet.addCell(label); label = new Label(5, k, StringUtils.nullToStr(map.get("tel")), this.getFt_item_left()); sheet.addCell(label); label = new Label(6, k, StringUtils.nullToStr(map.get("jsr")), this.getFt_item_left()); sheet.addCell(label); label = new Label(7, k, JMath.round(je, 2), this.getFt_item_right()); sheet.addCell(label); k++; } } } catch (Exception ex) { log.info(ex); } }