public void VerRptInvoice(List <ReporteInvoiceBE> lstReporte) { rptInvoice objReporte = new rptInvoice(); objReporte.SetDataSource(lstReporte); this.crystalReportViewer1.ReportSource = objReporte; }
private void GenerateInvoiceReport(CSOMaster oSOMaster) { POS posdateset = new POS(); DataTable dtInv = posdateset.Invoice; foreach (CSODetails oSODetails in oSOMaster.SOMstr_DetailsList) { DataRow drInv = dtInv.NewRow(); drInv["BranchName"] = currentBranch.CompBrn_Name; drInv["Address"] = currentBranch.CompBrn_Street; drInv["RoadNo"] = currentBranch.CompBrn_Road; drInv["City"] = currentBranch.CompBrn_City; drInv["Phone"] = currentBranch.CompBrn_Phone; drInv["InvoiceNo"] = oSOMaster.SOMstr_Code; drInv["VatClnNo"] = oSOMaster.SOMstr_VatClnNo; drInv["ItemName"] = oSODetails.SODet_ItemName; drInv["Qty"] = oSODetails.SODet_QTY; drInv["Price"] = oSODetails.SODet_Price; drInv["Amount"] = oSODetails.SODet_Amount; drInv["Discount"] = oSODetails.SODet_Discount; drInv["VATValue"] = oSODetails.SODet_VATValue; dtInv.Rows.Add(drInv); } rptInvoice objrptInvoice = new rptInvoice(); objrptInvoice.SetDataSource(dtInv); objrptInvoice.SetParameterValue(0, float.Parse(txtDiscountAmount.Text.Trim())); objrptInvoice.SetParameterValue(1, currentUser.User_UserName.Trim()); objrptInvoice.SetParameterValue(2, txtCustomerPaid.Text.Trim()); objrptInvoice.SetParameterValue(3, txtChange.Text.Trim()); if (InvoiceRawKind == 0) { PrintDocument pd = new PrintDocument(); pd.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("POS", 4, 4); InvoiceRawKind = (int)pd.PrinterSettings.DefaultPageSettings.PaperSize.RawKind; } objrptInvoice.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)InvoiceRawKind; objrptInvoice.PrintToPrinter(1, true, 1, 1); frmReportView ofrmReportView = new frmReportView(); CrystalReportViewer orptviewer = (CrystalReportViewer)ofrmReportView.Controls["rptviewer"]; orptviewer.ReportSource = objrptInvoice; orptviewer.AutoSize = false; orptviewer.Show(); ofrmReportView.Show(); }