public string GetSupplierPaymentsByID(string ID) { SupplierPaymentsViewModel supplierpaylist = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.GetSupplierPaymentsByID(ID)); // if (supplierpaylist.ApprovalStatus != 1) // { AppUA appUA = Session["AppUA"] as AppUA; if (appUA.RolesCSV.Contains("CEO") || appUA.RolesCSV.Contains("SAdmin")) { supplierpaylist.HasAccess = true; } //} return(JsonConvert.SerializeObject(new { Result = "OK", Records = supplierpaylist })); }
public string InsertUpdatePayments(SupplierPaymentsViewModel _supplierObj) { try { if (_supplierObj.TotalPaidAmt == 0) { _supplierObj.TotalPaidAmt = Decimal.Parse(_supplierObj.hdfCreditAmount); } if (_supplierObj.TotalPaidAmt == 0 && _supplierObj.Type == "C" || _supplierObj.hdfType == "C") { _supplierObj.TotalPaidAmt = Decimal.Parse(_supplierObj.hdfCreditAmount); //_supplierObj.AdvanceAmount = 0; if (_supplierObj.TotalPaidAmt == 0) { throw new Exception("Please Check Credit Notes"); } } else if (_supplierObj.TotalPaidAmt == 0) { throw new Exception("Please Enter Amount"); } AppUA appUA = Session["AppUA"] as AppUA; if (_supplierObj.paymentDetailhdf != null) { _supplierObj.supplierPaymentsDetail = JsonConvert.DeserializeObject <List <SupplierPaymentsDetailViewModel> >(_supplierObj.paymentDetailhdf); } _supplierObj.CommonObj = new CommonViewModel(); _supplierObj.CommonObj.CreatedBy = appUA.UserName; _supplierObj.CommonObj.CreatedDate = common.GetCurrentDateTime(); _supplierObj.CommonObj.UpdatedBy = appUA.UserName; _supplierObj.CommonObj.UpdatedDate = common.GetCurrentDateTime(); SupplierPaymentsViewModel CPVM = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.InsertUpdatePayments(Mapper.Map <SupplierPaymentsViewModel, SupplierPayments>(_supplierObj))); if (_supplierObj.ID != null && _supplierObj.ID != Guid.Empty) { return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.UpdateSuccess, Records = CPVM })); } else { return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = CPVM })); } } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string ApprovedPayment(SupplierPaymentsViewModel supobj) { AppUA appUA = Session["AppUA"] as AppUA; object result = null; try { result = _supplierPaymentsBusiness.ApprovedPayment(supobj.ID, appUA.UserName, common.GetCurrentDateTime()); return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string DeletePayments(SupplierPaymentsViewModel _supplierpayObj) { AppUA appUA = Session["AppUA"] as AppUA; object result = null; try { result = _supplierPaymentsBusiness.DeletePayments(_supplierpayObj.ID, appUA.UserName); return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.DeleteSuccess, Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string InsertPaymentAdjustment(SupplierPaymentsViewModel _supplierpayObj) { try { AppUA appUA = Session["AppUA"] as AppUA; _supplierpayObj.CommonObj = new CommonViewModel(); _supplierpayObj.CommonObj.CreatedBy = appUA.UserName; _supplierpayObj.CommonObj.CreatedDate = common.GetCurrentDateTime(); SupplierPaymentsViewModel CPVM = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.InsertPaymentAdjustment(Mapper.Map <SupplierPaymentsViewModel, SupplierPayments>(_supplierpayObj))); return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = CPVM })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string InsertRevise(SupplierPaymentsViewModel SupplierPaymentVM) { try { AppUA appUA = Session["AppUA"] as AppUA; SupplierPaymentVM.DocumentLogObj.CommonObj = new CommonViewModel(); SupplierPaymentVM.DocumentLogObj.CommonObj.CreatedBy = appUA.UserName; SupplierPaymentVM.DocumentLogObj.CommonObj.CreatedDate = common.GetCurrentDateTime(); SupplierPaymentVM.DocumentLogObj.Date = common.GetCurrentDateTime(); var result = (_supplierPaymentsBusiness.InsertRevise(Mapper.Map <DocumentLogViewModel, DocumentLog>(SupplierPaymentVM.DocumentLogObj))); return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.InsertSuccess, Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string Validate(SupplierPaymentsViewModel _supplierpayObj) { AppUA appUA = Session["AppUA"] as AppUA; object result = null; try { result = _supplierPaymentsBusiness.Validate(Mapper.Map <SupplierPaymentsViewModel, SupplierPayments>(_supplierpayObj)); return(JsonConvert.SerializeObject(new { Result = "OK", Message = "", Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message, Status = -1 })); } }
public string GetApprovedSupplierPayment(SupplierPayments SupObj) { try { if (SupObj == null) { throw new Exception(messages.NoItems); } if (SupObj.ApprovalDate == null) { SupObj.commonObj = new SPAccounts.DataAccessObject.DTO.Common(); SupObj.ApprovalDate = SupObj.commonObj.GetCurrentDateTime().ToString(); } SupplierPaymentsViewModel supplierpaylist = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.ApprovedSupplierPayment(SupObj)); return(JsonConvert.SerializeObject(new { Result = true, Records = supplierpaylist })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message })); } }
public string SendNotification(SupplierPaymentsViewModel supobj) { object result = null; try { string titleString = "Payment Approval"; string descriptionString = supobj.EntryNo + ", Supplier: " + supobj.supplierObj.CompanyName + ", Amount: " + supobj.TotalPaidAmt + ", Notes: " + supobj.GeneralNotes; Boolean isCommon = true; string CustomerID = ""; SupplierPaymentsViewModel CPVM = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.UpdateSupplierPaymentGeneralNotes(Mapper.Map <SupplierPaymentsViewModel, SupplierPayments>(supobj))); _supplierPaymentsBusiness.SendToFCM(titleString, descriptionString, isCommon, CustomerID); //Update notification result = _supplierPaymentsBusiness.UpdateNotification(Mapper.Map <SupplierPaymentsViewModel, SupplierPayments>(supobj)); return(JsonConvert.SerializeObject(new { Result = "OK", Message = c.NotificationSuccess, Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public ActionResult Index(string id) { ViewBag.value = id; AppUA appUA = Session["AppUA"] as AppUA; ViewBag.Currentdate = appUA.DateTime.ToString("dd-MMM-yyyy"); List <SelectListItem> selectListItem = new List <SelectListItem>(); SupplierPaymentsViewModel SP = new SupplierPaymentsViewModel(); //-------------1.Supplier List-------------------// SP.supplierObj = new SuppliersViewModel(); SP.supplierObj.SupplierList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <SuppliersViewModel> supplierList = Mapper.Map <List <Supplier>, List <SuppliersViewModel> >(_supplierBusiness.GetAllSuppliers()); foreach (SuppliersViewModel supplier in supplierList) { selectListItem.Add(new SelectListItem { Text = supplier.CompanyName, Value = supplier.ID.ToString(), Selected = false }); } SP.supplierObj.SupplierList = selectListItem; //-------------2.PaymentModes-------------------// SP.PaymentModesObj = new PaymentModesViewModel(); SP.PaymentModesObj.PaymentModesList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <PaymentModesViewModel> PaymentModeList = Mapper.Map <List <PaymentModes>, List <PaymentModesViewModel> >(_paymentmodesBusiness.GetAllPaymentModes()); foreach (PaymentModesViewModel PMVM in PaymentModeList) { selectListItem.Add(new SelectListItem { Text = PMVM.Description, Value = PMVM.Code, Selected = false }); } SP.PaymentModesObj.PaymentModesList = selectListItem; //-------------3.BanksList-------------------// SP.bankObj = new BankViewModel(); SP.bankObj.BanksList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <BankViewModel> BankList = Mapper.Map <List <Bank>, List <BankViewModel> >(_bankBusiness.GetAllBanks()); foreach (BankViewModel BL in BankList) { selectListItem.Add(new SelectListItem { Text = BL.Name, Value = BL.Code, Selected = false }); } SP.bankObj.BanksList = selectListItem; //-------------4.CompanyList-------------------// SP.CompanyObj = new CompaniesViewModel(); SP.CompanyObj.CompanyList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <CompaniesViewModel> CompaniesList = Mapper.Map <List <Companies>, List <CompaniesViewModel> >(_companiesBusiness.GetAllCompanies()); foreach (CompaniesViewModel BL in CompaniesList) { selectListItem.Add(new SelectListItem { Text = BL.Name, Value = BL.Code, Selected = false }); } SP.CompanyObj.CompanyList = selectListItem; //-------------4.Approval Status-------------------// SP.ApprovalStatusObj = new ApprovalStatusViewModel(); SP.ApprovalStatusObj.ApprovalStatusList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); List <ApprovalStatusViewModel> ApprovalStatus = Mapper.Map <List <ApprovalStatus>, List <ApprovalStatusViewModel> >(_approvalStatusBusiness.GetAllApprovalStatus()); foreach (ApprovalStatusViewModel BL in ApprovalStatus) { if (BL.Code != "4") { if (BL.Description != "Paid") { selectListItem.Add(new SelectListItem { Text = BL.Description, Value = BL.Code, Selected = false }); } else { selectListItem.Add(new SelectListItem { Text = BL.Description, Value = BL.Code, Disabled = true }); } } } SP.ApprovalStatusObj.ApprovalStatusList = selectListItem; //-------------5.Approve Status-------------------// SP.ApproveStatusObj = new ApprovalStatusViewModel(); SP.ApproveStatusObj.ApprovalStatusList = new List <SelectListItem>(); selectListItem = new List <SelectListItem>(); foreach (ApprovalStatusViewModel BL in ApprovalStatus) { if (BL.Code != "4") { selectListItem.Add(new SelectListItem { Text = BL.Description, Value = BL.Code, Selected = false }); } } SP.ApproveStatusObj.ApprovalStatusList = selectListItem; return(View(SP)); }
public string GetOutstandingAmountBySupplier(string CreditID, string SupplierID) { SupplierPaymentsViewModel Cus_pay = Mapper.Map <SupplierPayments, SupplierPaymentsViewModel>(_supplierPaymentsBusiness.GetOutstandingAmountBySupplier(SupplierID)); return(JsonConvert.SerializeObject(new { Result = "OK", Records = Cus_pay })); }