public void BindReport(string _invno,string _type)         {             if (!Is_Has_Express_No(_invno))             {                 return;             }             StringBuilder sb = new StringBuilder();             sb.Append(" select tt.ardt_jobno,tt.ardt_prodcode,tt.ardt_desc,tt.ardt_qty, ");             sb.Append(" tt.ardt_unit,tt.ardt_uprice,tt.isumprice,tt.Custcaseno,tt.docinfo,pmct_desc,tt.sType, ");             sb.Append(" decode(tt.sType,'P',isumprice,'')  pSumprice, ");             sb.Append("  decode(tt.sType,'M',isumprice,'')  mSumprice, ");             sb.Append(" decode(tt.jobm_redo_yn,'1','REMAKE','') jobm_redo_yn,arhr_invno,arhr_date,arhr_acctid,arhr_remark,acct_tel,acct_addr0,acct_addr, ");             sb.Append(" acct_addr_2,acct_addr_3,acct_addr_4,acct_invoice_remark ");             sb.Append("  from  ( ");             sb.Append(" select idt.ardt_jobno,idt.ardt_prodcode,idt.ardt_desc,idt.ardt_qty, ");             sb.Append("  decode(idt.ardt_unit,'排','SET','粒','UNIT','','UNIT',idt.ardt_unit) ardt_unit, ");             sb.Append("  idt.ardt_uprice, idt.ardt_qty * idt.ardt_uprice isumprice, ");             sb.Append("  (select distinct jo.jobm_custcaseno  from  job_product jp,job_order jo  where  ");             sb.Append(" jp.jobm_no = jo.jobm_no and jo.jobm_no =idt.ardt_jobno ) Custcaseno, ");

if (_type == "USD")             {                 sb.Append(" (select distinct  nvl(jo1.jobm_docinfo_1,jo1.jobm_docinfo_2) || '(' || jp1.jobm_no || ')'  from  job_product jp1,job_order jo1  where ");             }             else             {                 sb.Append(" (select distinct  '(' || jp1.jobm_no || ')'  from  job_product jp1,job_order jo1  where ");             }             sb.Append("  jp1.jobm_no = jo1.jobm_no and jo1.jobm_no =idt.ardt_jobno ) docinfo,  ");             sb.Append(" (select distinct pm.pmct_desc from product prx,product_category pc,product_category_major pm ");             sb.Append(" where pm.pmct_code = pc.pmct_code and pc.pcat_code = prx.pcat_code and prx.prod_code = idt.ardt_prodcode) pmct_desc,  ");             sb.Append(" (select distinct pro.prod_pro_mat from product pro where  pro.prod_code =  idt.ardt_prodcode)  sType, ");             sb.Append(" (select  jo2.jobm_redo_yn from job_order jo2 where jo2.jobm_no =idt.ardt_jobno ) jobm_redo_yn, ");             sb.Append(" i.arhr_invno, i.arhr_date, i.arhr_acctid, ");             sb.Append(" i.arhr_remark, decode(ac.acct_name_eng,'',ac.acct_name,ac.acct_name_eng) acct_addr0, ");             sb.Append(" decode(ac.acct_tel,'','','Tel: ' || ac.acct_tel)  acct_tel,");             sb.Append(" ac.acct_addr,  ");             sb.Append(" ac.acct_addr_2, ");             sb.Append(" ac.acct_addr_3,  ");             sb.Append(" ac.acct_addr_4, ac.acct_invoice_remark  from invoice_dtl idt ,invoice i,account ac  ");             sb.Append(" where idt.arhr_invno = '11003017'  ");   //A1515010   A1515310     11003017             sb.Append(" and i.arhr_invno = idt.arhr_invno and ac.acct_id = i.arhr_acctid  ");             sb.Append(" ) tt  order by tt.Custcaseno,tt.ardt_prodcode  ");             sb.Append("  ");

DataSet ds_com = DB.GetDSFromSql(sb.ToString());             //创建临时表分组             DataTable dtGroup = new DataTable();             DataColumn column = new DataColumn();             column.DataType = System.Type.GetType("System.Int32");             column.ColumnName = "GId";             dtGroup.Columns.Add(column);                         column = new DataColumn();             column.DataType = System.Type.GetType("System.Int32");             column.ColumnName = "GId";             ds_com.Tables[0].Columns.Add(column);               column = new DataColumn();             column.DataType = System.Type.GetType("System.String");             column.ColumnName = "Custcaseno";             dtGroup.Columns.Add(column);             column = new DataColumn();             column.DataType = System.Type.GetType("System.String");             column.ColumnName = "pmct_desc";             dtGroup.Columns.Add(column);                         DataTable dtDisView = ds_com.Tables[0].DefaultView.ToTable(true, "Custcaseno");                        DataRow dr = dtGroup.NewRow();

if (dtDisView.Rows.Count > 0)             {                 for (int k = 0; k < dtDisView.Rows.Count; k++)                 {                     dr = dtGroup.NewRow();                     dr["GId"] = k + 1;                     dr["Custcaseno"] = dtDisView.Rows[k]["Custcaseno"].ToString();                                        dtGroup.Rows.Add(dr);                                }             }

if (dtGroup.Rows.Count > 0)             {                 for (int n = 0; n < dtGroup.Rows.Count; n++)                 {                     for (int l = 0; l < ds_com.Tables[0].Rows.Count; l++)                     {                         if (ds_com.Tables[0].Rows[l]["Custcaseno"].ToString() == dtGroup.Rows[n]["Custcaseno"].ToString())                         {                             dtGroup.Rows[n]["pmct_desc"] = ds_com.Tables[0].Rows[l]["pmct_desc"].ToString();                             break;                         }

}                 }              }

double _fdaValue = 0;             double _nFdaValue = 0;             double _totalPrice = 0;

if (ds_com.Tables[0].Rows.Count > 0)             {                 for (int i = 0; i < ds_com.Tables[0].Rows.Count; i++)                 {

_fdaValue = _fdaValue + double.Parse(ds_com.Tables[0].Rows[i]["pSumprice"].ToString()==""?"0":ds_com.Tables[0].Rows[i]["pSumprice"].ToString());                     _nFdaValue = _nFdaValue + double.Parse(ds_com.Tables[0].Rows[i]["mSumprice"].ToString() == "" ? "0" : ds_com.Tables[0].Rows[i]["mSumprice"].ToString());                     _totalPrice = _totalPrice + double.Parse(ds_com.Tables[0].Rows[i]["isumprice"].ToString() == "" ? "0" : ds_com.Tables[0].Rows[i]["isumprice"].ToString());

//将汇总的值统一                     if (dtGroup.Rows.Count > 0)                     {                         for (int j = 0; j < dtGroup.Rows.Count; j++)                         {                             if (ds_com.Tables[0].Rows[i]["Custcaseno"].ToString() == dtGroup.Rows[j]["Custcaseno"].ToString())                             {                                 ds_com.Tables[0].Rows[i]["pmct_desc"] = dtGroup.Rows[j]["pmct_desc"].ToString();                                 ds_com.Tables[0].Rows[i]["GId"] = dtGroup.Rows[j]["GId"].ToString();                             }                                                 }                      }                 }             }                         if (ds_com.Tables[0].Rows.Count < 1)             {                 MessageBox.Show("没有相关报表信息!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);             }             else             {                               string fdaWord = string.Empty;                               DataTable dtDisHearder = ds_com.Tables[0].DefaultView.ToTable(true, "GId", "Custcaseno", "docinfo", "pmct_desc");                 //查询含多个发票号码

if (_type == "USD")                 {                     this.reportViewer1.LocalReport.ReportPath = "Rpt_Invoice_USD.rdlc";                 }                 else if (_type == "EUR")                 {                     this.reportViewer1.LocalReport.ReportPath = "Rpt_Invoice_EUR.rdlc";                 }                 else                 {                     this.reportViewer1.LocalReport.ReportPath = "Rpt_Invoice_hk.rdlc";                 }

//重新排序 ardt_prodcode

//this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dtDistinct));                 this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", ds_com.Tables[0]));                 this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dtDisHearder));                 this.reportViewer1.LocalReport.SubreportProcessing += (s1, e1) => {                     e1.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", ds_com.Tables[0]));                 };                 ReportParameter rp = new ReportParameter("logUser", DB.loginUserName);                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });

//FDA值                 rp = new ReportParameter("fdaValue", _fdaValue.ToString());                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });                 //非FDA值

rp = new ReportParameter("nFdaValue", _nFdaValue.ToString());                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });

//this.reportViewer1.LocalReport

string sqladd = " select t.udc_extend01,t.udc_extend02,t.udc_extend03  from zt00_udc_udcode t where t.udc_sys_code = 'MDLCRM' and t.udc_category = 'SO' and t.udc_key = 'ENTITY' and t.udc_value = 'MDIL澳门'  order by udc_key ";                 DataTable dtaddr = DB.GetDSFromSql(sqladd).Tables[0];                 string strSignor = string.Empty;                 string strFooter = string.Empty;                 string strRemark = string.Empty;

if (dtaddr.Rows.Count > 0)                 {                     strSignor = dtaddr.Rows[0]["udc_extend02"].ToString();                     strFooter = dtaddr.Rows[0]["udc_extend01"].ToString();                     strRemark = dtaddr.Rows[0]["udc_extend03"].ToString();                                }                 rp = new ReportParameter("add_signor", strSignor);                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });                 rp = new ReportParameter("addr_footer", strFooter);                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });                 rp = new ReportParameter("addr_remark", strRemark);                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });                                           rp = new ReportParameter("totalValue", _totalPrice.ToString());                 this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });                 this.reportViewer1.RefreshReport();                                                      }         }

winform 子报表的更多相关文章

  1. winform 子报表数据源赋值

    this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource(&qu ...

  2. RDLC 子报表

    1.RDLC 设计页面,拖入table或者矩形 2.右击表格或者矩形单元格,插入--子报表 3.输入名称和将此报表用作子报表 名称:显示在设计页面上的,仅作观看作用 将此报表用作子报表:填写目录下的需 ...

  3. RDLC系列之二 子报表

    本文实现简单的子报表 一.效果图

  4. Reporting Services 钻取报表、子报表

    一.钻取报表 1.概念 钻取报表是指用户通过单击其他报表中的链接打开的报表.钻取报表通常包含某原始汇总报表中所包含的某项的详细信息. 例如,在此图中,销售额汇总报表列出了销售订单和总额.当用户单击该汇 ...

  5. iReport 4.1 报表制作,子报表,实例解析

    开发使用步骤(iReport 4.1.1) (个人总结,如有问题请留言,另外知道table控件用法的给我留言或者发邮件谢谢.Email:jiazx0107@163.com) 目录 1.      开发 ...

  6. ReportView动态加载带参数的RDCL文件及子报表

    本文来自Torres.Wu发表在博客园的博客,转载请标明出处. 同上一篇差不多,这次咱们加载带有子报表的RDCl文件.首先还是创建一个form程序,在form2窗体中添加一个ReporView控件,l ...

  7. UniGui中使用Grid++Report报表控件子报表获取数据的方法

    Grid++Report是为优秀的报表控件,子报表是其重要功能之一,但Grid++Report提供的网页报表示范主要是以页面为主的,UniGui在Delphi中以快速编写web管理软件著称,但由于资料 ...

  8. JasperReport子报表参数传递

    子报表参数传递 下图的参数名称可以自定义 再子报表新增一个同名称的参数即可

  9. ActiveReports 报表控件V12新特性 -- 页面报表新增子报表

    ActiveReports是一款专注于 .NET 平台的报表控件,全面满足 HTML5 / WinForms / ASP.NET / ASP.NET MVC / WPF 等平台下报表设计和开发工作需求 ...

随机推荐

  1. Hibernate一对一双向关联(注解)

    每一个人(Person)对应一个身份证号(IdCard) package cqvie.yjq.domain; import java.util.Date; import javax.persisten ...

  2. JavaScript 详说事件机制之冒泡、捕获、传播、委托

    DOM事件流(event  flow )存在三个阶段:事件捕获阶段.处于目标阶段.事件冒泡阶段. 事件捕获(event  capturing):通俗的理解就是,当鼠标点击或者触发dom事件时,浏览器会 ...

  3. mysql通过data文件恢复数据库的方式

    1.首先定位mysql的my.ini配置文件,查找datadir的位置 #Path to the database rootdatadir="C:/ProgramData/MySQL/MyS ...

  4. ngRoute插件

    angular中可以使用插件,例如ngRoute插件就是用与路由控制. 首先要在模块中引入即可: var m1 = angular.module('myApp',['ngRoute']); 然后我们进 ...

  5. OpenCV linux cmake添加使用

    安装好opencv之后: 只需要添加一下,就可以方便的使用opencv了,find_package opencv 会寻找FindOpenCV.cmake find_package(OpenCV REQ ...

  6. SparkContext的初始化(季篇)——测量系统、ContextCleaner及环境更新

    <深入理解Spark:核心思想与源码分析>一书前言的内容请看链接<深入理解SPARK:核心思想与源码分析>一书正式出版上市 <深入理解Spark:核心思想与源码分析> ...

  7. WPFUIElement的Background的问题

    <Border Name="> <Border.Background> <VisualBrush> <VisualBrush.Visual> ...

  8. nio 弊端

    java-nio在Android上使用的种种弊端 August 12, 2013programming 我们知道,手机上的网络一般会比较慢(使用wifi除外),用户非常不希望自己在使用手机时被考验耐心 ...

  9. iOS NSDate与NSString相互转化

    1.时间格式的字符串转date NSString *birthdayStr=@"1986-03-28 00:00:00.000"; NSDateFormatter *dateFor ...

  10. IE事件模型,如何给IE和非IE浏览器添加事件

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <title> ...