public void EditInvoiceHeader(Code code, string rnc, Client client, DateTime dueDate, PaymentTerm paymentTerm, GeneralText notes, GeneralText termAndConditions, GeneralText footer, IEnumerable <InvoiceDetailDto> invoiceDetails) { var invoiceHeader = this; var _localInvoiceDetails = invoiceDetails.Map(d => new InvoiceDetail(new Code(d.ProductCode), new Name(d.ProductDescription), d.Qty, d.Amount, d.TaxPercent, invoiceHeader)); Code = code; Rnc = rnc; Client = client; DueDate = dueDate; PaymentTerm = paymentTerm; Notes = notes; TermAndConditions = termAndConditions; Footer = footer; Modified = DateTime.UtcNow; _invoiceDetails.RemoveAll(c => c.Id == c.Id); _invoiceDetails.AddRange(_localInvoiceDetails); }
public override ObservableCollection <PaymentTerm> GetAllPaymentTerms() { #if !ORACLE return(null); #endif ObservableCollection <PaymentTerm> PaymentTerms = new ObservableCollection <PaymentTerm>(); try { const string sql = "select * from sphrsbilling.Payment_Terms"; DataTable dt = OracleHelper.ExecuteQuery(base.ConnectionString.Value, sql, null); foreach (DataRow row in dt.Rows) { PaymentTerm item = new PaymentTerm { PAYMENT_TERMS = row["PAYMENT_TERMS"].ToString(), DESCR = row["DESCR"].ToString(), }; PaymentTerms.Add(item); } } catch (OracleException ex) { throw ex; } catch (Exception sysEx) { throw sysEx; } return(PaymentTerms); }
public async Task <ActionResult> AddPaymentTerm([FromBody] PaymentTermDto paymentTerm) { int id = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); var logineduser = await _auth.VerifyUser(id); PaymentTerm _newTerm = new PaymentTerm() { Status = true, Company = logineduser.Company }; _context.PaymentTerms.Add(_newTerm); await _context.SaveChangesAsync(); foreach (var item in paymentTerm.ContentForLang) { PaymentTermLang termLang = new PaymentTermLang() { PaymentTerm = _newTerm, Language = await _context.Languages.FirstOrDefaultAsync(s => s.code == item.Languagename), Name = item.Content, Status = true, }; _context.PaymentTermLangs.Add(termLang); await _context.SaveChangesAsync(); } return(Ok()); }
public PaymentTermsModel SavePaymentTerms(PaymentTermsModel objPaymentTermsModel) { var objPaymentTermRepository = new PaymentTermsRepository(); var objPaymentTerm = new PaymentTerm(); string action = ""; try { if (objPaymentTermsModel.PTM_Id == 0) { action = "I"; var savePaymentTerms = _workorderems.spSetPymentTerm(action, null, objPaymentTermsModel.PTM_Term, objPaymentTermsModel.PTM_GracePeriod, objPaymentTermsModel.PTM_IsActive); } else { action = "U"; var savePaymentTerms = _workorderems.spSetPymentTerm(action, objPaymentTermsModel.PTM_Id, objPaymentTermsModel.PTM_Term, objPaymentTermsModel.PTM_GracePeriod, objPaymentTermsModel.PTM_IsActive); } objPaymentTermsModel.Result = Result.Completed; } catch (Exception ex) { Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public PaymentTermsDetails SavePaymentTerms(String Action, int? PTM_Id, string PTM_Term, int PTM_GracePeriod, bool IsActive)", "Exception While Saving payment term.", null); throw; } return(objPaymentTermsModel); }
public Supplier(Code code , Name name , Email email , Phone phone , string rnc , string homeOrApartment , string city , string street , Country country , SupplierGroup supplierGroup , PaymentTerm paymentTerm , GeneralText notes , bool isInformalSupplier , DateTime created , DateTime? modified = null , EntityStatus status = EntityStatus.Active) { Code = code; Name = name; Email = email; Phone = phone; Rnc = rnc; HomeOrApartment = homeOrApartment; City = city; Street = street; Country = country; SupplierGroup = supplierGroup; PaymentTerm = paymentTerm; Notes = notes; IsInformalSupplier = isInformalSupplier; Created = created == DateTime.MinValue ? DateTime.Now : created; Modified = modified; Status = status; }
// GET: PaymentTerms public ActionResult Index() { PaymentTerm paymentTerm = new PaymentTerm(); paymentTerm.PT = db.PaymentTerms.ToList(); return(View(paymentTerm)); }
public Error InsertOrUpdatePaymentTerm(PaymentTermModel paymentTerm, UserModel user, string lockGuid) { var error = validateModel(paymentTerm); if (!error.IsError) { // Check that the lock is still current if (!db.IsLockStillValid(typeof(PaymentTerm).ToString(), paymentTerm.Id, lockGuid)) { error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "LatePaymentChargePercent"); } else { PaymentTerm temp = null; if (paymentTerm.Id != 0) { temp = db.FindPaymentTerm(paymentTerm.Id); } if (temp == null) { temp = new PaymentTerm(); } Mapper.Map <PaymentTermModel, PaymentTerm>(paymentTerm, temp); db.InsertOrUpdatePaymentTerm(temp); paymentTerm.Id = temp.Id; } } return(error); }
public void EditSupplier( Code code , Name name , Email email , Phone phone , SupplierGroup supplierGroup , PaymentTerm paymentTerm , GeneralText notes , bool isInformalSupplier , string rnc , string homeOrApartment , string city , string street , Country country , EntityStatus status) { Code = code; Name = name; Email = email; Phone = phone; Rnc = rnc; HomeOrApartment = homeOrApartment; City = city; Street = street; SupplierGroup = supplierGroup; PaymentTerm = paymentTerm; Notes = notes; IsInformalSupplier = isInformalSupplier; Country = country; Status = status; Modified = DateTime.Now; }
public bool CheckPaymentTermNoOfDaysExist(PaymentTerm paymentTerm) { try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[PSA].[CheckPaymentTermNoOfDaysExist]"; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value = paymentTerm.Code == null?"": paymentTerm.Code; cmd.Parameters.Add("@NoOfDays", SqlDbType.Int).Value = paymentTerm.NoOfDays; cmd.CommandType = CommandType.StoredProcedure; Object res = cmd.ExecuteScalar(); return(res.ToString() == "Exists" ? true : false); } } } catch (Exception ex) { throw ex; } }
public void RegisterPayment_TermsAreNotOverlapping_IsSuccessful() { var meetingGroupId = new MeetingGroupId(Guid.NewGuid()); var paymentScheduleForMeetingGroup = MeetingGroupPaymentRegister.CreatePaymentScheduleForMeetingGroup(meetingGroupId); var payerId = new PayerId(Guid.NewGuid()); var paymentTerm = new PaymentTerm( new DateTime(2019, 1, 1), new DateTime(2019, 1, 31)); paymentScheduleForMeetingGroup.RegisterPayment( paymentTerm, payerId); var nextPaymentTerm = new PaymentTerm( new DateTime(2019, 2, 1), new DateTime(2019, 2, 28)); paymentScheduleForMeetingGroup.RegisterPayment( nextPaymentTerm, payerId); var domainEvents = AssertPublishedDomainEvents <PaymentRegisteredDomainEvent>(paymentScheduleForMeetingGroup); Assert.That(domainEvents.Count, Is.EqualTo(2)); Assert.That(domainEvents[1].DateTo, Is.EqualTo(nextPaymentTerm.EndDate)); }
private void FillData(PaymentTerm paymentTerm) { NameTextEdit.Text = paymentTerm.Title; DescriptionTextEdit.Text = paymentTerm.Description; if (paymentTerm.IsNet) { NetDaysRadioButton.IsChecked = paymentTerm.IsNet; NetNetDaysSpinEdit.EditValue = paymentTerm.NetNetDays; NetDiscountPercentageSpinEdit.EditValue = paymentTerm.NetDiscountPercentage; NetDiscountDaysSpinEdit.EditValue = paymentTerm.NetDiscountDays; DateDrivenDueDateSpinEdit.EditValue = null; DateDrivenDiscountDateSpinEdit.EditValue = null; DateDrivenDiscountPercentageSpinEdit.EditValue = null; DateDrivenNextMonthIfWithinSpinEdit.EditValue = null; } else { DueDateRadioButton.IsChecked = true; DateDrivenDueDateSpinEdit.EditValue = paymentTerm.DateDrivenDueDate; DateDrivenDiscountDateSpinEdit.EditValue = paymentTerm.DateDrivenDiscountDate; DateDrivenDiscountPercentageSpinEdit.EditValue = paymentTerm.DateDrivenDiscountPercentage; DateDrivenNextMonthIfWithinSpinEdit.EditValue = paymentTerm.DateDrivenNextMonthIfWithin; NetNetDaysSpinEdit.EditValue = null; NetDiscountPercentageSpinEdit.EditValue = null; NetDiscountDaysSpinEdit.EditValue = null; } IsActiveCheckEdit.EditValue = paymentTerm.IsActive; }
private IEnumerable <Order> GenerateOrdersForCustomer(Customer customer, SalesHubDbContext context) { int orderCount = _random.Next(10, 20); for (int i = 0; i < orderCount; ++i) { var paymentTerm = new PaymentTerm { SplitPercentage = 1m, PaymentTermType = context.PaymentTermTypes.First() }; context.PaymentTerms.Add(paymentTerm); var order = new Order { ContractAmount = _random.Next(100, 1000000), ContractWeight = _random.Next(10, 1000000), ContractCurrencyTypeId = 0, Customer = customer, PaymentTerm1 = paymentTerm, IsActive = true, UnitOfWeight = customer.Region == "North America" ? UnitOfWeight.Pounds : UnitOfWeight.Kilograms, OrderDate = DateTime.Today, OrderNumber = "Order - " + i, }; customer.Orders.Add(order); context.Orders.Add(order); yield return(order); } }
public IActionResult PaymentTermDelete(int paymentTermSk) { System.Console.WriteLine("-----------------------------------PaymentTermDelete--------------------------------------"); if (HttpContext.Session.GetInt32("LoggedIn") != 1) { return(RedirectToAction("Login", "Login")); } bool isDeleteOk = true; PaymentTerm paymentTermInDb = paymentTermHelper.GetPaymentTermBySk(paymentTermSk); if (paymentTermInDb == null) { // PaymentTerm not found in Db. This is an exception... isDeleteOk = false; } if (isDeleteOk) { System.Console.WriteLine("-----------------------------------PaymentTermDelete-IsDeleteOk=true-------------------------------------"); // Delete PaymentTerm dbContext.PaymentTerm.Remove(paymentTermInDb); dbContext.SaveChanges(); } else { System.Console.WriteLine("-----------------------------------PaymentTermDelete-IsDeleteOk=false-------------------------------------"); } return(RedirectToAction("PaymentTermNewListView")); }
public IActionResult PaymentTermEditSave(PaymentTerm paymentTerm) { System.Console.WriteLine("-----------------------------------UomEditSave(PaymentTerm paymentTerm):1--------------------------------------"); bool isValid = ModelState.IsValid; if (isValid) { var nameInDb = (from p in dbContext.PaymentTerm where p.PaymentTermSk != paymentTerm.PaymentTermSk where p.Name == paymentTerm.Name select p).FirstOrDefault(); if (nameInDb != null) { ModelState.AddModelError("Name", "Name already exists."); isValid = false; } } if (isValid) { // Save PaymentTerm DateTime now = DateTime.Now; paymentTerm.UpdatedAt = now; dbContext.Update(paymentTerm); dbContext.SaveChanges(); return(RedirectToAction("PaymentTermNewListview")); } // Edit was invalid, route back to PaymentTerm Edit view setLayoutViewBag(); return(View("PaymentTermEdit", paymentTerm)); }
public ActionResult CondicaoPagamentoSave(PaymentTerm PaymentTerm) { context = new DALContext(); try { //prod.AliqICMS = 3; //prod.CombinedProduct = false; //prod.MinimumStockAlert = 50; if (PaymentTerm.Id > 0) { context.PaymentTerms.Update(PaymentTerm); } else { context.PaymentTerms.Create(PaymentTerm); } context.SaveChanges(); } catch (Exception ex) { throw ex; } ViewBag.Message = "Condição de Pagamento cadastrada com sucesso."; return(RedirectToAction("CondicaoPagamento")); }
public PaymentTerm CreateNew(PaymentTerm paymentTerm) { paymentTerm.Id = Guid.NewGuid(); erpNodeDBContext.PaymentTerms.Add(paymentTerm); erpNodeDBContext.SaveChanges(); return(paymentTerm); }
protected override void OnAddToolBarItem() { _activePaymentTerm = new PaymentTerm { IsActive = true, IsNet = true }; FillData(_activePaymentTerm); IsAdding(); }
public async Task <PaymentTerm> SavePaymentTerm(PaymentTerm pPaymentTerm) { if (pPaymentTerm.Id == Guid.Empty) { return(await mAsyncCLient.AddPaymentTermAsync(pPaymentTerm)); } return(await mAsyncCLient.EditPaymentTermAsync(pPaymentTerm)); }
public ActionResult DeleteConfirmed(int id) { PaymentTerm paymentTerm = db.PaymentTerms.Find(id); db.PaymentTerms.Remove(paymentTerm); db.SaveChanges(); return(RedirectToAction("Index")); }
public PaymentTermModel MapToModel(PaymentTerm item) { var model = Mapper.Map <PaymentTerm, PaymentTermModel>(item); model.TermText = buildPaymentTerm(item); return(model); }
public object InsertUpdatePaymentTerm(PaymentTerm paymentTerm) { SqlParameter outputStatus, outputCode = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[PSA].[InsertUpdatePaymentTerm]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@IsUpdate", SqlDbType.Bit).Value = paymentTerm.IsUpdate; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value = paymentTerm.Code; cmd.Parameters.Add("@Description", SqlDbType.NVarChar, 100).Value = paymentTerm.Description; cmd.Parameters.Add("@NoOfDays", SqlDbType.Int).Value = paymentTerm.NoOfDays; cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar, 250).Value = paymentTerm.PSASyscommon.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = paymentTerm.PSASyscommon.CreatedDate; cmd.Parameters.Add("@UpdatedBy", SqlDbType.VarChar, 250).Value = paymentTerm.PSASyscommon.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = paymentTerm.PSASyscommon.UpdatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputCode = cmd.Parameters.Add("@CodeOut", SqlDbType.VarChar, 10); outputCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": throw new Exception(paymentTerm.IsUpdate ? _appConst.UpdateFailure : _appConst.InsertFailure); case "1": paymentTerm.Code = outputCode.Value.ToString(); return(new { Code = outputCode.Value.ToString(), Status = outputStatus.Value.ToString(), Message = paymentTerm.IsUpdate ? _appConst.UpdateSuccess : _appConst.InsertSuccess }); } } catch (Exception ex) { throw ex; } return(new { Code = outputCode.Value.ToString(), Status = outputStatus.Value.ToString(), Message = paymentTerm.IsUpdate ? _appConst.UpdateSuccess : _appConst.InsertSuccess }); }
public ActionResult DeleteConfirmed(int id) { PaymentTerm pay = db.PaymentTerms.Find(id); db.PaymentTerms.Remove(pay); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully Deleted Payment Terms."; return(RedirectToAction("Index")); }
public List <PaymentTerm> GetAllPayTerm(PaymentTermAdvanceSearch paymentTermAdvanceSearch) { List <PaymentTerm> payTermList = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[PSA].[GetAllPaymentTerm]"; cmd.Parameters.Add("@SearchTerm", SqlDbType.NVarChar, -1).Value = string.IsNullOrEmpty(paymentTermAdvanceSearch.SearchTerm) ? "" : paymentTermAdvanceSearch.SearchTerm.Trim(); cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value = paymentTermAdvanceSearch.DataTablePaging.Start; if (paymentTermAdvanceSearch.DataTablePaging.Length == -1) { cmd.Parameters.AddWithValue("@Length", DBNull.Value); } else { cmd.Parameters.Add("@Length", SqlDbType.Int).Value = paymentTermAdvanceSearch.DataTablePaging.Length; } cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader sdr = cmd.ExecuteReader()) { if ((sdr != null) && (sdr.HasRows)) { payTermList = new List <PaymentTerm>(); while (sdr.Read()) { PaymentTerm payTerm = new PaymentTerm(); { payTerm.Code = (sdr["Code"].ToString() != "" ? (sdr["Code"].ToString()) : payTerm.Code); payTerm.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : payTerm.Description); payTerm.NoOfDays = (sdr["NoOfDays"].ToString() != "" ? int.Parse(sdr["NoOfDays"].ToString()) : payTerm.NoOfDays); payTerm.TotalCount = (sdr["TotalCount"].ToString() != "" ? int.Parse(sdr["TotalCount"].ToString()) : payTerm.TotalCount); payTerm.FilteredCount = (sdr["FilteredCount"].ToString() != "" ? int.Parse(sdr["FilteredCount"].ToString()) : payTerm.FilteredCount); } payTermList.Add(payTerm); } } } } } } catch (Exception ex) { throw ex; } return(payTermList); }
/// <summary> /// convert payment term view model to domain /// </summary> /// <param name="model"></param> /// <returns></returns> public PaymentTerm ConvertToDomain(PaymentTermViewModel model) { PaymentTerm term = new PaymentTerm(); term.PaymentTermId = model.PaymentTermId; term.Description = model.PaymentTermDescription; term.IsActive = model.IsActive; return(term); }
/// <summary> /// convert payment term to view madel /// </summary> /// <param name="term"></param> /// <returns></returns> public PaymentTermViewModel ConvertToView(PaymentTerm term) { PaymentTermViewModel model = new PaymentTermViewModel(); model.PaymentTermId = term.PaymentTermId; model.PaymentTermDescription = (!string.IsNullOrEmpty(term.Description)) ? term.Description : "N/A"; model.IsActive = term.IsActive; return(model); }
public async Task <Unit> Handle(RegisterPaymentCommand command, CancellationToken cancellationToken) { var paymentRegister = await _meetingGroupPaymentRegisterRepository.GetByIdAsync( new MeetingGroupPaymentRegisterId(command.MeetingGroupId)); paymentRegister.RegisterPayment(PaymentTerm.Create(command.StartDate, command.EndDate), _payerContext.PayerId); return(Unit.Value); }
public ActionResult Edit([Bind(Include = "PT_Id,Payment_Term")] PaymentTerm paymentTerm) { if (ModelState.IsValid) { db.Entry(paymentTerm).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paymentTerm)); }
public void SavePaymentTerm(PaymentTerm paymentTerm) { if (paymentTerm.Id == 0) { _paymentTermRepo.Insert(paymentTerm); } else { _paymentTermRepo.Update(paymentTerm); } }
//-------------------------------------------------------------- // Select and return one PaymentTerm related to the passed paymentTermSk public PaymentTerm GetPaymentTermBySk(int paymentTermSk) { System.Console.WriteLine("--------------------------------GetPaymentTermBySk(1)--------------------------------"); PaymentTerm paymentTerm = (from p in dbContext.PaymentTerm where p.PaymentTermSk == paymentTermSk select p) .FirstOrDefault(); return(paymentTerm); }
public ActionResult Create([Bind(Include = "PT_Id,Payment_Term")] PaymentTerm paymentTerm) { if (ModelState.IsValid) { db.PaymentTerms.Add(paymentTerm); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(paymentTerm)); }