private void btnCusName_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtCus.Text)) { SaleByCusReport objSale = new SaleByCusReport(); rptViewer objView = new rptViewer(); objSale.SetParameterValue("@CusID", txtCus.Text); SaleInvoiceBL objsal = new SaleInvoiceBL() { CustomerID = Convert.ToInt32(txtCus.Text) }; DataTable dt = objsal.SelectByCus(); if (dt.Rows.Count > 0) { objSale.SetDataSource(dt); // btnCusprint.Visible = true; objView.crptViewer.ReportSource = objSale; objView.WindowState = FormWindowState.Maximized; objView.ShowDialog(); txtCus.Clear(); } else { MessageBox.Show("No Record Found"); } } else if (!String.IsNullOrEmpty(txtinvoiceNo.Text)) { saleInvoiceReport objSale = new saleInvoiceReport(); rptViewer objView = new rptViewer(); objSale.SetParameterValue("@InvoiceNo", txtinvoiceNo.Text); SaleInvoiceBL obj = new SaleInvoiceBL() { InvoiceNo = Convert.ToInt32(txtinvoiceNo.Text) }; DataTable dt = obj.Search(); if (dt.Rows.Count > 0) { objSale.SetDataSource(dt); objView.crptViewer.ReportSource = objSale; objView.WindowState = FormWindowState.Maximized; objView.ShowDialog(); txtinvoiceNo.Clear(); } //crptViewerSale.ReportSource = objSale; else { MessageBox.Show("No Record Found"); } } else { MessageBox.Show("Please Enter Customer ID OR Return Invoice"); } }
private void btnPrint_Click(object sender, EventArgs e) { if (isReport1) { SaleGeneralReport objrep = new SaleGeneralReport(); rptViewer objview = new rptViewer(); //objSale.SetDataSource =; objrep.SetParameterValue("@mindate", txtMinDate.Value); objrep.SetParameterValue("@maxdate", txtmaxdate.Value); objview.crptViewer.ReportSource = objrep; objview.WindowState = FormWindowState.Normal; objview.ShowDialog(); } else { SaleByCusReport objSale = new SaleByCusReport(); rptViewer objView = new rptViewer(); objSale.SetParameterValue("@CusName", txtCusnam.Text); objView.crptViewer.ReportSource = objSale; objView.WindowState = FormWindowState.Normal; objView.ShowDialog(); } }