Esempio n. 1
0
        private void tsbPrint_Click(object sender, EventArgs e)
        {
            bsOrders.EndEdit();
            dgvOrders.EndEdit();
            if (orderList.Count == 0)
            {
                MessageBox.Show("Не выбраны заказы для печати накладной", "Нет заказов для печати", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BindingList <OrderEntity> orderListForPrint = new BindingList <OrderEntity>();

            foreach (OrderEntity order in orderList)
            {
                orderListForPrint.Add(order);
            }

            while (orderListForPrint.Count < ROW_COUNT_IN_REPORT)
            {
                orderListForPrint.Add(new OrderEntity());
            }

            DataSetEntity ds = new DataSetEntity();

            ds.EntityList = orderListForPrint;
            ds.DocDate    = dtpOrderDate.Value;
            ds.DocNumber  = tbDocsNumber.Text;

            Form frmReport = new frmReportViewer(ds);

            frmReport.Show();
        }
Esempio n. 2
0
        public frmReportViewer(DataSetEntity ds)
        {
            InitializeComponent();

            bsDataSetEntity.DataSource = ds;
            bsOrderEntity.DataSource   = ds.EntityList;

            ReportParameter[] parameters = new ReportParameter[1];
            parameters[0] = new ReportParameter("employee", Settings.Default.employee);
            this.reportViewer1.LocalReport.SetParameters(parameters);

            if (ds.EntityList[0].OrderNumber.StartsWith("23-") || ds.EntityList[0].OrderNumber.StartsWith("24"))
            {
                reportViewer1.LocalReport.ReportEmbeddedResource = "Nacladnaya.Nacladnaya-23.rdlc";
            }
            else
            {
                reportViewer1.LocalReport.ReportEmbeddedResource = "Nacladnaya.Nacladnaya.rdlc";
            }
        }