private void btn_print_Click(object sender, EventArgs e)
        {
            try
            {
                frm_reportViwer rpt = new frm_reportViwer();
                rpt.MdiParent = MDI_SMartAnything.ActiveForm;

                if (rdo_fulldet.Checked)
                {
                    if (rdo_orderform.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Order Forms");
                        rpt_pendingOF rptBank = new rpt_pendingOF();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalOF(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 4)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                    if (rdo_invoice.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Invoices");
                        rpt_pendingInvoice rptBank = new rpt_pendingInvoice();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalInvoices(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 4)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                    if (rdo_DO.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Dilivery Orders");
                        rpt_penddingDos rptBank = new rpt_penddingDos();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovaldos(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 4)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                }


                if (rdo_supp.Checked)
                {
                    if (txt_Suplier.Text.Trim() == "")
                    {
                        commonFunctions.SetMDIStatusMessage("Please enter supplier first", 1);
                        errorProvider1.SetError(txt_Category, "Please enter supplier first");
                        return;
                    }
                    if (rdo_orderform.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Order Forms");
                        rpt_pendingOF rptBank = new rpt_pendingOF();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalOF(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 1)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                    if (rdo_invoice.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Invoices");
                        rpt_pendingInvoice rptBank = new rpt_pendingInvoice();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalInvoices(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 1)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                    if (rdo_DO.Checked)
                    {
                        rpt = ReportStrings.PrintDoc("PENDING Dilivery Orders");
                        rpt_penddingDos rptBank = new rpt_penddingDos();
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovaldos(txt_Suplier.Text.Trim(), "", dtfrom.Value, dtto.Value, 1)));
                        rpt.RepViewer.ReportSource = rptBank;
                    }
                }

                if (rdo_cat.Checked)
                {
                    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) //with subcategory
                    {
                        if (rdo_orderform.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Order Forms");
                            rpt_pendingOF rptBank = new rpt_pendingOF();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalOF(txt_Category.Text.Trim(), "", dtfrom.Value, dtto.Value, 2)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                        if (rdo_invoice.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Invoices");
                            rpt_pendingInvoice rptBank = new rpt_pendingInvoice();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalInvoices(txt_Category.Text.Trim(), "", dtfrom.Value, dtto.Value, 2)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                        if (rdo_DO.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Dilivery Orders");
                            rpt_penddingDos rptBank = new rpt_penddingDos();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovaldos(txt_Category.Text.Trim(), "", dtfrom.Value, dtto.Value, 2)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                    }
                    else
                    { //with no subcategory
                        if (txt_subcat.Text.Trim() == "")
                        {
                            commonFunctions.SetMDIStatusMessage("Please enter customer subcategory first", 1);
                            errorProvider1.SetError(txt_subcat, "Please enter customer subcategory first");
                            return;
                        }
                        if (rdo_orderform.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Order Forms");
                            rpt_pendingOF rptBank = new rpt_pendingOF();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalOF(txt_Category.Text.Trim(), txt_subcat.Text.Trim(), dtfrom.Value, dtto.Value, 3)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                        if (rdo_invoice.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Invoices");
                            rpt_pendingInvoice rptBank = new rpt_pendingInvoice();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovalInvoices(txt_Category.Text.Trim(), txt_subcat.Text.Trim(), dtfrom.Value, dtto.Value, 3)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                        if (rdo_DO.Checked)
                        {
                            rpt = ReportStrings.PrintDoc("PENDING Dilivery Orders");
                            rpt_penddingDos rptBank = new rpt_penddingDos();
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetPendingApprovaldos(txt_Category.Text.Trim(), txt_subcat.Text.Trim(), dtfrom.Value, dtto.Value, 2)));
                            rpt.RepViewer.ReportSource = rptBank;
                        }
                    }
                }



                rpt.RepViewer.Refresh();
                rpt.Show();
            }
            catch (Exception ex) {
            }
        }