private ResultDto GroupInsertUpdateContraEntryDeposited(ContraEntryDepositedDto contraEntryDepositedDto)
        {
            ResultDto resultDto  = new ResultDto();
            string    objectName = "ContraEntryDeposited";

            try
            {
                string contraEntryTransactionsxml = CommonMethods.SerializeListDto <List <ContraEntryDepositedTransactionsDto> >(contraEntryDepositedDto.contraEntryDepositedTransactions);

                ObjectParameter paramaccounmasterID = new ObjectParameter("AccountMasterID", contraEntryDepositedDto.AccountMasterID);
                ObjectParameter paramreCEWCode;
                if (contraEntryDepositedDto.VoucherNumber == "")
                {
                    paramreCEWCode = new ObjectParameter("VoucherNumber", string.Empty);
                }
                else
                {
                    paramreCEWCode = new ObjectParameter("VoucherNumber", contraEntryDepositedDto.VoucherNumber);
                }

                _dbContext.uspGroupContraEntryDepositedInsertUpdate(paramaccounmasterID, contraEntryDepositedDto.TransactionDate, paramreCEWCode, contraEntryDepositedDto.VoucherRefNumber, contraEntryDepositedDto.CodeSno, contraEntryDepositedDto.PartyName, contraEntryDepositedDto.EmployeeID,
                                                                    contraEntryDepositedDto.AHID, contraEntryDepositedDto.SubHeadID, contraEntryDepositedDto.TransactionType, contraEntryDepositedDto.Amount, contraEntryDepositedDto.TransactionMode,
                                                                    contraEntryDepositedDto.BankAccount, contraEntryDepositedDto.Narration, contraEntryTransactionsxml, contraEntryDepositedDto.IsGroup, contraEntryDepositedDto.GroupID, contraEntryDepositedDto.UserID);

                resultDto.ObjectId   = Convert.ToInt32(paramaccounmasterID.Value);
                resultDto.ObjectCode = string.IsNullOrEmpty((string)paramreCEWCode.Value) ? contraEntryDepositedDto.VoucherNumber : (string)paramreCEWCode.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);
        }
Beispiel #2
0
        private ContraEntryDepositedDto ReadFormDataDeposited(FormCollection form)
        {
            ContraEntryDepositedDto contraEntryDepositedDto = new ContraEntryDepositedDto();

            contraEntryDepositedDto.AccountMasterID = Convert.ToInt32(form["hdnAccountMasterID"]);
            DateTime transactionDate = form["TransactionDate"].ConvertToDateTime();

            contraEntryDepositedDto.TransactionDate  = transactionDate;
            contraEntryDepositedDto.VoucherNumber    = Convert.ToString(form["hdnVoucherNumber"]);
            contraEntryDepositedDto.VoucherRefNumber = Convert.ToString(form["VoucherNumber"]);
            contraEntryDepositedDto.PartyName        = Convert.ToString(form["PartyName"]);
            contraEntryDepositedDto.TransactionMode  = "C";
            contraEntryDepositedDto.AHID             = Convert.ToInt32(form["hdnCashInHandAHID"]);
            contraEntryDepositedDto.EmployeeID       = UserInfo.UserID;;
            contraEntryDepositedDto.TransactionType  = Convert.ToInt32(form["TransactionType"]);
            contraEntryDepositedDto.Amount           = Convert.ToInt32(form["TotalAmmount"]);
            contraEntryDepositedDto.Narration        = Convert.ToString(form["Narration"]);
            contraEntryDepositedDto.UserID           = UserInfo.UserID;
            contraEntryDepositedDto.GroupID          = GroupInfo.GroupID;

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

            contraEntryDepositedDto.contraEntryDepositedTransactions = new List <ContraEntryDepositedTransactionsDto>();
            ContraEntryDepositedTransactionsDto contraEntrydepositedtransactions = null;

            for (int i = 1; i <= maxIndex; i++)
            {
                contraEntrydepositedtransactions          = new ContraEntryDepositedTransactionsDto();
                contraEntrydepositedtransactions.AHID     = Convert.ToInt32(form["hdnAHID_" + i]);;
                contraEntrydepositedtransactions.CrAmount = Convert.ToDecimal(form["hdnCrAmount_" + i]);
                contraEntrydepositedtransactions.DrAmount = Convert.ToDecimal(form["hdnDrAmount_" + i]);
                contraEntryDepositedDto.contraEntryDepositedTransactions.Add(contraEntrydepositedtransactions);
            }

            contraEntrydepositedtransactions          = new ContraEntryDepositedTransactionsDto();
            contraEntrydepositedtransactions.AHID     = Convert.ToInt32(form["hdnCashInHandAHID"]);
            contraEntrydepositedtransactions.DrAmount = 0;
            contraEntrydepositedtransactions.CrAmount = contraEntryDepositedDto.contraEntryDepositedTransactions.Sum(s => s.DrAmount);
            contraEntrydepositedtransactions.IsMaster = true;
            contraEntryDepositedDto.contraEntryDepositedTransactions.Add(contraEntrydepositedtransactions);
            return(contraEntryDepositedDto);
        }
        public ActionResult CreateContraEntryDeposited(string id)
        {
            long AccountMasterID = string.IsNullOrEmpty(id.DecryptString()) ? default(long) : Convert.ToInt32(id.DecryptString());
            ContraEntryDepositedDto contraEntryDepositedDto = new ContraEntryDepositedDto();

            if (AccountMasterID > 0)
            {
                contraEntryDepositedDto = _ContraEntryService.FederationContraEntryDepositedGetByAccountMasterId(AccountMasterID);
            }

            BankMasterViewDto objBank = new BankMasterViewDto();

            List <BankMasterViewDto> lstAllBanks = _ContraEntryService.GetAllOrganizationBanks();
            SelectList lstBanks = new SelectList(lstAllBanks, "AHID", "AccountNumber", objBank.BankEntryID);

            ViewBag.AllBanks = lstBanks;


            AccountHeadDto objAccountHead  = _accountheadService.GetCashInHandAccount(true);
            int            ahId            = objAccountHead.AHID;
            AccountHeadDto closeingBalance = _accountheadService.GetAccountHeadViewBalanceSummary(ahId, true);

            objAccountHead.ClosingBalance = closeingBalance.ClosingBalance;
            ViewBag.CashInHandDetails     = objAccountHead;

            int EmployeeID = UserInfo.UserID;

            contraEntryDepositedDto.UserID = UserInfo.UserID;
            EmployeeDto obj = _employeeService.GetByID(EmployeeID);

            contraEntryDepositedDto.EmployeeName = obj.EmployeeName;
            contraEntryDepositedDto.EmployeeCode = obj.EmployeeCode;

            if (contraEntryDepositedDto.contraEntryDepositedTransactions != null && contraEntryDepositedDto.contraEntryDepositedTransactions.Count > 0)
            {
                var totalCrAmmount = contraEntryDepositedDto.contraEntryDepositedTransactions[contraEntryDepositedDto.contraEntryDepositedTransactions.Count() - 1].CrAmount;
                ViewBag.TotalCrAmmount = totalCrAmmount;
            }

            return(View(contraEntryDepositedDto));
        }
 public ResultDto GroupUpdateContraEntryDeposited(ContraEntryDepositedDto contraEntryDepositedDto)
 {
     return(GroupInsertUpdateContraEntryDeposited(contraEntryDepositedDto));
 }
 public ResultDto FederationUpdateContraEntryDeposited(ContraEntryDepositedDto contraEntryDepositedDto)
 {
     return(FederationInsertUpdateContraEntryDeposited(contraEntryDepositedDto));
 }