Ejemplo n.º 1
0
        private ResultDto insertUpdaterefundsFromFederation(GeneralReceiptDto generalpayments)
        {
            ResultDto resultDto = new ResultDto();

            generalpayments.IsGroup        = true;
            generalpayments.IsPairedRecord = true;
            string objectName = "Refunds From Federation";

            try
            {
                string          amountxml            = CommonMethods.SerializeListDto <List <AddAmountDto> >(generalpayments.Addamount);
                ObjectParameter paramAccountMasterID = new ObjectParameter("AccountMasterID", generalpayments.AccountMasterID);
                ObjectParameter paramVoucherNumber   = new ObjectParameter("VoucherNumber", string.Empty);


                _dbContext.uspAccountMasterRefundsFromFederationInsert(paramAccountMasterID, generalpayments.TransactionDate, paramVoucherNumber, generalpayments.VoucherRefNumber, generalpayments.PartyName, generalpayments.EmployeeID, generalpayments.AHID,
                                                                       generalpayments.SubHeadID, generalpayments.TransactionType, generalpayments.Amount, generalpayments.TransactionMode, generalpayments.ChequeNumber, generalpayments.ChequeDate,
                                                                       generalpayments.BankAccount, generalpayments.Narration, generalpayments.IsGroup, generalpayments.GroupID, generalpayments.UserID, generalpayments.Type, generalpayments.IsPairedRecord, amountxml);
                long masterObjectId = Convert.ToInt64(paramAccountMasterID.Value);
                resultDto.ObjectId   = Convert.ToInt32(masterObjectId);
                resultDto.ObjectCode = string.IsNullOrEmpty((string)paramVoucherNumber.Value) ? generalpayments.VoucherNumber : (string)paramVoucherNumber.Value;

                if (resultDto.ObjectId > 0)
                {
                    resultDto.Message = string.Format("{0} details saved successfully with code : {1}", objectName, resultDto.ObjectCode);
                }
                else if (resultDto.ObjectId == -1)
                {
                    resultDto.Message = string.Format("Error occured while generating {0} code", objectName);
                }
                else
                {
                    resultDto.Message = string.Format("Error occured while saving {0} details", objectName);
                }
            }
            catch (Exception)
            {
                resultDto.Message  = string.Format("Service layer error occured while saving the {0} details", objectName);
                resultDto.ObjectId = -98;
            }
            return(resultDto);
        }
        public GeneralReceiptDto GetByID(long AccountMasterId)
        {
            long            accountmasterID    = Convert.ToInt64(AccountMasterId);
            ObjectParameter prmAccountMasterId = new ObjectParameter("AccountMasterId", accountmasterID);

            var results = new MFISDBContext()
                          .MultipleResults(CustomProcNames.uspGeneralReceiptGetById, prmAccountMasterId)
                          .With <GeneralReceiptDto>()
                          .With <AddAmountDto>()
                          .Execute();
            GeneralReceiptDto generalReceiptDto = new GeneralReceiptDto();

            if ((results[0] as List <GeneralReceiptDto>).Count > 0)
            {
                generalReceiptDto = (results[0] as List <GeneralReceiptDto>)[0];
                var addAmountDtoList = results[1] as List <AddAmountDto>;
                generalReceiptDto.Addamount = addAmountDtoList;
            }
            return(generalReceiptDto);
        }
Ejemplo n.º 3
0
        public GeneralReceiptDto GetByID(long AccountMasterId)
        {
            long            accountmasterID    = Convert.ToInt64(AccountMasterId);
            ObjectParameter prmAccountMasterId = new ObjectParameter("AccountMasterId", accountmasterID);

            var results = new MFISDBContext()
                          .MultipleResults("uspRefundsFromfederationGetById", prmAccountMasterId)
                          .With <GeneralReceiptDto>()
                          .With <AddAmountDto>()
                          .Execute();
            var generalPaymentsDto = new GeneralReceiptDto();
            var addAmountDtoList   = new List <AddAmountDto>();

            if ((results[0] as List <GeneralReceiptDto>).Count > 0)
            {
                generalPaymentsDto           = (results[0] as List <GeneralReceiptDto>)[0];
                addAmountDtoList             = results[1] as List <AddAmountDto>;
                generalPaymentsDto.Addamount = addAmountDtoList;
            }


            return(generalPaymentsDto);
        }
Ejemplo n.º 4
0
 public ResultDto Update(GeneralReceiptDto generalpayments)
 {
     return(insertUpdaterefundsFromFederation(generalpayments));
 }
 public ResultDto Update(GeneralReceiptDto generalreceiptDto)
 {
     return(insertupdateGeneralreceipt(generalreceiptDto));
 }
        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));
        }
        private GeneralReceiptDto ReadFormData(FormCollection form)
        {
            GeneralReceiptDto generalreceiptDto = new GeneralReceiptDto();

            generalreceiptDto.AccountMasterID = Convert.ToInt64(Request.Form["hdnObjectID"]);
            if (generalreceiptDto.AccountMasterID == 0)
            {
                int accountMasterID = default(int);
                int.TryParse(form["AccountMasterID"], out accountMasterID);
            }
            generalreceiptDto.UserID     = UserInfo.UserID;
            generalreceiptDto.EmployeeID = UserInfo.UserID;
            if (form["BankAccount"] != null && form["BankAccount"] != string.Empty && form["BankAccount"] != "0")
            {
                generalreceiptDto.BankAccount = Convert.ToInt32(form["BankAccount"]);
            }
            generalreceiptDto.AHID             = Convert.ToInt32(form["hdnCashinHandAHID"]);
            generalreceiptDto.Amount           = Convert.ToDecimal(form["DRAmountTotal"]);
            generalreceiptDto.GroupID          = GroupInfo.GroupID;
            generalreceiptDto.VoucherRefNumber = Convert.ToString(form["VoucherRefNumber"]);
            generalreceiptDto.PartyName        = Convert.ToString(form["PartyName"]);
            generalreceiptDto.TransactionMode  = Convert.ToString(form["TransactionMode"]);
            generalreceiptDto.ChequeNumber     = Convert.ToString(form["ChequeNumber"]);
            generalreceiptDto.Narration        = Convert.ToString(form["Narration"]);
            generalreceiptDto.TransactionType  = Convert.ToInt32(form["TransactionType"]);
            DateTime dtTransactionDate = DateTime.ParseExact(form["TransactionDate"], "dd/MMM/yyyy", provider);
            DateTime dtChequeDate      = DateTime.Now;

            if (form["ChequeDate"] != null && form["ChequeDate"] != string.Empty)
            {
                dtChequeDate = DateTime.ParseExact(form["ChequeDate"], "dd/MMM/yyyy", provider);
            }

            generalreceiptDto.TransactionDate = dtTransactionDate;
            generalreceiptDto.ChequeDate      = dtChequeDate;

            int maxIndex = Convert.ToInt32(form["hdnMaxRateIndex"]);

            generalreceiptDto.Addamount = new List <AddAmountDto>();
            AddAmountDto Amount = null;

            for (int i = 1; i <= maxIndex; i++)
            {
                if (form["hdnAccountCode_" + i] == null)
                {
                    continue;
                }

                Amount          = new AddAmountDto();
                Amount.AHID     = Convert.ToInt32(form["FedAHead_" + 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;
                generalreceiptDto.Addamount.Add(Amount);
            }
            var MasterAmount = new AddAmountDto();

            MasterAmount.AHID     = Convert.ToInt32(form["hdnCashinHandAHID"]);
            MasterAmount.CrAmount = 0;
            MasterAmount.DrAmount = Convert.ToDecimal(form["DRAmountTotal"]);
            MasterAmount.IsMaster = true;
            generalreceiptDto.Addamount.Add(MasterAmount);
            return(generalreceiptDto);
        }
        public ActionResult CreateGeneralReceipt(string Id)
        {
            long AccountMasterId     = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString());
            GeneralReceiptDto objDto = new GeneralReceiptDto();

            if (AccountMasterId > 0)
            {
                objDto = _generalReceiptService.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.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;
                }
            }

            //bool isFederation = true;
            //List<AccountHeadDto> lstslaccounts = _accountheadService.GetAll(isFederation).FindAll(f => f.AHLevel > 4 && f.IsSLAccount == false);
            //SelectList slaccountno = new SelectList(lstslaccounts, "AHID", "AHCode");
            //ViewBag.slaccounts = slaccountno;

            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();

            for (int i = 0; i < lstFedBanks.Count; i++)
            {
                var lst = lstFedBanks[i].AccountNumber + ':' + lstFedBanks[i].BankCode;
                lstFedBanks[i].AccountNumber = lst;
            }
            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));
        }
        public ActionResult CreateGeneralReceipt(string Id)
        {
            long AccountMasterId     = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt64(Id.DecryptString());
            GeneralReceiptDto objDto = new GeneralReceiptDto();

            ViewBag.LockStatus = GroupInfo.LockStatus;
            if (AccountMasterId > 0)
            {
                objDto = _generalReceiptService.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.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;
                    }
                }

                else
                {
                    ViewBag.Message = "General receipt was Not Active";
                }
            }

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

            List <AccountHeadDto> lstAccountHeadDtos = _accountheadService.GetGroupAccountTree(GroupInfo.GroupID);

            lstAccountHeadDtos = lstAccountHeadDtos.FindAll(l => l.AHLevel > 3);
            //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));
        }