public JsonResult SaveCBPayment(NetStock.Contract.CBPayment CBPaymentdata) { try { CBPaymentdata.CreatedBy = Utility.DEFAULTUSER; CBPaymentdata.ModifiedBy = Utility.DEFAULTUSER; CBPaymentdata.Source = "CB"; CBPaymentdata.CurrencyCode = Utility.DEFAULTCURRENCYCODE; CBPaymentdata.BranchID = Utility.SsnBranch; if (CBPaymentdata.CBPaymentDetails != null) { foreach (var item in CBPaymentdata.CBPaymentDetails) { item.MatchDocumentDate = DateTime.UtcNow.ThaiTime(); } } var result = new NetStock.BusinessFactory.CBPaymentBO().SaveCBPayment(CBPaymentdata); } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); } return(Json(new { success = true, Message = "CBPayment saved successfully.", CBPaymentData = CBPaymentdata })); //return RedirectToAction("CBPayment"); }
public PartialViewResult AddCBPaymentItem(string documentNo, Int16 itemNo) { CBPaymentDetail cbPaymentDetail = null; if (documentNo == string.Empty || documentNo == null) { cbPaymentDetail = new CBPaymentDetail(); cbPaymentDetail.SetOffDate = DateTime.Now; } else { cbPaymentDetail = new NetStock.BusinessFactory.CBPaymentBO().GetCBPayment(new Contract.CBPayment { DocumentNo = documentNo }) .CBPaymentDetails.Where(dt => dt.ItemNo == itemNo).FirstOrDefault(); if (cbPaymentDetail == null) { cbPaymentDetail = new CBPaymentDetail(); } } cbPaymentDetail.CurrencyList = Utility.GetCurrencyItemList(); cbPaymentDetail.AccountCodeList = Utility.GetAccountCodeItemList(); cbPaymentDetail.ChargeCodeList = Utility.GetChargeCodeItemList(); cbPaymentDetail.SetOffDate = DateTime.Now; return(PartialView("AddChargeCode", cbPaymentDetail)); //return PartialView("AddQuotationItem"); }
public ActionResult CBPayment(string CBPaymentType, string DocumentNo) { CBPayment cbpayment = null; //DocumentNo = DocumentNo ?? Utility.NEWRECORD; if (DocumentNo == Utility.NEWRECORD) { cbpayment = new CBPayment(); //cbpayment.AccountDate =null; cbpayment.DocumentDate = DateTime.UtcNow.ThaiTime(); cbpayment.AccountDate = DateTime.UtcNow.ThaiTime(); cbpayment.ChequeDate = DateTime.UtcNow.ThaiTime(); cbpayment.CBPaymentDetails = new List <CBPaymentDetail>(); cbpayment.CBPaymentSetOffDetails = new List <CBPaymentSetOffDetail>(); cbpayment.CBPaymentGLDetails = new List <CBPaymentGlDetail>(); } else { var cbpaymentBO = new NetStock.BusinessFactory.CBPaymentBO(); //var cbpayment1 = new NetStock.BusinessFactory.CBPaymentBO().GetList(); cbpayment = new NetStock.BusinessFactory.CBPaymentBO().GetCBPayment(new CBPayment { DocumentNo = DocumentNo }); if (cbpayment == null) { cbpayment = new CBPayment(); } cbpayment.CBPaymentSetOffDetails = new List <CBPaymentSetOffDetail>(); cbpayment.CBPaymentGLDetails = new List <CBPaymentGlDetail>(); if (cbpayment.PaymentType == "CREDITOR") { } else if (cbpayment.PaymentType == "PAY-OTHERS") { cbpayment.CBPaymentDetails = new NetStock.BusinessFactory.CBPaymentDetailBO().GetListByDocumentNo(cbpayment.DocumentNo); cbpayment.GLTransactionDetails = new NetStock.BusinessFactory.GLTransactionBO().GetList(cbpayment.DocumentNo); } } cbpayment.PaymentTypeList = Utility.GetPaymentTypeList("PaymentType"); cbpayment.CreditorList = Utility.GetCreditorList(); cbpayment.BankCodeList = Utility.GetBankCodeList(); cbpayment.CurrencyCodeList = Utility.GetCurrencyItemList(); //cbpayment.CBPaymentDetails = new List<CBPaymentDetail>(); return(View("CBPayment", cbpayment)); }
public JsonResult DeleteCBPayment(string documentNo, string cancelBy) { //CBReceipt CBReceiptdata = var result = false; cancelBy = Utility.DEFAULTUSER; string message = string.Empty; try { result = new NetStock.BusinessFactory.CBPaymentBO().DeleteCBPayment(documentNo, cancelBy); } catch (Exception ex) { ModelState.AddModelError("Error", ex.Message); } return(Json(new { result = result, Message = "Payment deleted successfully.", documentNo = documentNo })); //return RedirectToAction("CBReceipt", new { CBReceiptType = "", DocumentNo = CBReceiptdata.DocumentNo }); }
public ActionResult CBSearchPayment(string DocumentNo) { if (DocumentNo != "0") { CBPayment cbPayment = null; var cbpaymentBO = new NetStock.BusinessFactory.CBPaymentBO(); var c = new NetStock.BusinessFactory.CBPaymentBO().GetList(); cbPayment = new NetStock.BusinessFactory.CBPaymentBO().GetList().Where(x => x.DocumentNo == DocumentNo).FirstOrDefault(); if (cbPayment == null) { cbPayment = new CBPayment(); } if (cbPayment.DocumentNo != null) { cbPayment.CBPaymentDetails = new NetStock.BusinessFactory.CBPaymentDetailBO().GetListByDocumentNo(cbPayment.DocumentNo); } else { cbPayment.CBPaymentDetails = new List <CBPaymentDetail>(); } //} cbPayment.DocumentDate = DateTime.Today.Date; cbPayment.PaymentTypeList = Utility.GetReceiptTypeList("PaymentType"); cbPayment.CreditorList = Utility.GetCreditorList(); cbPayment.BankCodeList = Utility.GetBankCodeList(); cbPayment.CurrencyCodeList = Utility.GetCurrencyItemList(); return(RedirectToAction("CBPayment", new { CBPaymentType = "", DocumentNo = DocumentNo })); //return View("CBReceipt", cbReceipt); } else { return(RedirectToAction("CBPayment")); } }
public ActionResult CBPaymentList() { var lstCBPayment = new NetStock.BusinessFactory.CBPaymentBO().GetList().Where(x => x.IsCancel == false).ToList(); return(View("CBPaymentList", lstCBPayment)); }