コード例 #1
0
        public List <GeneralLedgerDto> GetAllGeneralLedgers(int AHID, int groupId, DateTime FromDate, DateTime ToDate, out string OrgAddress, out string AhName)
        {
            List <GeneralLedgerDto> lstLedger = new List <GeneralLedgerDto>();
            SqlCommand cmd = new SqlCommand("uspGeneralLedgerDReport", con);

            cmd.Parameters.AddWithValue("@AHID", AHID);
            cmd.Parameters.AddWithValue("@GroupId", groupId);
            cmd.Parameters.AddWithValue("@StartDate", FromDate);
            cmd.Parameters.AddWithValue("@EndDate", ToDate);

            cmd.Parameters.Add("@OrgAddress", SqlDbType.VarChar, 1000);
            cmd.Parameters["@OrgAddress"].Direction = ParameterDirection.Output;

            cmd.Parameters.Add("@AccountHeadName", SqlDbType.VarChar, 100);
            cmd.Parameters["@AccountHeadName"].Direction = ParameterDirection.Output;

            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                GeneralLedgerDto obj = new GeneralLedgerDto();

                obj.Date   = Convert.ToDateTime(dr["TDate"]);
                obj.AHCode = Convert.ToString(dr["AHCode"]);
                obj.AHName = Convert.ToString(dr["AHName"]);
                if (dr["DrAmount"] != DBNull.Value)
                {
                    obj.DrAmount = Convert.ToDecimal(dr["DrAmount"]);
                }
                if (dr["CrAmount"] != DBNull.Value)
                {
                    obj.CrAmount = Convert.ToDecimal(dr["CrAmount"]);
                }
                if (dr["Balance"] != DBNull.Value)
                {
                    obj.Balance = Convert.ToDecimal(dr["Balance"]);
                }
                lstLedger.Add(obj);
            }

            OrgAddress = Convert.ToString(cmd.Parameters["@OrgAddress"].Value);
            AhName     = Convert.ToString(cmd.Parameters["@AccountHeadName"].Value);
            con.Close();

            return(lstLedger);
        }
コード例 #2
0
        public List <GeneralLedgerDto> GetAllBankBook(int groupId, DateTime FromDate, DateTime ToDate, out string OrgAddress)
        {
            List <GeneralLedgerDto> lstLedger = new List <GeneralLedgerDto>();
            SqlCommand cmd = new SqlCommand("uspGroupBankBook_v1", con);


            cmd.Parameters.AddWithValue("@GroupId", groupId);
            cmd.Parameters.AddWithValue("@StartDate", FromDate);
            cmd.Parameters.AddWithValue("@EndDate", ToDate);

            cmd.Parameters.Add("@OrgAddress", SqlDbType.VarChar, 1000);
            cmd.Parameters["@OrgAddress"].Direction = ParameterDirection.Output;

            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                GeneralLedgerDto obj = new GeneralLedgerDto();

                obj.Date          = Convert.ToDateTime(dr["TDate"]);
                obj.AHCode        = Convert.ToString(dr["AHCode"]);
                obj.AHName        = Convert.ToString(dr["AHName"]);
                obj.BankName      = Convert.ToString(dr["BankName"]);
                obj.Branch        = Convert.ToString(dr["BranchName"]);
                obj.AccountNumner = Convert.ToString(dr["AccountNumber"]);
                obj.VrNumber      = Convert.ToString(dr["VoucherNumber"]);
                if (dr["DrAmount"] != DBNull.Value)
                {
                    obj.DrAmount = Convert.ToDecimal(dr["DrAmount"]);
                }
                if (dr["CrAmount"] != DBNull.Value)
                {
                    obj.CrAmount = Convert.ToDecimal(dr["CrAmount"]);
                }
                if (dr["Balance"] != DBNull.Value)
                {
                    obj.Balance = Convert.ToDecimal(dr["Balance"]);
                }
                if (dr["OpeningBalance"] != DBNull.Value)
                {
                    obj.OpeningBalance = Convert.ToDecimal(dr["OpeningBalance"]);
                }
                lstLedger.Add(obj);
            }
            ViewBag.OpeningBalance = lstLedger != null && lstLedger.Count > 0 ? lstLedger[lstLedger.Count - 1].OpeningBalance.ToDisplayCurrencyRPT() : "";
            ViewBag.BankBalance    = lstLedger != null && lstLedger.Count > 0 ? lstLedger[lstLedger.Count - 1].Balance.ToDisplayCurrencyRPT() : "";
            ViewBag.BankName       = lstLedger != null && lstLedger.Count > 0 ? lstLedger.Where(x => x.AHName == "BANK").Select(x => x.BankName).First().ToString() : "";
            ViewBag.AccountNumber  = lstLedger != null && lstLedger.Count > 0 ? lstLedger.Where(x => x.AHName == "BANK").Select(x => x.AccountNumner).First().ToString() : "";
            ViewBag.Branch         = lstLedger != null && lstLedger.Count > 0 ? lstLedger.Where(x => x.AHName == "BANK").Select(x => x.Branch).First().ToString() : "";
            ViewBag.Group          = GroupInfo.GroupName;
            ViewBag.GroupCode      = GroupInfo.GroupCode;
            ViewBag.Cluster        = GroupInfo.Cluster;
            OrgAddress             = Convert.ToString(cmd.Parameters["@OrgAddress"].Value);
            con.Close();

            return(lstLedger);
        }