Exemple #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("Order Tracking");
                rpt_OrderTrackingSummary rptBank = new rpt_OrderTrackingSummary();

                if (rdo_summary.Checked)         //if summary cracked
                {
                    if (rdo_fulldetails.Checked) // option 1 full view of order tracking
                    {
                        if (rdo_pinv.Checked)    //if pending invoice cracked
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 1)));
                        }
                        else if (rdo_pdo.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 2)));
                        }
                        else if (rdo_paudit.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 3)));
                        }
                        else if (rdo_pdispatch.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 4)));
                        }
                        else if (rdo_dilivery.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 5)));
                        }
                        else if (rdo_pconfirm.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary("", false, "", dtfrom.Value, dtto.Value, 1, 6)));
                        }
                    }
                    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_pinv.Checked) //if pending invoice cracked
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 1)));
                        }
                        else if (rdo_pdo.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 2)));
                        }
                        else if (rdo_paudit.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 3)));
                        }
                        else if (rdo_pdispatch.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 4)));
                        }
                        else if (rdo_dilivery.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 5)));
                        }
                        else if (rdo_pconfirm.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Suplier.Text.Trim(), false, "", dtfrom.Value, dtto.Value, 2, 6)));
                        }
                    }

                    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_pinv.Checked) //if pending invoice cracked
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, subcat, dtfrom.Value, dtto.Value, header, 1)));
                        }
                        else if (rdo_pdo.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, "", dtfrom.Value, dtto.Value, header, 2)));
                        }
                        else if (rdo_paudit.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, "", dtfrom.Value, dtto.Value, header, 3)));
                        }
                        else if (rdo_pdispatch.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, "", dtfrom.Value, dtto.Value, header, 4)));
                        }
                        else if (rdo_dilivery.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, "", dtfrom.Value, dtto.Value, header, 5)));
                        }
                        else if (rdo_pconfirm.Checked) //
                        {
                            rptBank.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackSummary(txt_Category.Text.Trim(), false, "", dtfrom.Value, dtto.Value, header, 6)));
                        }
                    }
                }
                rpt.RepViewer.ReportSource = rptBank;
                rpt.RepViewer.Refresh();
                rpt.Show();

                if (rdo_foroneorder.Checked)
                {
                    frm_reportViwer rpt1 = new frm_reportViwer();
                    rpt1.MdiParent = MDI_SMartAnything.ActiveForm;
                    rpt1           = ReportStrings.PrintDoc("Order Tracking Summary");
                    rpt_ordertracking rptBank1 = new rpt_ordertracking();
                    rptBank1.SetDataSource(commonFunctions.GetDatatable(ReportStrings.GetOrderTrackOne(textBox2.Text.Trim())));
                    rpt1.RepViewer.ReportSource = rptBank1;
                    rpt1.RepViewer.Refresh();
                    rpt1.Show();
                }
            }
            catch (Exception ex) { }
        }