コード例 #1
0
        public ActionResult CreateGeneralPayments()
        {
            GeneralPaymentsDto     objGeneralPaymentsModel = new GeneralPaymentsDto();
            List <GroupMeetingDto> lstGroupMeetings        = _groupOtherReceiptService.MeetingDates(GroupInfo.GroupID);

            //If no meetings has been conducted user should not allow to make any transactions
            if (lstGroupMeetings == null || lstGroupMeetings.Count < 1)
            {
                return(RedirectToAction("CreateGroupMeeting", "GroupMeeting"));
            }
            lstGroupMeetings.ForEach(l => { l.DisplayMeetingDate = l.MeetingDate.ToDisplayDateFormat(); });
            ViewBag.MonthMeetings = new SelectList(lstGroupMeetings, "DisplayMeetingDate", "DisplayMeetingDate");
            LoadOtherReceiptDropDowns();
            return(View(objGeneralPaymentsModel));
        }
コード例 #2
0
        private ResultDto insertUpdateGeneralPayments(GeneralPaymentsDto generalpayments)
        {
            ResultDto resultDto = new ResultDto();

            generalpayments.IsGroup  = Convert.ToBoolean(0);
            generalpayments.IsMaster = Convert.ToBoolean(0);
            string objectName = "General Payments";

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


                _dbContext.uspAccountMasterInsertUpdate(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.IsMaster, 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);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public GeneralPaymentsDto GetByID(long AccountMasterId)
        {
            long            accountmasterID    = Convert.ToInt64(AccountMasterId);
            ObjectParameter prmAccountMasterId = new ObjectParameter("AccountMasterId", accountmasterID);

            var results = new MFISDBContext()
                          .MultipleResults(CustomProcNames.uspGeneralPaymentsGetById, prmAccountMasterId)
                          .With <GeneralPaymentsDto>()
                          .With <AddAmountDto>()
                          .Execute();
            GeneralPaymentsDto generalPaymentsDto = new GeneralPaymentsDto();

            if ((results[0] as List <GeneralPaymentsDto>).Count > 0)
            {
                generalPaymentsDto = (results[0] as List <GeneralPaymentsDto>)[0];
                var addAmountDtoList = results[1] as List <AddAmountDto>;
                generalPaymentsDto.Addamount = addAmountDtoList;
            }
            return(generalPaymentsDto);
        }
コード例 #5
0
 public ResultDto Update(GeneralPaymentsDto generalpayments)
 {
     return(insertUpdateGeneralPayments(generalpayments));
 }
コード例 #6
0
        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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
        }