示例#1
0
        private void btnPrintReport_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("确定要进行套打吗?这样占用较多时间,请不要关闭窗口", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (selection1.SelectedCount == 0)
                {
                    MessageBox.Show("请先选择需要打印报表的采购结算单");
                }
                else
                {
                    try
                    {
                        for (int i = 0; i < selection1.SelectedCount; ++i)
                        {
                            int RowIndex = selection1.GetSelectedRowIndex(i);
                            int RowHandle = gridView1.GetRowHandle(RowIndex);
                            string strXSTSDID = gridView1.GetRowCellValue(RowHandle, colXSTSDID).ToString();
                            XtraReportXSTSDjt report = new XtraReportXSTSDjt(strXSTSDID);
                            report.Print();
                            System.Threading.Thread.Sleep(1000);
                            report.Dispose();
                        }

                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                }
            }
        }
示例#2
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            bool fgCheck = false;
            if (selection1.SelectedCount == 0)
            {

                fgCheck = false;
                MessageBox.Show("请先选择需要预览的采购结算单");
            }
            else if (selection1.SelectedCount != 1)
            {
                fgCheck = false;
                MessageBox.Show("每次只能预览一张采购结算单");
            }
            else
            {
                fgCheck = true;

            }
            if (fgCheck == true)
            {
                int RowIndex = selection1.GetSelectedRowIndex(0);
                int RowHandle = gridView1.GetRowHandle(RowIndex);
                string strXSTSDID = gridView1.GetRowCellValue(RowHandle, colXSTSDID).ToString();
                XtraReportXSTSDjt report = new XtraReportXSTSDjt(strXSTSDID);
                report.ShowPreviewDialog();

            }
        }