public PaymentVoucher CreateObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService, IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService) { paymentVoucher.Errors = new Dictionary <String, String>(); return(_validator.ValidCreateObject(paymentVoucher, this, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService) ? _repository.CreateObject(paymentVoucher) : paymentVoucher); }
public PaymentVoucher ConfirmObject(PaymentVoucher paymentVoucher, DateTime ConfirmationDate, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { paymentVoucher.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(paymentVoucher, this, _paymentVoucherDetailService, _cashBankService, _payableService, _closingService)) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var detail in details) { detail.Errors = new Dictionary <string, string>(); _paymentVoucherDetailService.ConfirmObject(detail, ConfirmationDate, this, _payableService); } _repository.ConfirmObject(paymentVoucher); if (!paymentVoucher.IsGBCH) { CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank); _cashMutationService.CashMutateObject(cashMutation, _cashBankService); _generalLedgerJournalService.CreateConfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService); } } return(paymentVoucher); }
public PaymentVoucher ReconcileObject(PaymentVoucher paymentVoucher, DateTime ReconciliationDate, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { paymentVoucher.ReconciliationDate = ReconciliationDate; if (_validator.ValidReconcileObject(paymentVoucher, _closingService)) { _repository.ReconcileObject(paymentVoucher); CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); CashMutation cashMutation = _cashMutationService.CreateCashMutationForPaymentVoucher(paymentVoucher, cashBank); _cashMutationService.CashMutateObject(cashMutation, _cashBankService); IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var paymentVoucherDetail in paymentVoucherDetails) { Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId); payable.PendingClearanceAmount -= paymentVoucherDetail.Amount; if (payable.PendingClearanceAmount == 0 && payable.RemainingAmount == 0) { payable.IsCompleted = true; payable.CompletionDate = DateTime.Now; } _payableService.UpdateObject(payable); } } return(paymentVoucher); }
public PaymentVoucher UnreconcileObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashMutationService _cashMutationService, ICashBankService _cashBankService, IPayableService _payableService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnreconcileObject(paymentVoucher, _closingService)) { _repository.UnreconcileObject(paymentVoucher); CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank); foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } IList <PaymentVoucherDetail> paymentVoucherDetails = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var paymentVoucherDetail in paymentVoucherDetails) { Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId); payable.PendingClearanceAmount += paymentVoucherDetail.Amount; if (payable.PendingClearanceAmount != 0 || payable.RemainingAmount != 0) { payable.IsCompleted = false; payable.CompletionDate = null; } _payableService.UpdateObject(payable); } } return(paymentVoucher); }
protected void GrdReport_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int DeleteId = Convert.ToInt32(((ImageButton)GrdReport.Rows[e.RowIndex].Cells[0].FindControl("ImgBtnDelete")).CommandArgument.ToString()); Entity_Call.VoucherId = Convert.ToInt32(DeleteId); Entity_Call.LoginID = Convert.ToInt32(Session["UserID"]); Entity_Call.LoginDate = DateTime.Now; int iDelete = Obj_Call.DeletePaymentVoucher(ref Entity_Call, out StrError); if (iDelete != 0) { CommFun.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } Entity_Call = null; Obj_Call = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
public PaymentVoucher UnconfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService, ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { if (_validator.ValidUnconfirmObject(paymentVoucher, _closingService)) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var detail in details) { detail.Errors = new Dictionary <string, string>(); _paymentVoucherDetailService.UnconfirmObject(detail, this, _payableService); } _repository.UnconfirmObject(paymentVoucher); if (!paymentVoucher.IsGBCH) { CashBank cashBank = _cashBankService.GetObjectById(paymentVoucher.CashBankId); IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForPaymentVoucher(paymentVoucher, cashBank); foreach (var cashMutation in cashMutations) { _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService); } _generalLedgerJournalService.CreateUnconfirmationJournalForPaymentVoucher(paymentVoucher, cashBank, _accountService); } } return(paymentVoucher); }
/// <summary> /// Saves the voucher. /// </summary> /// <param name="session">The session.</param> /// <param name="voucherdDate">The voucherd date.</param> /// <param name="voucherAmount">The voucher amount.</param> /// <param name="voucherType">Type of the voucher.</param> /// <param name="referenceId">The reference identifier.</param> /// <param name="description">The description.</param> /// <param name="userId">The user identifier.</param> /// <param name="locationId">The location identifier.</param> /// <returns></returns> public ResponseCode SaveVoucher(CurrentSession session, DateTime voucherdDate, double voucherAmount, string voucherType, string referenceId, string description) { if (session.HasFeaturePermission("BILLING_MODULE")) { IKnockOff mgr = (IKnockOff)ObjectFactory.CreateInstance("BusinessProcess.Billing.BKnockOff, BusinessProcess.Billing"); PaymentVoucher voucher = new PaymentVoucher() { Amount = voucherAmount, DeleteBy = null, DeleteDate = null, Description = description, LocationId = session.Facility.Id, UserId = session.User.Id, VoucherDate = voucherdDate, VoucherType = voucherType, ReferenceId = referenceId, Id = -1 }; PaymentVoucher newVoucher = mgr.SaveVoucher(voucher, session.User.Id); mgr = null; return(ResponseCode.Ok); } return(ResponseCode.Unauthorized); }
public PaymentVoucherDetail ConfirmObject(PaymentVoucherDetail paymentVoucherDetail, DateTime ConfirmationDate, IPaymentVoucherService _paymentVoucherService, IPayableService _payableService) { paymentVoucherDetail.ConfirmationDate = ConfirmationDate; if (_validator.ValidConfirmObject(paymentVoucherDetail, _payableService)) { PaymentVoucher paymentVoucher = _paymentVoucherService.GetObjectById(paymentVoucherDetail.PaymentVoucherId); Payable payable = _payableService.GetObjectById(paymentVoucherDetail.PayableId); if (paymentVoucher.IsGBCH) { payable.PendingClearanceAmount += paymentVoucherDetail.Amount; } payable.RemainingAmount -= paymentVoucherDetail.Amount; if (payable.RemainingAmount == 0 && payable.PendingClearanceAmount == 0) { payable.IsCompleted = true; payable.CompletionDate = DateTime.Now; } _payableService.UpdateObject(payable); paymentVoucherDetail = _repository.ConfirmObject(paymentVoucherDetail); } return(paymentVoucherDetail); }
public Result SavePaymentVoucher(PaymentVoucher req) { Result result = new Result(); if (!req.IsValid()) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = req.StatusDesc; return(result); } DataTable dt = dh.ExecuteDataSet("SavePaymentVoucher", new string[] { req.VoucherCode, req.InvoiceNumber, req.CompanyCode, req.VoucherAmount, req.IsUsed, req.ModifiedBy, req.Reason }).Tables[0]; if (dt.Rows.Count <= 0) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = "FAILED: SALE NOT SAVED"; return(result); } result.StatusCode = Globals.SUCCESS_STATUS_CODE; result.StatusDesc = Globals.SUCCESS_STATUS_TEXT; result.PegPayID = dt.Rows[0][0].ToString(); return(result); }
private PaymentVoucher GetPaymentVoucherById(string companyCode, string objectId) { PaymentVoucher result = new PaymentVoucher(); string[] param = { companyCode, objectId }; DataTable dt = dh.ExecuteDataSet("GetPaymentVoucherById", param).Tables[0]; if (dt.Rows.Count == 0) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = "NOT FOUND"; return(result); } DataRow dr = dt.Rows[0]; result.CompanyCode = companyCode; result.CreatedBy = dr["CreatedBy"].ToString(); result.CreatedOn = dr["CreatedOn"].ToString(); result.IsUsed = dr["IsUsed"].ToString(); result.Reason = dr["Reason"].ToString(); result.VoucherAmount = dr["VoucherAmount"].ToString(); result.VoucherCode = dr["VoucherCode"].ToString(); result.InvoiceNumber = dr["InvoiceNumber"].ToString(); result.ModifiedBy = dr["ModifiedBy"].ToString(); result.ModifiedOn = dr["ModifiedOn"].ToString(); result.RecordId = dr["RecordId"].ToString(); result.StatusCode = Globals.SUCCESS_STATUS_CODE; result.StatusDesc = Globals.SUCCESS_STATUS_TEXT; return(result); }
public async Task <string> pendingOrderPayment(PaymentVoucher paymentVoucher) { PaymentVoucherDomainModel paymentVoucherDM = new PaymentVoucherDomainModel(); AutoMapper.Mapper.Map(paymentVoucher, paymentVoucherDM); return(await voucherBusiness.pendingOrderPayment(paymentVoucherDM)); }
public dynamic Insert(PaymentVoucher model) { try { if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.PaymentVoucher, Core.Constants.Constant.MenuGroupName.Transaction)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Add record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } model = _paymentVoucherService.CreateObject(model, _paymentVoucherDetailService, _payableService , _contactService, _cashBankService); } catch (Exception ex) { LOG.Error("Insert Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public dynamic Delete(PaymentVoucher model) { try { if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.PaymentVoucher, Core.Constants.Constant.MenuGroupName.Transaction)) { Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "You are Not Allowed to Delete Record"); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } var data = _paymentVoucherService.GetObjectById(model.Id); model = _paymentVoucherService.SoftDeleteObject(data, _paymentVoucherDetailService); } catch (Exception ex) { LOG.Error("Delete Failed", ex); Dictionary <string, string> Errors = new Dictionary <string, string>(); Errors.Add("Generic", "Error " + ex); return(Json(new { Errors }, JsonRequestBehavior.AllowGet)); } return(Json(new { model.Errors })); }
public bool ValidUpdateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService) { paymentVoucher.Errors.Clear(); VUpdateObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService); return(isValid(paymentVoucher)); }
public ActionResult AddPayment(string key) { var msg = new JsonMessage(false, "Thêm mới dữ liệu thành công."); try { var model = new PaymentVoucher(); if (key != Keyapi) { return(Json(0, JsonRequestBehavior.AllowGet)); } UpdateModel(model); model.Note = HttpUtility.UrlDecode(model.Note); model.IsDelete = false; model.IsActive = false; model.Code = DateTime.Now.ToString("yyMMddHHmmss"); var startDate = Request["DateReturn_"]; model.DateReturn = startDate.StringToDecimal(); model.DateCreated = DateTime.Now.TotalSeconds(); _da.Add(model); _da.Save(); } catch (Exception ex) { msg.Erros = true; msg.Message = "Dữ liệu chưa được thêm mới."; } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public RetailPurchaseInvoice PaidObject(RetailPurchaseInvoice retailPurchaseInvoice, decimal AmountPaid, ICashBankService _cashBankService, IPayableService _payableService, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, IContactService _contactService, ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService) { retailPurchaseInvoice.AmountPaid = AmountPaid; if (_validator.ValidPaidObject(retailPurchaseInvoice, _cashBankService, _paymentVoucherService)) { CashBank cashBank = _cashBankService.GetObjectById((int)retailPurchaseInvoice.CashBankId.GetValueOrDefault()); retailPurchaseInvoice.IsBank = cashBank.IsBank; if (!retailPurchaseInvoice.IsGBCH) { retailPurchaseInvoice.GBCH_No = null; retailPurchaseInvoice.Description = null; } if (retailPurchaseInvoice.AmountPaid == retailPurchaseInvoice.Total) { retailPurchaseInvoice.IsFullPayment = true; } Payable payable = _payableService.GetObjectBySource(Core.Constants.Constant.PayableSource.RetailPurchaseInvoice, retailPurchaseInvoice.Id); PaymentVoucher paymentVoucher = _paymentVoucherService.CreateObject((int)retailPurchaseInvoice.CashBankId.GetValueOrDefault(), retailPurchaseInvoice.ContactId, DateTime.Now, retailPurchaseInvoice.Total, retailPurchaseInvoice.IsGBCH, (DateTime)retailPurchaseInvoice.DueDate.GetValueOrDefault(), retailPurchaseInvoice.IsBank, _paymentVoucherDetailService, _payableService, _contactService, _cashBankService); PaymentVoucherDetail paymentVoucherDetail = _paymentVoucherDetailService.CreateObject(paymentVoucher.Id, payable.Id, (decimal)retailPurchaseInvoice.AmountPaid.GetValueOrDefault(), "Automatic Payment", _paymentVoucherService, _cashBankService, _payableService); retailPurchaseInvoice = _repository.PaidObject(retailPurchaseInvoice); _paymentVoucherService.ConfirmObject(paymentVoucher, (DateTime)retailPurchaseInvoice.ConfirmationDate.GetValueOrDefault(), _paymentVoucherDetailService, _cashBankService, _payableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService); } return(retailPurchaseInvoice); }
public PaymentVoucher VCreateObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, IPayableService _payableService, IContactService _contactService, ICashBankService _cashBankService) { VHasContact(paymentVoucher, _contactService); if (!isValid(paymentVoucher)) { return(paymentVoucher); } VHasCashBank(paymentVoucher, _cashBankService); if (!isValid(paymentVoucher)) { return(paymentVoucher); } VHasPaymentDate(paymentVoucher); if (!isValid(paymentVoucher)) { return(paymentVoucher); } VIfGBCHThenIsBank(paymentVoucher, _cashBankService); if (!isValid(paymentVoucher)) { return(paymentVoucher); } VIfGBCHThenHasDueDate(paymentVoucher); return(paymentVoucher); }
public PaymentVoucher VAllPaymentVoucherDetailsAreConfirmable(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); foreach (var detail in details) { detail.Errors = new Dictionary <string, string>(); detail.ConfirmationDate = paymentVoucher.ConfirmationDate; detail.Errors = new Dictionary <string, string>(); if (!_paymentVoucherDetailService.GetValidator().ValidConfirmObject(detail, _payableService)) { foreach (var error in detail.Errors) { paymentVoucher.Errors.Add(error.Key, error.Value); } if (paymentVoucher.Errors.Any()) { return(paymentVoucher); } } } return(paymentVoucher); }
public PaymentVoucher VHasPaymentDate(PaymentVoucher paymentVoucher) { if (paymentVoucher.PaymentDate == null) { paymentVoucher.Errors.Add("PaymentDate", "Tidak boleh kosong"); } return(paymentVoucher); }
public PaymentVoucher VHasConfirmationDate(PaymentVoucher obj) { if (obj.ConfirmationDate == null) { obj.Errors.Add("ConfirmationDate", "Tidak boleh kosong"); } return(obj); }
public PaymentVoucher VHasReconciliationDate(PaymentVoucher paymentVoucher) { if (paymentVoucher.ReconciliationDate == null) { paymentVoucher.Errors.Add("ReconciliationDate", "Harus memiliki reconciliation date"); } return(paymentVoucher); }
public PaymentVoucher VHasNotBeenReconciled(PaymentVoucher paymentVoucher) { if (paymentVoucher.IsReconciled) { paymentVoucher.Errors.Add("Generic", "Sudah di reconcile"); } return(paymentVoucher); }
public PaymentVoucher VHasBeenReconciled(PaymentVoucher paymentVoucher) { if (!paymentVoucher.IsReconciled) { paymentVoucher.Errors.Add("Generic", "Belum di reconcile"); } return(paymentVoucher); }
public PaymentVoucher VHasBeenConfirmed(PaymentVoucher paymentVoucher) { if (!paymentVoucher.IsConfirmed) { paymentVoucher.Errors.Add("Generic", "Harus sudah dikonfirmasi"); } return(paymentVoucher); }
public PaymentVoucher VHasNotBeenConfirmed(PaymentVoucher paymentVoucher) { if (paymentVoucher.IsConfirmed) { paymentVoucher.Errors.Add("Generic", "Tidak boleh sudah dikonfirmasi"); } return(paymentVoucher); }
public PaymentVoucher VHasNotBeenDeleted(PaymentVoucher paymentVoucher) { if (paymentVoucher.IsDeleted) { paymentVoucher.Errors.Add("Generic", "Tidak boleh sudah di deleted"); } return(paymentVoucher); }
public IActionResult Update([FromBody] CrudViewModel <PaymentVoucher> payload) { PaymentVoucher paymentVoucher = payload.value; _context.PaymentVoucher.Update(paymentVoucher); _context.SaveChanges(); return(Ok(paymentVoucher)); }
public bool ValidConfirmObject(PaymentVoucher paymentVoucher, IPaymentVoucherService _paymentVoucherService, IPaymentVoucherDetailService _paymentVoucherDetailService, ICashBankService _cashBankService, IPayableService _payableService, IClosingService _closingService) { paymentVoucher.Errors.Clear(); VConfirmObject(paymentVoucher, _paymentVoucherService, _paymentVoucherDetailService, _cashBankService, _payableService, _closingService); return(isValid(paymentVoucher)); }
public IActionResult Insert([FromBody] CrudViewModel <PaymentVoucher> payload) { PaymentVoucher paymentVoucher = payload.value; paymentVoucher.PaymentVoucherName = _numberSequence.GetNumberSequence("PAYVCH"); _context.PaymentVoucher.Add(paymentVoucher); _context.SaveChanges(); return(Ok(paymentVoucher)); }
public PaymentVoucher VHasNoPaymentVoucherDetail(PaymentVoucher paymentVoucher, IPaymentVoucherDetailService _paymentVoucherDetailService) { IList <PaymentVoucherDetail> details = _paymentVoucherDetailService.GetObjectsByPaymentVoucherId(paymentVoucher.Id); if (details.Any()) { paymentVoucher.Errors.Add("Generic", "Tidak boleh ada payment voucher details"); } return(paymentVoucher); }