private void btnPrint_Click(object sender, EventArgs e) { BillReport print = new BillReport(); print.Bill_No = Convert.ToInt16(lblBillNo.Text); print.partyName = cmbCustName.Text.ToString(); print.date = Convert.ToString(lblDate.Text); print.paymentType = cmbPaymentType.Text.ToString(); List<Product> product = new List<Product>(); foreach (DataGridViewRow row in dataGridView1.Rows) { Product p = new Product(); p.srno = Convert.ToInt16(row.Cells["SrNo"].Value); p.Item = Convert.ToString(row.Cells["produtlist"].FormattedValue); p.MRP = Convert.ToSingle(row.Cells["ColMRP"].Value); p.qty = Convert.ToInt16(row.Cells["ColQTY"].Value); p.Rate = Convert.ToSingle(row.Cells["ColRate"].Value); p.Scheme = Convert.ToSingle(row.Cells["txtScheme"].Value); p.Amt = Convert.ToSingle(row.Cells["ColTotal"].Value); product.Add(p); // p.Item = row.Cells["Item"].Value.ToString(); } print.productList = product; EstimatePrintBill bill = new EstimatePrintBill(print); bill.rpt = print; bill.Show(); }
public EstimatePrintBill(BillReport report) : this() { rpt = report; float amt = 0; foreach (Product p in report.productList) { amt += p.Amt; } txtAmt.Text = amt.ToString(); txtTotalAmt.Text = amt.ToString(); }
public FinalPrint(BillReport obj) : this() { objReport = obj; reportViewer1.LocalReport.DataSources.Clear(); //clear report reportViewer1.LocalReport.ReportEmbeddedResource = "BookStore.Report1.rdlc"; // bind reportviewer with .rdlc List<BillReport> lstBillReport = new List<BillReport>(); lstBillReport.Add(objReport); Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", lstBillReport); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); // dataset.Value = list; Microsoft.Reporting.WinForms.ReportDataSource dataset1 = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", objReport.productList); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset1); // dataset1.Value = list; reportViewer1.LocalReport.Refresh(); reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport(); }