示例#1
0
        public List <AccountHeadDto> GetAll(bool isFederation)
        {
            var lstAccountHeadDto = new List <AccountHeadDto>();
            var lstuspAccountHeadGetAll_Result = _dbContext.uspAccountHeadGetAll().ToList().FindAll(f => f.IsFederation == isFederation || f.AHLevel < 4);

            foreach (var AH in lstuspAccountHeadGetAll_Result)
            {
                AccountHeadDto accountHeadDto = Mapper.Map <uspAccountHeadGetAll_Result, AccountHeadDto>(AH);
                lstAccountHeadDto.Add(accountHeadDto);
            }
            return(lstAccountHeadDto);
        }
        public ActionResult CreatePaymentsToFederation(string Id)
        {
            bool isFederation        = true;
            long AccountMasterId     = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString());
            GeneralReceiptDto objDto = new GeneralReceiptDto();

            if (AccountMasterId > 0)
            {
                objDto = _paymentsToFederationService.GetByID(AccountMasterId);
                if (objDto.Addamount.Count > 0)
                {
                    List <AddAmountDto> lstAccounts = new List <AddAmountDto>();

                    var list = objDto.Addamount;
                    foreach (var i in list)
                    {
                        AddAmountDto Addamountdto = new AddAmountDto();
                        int          ahId         = i.AHID;

                        AccountHeadDto accountHeadDto = _accountheadService.GetAccountHeadViewBalanceSummary(ahId, isFederation);
                        if (accountHeadDto.ClosingBalance != 0)
                        {
                            Decimal ClosingBalance = accountHeadDto.ClosingBalance + i.CrAmount;
                            Addamountdto.Balance = ClosingBalance;
                        }
                        Addamountdto.AHID     = i.AHID;
                        Addamountdto.AHCode   = i.AHCode;
                        Addamountdto.AHName   = i.AHName;
                        Addamountdto.CrAmount = i.CrAmount;
                        Addamountdto.DrAmount = i.DrAmount;
                        lstAccounts.Add(Addamountdto);
                    }
                    objDto.Addamount = lstAccounts;
                }
            }

            List <SelectListDto> lstselectDto = _accountheadService.GetGeneralReceiptLedgersDropDown(true);
            SelectList           lstahcode    = new SelectList(lstselectDto, "ID", "Text");

            ViewBag.ahcodes = lstahcode;
            isFederation    = true;
            List <SelectListDto> lstClusters = _clusterService.GetClusterSelectList();
            SelectList           slClusters  = new SelectList(lstClusters, "ID", "Text");

            ViewBag.clusters = slClusters;

            List <GroupLookupDto> lstGroupDto = _groupService.Lookup();
            SelectList            lstgroup    = new SelectList(lstGroupDto, "GroupID", "GroupCode");

            ViewBag.GroupNames = lstgroup;
            int EmployeeID = UserInfo.UserID;


            EmployeeDto ObjEmployee = _employeeService.GetByID(EmployeeID);

            objDto.EmployeeCode = ObjEmployee.EmployeeCode;
            objDto.EmployeeName = ObjEmployee.EmployeeName;

            List <uspAccountHeadGetAll_Result> lstuspAccountHeadGetAll_Result = _dbContext.uspAccountHeadGetAll().ToList();

            var listOfSearchedIds = new List <string> {
                "2020", "2114", "1231", "1232", "1241", "1242", "1243"
            };

            lstuspAccountHeadGetAll_Result = (lstuspAccountHeadGetAll_Result.Where(x => listOfSearchedIds.Contains(x.AHCode))).ToList();
            SelectList FederationAHeads = new SelectList(lstuspAccountHeadGetAll_Result, "AHID", "AHName");

            ViewBag.FederationAH = FederationAHeads;

            return(View(objDto));
        }