预览打印

 

  Print("preview");

 

查询页面:

        private void Print(string printOrpreview)
        {
            DevExpress.XtraGrid.Views.Grid.GridView gridview = this.HwInInvGridView;
            int[] rows = gridview.GetSelectedRows();
            if (rows.Length <= 0)
            {
                MessageBox.Show("请选中需要打印的内容!", "提示");
                return;
            }
            string mainid = "";
            for (int i = 0; i < rows.Length; i++)
            {
                mainid += "'" + gridview.GetRowCellValue(rows[i], "mainid") + "',";
            }
            if (!string.IsNullOrEmpty(mainid))
            {
                mainid = mainid.Substring(0, mainid.Length - 1);
            }
            //此处 主单id和物料编号共同确定一条选择的的数据
            string sqlcondition = " and ep_FinishedGoodsStockInBase.ep_FinishedGoodsStockInId in (" + mainid + ")";
            #region 预览打印
            string isqueraydata = "1";//是否查数据
            string iswritelog = "0";//是否写入日志
            string fupage = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName;//功能页面
            string buttonname = printOrpreview == "preview" ? buttonname = this.BtnPreview.Text.ToString() : this.BtnPrint.Text.ToString();//预览还是打印按钮
            FormPrintSetUtils.GetDataAndPrint(fupage, buttonname, sqlcondition, isqueraydata, iswritelog, FReport, printOrpreview);//数据集获取,预览还是打印
            #endregion
        }
View Code

 

 

信息页面:

  private void Print(string printOrpreview)
        {
            string mainid = id;
            if (string.IsNullOrEmpty(mainid))
            {
                MessageBox.Show("获取信息失败!", "提示");
                return;
            }
            #region 预览打印
            string sqlcondition = " and ep_hwwarehouseformBase .ep_hwwarehouseformId ='" + mainid + "'";
            string buttonname = printOrpreview == "preview" ? this.BtnPreview.Text.ToString() : this.BtnPrint.Text.ToString();//按钮名
            string fupage = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName;//功能页面
            string isqueraydata = "1";//是否查数据
            string iswritelog = "0";//是否写入日志
            FormPrintSetUtils.GetDataAndPrint(fupage, buttonname, sqlcondition, isqueraydata, iswritelog, FReport, printOrpreview);//数据集获取,预览还是打印
            #endregion
        }
View Code

 

posted on 2021-05-19 14:17  RookieBoy666  阅读(47)  评论(0编辑  收藏  举报