Beispiel #1
0
        private void ShowReport()
        {
            ExpenseEntryBAL exBal = new ExpenseEntryBAL();

            Selected_Branch_ID       = Convert.ToInt32(cmb_Branch.SelectedValue);
            Selected_CategoryType_ID = Convert.ToInt32(cmb_CatgType.SelectedValue);
            Selected_FrequencyID     = Convert.ToInt32(cmb_ExpsFrequency.SelectedValue);

            Selected_FrequencyName     = (string)cmb_ExpsFrequency.Text;
            Selected_CategoryType_Name = (string)cmb_CatgType.Text;
            Selected_Branch_Name       = (string)cmb_Branch.Text;

            Selected_FromDate = (DateTime)dt_FromDate.Value;
            Selected_ToDate   = (DateTime)dt_ToDate.Value;

            string grouping = string.Empty;

            if (rdBtn_Daily.Checked)
            {
                grouping = Indication_ExpenseReports.Expense_Grouping_Daily;
            }
            else if (rdBtn_Monthly.Checked)
            {
                grouping = Indication_ExpenseReports.Expense_Grouping_Monthly;
            }
            else if (rdBtn_Yearly.Checked)
            {
                grouping = Indication_ExpenseReports.Expense_Grouping_Yearly;
            }

            GetReport(Selected_Branch_ID, Selected_CategoryType_ID, Selected_FrequencyID, Selected_FromDate, Selected_ToDate, grouping);
            //}
            //else if (Selected_FrequencyName == Indication_ExpenseReports.Expense_Frequency_Monthly || Selected_FrequencyName == Indication_ExpenseReports.Expense_Frequency_HalfYearly && Selected_CategoryType_Name != "All")
            //{
            //    Selected_FromDate = new DateTime(dt_FromDate.Value.Year, dt_FromDate.Value.Month, 1);
            //    Selected_ToDate = new DateTime(dt_ToDate.Value.Year, dt_ToDate.Value.Month, DateTime.DaysInMonth(dt_ToDate.Value.Year, dt_ToDate.Value.Month));

            //    GetReport(Selected_Branch_ID, Selected_CategoryType_ID, Selected_FrequencyID, Selected_FromDate, Selected_ToDate, grouping);
            //}
            //else if (Selected_FrequencyName == Indication_ExpenseReports.Expense_Frequency_Yearly && Selected_CategoryType_Name != "All")
            //{
            //    Selected_FromDate = new DateTime(((DateTime)(dt_FromDate.Value)).Year, 1, 1);
            //    Selected_ToDate = new DateTime(dt_ToDate.Value.Year, 12, 31);

            //    GetReport(Selected_Branch_ID, Selected_CategoryType_ID, Selected_FrequencyID, Selected_FromDate, Selected_ToDate, grouping);
            //}
            //else
            //{
            //    throw new Exception("Category All Or Frequency All Are Invalid Entry");
            //}
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ExpenseOrPayment"></param>
        /// <param name="sorting">NEW added Sorting</param>
        private void MonthlyexpenseReport(string ExpenseOrPayment, string sorting)
        {
            ExpenseEntryBAL bal = new ExpenseEntryBAL();
            DataTable       dt  = new DataTable();

            dt = bal.GetMonthlyExpenseReport((DateTime)dt_FromDate.Value, (DateTime)dt_ToDate.Value, ExpenseOrPayment);
            crExpenseMonthly cr = new crExpenseMonthly();
            frmReportViewer  objreportviewer = new frmReportViewer();

            cr.SetDataSource(dt);
            GetCommonInfo();

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

            ((TextObject)cr.ReportDefinition.Sections[2].ReportObjects["txtfromDate"]).Text = dt_FromDate.Value.Date.ToShortDateString();
            ((TextObject)cr.ReportDefinition.Sections[2].ReportObjects["txtto"]).Text       = dt_ToDate.Value.Date.ToShortDateString();
            ((TextObject)cr.ReportDefinition.Sections[2].ReportObjects["Sorting"]).Text     = sorting;
            objreportviewer.crvReportViewer.ReportSource = cr;
            objreportviewer.Show();
        }
Beispiel #3
0
        private void GetExpenseCategoryTypeList()
        {
            try
            {
                ExpenseEntryBAL exBal = new ExpenseEntryBAL();
                DataTable       data  = new DataTable();

                data = exBal.GetCategoryType();

                DataRow dr = data.NewRow();
                dr["Category_Type_ID"] = 0;
                dr["Category_Type"]    = "All";

                data.Rows.InsertAt(dr, 0);
                cmb_CatgType.DataSource    = data;
                cmb_CatgType.DisplayMember = "Category_Type";
                cmb_CatgType.ValueMember   = "Category_Type_ID";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #4
0
        private void GetExpenseFrequencyList()
        {
            try
            {
                ExpenseEntryBAL exBal = new ExpenseEntryBAL();
                DataTable       data  = new DataTable();

                data = exBal.GetExpenseFrequency();

                DataRow dr = data.NewRow();
                dr["Frequency_ID"]   = 0;
                dr["Frequency_Name"] = "All";

                data.Rows.InsertAt(dr, 0);
                cmb_ExpsFrequency.DataSource    = data;
                cmb_ExpsFrequency.DisplayMember = "Frequency_Name";
                cmb_ExpsFrequency.ValueMember   = "Frequency_ID";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
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;
            }
        }