예제 #1
0
        private void frmReportViewer_Load(object sender, EventArgs e)
        {
            ReportDocument rpt1;

            try
            {
                switch (selector)
                {
                case ViewerSelector.Performance:
                    List <Mprojection> objPerformance = objExtra.mQueryPerformance(strComID, intmode).ToList();
                    if (objPerformance.Count > 0)
                    {
                        if (intmode == 3)
                        {
                            rptPerformanceZone rptPerformance = new rptPerformanceZone();
                            rpt1 = (ReportDocument)rptPerformance;
                        }
                        else if (intmode == 4)
                        {
                            rptPerformanceAll rptPerformance = new rptPerformanceAll();
                            rpt1 = (ReportDocument)rptPerformance;
                        }
                        else
                        {
                            rptPerformance rptPerformance = new rptPerformance();
                            rpt1 = (ReportDocument)rptPerformance;
                        }
                        rpt1.SetDataSource(objPerformance.ToList());
                        this.reportTitle     = "Sales Performance";
                        this.secondParameter = Convert.ToDateTime(strFdate).ToString("dd-MM-yyy") + " to " + Convert.ToDateTime(strTdate).ToString("dd-MM-yyy");
                        InitialiseLabels(rpt1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }
                    break;

                case ViewerSelector.ProjectionR:


                    List <PCollectionCopmarison> objProjection = objExtra.mGetCollectionComparision(strComID, "", "", Utility.gstrUserName, intPosition).ToList();
                    if (objProjection.Count > 0)
                    {
                        if (intPosition == 1)
                        {
                            rptCollectionComparision_Zone rptCollectionComparision = new rptCollectionComparision_Zone();
                            rpt1 = (ReportDocument)rptCollectionComparision;
                        }
                        else if (intPosition == 2)
                        {
                            rptCollectionComparision_Division rptCollectionComparision = new rptCollectionComparision_Division();
                            rpt1 = (ReportDocument)rptCollectionComparision;
                        }
                        else if (intPosition == 3)
                        {
                            rptCollectionComparision_Area rptCollectionComparision = new rptCollectionComparision_Area();
                            rpt1 = (ReportDocument)rptCollectionComparision;
                        }
                        else if (intPosition == 4)
                        {
                            rptCollectionComparisioN_Mpo rptCollectionComparision = new rptCollectionComparisioN_Mpo();
                            rpt1 = (ReportDocument)rptCollectionComparision;
                        }
                        else
                        {
                            rptCollectionComparisioN_Mpo rptCollectionComparision = new rptCollectionComparisioN_Mpo();
                            rpt1 = (ReportDocument)rptCollectionComparision;
                        }
                        rpt1.SetDataSource(objProjection.ToList());
                        this.reportTitle = "Projection Report";
                        InitialiseLabels(rpt1);
                        rpt1.SetParameterValue("MonthYY", "Month :" + strString1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }

                    break;

                case ViewerSelector.CollectionComparision:
                    string strSdate = "";
                    string strEdate = "";

                    List <PCollectionCopmarison> otheading22 = objExtra.mGetProjectionStarEndDate(strComID, strString1, strString2, "").ToList();
                    if (otheading22.Count > 0)
                    {
                        foreach (PCollectionCopmarison oo in otheading22)
                        {
                            strEdate = strString1;

                            strProjectionName = oo.strProjectionName;

                            List <PCollectionCopmarison> oLedger = objExtra.mGetMontlyLadger(strComID, strString1, strledgerName).ToList();
                            if (oLedger.Count > 0)
                            {
                                foreach (PCollectionCopmarison ooL in oLedger)
                                {
                                    List <PCollectionCopmarison> objPerfo = objExtra.mGetCollectionComparisionReport(strComID, strProjectionName, strString1, strString2, intmode, ooL.strLedgerName, strFdate).ToList();
                                    intmode = intmode + 1;
                                }
                            }
                        }
                    }

                    List <PCollectionCopmarison> objColl = objExtra.mGetCollectionComparision(strComID, strSdate, strEdate, Utility.gstrUserName, intmode).ToList();
                    if (objColl.Count > 0)
                    {
                        rptCollectionComparision rptCollectionComparision = new rptCollectionComparision();
                        rpt1 = (ReportDocument)rptCollectionComparision;
                        rpt1.SetDataSource(objColl.ToList());
                        this.reportTitle = "Collection Comparison Report";
                        //this.secondParameter = Convert.ToDateTime(strFdate).ToString("dd-MM-yyy") + " to " + Convert.ToDateTime(strTdate).ToString("dd-MM-yyy");
                        InitialiseLabels(rpt1);
                        rpt1.SetParameterValue("MonthYY", "Month :" + strString1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }

                    break;

                case ViewerSelector.ProjectionRW:

                    List <ProjectionSet> objProjectionW = objExtra.mFillWeeklyProjectionReport(strComID, strString1, strString2, intmode).ToList();
                    if (objProjectionW.Count > 0)
                    {
                        rptWeeklyprojection rptWeeklyprojection = new rptWeeklyprojection();
                        rpt1 = (ReportDocument)rptWeeklyprojection;
                        rpt1.SetDataSource(objProjectionW.ToList());
                        this.reportTitle = "Weekly Projection Individual Division (" + strString1 + ")";
                        InitialiseLabels(rpt1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }
                    break;

                case ViewerSelector.ProjectionRM:

                    List <ProjectionSet> objProjectionV = objExtra.mrptFillDisplayMonthlyProjection(strComID, strString1, strString2, intmode).ToList();
                    if (objProjectionV.Count > 0)
                    {
                        rptmonthlyprojection rptmonthlyprojection = new rptmonthlyprojection();
                        rpt1 = (ReportDocument)rptmonthlyprojection;
                        rpt1.SetDataSource(objProjectionV.ToList());
                        this.reportTitle = "Monthly Projection Individual Division (" + strString1 + ")";
                        InitialiseLabels(rpt1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #2
0
        private void frmReportViewer_Load(object sender, EventArgs e)
        {
            ReportDocument rpt1;

            try
            {
                switch (selector)
                {
                case ViewerSelector.Performance:
                    //double dblFineRecAmount = 0;
                    List <Mprojection> objPerformance = objExtra.mQueryPerformance(strComID).ToList();
                    if (objPerformance.Count > 0)
                    {
                        rptPerformance rptPerformance = new rptPerformance();
                        rpt1 = (ReportDocument)rptPerformance;
                        rpt1.SetDataSource(objPerformance.ToList());
                        this.reportTitle     = "Sales Performance";
                        this.secondParameter = Convert.ToDateTime(strFdate).ToString("dd-MM-yyy") + " to " + Convert.ToDateTime(strTdate).ToString("dd-MM-yyy");
                        InitialiseLabels(rpt1);

                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }
                    break;

                case ViewerSelector.ProjectionR:

                    List <PCollectionCopmarison> oProjection = objExtra.mGetProjectionStarEndDate(strComID, strString1, "").ToList();
                    if (oProjection.Count > 0)
                    {
                        foreach (PCollectionCopmarison oo in oProjection)
                        {
                            strProjectionName = oo.strProjectionName;

                            List <PCollectionCopmarison> oLedger = objExtra.mGetMontlyLadgerProjection(strComID, strString1, strledgerName).ToList();
                            if (oLedger.Count > 0)
                            {
                                foreach (PCollectionCopmarison ooL in oLedger)
                                {
                                    //string strledgerName = ooL.strLedgerName;
                                    List <PCollectionCopmarison> objPerfo = objExtra.mGetProjectionReport(strComID, strProjectionName, strString1, strString2, intmode, ooL.strLedgerName).ToList();
                                    intmode = intmode + 1;
                                }
                            }
                        }
                    }

                    List <PCollectionCopmarison> objProjection = objExtra.mGetCollectionComparision(strComID, "", "").ToList();
                    if (objProjection.Count > 0)
                    {
                        rptCollectionComparision rptCollectionComparision = new rptCollectionComparision();
                        rpt1 = (ReportDocument)rptCollectionComparision;
                        rpt1.SetDataSource(objProjection.ToList());
                        this.reportTitle = "Projection Report";
                        InitialiseLabels(rpt1);
                        rpt1.SetParameterValue("MonthYY", "Month :" + strString1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }

                    break;



                case ViewerSelector.CollectionComparision:
                    string strSdate = "";
                    string strEdate = "";

                    List <PCollectionCopmarison> otheading22 = objExtra.mGetProjectionStarEndDate(strComID, strString1, "").ToList();
                    if (otheading22.Count > 0)
                    {
                        foreach (PCollectionCopmarison oo in otheading22)
                        {
                            strEdate = strString1;

                            strProjectionName = oo.strProjectionName;

                            List <PCollectionCopmarison> oLedger = objExtra.mGetMontlyLadger(strComID, strString1, strledgerName).ToList();
                            if (oLedger.Count > 0)
                            {
                                foreach (PCollectionCopmarison ooL in oLedger)
                                {
                                    //string strledgerName = ooL.strLedgerName;
                                    List <PCollectionCopmarison> objPerfo = objExtra.mGetCollectionComparisionReport(strComID, strProjectionName, strString1, strString2, intmode, ooL.strLedgerName).ToList();
                                    intmode = intmode + 1;
                                }
                            }
                        }
                    }

                    List <PCollectionCopmarison> objColl = objExtra.mGetCollectionComparision(strComID, strSdate, strEdate).ToList();
                    if (objColl.Count > 0)
                    {
                        rptCollectionComparision rptCollectionComparision = new rptCollectionComparision();
                        rpt1 = (ReportDocument)rptCollectionComparision;
                        rpt1.SetDataSource(objColl.ToList());
                        this.reportTitle = "Collection Comparison Report";
                        //this.secondParameter = Convert.ToDateTime(strFdate).ToString("dd-MM-yyy") + " to " + Convert.ToDateTime(strTdate).ToString("dd-MM-yyy");
                        InitialiseLabels(rpt1);
                        rpt1.SetParameterValue("MonthYY", "Month :" + strString1);
                        crystalReportViewer1.ReportSource = rpt1;
                        ShowReport(rpt1, false, "");
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }