public ResultDto AddUpdateGeneralPayment(GroupGeneralPaymentDto _groupGeneralPaymentDto, int userId, int groupId)
        {
            GroupGeneralPaymentDal objDal = new GroupGeneralPaymentDal();
            string generalPaymentTranxml  = CommonMethods.SerializeListDto <List <GroupGeneralPaymentTranDto> >(_groupGeneralPaymentDto.TransactionsList);

            return(objDal.AddUpdateGeneralPayment(_groupGeneralPaymentDto, generalPaymentTranxml, userId, groupId));
        }
Пример #2
0
        public ResultDto AddUpdateGeneralPayment(GroupGeneralPaymentDto objDto, string generalPaymentTranxml, int userId, int groupId)
        {
            ResultDto res = new ResultDto();

            try
            {
                SqlConnection con = new SqlConnection(DBConstants.MFIS_CS);
                SqlCommand    cmd = new SqlCommand("uspGroupGeneralPaymentInsertUpdate", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@TransactionMode", objDto.TransactionMode);
                cmd.Parameters.AddWithValue("@TransactionDate", objDto.TransactionDate);
                if (!string.IsNullOrWhiteSpace(objDto.VoucherRefNumber))
                {
                    cmd.Parameters.AddWithValue("@VoucherRefNumber", objDto.VoucherRefNumber);
                }
                cmd.Parameters.AddWithValue("@CollectionAgent", objDto.CollectionAgent);
                if (objDto.TransactionMode == "BC")
                {
                    cmd.Parameters.AddWithValue("@ChequeNumber", objDto.ChequeNumber);
                    cmd.Parameters.AddWithValue("@ChequeDate", objDto.ChequeDate);
                }
                cmd.Parameters.AddWithValue("@Amount", objDto.TotalAmount);
                if (objDto.TransactionMode != "C")
                {
                    cmd.Parameters.AddWithValue("@BankEntryId", objDto.BankEntryId);
                }

                cmd.Parameters.AddWithValue("@Narration", objDto.Narration);
                cmd.Parameters.AddWithValue("@UserId", userId);
                cmd.Parameters.AddWithValue("@GroupId", groupId);
                cmd.Parameters.AddWithValue("@TransactionXML", generalPaymentTranxml);


                SqlParameter prmAccountMasterId = new SqlParameter("@AccountMasterId", SqlDbType.Int);
                prmAccountMasterId.Value     = objDto.AccountMasterID;
                prmAccountMasterId.Direction = ParameterDirection.InputOutput;
                cmd.Parameters.Add(prmAccountMasterId);

                SqlParameter prmVcoherNumber = new SqlParameter("@VoucherNumber", SqlDbType.VarChar, 32);
                prmVcoherNumber.Value     = objDto.VoucherNumber;
                prmVcoherNumber.Direction = ParameterDirection.InputOutput;
                cmd.Parameters.Add(prmVcoherNumber);
                con.Open();
                cmd.ExecuteNonQuery();

                res.ObjectId   = Convert.ToInt32(prmAccountMasterId.Value);
                res.ObjectCode = prmVcoherNumber.Value.ToString();
                con.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(res);
        }
Пример #3
0
        public ActionResult AddGeneralPayment(string Id)
        {
            int accountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString());
            GroupGeneralPaymentDto grpGeneralPaymentDto = new GroupGeneralPaymentDto();

            if (accountMasterId > 0)
            {
                grpGeneralPaymentDto = _groupGeneralPayemntService.GetGroupGeneralPaymentById(accountMasterId);
            }
            LoadOtherReceiptDropDowns();
            return(View(grpGeneralPaymentDto));
        }
Пример #4
0
        public GroupGeneralPaymentDto GetGroupGeneralPaymentById(long accountMasterId)
        {
            GroupGeneralPaymentDto objGp = null;
            SqlConnection          con   = new SqlConnection(DBConstants.MFIS_CS);
            SqlCommand             cmd   = new SqlCommand("uspGeneralPaymentsGetById_NEW", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@AccountMasterId", accountMasterId);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                objGp = new GroupGeneralPaymentDto();
                objGp.AccountMasterID     = accountMasterId;
                objGp.TransactionDate     = Convert.ToDateTime(dr["TransactionDate"]);
                objGp.TransactionMode     = Convert.ToString(dr["TransactionMode"]);
                objGp.VoucherNumber       = Convert.ToString(dr["VoucherNumber"]);
                objGp.VoucherRefNumber    = Convert.ToString(dr["VoucherRefNumber"]);
                objGp.CollectionAgent     = Convert.ToInt32(dr["EmployeeID"]);
                objGp.CollectionAgentName = Convert.ToString(dr["EmployeeName"]);
                objGp.ChequeNumber        = Convert.ToString(dr["ChequeNumber"]);
                if (!Convert.IsDBNull(dr["ChequeDate"]))
                {
                    objGp.ChequeDate = Convert.ToDateTime(dr["ChequeDate"]);
                }
                objGp.TotalAmount = Convert.ToDecimal(dr["Amount"]);
                if (!Convert.IsDBNull(dr["BankAccount"]))
                {
                    objGp.BankEntryId = Convert.ToInt32(dr["BankAccount"]);
                }
                objGp.ToAhNameForView = Convert.ToString(dr["ToAhName"]);
                objGp.Narration       = Convert.ToString(dr["Narration"]);
            }
            if (dr.NextResult())
            {
                objGp.TransactionsList = new List <GroupGeneralPaymentTranDto>();
                GroupGeneralPaymentTranDto objTran = null;
                while (dr.Read())
                {
                    objTran             = new GroupGeneralPaymentTranDto();
                    objTran.GLAccountId = Convert.ToInt32(dr["GLAhId"]);
                    objTran.SLAccountId = Convert.ToInt32(dr["SLAhId"]);
                    objTran.GLAccount   = Convert.ToString(dr["GLAHNAME"]);
                    objTran.SLAccount   = Convert.ToString(dr["SLAHNAME"]);
                    objTran.Amount      = Convert.ToDecimal(dr["Amount"]);
                    objGp.TransactionsList.Add(objTran);
                }
            }
            return(objGp);
        }
Пример #5
0
        public ActionResult ViewGeneralPayment(string id)
        {
            int accountMasterId = Convert.ToInt32(id.DecryptString());

            GroupGeneralPaymentDto grpGeneralPaymentDto = new GroupGeneralPaymentDto();

            if (accountMasterId > 0)
            {
                grpGeneralPaymentDto = _groupGeneralPayemntService.GetGroupGeneralPaymentById(accountMasterId);
            }

            if (accountMasterId < 1)
            {
                return(RedirectToAction("GeneralPaymentsLookup"));
            }

            return(View(grpGeneralPaymentDto));
        }
Пример #6
0
        public ActionResult AddGeneralPayment(FormCollection form)
        {
            GroupGeneralPaymentDto _groupGeneralPaymentDto = new GroupGeneralPaymentDto();

            try
            {
                _groupGeneralPaymentDto.AccountMasterID = Convert.ToInt32(Request.Form["AccountMasterID"]);
                _groupGeneralPaymentDto.TransactionMode = Convert.ToString(Request.Form["TransactionMode"]);

                string   tranDate   = _groupGeneralPaymentDto.TransactionMode == "C" ? Request.Form["TransactionDate"] : Request.Form["txtTransactionDate"];
                DateTime dtTranDate = tranDate.ConvertToDateTime();
                _groupGeneralPaymentDto.TransactionDate = dtTranDate;

                _groupGeneralPaymentDto.VoucherRefNumber = Convert.ToString(Request.Form["VoucherRefNumber"]);
                _groupGeneralPaymentDto.CollectionAgent  = Convert.ToInt32(Request.Form["CollectionAgent"]);

                if (_groupGeneralPaymentDto.TransactionMode == "BC")
                {
                    _groupGeneralPaymentDto.ChequeNumber = Convert.ToString(Request.Form["ChequeNumber"]);
                    _groupGeneralPaymentDto.ChequeDate   = Request.Form["ChequeDate"].ConvertToDateTime();
                }
                _groupGeneralPaymentDto.TotalAmount = Convert.ToDecimal(Request.Form["hdnTotalAmount"]);
                if (_groupGeneralPaymentDto.TransactionMode != "C")
                {
                    _groupGeneralPaymentDto.BankEntryId = Convert.ToInt32(Request.Form["BankEntryId"]);
                }

                _groupGeneralPaymentDto.Narration = Convert.ToString(Request.Form["Narration"]);
                ViewBag.LockStatus = GroupInfo.LockStatus;
                //Transactions Read
                _groupGeneralPaymentDto.TransactionsList = new List <GroupGeneralPaymentTranDto>();

                int maxCount = Convert.ToInt32(Request.Form["hdnMaxTranCount"]);

                GroupGeneralPaymentTranDto objTran = null;
                for (int index = 0; index <= maxCount; index++)
                {
                    if (Request.Form["hdnSLId_" + index] == null)
                    {
                        continue;
                    }

                    objTran             = new GroupGeneralPaymentTranDto();
                    objTran.GLAccount   = Convert.ToString(Request.Form["hdnGLAccount_" + index]);
                    objTran.SLAccount   = Convert.ToString(Request.Form["hdnSLAccount_" + index]);
                    objTran.SLAccountId = Convert.ToInt32(Request.Form["hdnSLId_" + index]);
                    objTran.Amount      = Convert.ToDecimal(Request.Form["hdnAmount_" + index]);

                    _groupGeneralPaymentDto.TransactionsList.Add(objTran);
                }

                //Save
                ResultDto resultDto = new ResultDto();
                int       GroupId   = GroupInfo.GroupID;
                resultDto = _groupGeneralPayemntService.AddUpdateGeneralPayment(_groupGeneralPaymentDto, UserInfo.UserID, GroupId);
                _groupGeneralPaymentDto.VoucherNumber   = resultDto.ObjectCode;
                _groupGeneralPaymentDto.AccountMasterID = resultDto.ObjectId;

                LoadOtherReceiptDropDowns();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View(_groupGeneralPaymentDto));
        }