public ActionResult ViewGeneralPayments(string Id) { long AccountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString()); GeneralPaymentsDto objDto = new GeneralPaymentsDto(); if (AccountMasterId > 0) { objDto = _generalpaymentsService.GetByViewID(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; bool isFederation = true; AccountHeadDto accountHeadDto = _accountheadService.GetAccountHeadViewBalanceSummary(ahId, isFederation); if (accountHeadDto.ClosingBalance != 0) { Decimal ClosingBalance = accountHeadDto.ClosingBalance - i.DrAmount; 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; } } int EmployeeID = UserInfo.UserID; EmployeeDto ObjEmployee = _employeeService.GetByID(EmployeeID); objDto.EmployeeCode = ObjEmployee.EmployeeCode; objDto.EmployeeName = ObjEmployee.EmployeeName; return(View(objDto)); //return View(); }
public ActionResult CreateGeneralPayments(string Id) { long AccountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString()); GeneralPaymentsDto objDto = new GeneralPaymentsDto(); if (AccountMasterId > 0) { objDto = _generalpaymentsService.GetByID(AccountMasterId); if (objDto.AccountMasterID > 0) { 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; bool isFederation = true; AccountHeadDto accountHeadDto = _accountheadService.GetAccountHeadViewBalanceSummary(ahId, isFederation); if (accountHeadDto.ClosingBalance != 0) { Decimal ClosingBalance = accountHeadDto.ClosingBalance - i.DrAmount; 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; } } else { ViewBag.Message = "The AccountHead is Not Active"; } } List <AccountHeadDto> lstAccountHeadDtos = _accountheadService.GetGroupAccountTree(GroupInfo.GroupID); lstAccountHeadDtos = lstAccountHeadDtos.FindAll(l => l.AHLevel > 3).OrderBy(o => o.AHName).ToList(); //List<SelectListDto> lstselectDto = _accountheadService.GetGeneralReceiptLedgersDropDown(true); SelectList lstahcode = new SelectList(lstAccountHeadDtos.OrderBy(l => l.AHNameAndCode), "AHID", "AHNameAndCode"); ViewBag.ahcodes = lstahcode; BankMasterBll bankBll = new BankMasterBll(); List <BankMasterDto> lstFedBanks = bankBll.GetGroupBanks(GroupInfo.GroupID); SelectList lstFederationBanks = new SelectList(lstFedBanks, "BankEntryID", "AccountNumber", "Select Bank"); ViewBag.federationbanks = lstFederationBanks; int EmployeeID = UserInfo.UserID; EmployeeDto ObjEmployee = _employeeService.GetByID(EmployeeID); objDto.EmployeeCode = ObjEmployee.EmployeeCode; objDto.EmployeeName = ObjEmployee.EmployeeName; if (objDto.AccountMasterID > 0 && objDto.TransactionMode == "B") { objDto.AccountName = lstFedBanks.Find(l => l.AHID == objDto.AHID).AHName; } return(View(objDto)); }
private GeneralPaymentsDto ReadFormData(FormCollection form) { GeneralPaymentsDto generalPaymentsDto = new GeneralPaymentsDto(); generalPaymentsDto.AccountMasterID = Convert.ToInt64(Request.Form["hdnObjectID"]); if (generalPaymentsDto.AccountMasterID == 0) { int accountMasterID = default(int); int.TryParse(form["AccountMasterID"], out accountMasterID); } generalPaymentsDto.UserID = UserInfo.UserID; generalPaymentsDto.EmployeeID = UserInfo.UserID; if (form["BankAccount"] != null && form["BankAccount"] != string.Empty && form["BankAccount"] != "0") { generalPaymentsDto.BankAccount = Convert.ToInt32(form["BankAccount"]); } generalPaymentsDto.AHID = Convert.ToInt32(form["AccountHeadId"]); generalPaymentsDto.Amount = Convert.ToDecimal(form["AmountTotal"]); generalPaymentsDto.GroupID = GroupInfo.GroupID; generalPaymentsDto.VoucherRefNumber = Convert.ToString(form["VoucherRefNumber"]); generalPaymentsDto.PartyName = Convert.ToString(form["PartyName"]); generalPaymentsDto.TransactionMode = Convert.ToString(form["TransactionMode"]); generalPaymentsDto.ChequeNumber = Convert.ToString(form["ChequeNumber"]); generalPaymentsDto.Narration = Convert.ToString(form["Narration"]); generalPaymentsDto.TransactionType = Convert.ToInt32(form["TransactionType"]); string dttranformat = form["TransactionDate"].Contains("/") ? "dd/MMM/yyyy" : "dd-MMM-yyyy"; DateTime dtTransactionDate = DateTime.ParseExact(form["TransactionDate"], dttranformat, provider); DateTime dtChequeDate = DateTime.Now; if (form["ChequeDate"] != null && form["ChequeDate"] != string.Empty) { string dtcheckdateformant = form["ChequeDate"].Contains("/") ? "dd/MMM/yyyy" : "dd-MMM-yyyy"; dtChequeDate = DateTime.ParseExact(form["ChequeDate"], dtcheckdateformant, provider); } generalPaymentsDto.TransactionDate = dtTransactionDate; generalPaymentsDto.ChequeDate = dtChequeDate; int maxIndex = Convert.ToInt32(form["hdnMaxRateIndex"]); generalPaymentsDto.Addamount = new List <AddAmountDto>(); AddAmountDto Amount = null; for (int i = 1; i <= maxIndex; i++) { if (form["hdnAccountCode_" + i] == null) { continue; } Amount = new AddAmountDto(); if ((form["hdnSLAccountNo_" + i]) != "") { Amount.AHID = Convert.ToInt32(form["hdnSLAccountNo_" + i]); } else { Amount.AHID = Convert.ToInt32(form["hdnAHID_" + i]); } Amount.AHCode = form["hdnAccountCode_" + i]; Amount.Type = form["hdntypeBy_" + i]; Amount.AHName = form["hdnAccountName_" + i]; Amount.DrAmount = Convert.ToDecimal(form["hdnDrAmount_" + i]); Amount.CrAmount = Convert.ToDecimal(form["hdnCrAmount_" + i]); Amount.IsMaster = false; generalPaymentsDto.Addamount.Add(Amount); } var MasterAmount = new AddAmountDto(); MasterAmount.AHID = Convert.ToInt32(form["AccountHeadId"]); MasterAmount.CrAmount = Convert.ToDecimal(form["CRAmountTotal"]); MasterAmount.IsMaster = true; MasterAmount.DrAmount = 0; generalPaymentsDto.Addamount.Add(MasterAmount); return(generalPaymentsDto); }
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)); }
public ActionResult CreateGeneralPayments(string Id) { long AccountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString()); GeneralPaymentsDto objDto = new GeneralPaymentsDto(); if (AccountMasterId > 0) { objDto = _generalpaymentsService.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; bool isFederation = true; AccountHeadDto accountHeadDto = _accountheadService.GetAccountHeadViewBalanceSummary(ahId, isFederation); if (accountHeadDto.ClosingBalance != 0) { Decimal ClosingBalance = accountHeadDto.ClosingBalance - i.DrAmount; 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; BankMasterViewDto objBank = new BankMasterViewDto(); List <BankMasterViewDto> lstFedBanks = _groupReceiptService.GetFederationBanks(); SelectList lstFederationBanks = new SelectList(lstFedBanks, "BankEntryID", "AccountNumber", objBank.BankEntryID); ViewBag.federationbanks = lstFederationBanks; 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; return(View(objDto)); }