protected void btExport_Click(object sender, EventArgs e) { if (TabStrip1.ActiveTabIndex == 0) { if (GridGoods.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=单品到货分析.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(GridGoods)); Response.End(); btnExp.Enabled = true; } if (TabStrip1.ActiveTabIndex == 1) { if (GridList.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=单据到货分析.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(GridList)); Response.End(); btnExp.Enabled = true; } }
protected void btnExport_Click(object sender, EventArgs e) { if (GridGoods.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=信息导出.xls"); Response.ContentType = "application/excel"; Response.Write(PubFunc.GridToHtml(GridGoods)); Response.End(); btnExport.Enabled = true; }
protected void btExport_Click(object sender, EventArgs e) { if (GridGoods == null) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=供应商进销存汇总报表.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(GridGoods)); Response.End(); btnExp.Enabled = true; }
protected void btExport_Click(object sender, EventArgs e) { if (TabStrip1.ActiveTabIndex == 0) { if (GridGoods.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=科室排行.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(GridGoods)); Response.End(); btnExp.Enabled = true; } if (TabStrip1.ActiveTabIndex == 1) { if (GridList.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } //Response.ClearContent(); //Response.AddHeader("content-disposition", "attachment; filename=科室明细排行.xls"); //Response.ContentType = "application/excel"; //Response.ContentEncoding = System.Text.Encoding.UTF8; //Response.Write(PubFunc.GridToHtml(GridList)); //Response.End(); //btnExp.Enabled = true; string supidboth = string.IsNullOrEmpty(hdfdeptid.Text) ? ddlDEPTID.SelectedValue : hdfdeptid.Text; string strSql = @" SELECT * FROM (SELECT C.MONTHID 月份, C.DEPTNAME 科室, SUM(C.SUMSL) 消耗数量,ROUND(SUM(C.SLZB)*100,4)||'%' 数量占比,ROUND(SUM(C.SLTB)*100,4)||'%' 数量同比,ROUND(SUM(C.SLHB)*100,4)||'%' 数量环比, SUM(C.HSJE) 消耗金额,ROUND(SUM(C.JEZB)*100,4)||'%' 金额占比,ROUND(SUM(C.JETB)*100,4)||'%' 金额同比,ROUND(SUM(C.JEHB)*100,4)||'%' 金额环比 FROM (SELECT A.RQSJ MONTHID, A.DEPTID, (SELECT NAME FROM SYS_DEPT WHERE CODE = A.DEPTID) DEPTNAME, SUM(A.SL) SUMSL, A.HSJE, ROUND((A.SL / (SELECT SUM(DECODE(AA.BILLTYPE, 'XST', -ABS(AA.SL), 'XSG', ABS(AA.SL), 'XSD', ABS(AA.SL), 'DSH', ABS(AA.SL))) FROM DAT_GOODSJXC AA WHERE AA.RQSJ BETWEEN TO_DATE('{0}', 'YYYY-MM') AND add_months(TO_DATE('{1}', 'YYYY-MM'),1) AND AA.KCADD < 0)), 4) SLZB, ROUND((A.HSJE / (SELECT SUM(DECODE(AA.BILLTYPE, 'XST', -ABS(AA.HSJE), 'XSG', ABS(AA.HSJE), 'XSD', ABS(AA.HSJE), 'DSH', ABS(AA.HSJE))) FROM DAT_GOODSJXC AA WHERE AA.RQSJ BETWEEN TO_DATE('{0}', 'YYYY-MM') AND add_months(TO_DATE('{1}', 'YYYY-MM'),1)AND AA.KCADD < 0)), 4) JEZB, F_GETHB_BYMONTH('DPJEHB', '{0}', '{1}', A.DEPTID, '', '', '', '') JEHB, F_GETHB_BYMONTH('DPJETB', '{0}', '{1}', A.DEPTID, '', '', '', '') JETB, F_GETHB_BYMONTH('DPSLHB', '{0}', '{1}', A.DEPTID, '', '', '', '') SLHB, F_GETHB_BYMONTH('DPSLTB', '{0}', '{1}', A.DEPTID, '', '', '', '') SLTB FROM (SELECT TO_CHAR(A.RQSJ, 'YYYY-MM') RQSJ, A.DEPTID, --A.GDSEQ, SUM(DECODE(A.BILLTYPE, 'XST', -ABS(A.SL), 'XSG', ABS(A.SL), 'XSD', ABS(A.SL), 'DSH', ABS(A.SL))) SL, SUM(DECODE(A.BILLTYPE, 'XST', -ABS(A.HSJE), 'XSG', ABS(A.HSJE), 'XSD', ABS(A.HSJE), 'DSH', ABS(A.HSJE))) HSJE FROM DAT_GOODSJXC A, SYS_DEPT B WHERE A.RQSJ BETWEEN TO_DATE('{0}', 'YYYY-MM') AND add_months(TO_DATE('{1}', 'YYYY-MM'),1) {2} AND A.DEPTID = B.CODE AND A.KCADD < 0 AND A.DEPTID LIKE NVL('{3}', '%') AND BILLTYPE IN ('XST','XSG','XSD','DSH') GROUP BY TO_CHAR(A.RQSJ, 'YYYY-MM'), A.DEPTID) A--, --DOC_GOODS B --WHERE A.GDSEQ = B.GDSEQ GROUP BY A.RQSJ, A.DEPTID, A.HSJE, A.SL) C GROUP BY C.MONTHID, C.DEPTNAME"; string strWhere = ""; string strWhere2 = ""; if (ddlDEPTID.SelectedValue.Length > 1) { strWhere2 += " AND A.DEPTID = '" + ddlDEPTID.SelectedValue + "'"; } if (strWhere.Trim().Length > 0) { strSql = strSql + strWhere; } string sortField = GridList.SortField; string sortDirection = GridList.SortDirection; DataTable dtData = DbHelperOra.QueryForTable(string.Format(strSql, tbxBEGRQ.Text, tbxENDRQ.Text, strWhere2, supidboth) + String.Format(" ORDER BY {0} {1}) WHERE 消耗数量<>0", "消耗金额", sortDirection)); XTBase.Utilities.ExcelHelper.ExportByWeb(dtData, "科室明细排行", "科室明细排行_" + DateTime.Now.ToString("yyyyMMddHH") + ".xls"); btnExpt.Enabled = true; } }
protected void btExport_Click(object sender, EventArgs e) { if (TabStrip1.ActiveTabIndex == 0) { //科室分类 if (GridGoods.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } string strSql = @"select f_getdeptname(A.DEPTID) 科室名称 ,sum(decode(exp_form,'低值易耗',b.hsje,0)) 低值易耗,sum(decode(exp_form,'非收费其他',b.hsje,0)) 非收费其他 ,sum(decode(exp_form,'试剂',b.hsje,0)) 试剂 ,sum(decode(exp_form,'收费其他',b.hsje,0)) 收费其他 ,sum(decode(exp_form,'植入性材料',b.hsje,0)) 植入性材料 ,sum(decode(nvl(exp_form,'#'),'办公用品',b.hsje,'低值易耗',b.hsje,'非收费其他',b.hsje,'收费其他',b.hsje,'植入性材料',b.hsje,'试剂',b.hsje,0)) 合计 from dat_xs_doc a,dat_xs_com b,doc_goods c,(select distinct exp_code,exp_form from temp_goods_his) d where a.seqno = b.seqno and a.flag in('Y','G') and a.SHRQ between to_date('{0}','yyyy-mm-dd') and to_date('{1}','yyyy-mm-dd') and b.gdseq = c.gdseq and c.hiscode = d.exp_code(+)"; string strWhere = ""; if (!PubFunc.StrIsEmpty(ddlDEPTID.SelectedValue)) { strWhere += " and a.deptid = '" + ddlDEPTID.SelectedValue + "'"; } if (strWhere.Trim().Length > 0) { strSql = strSql + strWhere; } strSql += " group by a.deptid order by a.deptid"; DataTable dtBill = new DataTable(); dtBill = DbHelperOra.QueryForTable(string.Format(strSql, dpkDATE1.Text, dpkDATE2.Text)); if (dtBill == null || dtBill.Rows.Count == 0) { Alert.Show("暂时没有符合要求的数据,无法导出", "消息提示", MessageBoxIcon.Warning); return; } XTBase.Utilities.ExcelHelper.ExportByWeb(dtBill, "威海市妇幼保健院医用耗材来源情况汇总表", string.Format("科室分类结算信息_{0}.xls", DateTime.Now.ToString("yyyyMMdd"))); btnExp.Enabled = true; } if (TabStrip1.ActiveTabIndex == 1) { if (Gridlist.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } string strSql = @"select F_GETPARA('SUPPER') 供应商名称,sum(decode(exp_form,'办公用品',b.xssl,0)) 办公用品数量,sum(decode(exp_form,'办公用品',b.hsje,0)) 办公用品 ,sum(decode(exp_form,'低值易耗',b.xssl,0)) 低值易耗数量,sum(decode(exp_form,'低值易耗',b.hsje,0)) 低值易耗 ,sum(decode(exp_form,'非收费其他',b.xssl,0)) 非收费其他数量,sum(decode(exp_form,'非收费其他',b.hsje,0)) 非收费其他 ,sum(decode(exp_form,'试剂',b.xssl,0)) 试剂其他,sum(decode(exp_form,'试剂',b.hsje,0)) 试剂 ,sum(decode(exp_form,'收费其他',b.xssl,0)) 收费其他数量,sum(decode(exp_form,'收费其他',b.hsje,0)) 收费其他 ,sum(decode(exp_form,'植入性材料',b.xssl,0)) 植入性材料数量,sum(decode(exp_form,'植入性材料',b.hsje,0)) 植入性材料 ,sum(decode(nvl(exp_form,'#'),'办公用品',b.xssl,'低值易耗',b.xssl,'非收费其他',b.xssl,'收费其他',b.xssl,'植入性材料',b.xssl,'试剂',b.xssl,0)) 合计数量 ,sum(decode(nvl(exp_form,'#'),'办公用品',b.hsje,'低值易耗',b.hsje,'非收费其他',b.hsje,'收费其他',b.hsje,'植入性材料',b.hsje,'试剂',b.hsje,0)) 合计金额 from dat_xs_doc a,dat_xs_com b,doc_goods c,(select distinct exp_code,exp_form from temp_goods_his) d where a.seqno = b.seqno and a.flag in('Y','G') and a.SHRQ between to_date('{0}','yyyy-mm-dd') and to_date('{1}','yyyy-mm-dd') and b.gdseq = c.gdseq and c.hiscode = d.exp_code(+)"; DataTable dtBill = new DataTable(); dtBill = DbHelperOra.QueryForTable(string.Format(strSql, dpkTIME1.Text, dpkTIME2.Text)); if (dtBill == null || dtBill.Rows.Count == 0) { Alert.Show("暂时没有符合要求的数据,无法导出", "消息提示", MessageBoxIcon.Warning); return; } XTBase.Utilities.ExcelHelper.ExportByWeb(dtBill, "威海市妇幼保健院医用耗材来源情况汇总表", string.Format("供应商消耗商品金额汇总_{0}.xls", DateTime.Now.ToString("yyyyMMdd"))); //Response.ClearContent(); //Response.AddHeader("content-disposition", "attachment; filename=供应商消耗商品金额汇总.xls"); //Response.ContentType = "application/excel"; //Response.ContentEncoding = System.Text.Encoding.UTF8; //Response.Write(PubFunc.GridToHtml(Gridlist)); //Response.End(); BtnEpt.Enabled = true; } if (TabStrip1.ActiveTabIndex == 2) { if (Gridlist2.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } string strSql = @"select F_GETPARA('SUPPER') 供应商名称,sum(hsje) 合计金额,sum(decode(a.billtype,'DSH',b.bzhl,b.xssl)) 合计数量 from dat_xs_doc a,dat_xs_com b where a.seqno = b.seqno and a.flag in('Y','G') and a.SHRQ between to_date('{0}','yyyy-mm-dd') and to_date('{1}','yyyy-mm-dd')"; DataTable dtBill = new DataTable(); dtBill = DbHelperOra.QueryForTable(string.Format(strSql, dpkdata1.Text, dpkdata2.Text)); if (dtBill == null || dtBill.Rows.Count == 0) { Alert.Show("暂时没有符合要求的数据,无法导出", "消息提示", MessageBoxIcon.Warning); return; } XTBase.Utilities.ExcelHelper.ExportByWeb(dtBill, "威海市妇幼保健院医用耗材来源情况汇总表", string.Format("供应商消耗商品金额汇总_{0}.xls", DateTime.Now.ToString("yyyyMMdd"))); //Response.ClearContent(); //Response.AddHeader("content-disposition", "attachment; filename=供应商消耗商品金额汇总.xls"); //Response.ContentType = "application/excel"; //Response.ContentEncoding = System.Text.Encoding.UTF8; //Response.Write(PubFunc.GridToHtml(Gridlist2)); //Response.End(); btnexl.Enabled = true; } if (TabStrip1.ActiveTabIndex == 3) { if (Grdlist.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=单品入库明细.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(Grdlist)); Response.End(); btnexl.Enabled = true; } if (TabStrip1.ActiveTabIndex == 4) { if (Gridlist4.Rows.Count < 1) { Alert.Show("没有数据,无法导出!"); return; } Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=单品入库汇总.xls"); Response.ContentType = "application/excel"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.Write(PubFunc.GridToHtml(Gridlist4)); Response.End(); btnexl.Enabled = true; } }