Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads
 
Add your own
alternative version
Go to top

AccountPlus

, 10 Sep 2009
A Complete Account Management System
accountplus.zip
AccountPlus
AccountPlus
AccountPlus.JPG
Database
AccountPlus.mdb
Documents
AccountPlus.doc
Thumbs.db
Setup
setup.msi
Thumbs.db
Source_Code.zip
accountplussource.zip
AccountPlusSource
AccountPlus.BusinessLogic
AccountPlus.BusinessLogic.csproj.user
Properties
AccountPlus.Configurations
Properties
AccountPlus.DataAccess
Properties
AccountPlus.Formatting
Properties
AccountPlus.Messaging
Properties
AccountPlus.Setup
AccountPlus.Setup.CustomActions
Properties
Settings.settings
AccountPlus.Setup.vdproj
AccountPlus.UserInterface
AccountPlus.UserInterface.csproj.user
AccPlus.csproj.user
Help
AccountPlus.pdf
log4net.dll
Properties
Settings.settings
propertiesORoptions.ico
Assemblies
log4net.dll
database.zip
Database
MS Access
AccountPlus.mdb
MySQL
SQL Server
Backup
AccountPlus.bak
Script
setup.zip
Setup
Setup.msi
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using AccountPlus.DataAccess;

namespace AccountPlus.BusinessLogic
{
    public class ItemAnalyticArch
    {
        private DBHelper _dbHelper = new DBHelper();
        private Arch arch = new Arch();

        public DataTable MonthlyReportData(string month, string Year)
        {
            DataTable dtReportData = new DataTable();
            string monthYear = arch.DecodeMonthYear(month, Year);        

            string Query = "SELECT Distinct(Expense_Details.Item_Id), Item_Details.Item_Name as Item, Sum(Exp_Amount) as TotalExpense from " +
                                "Expense_Details,Item_Details Where " +
                                "Expense_Details.Item_Id=Item_Details.Item_Id AND " +
                                "Expense_Details.MonthYear='" + monthYear + "' AND Expense_Details.IsDeleted=0 " +
                                "Group by Expense_Details.Item_Id, Item_Details.Item_Name";

            dtReportData = _dbHelper.ExecuteDataTable(Query);

            return dtReportData;
        }      

        public string[] GetAllItems()
        {
            string[] nameArray = null;

            DataTable dtItemName = new DataTable();
            string Query = string.Empty;
            Query = "SELECT Item_Name From Item_Details where IsActive=1";
            dtItemName = _dbHelper.ExecuteDataTable(Query);
            int iRowCount = dtItemName.Rows.Count;

            if (iRowCount > 0)
            {
                nameArray = new string[iRowCount];

                for (int i = 0; i < iRowCount; i++)
                {
                    nameArray[i] = dtItemName.Rows[i][0].ToString();
                }
            }

            return nameArray;
        }

        public string[] GetItemIds()
        {
            string[] itemIdArray = null;
            DataTable dtItemID = new DataTable();
            string Query = string.Empty;
            Query = "SELECT Item_Id  From Item_Details where IsActive=1";
            dtItemID = _dbHelper.ExecuteDataTable(Query);
            int iRowCount = dtItemID.Rows.Count;

            if (iRowCount > 0)
            {
                itemIdArray = new string[iRowCount];

                for (int i = 0; i < iRowCount; i++)
                {
                    itemIdArray[i] = dtItemID.Rows[i][0].ToString();
                }
            }

            return itemIdArray;
        }

        public string[] GetExpenseOnItems()
        {
            string[] itemIDs = GetItemIds();
            string Query = string.Empty;

            string[] expenseAmount = new string[itemIDs.Length];

            for (int i = 0; i < itemIDs.Length; i++)
            {                
                Query = "SELECT Sum(Exp_Amount) FROM Expense_Details WHERE IsDeleted=0 AND Item_Id=" + itemIDs[i];

                if (_dbHelper.ExecuteScalar(Query) != null)
                {
                    expenseAmount[i] = _dbHelper.ExecuteScalar(Query).ToString();
                    if (expenseAmount[i].Equals(""))
                        expenseAmount[i] = "0";
                }
            }

            return expenseAmount;
        }

        public string[] GetExpenseForItems(string monthYear)
        {
            string[] itemIDs = GetItemIds();
            string Query = string.Empty;

            string[] expenseAmount = new string[itemIDs.Length];

            for (int i = 0; i < itemIDs.Length; i++)
            {
                Query = "SELECT Sum(Exp_Amount) FROM Expense_Details WHERE IsDeleted=0 AND MonthYear='" + monthYear + "' AND Item_Id=" + itemIDs[i];

                if (_dbHelper.ExecuteScalar(Query) != null)
                {
                    expenseAmount[i] = _dbHelper.ExecuteScalar(Query).ToString();
                    if (expenseAmount[i].Equals(""))
                        expenseAmount[i] = "0";
                }
            }

            return expenseAmount;
        }

        public string GetAmount(string p)
        {
            double individualExpense = Convert.ToDouble(GetIndividualExpense());
            double amountPaid = Math.Round(Convert.ToDouble(p), 2); ;
            double amount = 0.0;

            if (amountPaid > individualExpense)
                amount = amountPaid - individualExpense;
            else if (amountPaid.Equals(individualExpense))
                amount = 0.0;
            else
                amount = individualExpense - amountPaid;

            return amount.ToString();
        }

        public string GetIndividualExpense()
        {
            double indExp = 0.0;
            string individualExpense = string.Empty;
            string noOfParticipents = GetExpenseParticipents();

            indExp = Math.Round(Convert.ToDouble(GetTotalExpenses()) / Convert.ToDouble(noOfParticipents), 2);

            return indExp.ToString();

        }

        public string GetExpenseParticipents()
        {
            string participents = string.Empty;
            participents = _dbHelper.ExecuteScalar("Select Count(*) from User_Info WHERE IsActive=1 AND User_Id<>1").ToString();
            return participents;
        }

        public string GetTotalExpenses()
        {
            string totalExpense = string.Empty;
            totalExpense = _dbHelper.ExecuteScalar("Select Sum(Exp_Amount) from Expense_Details WHERE Finalized=0").ToString();

            if (totalExpense.Equals(""))
                return "0";
            else
                return totalExpense;
        }     
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Ashish Tripathi
Founder Aspirea Technologies Pvt Ltd
India India
• 8 years of experience in IT Industry as a Developer.
• Experience of End-To-End Software Development and Implementation (Entire SDLC i.e Software Development Life Cycle)
• Real time Exposure to Banking, Finance and Energy industry.
• Expertise in distributed application architecture as well as web based applications using Microsoft.NET platform.
• Expertise in database design, SQL programming and SQL performance tuning.
• Expertise in Web Services and WCF Services.
• Experience of Rich Internet Application using Adobe Flex.
• Experience in migration of legacy application to latest technology, migration of VB application to .NET.
• Knowledge of OOPS and Design Concepts.
• Expertise in Agile/ Scrum software development processes.
 
Specialties
• Languages\ Technologies-
.NET Framework 1.1/2.0/3.0/3.5, C#.NET, VB.NET, ASP.NET, VB6, AJAX, ASP.NET, Adobe Flex 3.0, Web Services, Windows Communication Foundation (WCF), LINQ, SQL Server, Oracle, MySql, MS Access, HTML, XML, JavaScript, C# Script, CSS and XSLT.
 
• Methodology/ Concepts-
OOPS, Data Structures, Design Concepts and Agile/ Scrum Software Development
Follow on   Twitter

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 10 Sep 2009
Article Copyright 2008 by Ashish Tripathi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid