private void showButton_Click(object sender, EventArgs e) { // add for Get date DateTime fromdate = fromdateTimePicker.Value; DateTime todate = todateTimePicker.Value; todate = todate.AddDays(1); fromdate = fromdate.Date; todate = todate.Date; todate = todate.AddSeconds(-1); List<SupplierPaymentReport> aSupplierPaymentReports=new List<SupplierPaymentReport>(); SupplierPaymentReportBLL aPaymentReportBll=new SupplierPaymentReportBLL(); aSupplierPaymentReports = aPaymentReportBll.GetSupplierPaymentReportBetweenDate(fromdate,todate); // supplierdatapaymentGridView.DataSource = aSupplierPaymentReports; ShowReport(aSupplierPaymentReports); }
private void printRawmaterialsReportbutton_Click(object sender, EventArgs e) { SupplierPaymentReportBLL aPaymentReportBll = new SupplierPaymentReportBLL(); List<SupplierPaymentReport> aPaymentReports = new List<SupplierPaymentReport>(); aPaymentReports = (List<SupplierPaymentReport>)supplierdatapaymentGridView.DataSource; if (aPaymentReports == null) { MessageBox.Show("No data Available Into GridView"); return; } int printlenght = aPaymentReports.Count; PrintDocument doc = new TextDocument(aPaymentReportBll.SupplierPaymentReportPrint(aPaymentReports), printlenght); //ViewReport aReport = new ViewReport(); printReportLogoType = 1; doc.PrintPage += this.Doc_PrintPage; doc.DefaultPageSettings.Landscape = true; PrintDialog dlgSettings = new PrintDialog(); dlgSettings.Document = doc; dlgSettings.UseEXDialog = true; if (dlgSettings.ShowDialog() == DialogResult.OK) { doc.Print(); } }