コード例 #1
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);
        }
コード例 #2
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));
        }