预览 打印

1.常规查询界面(shfit多选):

private void Print(string printOrpreview)
{

    int[] rows = this.gridviewpurpay.GetSelectedRows();
            if (rows.Length <= 0)
            {
                MessageBox.Show("请选中需要打印的内容!", "提示");
                return;
            }
            string mainid = "";
            for (int i = 0; i < rows.Length; i++)
            {
                mainid += "'" + gridviewpurpay.GetRowCellValue(i, "mainid") + "',";
            }
            if (!string.IsNullOrEmpty(mainid))
            {
                mainid = mainid.Substring(0, mainid.Length - 1);
            }
            string fupage = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName;//功能页面
            string buttonname = printOrpreview == "preview" ? buttonname = this.BtnPreview.Text.ToString() : this.BtnPrint.Text.ToString();//预览还是打印按钮
            int printorpreview = printOrpreview == "preview" ? 0 : 1;//预览还是打印
            DataTable dtFR = CRMPrintDA.GetFormPrintSetPrintFile(fupage, buttonname);//获取打印xml
            string sqlcondition = " and ep_receivablespaymentBase.ep_receivablespaymentId in (" + mainid + ") ";
            DataSet dtCodeList = CRMPrintDA.GetReportDataSet(dtFR, fupage, buttonname, sqlcondition, 1, 0);//获取数据集
            CRMPrintDA.showPrint(dtFR, dtCodeList, FReport, printorpreview);//预览还是打印
}

 

2.信息页面

        private void Print(string printOrpreview)
        {
            string fupage = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName;//功能页面
            string buttonname = printOrpreview == "preview" ? buttonname = this.BtnPreview.Text.ToString() : this.BtnPrint.Text.ToString();//预览还是打印按钮
            int printorpreview = printOrpreview == "preview" ? 0 : 1;//预览还是打印
            string mainid = id;
            if (string.IsNullOrEmpty(mainid))
            {
                MessageBox.Show("获取信息失败!", "提示");
                return;
            }
            DataTable dtFR = CRMPrintDA.GetFormPrintSetPrintFile(fupage, buttonname);//获取xml文件
            string sqlcondition = " and ep_receivablespaymentBase.ep_receivablespaymentId ='" + mainid + "'";
            DataSet dtCodeList = CRMPrintDA.GetReportDataSet(dtFR, fupage, buttonname, sqlcondition, 1, 0);//获取数据集 
            CRMPrintDA.showPrint(dtFR, dtCodeList, FReport, printorpreview);//预览还是打印
        }

 

posted on 2020-12-30 14:07  RookieBoy666  阅读(127)  评论(0编辑  收藏  举报