private void btn_print_Click(object sender, EventArgs e) { try { frm_reportViwer rpt = new frm_reportViwer(); rpt.MdiParent = MDI_SMartAnything.ActiveForm; rpt = ReportStrings.PrintDoc("CUSTOMER LIABILITY"); rpt_cusliability rptBank = new rpt_cusliability(); if (rdo_fulldetails.Checked) // option 1 full view of order tracking { rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCusLiabilityDet("", false, "", dtfrom.Value, dtto.Value, 1, 1))); } if (rdo_CusRange.Checked) // option 1 full view of order tracking { if (txt_customer1.Text.Trim() == "") { commonFunctions.SetMDIStatusMessage("Please enter customer first", 1); errorProvider1.SetError(txt_customer1, "Please enter customer first"); return; } if (txt_customer2.Text.Trim() == "") { commonFunctions.SetMDIStatusMessage("Please enter customer first", 1); errorProvider1.SetError(txt_customer2, "Please enter customer first"); return; } rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCusLiabilityDet(txt_customer1.Text, false, txt_customer2.Text, dtfrom.Value, dtto.Value, 1, 2))); } if (rdo_cat.Checked) // option 1 full view of order tracking { string subcat = ""; int header = 3; if (txt_Category.Text.Trim() == "") { commonFunctions.SetMDIStatusMessage("Please enter customer category first", 1); errorProvider1.SetError(txt_Category, "Please enter customer category first"); return; } if (rdo_subcat.Checked) { if (txt_subcat.Text.Trim() == "") { commonFunctions.SetMDIStatusMessage("Please enter customer subcategory first", 1); errorProvider1.SetError(txt_subcat, "Please enter customer subcategory first"); return; } subcat = txt_subcat.Text.Trim(); header = 4; } rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCusLiabilityDet(txt_customer1.Text, false, txt_customer2.Text, dtfrom.Value, dtto.Value, 1, header))); } if (rdo_salesman.Checked) // option 1 full view of order tracking { if (txt_salesman.Text.Trim() == "") { commonFunctions.SetMDIStatusMessage("Please enter salesman first", 1); errorProvider1.SetError(txt_Category, "Please enter salesman first"); return; } rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCusLiabilityDet(txt_customer1.Text, false, txt_customer2.Text, dtfrom.Value, dtto.Value, 1, 5))); } rpt.RepViewer.ReportSource = rptBank; rpt.RepViewer.Refresh(); rpt.Show(); } catch (Exception ex) { } }