Exemplo n.º 1
0
        private void btn_print_Click(object sender, EventArgs e)
        {
            try
            {
                frm_reportViwer rpt = new frm_reportViwer();
                rpt.MdiParent = MDI_SMartAnything.ActiveForm;
                rpt           = ReportStrings.PrintDoc("cheque details".ToUpper());
                rpt_allCQs rptBank = new rpt_allCQs();

                if (rdo_fulldetails.Checked) // option 1 full view of order tracking
                {
                    if (rdo_pd.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 1, 1)));
                    }
                    else if (rdo_returned.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 1, 2)));
                    }
                    else if (rdo_relize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 1, 3)));
                    }
                    else if (rdo_unrealize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 1, 4)));
                    }
                }
                if (rdo_supp.Checked) // option 1 full view of order tracking
                {
                    if (txt_Suplier.Text.Trim() == "")
                    {
                        commonFunctions.SetMDIStatusMessage("Please enter customer first", 1);
                        errorProvider1.SetError(txt_Suplier, "Please enter customer first");
                        return;
                    }
                    if (rdo_pd.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 1)));
                    }
                    else if (rdo_returned.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 2)));
                    }
                    else if (rdo_relize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 3)));
                    }
                    else if (rdo_unrealize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 4)));
                    }
                }

                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;
                    }
                    if (rdo_pd.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Category.Text.Trim(), false, subcat, dtfrom.Value, dtto.Value, header, 1)));
                    }
                    else if (rdo_returned.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Category.Text.Trim(), false, subcat, dtfrom.Value, dtto.Value, header, 2)));
                    }
                    else if (rdo_relize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Category.Text.Trim(), false, subcat, dtfrom.Value, dtto.Value, header, 3)));
                    }
                    else if (rdo_unrealize.Checked)
                    {
                        rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetCQDetails(txt_Category.Text.Trim(), false, subcat, dtfrom.Value, dtto.Value, header, 4)));
                    }
                }


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