Example #1
0
        //private void GetReport(int BranchID, int CatgId, int FreqId, DateTime fromDate, DateTime toDate, string Grouping)
        //{
        //    try
        //    {
        //        if (Grouping == Indication_ExpenseReports.Expense_Grouping_Monthly)
        //        {
        //            cr_MonthlyOpex objcrmonthlyopex = new cr_MonthlyOpex();
        //            DataTable datatable = new DataTable();
        //            frmReportViewer objreportviewer = new frmReportViewer();
        //            RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL();
        //            ExpenseEntryBAL exbal = new ExpenseEntryBAL();
        //            int tempbranchid = -2;

        //            int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex);
        //            int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid);

        //            if (BranchID == Indication_BrokerBranch.HeadOffice_ID)
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid));

        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            else
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid));
        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            objcrmonthlyopex.SetDataSource(datatable);

        //            GetCommonInfo();
        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName;
        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "Branch name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name +" Report: Monthly Wise";
        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy");
        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy");
        //            ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName;


        //            objreportviewer.crvReportViewer.ReportSource = objcrmonthlyopex;
        //            objreportviewer.Text = Selected_CategoryType_Name + " Report: Monthly wise";
        //            objreportviewer.Show();
        //        }
        //        else if (Grouping == Indication_ExpenseReports.Expense_Grouping_Daily)
        //        {
        //            cr_DailyOpex objctDailyOpex = new cr_DailyOpex();
        //            DataTable datatable = new DataTable();
        //            frmReportViewer objreportviewer = new frmReportViewer();
        //            RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL();
        //            ExpenseEntryBAL exbal = new ExpenseEntryBAL();
        //            int tempbranchid = -2;

        //            int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex);
        //            int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid);

        //            if (BranchID == Indication_BrokerBranch.HeadOffice_ID)
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid));

        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            else
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid));
        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            objctDailyOpex.SetDataSource(datatable);

        //            GetCommonInfo();
        //            ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName;
        //            ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

        //            ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name+" Report: Daily Wise";
        //            ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy");
        //            ((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy");
        //            //((TextObject)objctDailyOpex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName;


        //            objreportviewer.crvReportViewer.ReportSource = objctDailyOpex;
        //            objreportviewer.Text = Selected_CategoryType_Name + " Report: Daily wise";
        //            objreportviewer.Show();
        //        }
        //        else if (Grouping == Indication_ExpenseReports.Expense_Grouping_Yearly)
        //        {

        //            cr_YearlyOPex objctYearlyOpex = new cr_YearlyOPex();
        //            DataTable datatable = new DataTable();
        //            frmReportViewer objreportviewer = new frmReportViewer();
        //            RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL();
        //            ExpenseEntryBAL exbal = new ExpenseEntryBAL();
        //            int tempbranchid = -2;

        //            int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex);
        //            int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid);

        //            if (BranchID == Indication_BrokerBranch.HeadOffice_ID)
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid));

        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            else
        //            {
        //                tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid));
        //                if (BranchID != tempbranchid)
        //                {
        //                    MessageBox.Show("you are restricted");
        //                    return;
        //                }
        //                else
        //                {
        //                    datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate);
        //                }
        //            }
        //            objctYearlyOpex.SetDataSource(datatable);

        //            GetCommonInfo();
        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName;
        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text = "branch name:" + _branchName + "," + _branchAddress + ". phone:" + _branchContactNumber;

        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtreport"]).Text = Selected_CategoryType_Name+ " Report: Yearly wise";
        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-mmm-yyyy");
        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy");
        //            ((TextObject)objctYearlyOpex.ReportDefinition.Sections[2].ReportObjects["txtbranchname"]).Text = _branchName;


        //            objreportviewer.crvReportViewer.ReportSource = objctYearlyOpex;
        //            objreportviewer.Text = Selected_CategoryType_Name + " Report: Yearly wise";
        //            objreportviewer.Show();
        //        }



        //    }
        //    catch (Exception)
        //    {

        //        throw;
        //    }

        //}

        private void GetReport(int BranchID, int CatgId, int FreqId, DateTime fromDate, DateTime toDate, string Grouping)
        {
            try
            {
                cr_ExpenseReport        objcrmonthlyopex        = new cr_ExpenseReport();
                DataTable               datatable               = new DataTable();
                frmReportViewer         objreportviewer         = new frmReportViewer();
                RecordLevelFilteringBAL recordlevelfilteringbal = new RecordLevelFilteringBAL();
                ExpenseEntryBAL         exbal = new ExpenseEntryBAL();
                bool IsExpensedate            = false;

                int tempbranchid = -2;

                int resourceid = recordlevelfilteringbal.GetResourceID(ResourceName.Daily_Expenditure_Monthly_Opex);
                int criteriaid = recordlevelfilteringbal.GetCriteriaID(resourceid);

                if (rd_ExpenseDate.Checked)
                {
                    IsExpensedate = rd_ExpenseDate.Checked;
                }

                if (BranchID == Indication_BrokerBranch.HeadOffice_ID)
                {
                    tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterWorkStation_All(BranchID.ToString(), resourceid, criteriaid));

                    if (BranchID != tempbranchid)
                    {
                        MessageBox.Show("you are restricted");
                        return;
                    }
                    else
                    {
                        datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate, IsExpensedate);
                    }
                }
                else
                {
                    tempbranchid = Convert.ToInt32(recordlevelfilteringbal.FilterBranchID(BranchID.ToString(), resourceid, criteriaid));
                    if (BranchID != tempbranchid)
                    {
                        MessageBox.Show("you are restricted");
                        return;
                    }
                    else
                    {
                        datatable = exbal.GetReport(CatgId, FreqId, BranchID, fromDate, toDate, IsExpensedate);
                    }
                }
                ParameterDiscreteValue pdv = new ParameterDiscreteValue();
                pdv.Value = (object)Grouping;

                objcrmonthlyopex.SetDataSource(datatable);
                GetCommonInfo();

                ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtcompanyname"]).Text = _CommpanyName;
                ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtaddress"]).Text     = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;;

                ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtfrom"]).Text = fromDate.ToString("dd-MMM-yyyy") + " To " + toDate.ToString("dd-MMM-yyyy");
                //((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text = toDate.ToString("dd-mmm-yyyy");
                ((TextObject)objcrmonthlyopex.ReportDefinition.Sections[2].ReportObjects["txtDate"]).Text = IsExpensedate ? "Expense Date" : "Payment Date";
                objcrmonthlyopex.ParameterFields["GroupingDate"].CurrentValues.Add(pdv);
                objreportviewer.crvReportViewer.ReportSource = objcrmonthlyopex;
                objreportviewer.Text = "Expense Report ";
                objreportviewer.Show();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        private void btnViewReportSet_Click(object sender, EventArgs e)
        {
            SetReportOrder();
            frmReportViewer frmReports   = new frmReportViewer();
            frmReportViewer frmViewWaste = new frmReportViewer();
            bool            isReports    = false;
            int             nViewWaste   = 0;

            this.Cursor = Cursors.WaitCursor;

            bool isWeekly = false;

            //get the count of selected rows and drop each starting at the dropIndex
            foreach (UltraGridRow aRow in ultraGrid1.Selected.Rows)
            {
                isWeekly = Regex.IsMatch(aRow.Cells["SerieName"].Value.ToString(), "weekly", RegexOptions.IgnoreCase);
                if (aRow.Band.Key == "ReportSet")
                {
                    int id = int.Parse(aRow.Cells["ReportMemorized.ID"].Value.ToString());
                    if (aRow.Cells["ReportType"].Value.ToString() == "View Waste")
                    {
                        frmViewWaste.AddPDF(id);
                        nViewWaste++;
                    }
                    else
                    {
                        frmReports.AddLoadParameters(id, isWeekly);
                        isReports = true;
                    }
                }
                else
                {
                    DataView view = _ReportSeries.Tables["ReportSet"].DefaultView;
                    view.RowFilter = "ReportSeries.ID = " + aRow.Cells["ID"].Value;
                    view.Sort      = "Order";
                    foreach (DataRowView viewRow in view)
                    {
                        if (viewRow["ReportMemorized.ID"].ToString() != "")
                        {
                            int id = int.Parse(viewRow["ReportMemorized.ID"].ToString());
                            if (viewRow["ReportType"].ToString() == "View Waste")
                            {
                                frmViewWaste.AddPDF(id);
                                nViewWaste++;
                            }
                            else
                            {
                                frmReports.AddLoadParameters(id, isWeekly);
                                isReports = true;
                            }
                        }
                    }
                }
            }
            this.Cursor = Cursors.Default;
            if (isReports)
            {
                frmReports.SetTitle(ultraGrid1.Rows[0].Cells["SerieName"].Value.ToString());
                frmReports.View();
                frmReports.Show();
            }
            if (nViewWaste > 0)
            {
                if (nViewWaste > 1)
                {
                    DialogResult result = ShowSavePDF();
                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }
                    string fileName = this.saveFileDialog1.FileName;
                    frmViewWaste.ShowPDF(fileName);
                }
                else
                {
                    frmViewWaste.View();
                    frmViewWaste.Show();
                }
            }

            // set task checkboxes
            VWA4Common.UtilitiesInstance utils = new VWA4Common.UtilitiesInstance();
            utils.setTaskCheck(DateTime.Parse(VWA4Common.GlobalSettings.StartDateOfSelectedWeek), true, "reviewreports");
        }