public GroupOtherRecieptDto EditGroupOtherReceipt(int AccountMasterId) { SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmd = new SqlCommand(ProcNames.GetGroupOtherReceiptById, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@AccountMasterId", AccountMasterId); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); GroupOtherRecieptDto OtherReceiptDto = null; if (dr.Read()) { OtherReceiptDto = new GroupOtherRecieptDto(); OtherReceiptDto.TransactionDate = Convert.ToDateTime(dr["TransactionDate"]); OtherReceiptDto.TransactionMode = Convert.ToString(dr["TransactionMode"]); OtherReceiptDto.VoucherNumber = Convert.ToString(dr["VoucherNumber"]); OtherReceiptDto.VoucherRefNumber = Convert.ToString(dr["VoucherRefNumber"]); OtherReceiptDto.CollectionAgent = Convert.ToInt32(dr["EmployeeID"]); OtherReceiptDto.ChequeNumber = Convert.ToString(dr["ChequeNumber"]); if (!Convert.IsDBNull(dr["ChequeDate"])) { OtherReceiptDto.ChequeDate = Convert.ToDateTime(dr["ChequeDate"]); } OtherReceiptDto.Amount = Convert.ToDecimal(dr["Amount"]); if (!Convert.IsDBNull(dr["BankAccount"])) { OtherReceiptDto.BankEntryId = Convert.ToInt32(dr["BankAccount"]); } OtherReceiptDto.SLAccountId = Convert.ToInt32(dr["AHID"]); OtherReceiptDto.GLAccountId = Convert.ToInt32(dr["ParentAHID"]); OtherReceiptDto.Narration = Convert.ToString(dr["Narration"]); } return(OtherReceiptDto); }
public GroupOtherPaymentsController() { _masterService = new MasterService(); _accountheadService = new AccountHeadService(); //_groupGeneralReceiptService = new GroupGeneralReceiptService(); _groupOtherReceiptService = new GroupOtherReceiptService(); _groupOtherReceiptDto = new GroupOtherRecieptDto(); }
public ActionResult CreateOtherReceipt(FormCollection form) { GroupOtherRecieptDto _groupOtherReceiptDto = new GroupOtherRecieptDto(); try { _groupOtherReceiptDto.AccountMasterID = Convert.ToInt32(Request.Form["AccountMasterID"]); _groupOtherReceiptDto.TransactionMode = Convert.ToString(Request.Form["TransactionMode"]); string tranDate = _groupOtherReceiptDto.TransactionMode == "C" ? Request.Form["TransactionDate"] : Request.Form["txtTransactionDate"]; DateTime dtTranDate = tranDate.ConvertToDateTime(); _groupOtherReceiptDto.TransactionDate = dtTranDate; _groupOtherReceiptDto.VoucherRefNumber = Convert.ToString(Request.Form["VoucherRefNumber"]); _groupOtherReceiptDto.CollectionAgent = Convert.ToInt32(Request.Form["CollectionAgent"]); _groupOtherReceiptDto.GLAccountId = Convert.ToInt32(Request.Form["GLAccountId"]); _groupOtherReceiptDto.SLAccountId = Convert.ToInt32(Request.Form["SLAccountId"]); if (_groupOtherReceiptDto.TransactionMode == "BC") { _groupOtherReceiptDto.ChequeNumber = Convert.ToString(Request.Form["ChequeNumber"]); _groupOtherReceiptDto.ChequeDate = Request.Form["ChequeDate"].ConvertToDateTime(); } bool isContra = Convert.ToBoolean((Request.Form["IsContra"]).Split(',')[0]); _groupOtherReceiptDto.Amount = Convert.ToDecimal(Request.Form["Amount"]); if (_groupOtherReceiptDto.TransactionMode != "C") { _groupOtherReceiptDto.BankEntryId = Convert.ToInt32(Request.Form["BankEntryId"]); } if (_groupOtherReceiptDto.TransactionMode == "C" && isContra == true) { _groupOtherReceiptDto.BankEntryId = Convert.ToInt32(Request.Form["BankEntryId"]); } _groupOtherReceiptDto.Narration = Convert.ToString(Request.Form["Narration"]); _groupOtherReceiptDto.UserId = UserInfo.UserID; //Save ResultDto resultDto = new ResultDto(); int GroupId = GroupInfo.GroupID; resultDto = _groupOtherReceiptService.Insert(_groupOtherReceiptDto, GroupId, isContra); _groupOtherReceiptDto.VoucherNumber = resultDto.ObjectCode; _groupOtherReceiptDto.AccountMasterID = resultDto.ObjectId; ViewBag.LockStatus = GroupInfo.LockStatus; LoadOtherReceiptDropDowns(); } catch (Exception ex) { throw ex; } return(View(_groupOtherReceiptDto)); }
private List <GroupOtherRecieptDto> ConvertGroupOtherRecieptDataTableToList(DataTable dtOtherReciept) { List <GroupOtherRecieptDto> lst = new List <GroupOtherRecieptDto>(); GroupOtherRecieptDto obj = null; foreach (DataRow dr in dtOtherReciept.Rows) { if (String.IsNullOrWhiteSpace(Convert.ToString(dr["TransactionMode"]).Trim())) { break; } obj = new GroupOtherRecieptDto(); obj.TransactionMode = Convert.ToString(dr["TransactionMode"]).Trim().ToUpper(); obj.TransactionDate = Convert.ToDateTime(dr["TransactionDate"]); obj.VoucherRefNumber = Convert.ToString(dr["VoucherReferenceNumber"]).Trim(); string strCollectionAgent = Convert.ToString(dr["CollectionAgent"]).Trim().ToUpper(); obj.CollectionAgent = objUploadValidateInfo.Employees.Find(l => l.EmployeeCode.Trim().ToUpper() == strCollectionAgent).EmployeeID; string strSLAccountCode = Convert.ToString(dr["SLAccountCode"]).Trim(); obj.SLAccountId = objUploadValidateInfo.SlAccountHeads.Find(l => l.AHCode.ToUpper() == strSLAccountCode.ToUpper()).AHId; if (obj.TransactionMode == "BC") { obj.ChequeNumber = Convert.ToString(dr["ChequeNumber"]).Trim().ToUpper(); string strChequeDate = Convert.ToString(dr["ChequeDate"]).Trim(); if (!String.IsNullOrWhiteSpace(strChequeDate)) { obj.ChequeDate = Convert.ToDateTime(strChequeDate); } } if (obj.TransactionMode == "BC" || obj.TransactionMode == "BD") { string strBankCode = Convert.ToString(dr["BankCode"]).Trim().ToUpper(); obj.BankEntryId = objUploadValidateInfo.GroupBanks.Find(l => l.BankCode.ToUpper() == strBankCode.ToUpper()).BankEntryId; } string strAmount = Convert.ToString(dr["Amount"]).Trim(); obj.Amount = Convert.ToDecimal(strAmount); obj.Narration = Convert.ToString(dr["Narration"]).Trim(); obj.UserId = UserInfo.UserID; lst.Add(obj); } return(lst); }
public ActionResult CreateOtherReceipt(string Id) { int AccountMasterId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString()); GroupOtherRecieptDto grpOtherReceiptDto = new GroupOtherRecieptDto(); if (AccountMasterId > 0) { grpOtherReceiptDto = _groupOtherReceiptService.EditGroupOtherReceipt(AccountMasterId); } ViewBag.LockStatus = GroupInfo.LockStatus; grpOtherReceiptDto.AccountMasterID = AccountMasterId; LoadOtherReceiptDropDowns(); return(View(grpOtherReceiptDto)); }
public GroupOtherReceiptController() { _masterService = new MasterService(); _groupOtherReceiptService = new GroupOtherReceiptService(); _groupOtherReceiptDto = new GroupOtherRecieptDto(); }
public GroupOtherRecieptDto EditGroupOtherReceipt(int AccountMasterId) { GroupOtherRecieptDto dto = _groupOtherReceiptDal.EditGroupOtherReceipt(AccountMasterId); return(dto); }
public ResultDto Insert(GroupOtherRecieptDto objDto, int GroupId, bool isContra) { ResultDto resultDto = new ResultDto(); return(_groupOtherReceiptDal.InsertUpdateOtherReciept(objDto, GroupId, isContra)); }
public ResultDto InsertUpdateOtherReciept(GroupOtherRecieptDto objDto, int groupId, bool isContra) { ResultDto res = new ResultDto(); try { SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.CommandText = "uspGroupOtherRecieptInsertUpdate"; 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); cmd.Parameters.AddWithValue("@GLAccountId", objDto.GLAccountId); cmd.Parameters.AddWithValue("@SLAccountId", objDto.SLAccountId); if (objDto.TransactionMode == "BC") { cmd.Parameters.AddWithValue("@ChequeNumber", objDto.ChequeNumber); cmd.Parameters.AddWithValue("@ChequeDate", objDto.ChequeDate); } cmd.Parameters.AddWithValue("@Amount", objDto.Amount); if (objDto.TransactionMode != "C") { cmd.Parameters.AddWithValue("@BankEntryId", objDto.BankEntryId); } if (objDto.TransactionMode == "C" && isContra == true) { cmd.Parameters.AddWithValue("@BankEntryId", objDto.BankEntryId); } cmd.Parameters.AddWithValue("@Narration", objDto.Narration); cmd.Parameters.AddWithValue("@UserId", objDto.UserId); cmd.Parameters.AddWithValue("@GroupId", groupId); cmd.Parameters.AddWithValue("@IsContra", isContra); 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); }