Esempio n. 1
0
        public GroupMemberPaymentDto GetGroupMemberPaymentById(long accountMasterId)
        {
            GroupMemberPaymentDto objGp = null;
            SqlConnection         con   = new SqlConnection(DBConstants.MFIS_CS);
            SqlCommand            cmd   = new SqlCommand("uspMemberPaymentsGetById", con);

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

            if (dr.Read())
            {
                objGp = new GroupMemberPaymentDto();
                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.MemberId            = Convert.ToInt32(dr["MemberID"]);
                objGp.MemberName          = Convert.ToString(dr["MemberName"]);
                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 <GroupMemberPaymentTranDto>();
                GroupMemberPaymentTranDto objTran = null;
                while (dr.Read())
                {
                    objTran             = new GroupMemberPaymentTranDto();
                    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);
        }
Esempio n. 2
0
        public ActionResult AddMemberPayment(FormCollection form)
        {
            GroupMemberPaymentDto _groupMemberPaymentDto = new GroupMemberPaymentDto();

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

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

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

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

                _groupMemberPaymentDto.Narration = Convert.ToString(Request.Form["Narration"]);

                //Transactions Read
                _groupMemberPaymentDto.TransactionsList = new List <GroupMemberPaymentTranDto>();

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

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

                    objTran             = new GroupMemberPaymentTranDto();
                    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]);

                    _groupMemberPaymentDto.TransactionsList.Add(objTran);
                }

                //Save
                ResultDto resultDto = new ResultDto();
                int       GroupId   = GroupInfo.GroupID;
                resultDto = _groupMemberPayemntService.AddUpdateMemberPayment(_groupMemberPaymentDto, UserInfo.UserID, GroupId);
                _groupMemberPaymentDto.VoucherNumber   = resultDto.ObjectCode;
                _groupMemberPaymentDto.AccountMasterID = resultDto.ObjectId;

                LoadMemberPaymentDropDowns();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View(_groupMemberPaymentDto));
        }