private void chkNull(TaxDetail p) { int chk = 0; Decimal chk1 = 0; p.date_modi = p.date_modi == null ? "" : p.date_modi; p.date_cancel = p.date_cancel == null ? "" : p.date_cancel; p.user_create = p.user_create == null ? "" : p.user_create; p.user_modi = p.user_modi == null ? "" : p.user_modi; p.user_cancel = p.user_cancel == null ? "" : p.user_cancel; //p.item_id = p.item_id == null ? "" : p.item_id; //p.tax_id = p.tax_id == null ? "" : p.tax_id; p.b_tax_name_t = p.b_tax_name_t == null ? "" : p.b_tax_name_t; p.remark = p.remark == null ? "" : p.remark; p.item_name_t = p.item_name_t == null ? "" : p.item_name_t; p.tax_date = p.tax_date == null ? "" : p.tax_date; //p.item_name_t = p.item_name_t == null ? "" : p.item_name_t; p.item_id = int.TryParse(p.item_id, out chk) ? chk.ToString() : "0"; p.b_tax_id = int.TryParse(p.b_tax_id, out chk) ? chk.ToString() : "0"; p.tax_id = int.TryParse(p.tax_id, out chk) ? chk.ToString() : "0"; //p.amount = Decimal.TryParse(p.amount, out chk1) ? chk1.ToString() : "0"; p.amount = Decimal.TryParse(p.amount, out chk1) ? chk1.ToString() : "0"; p.rate1 = Decimal.TryParse(p.rate1, out chk1) ? chk1.ToString() : "0"; p.tax_amount = Decimal.TryParse(p.tax_amount, out chk1) ? chk1.ToString() : "0"; }
public String insert(TaxDetail p, String userId) { String re = "", sql = ""; p.active = "1"; //p.ssdata_id = ""; chkNull(p); sql = "Insert Into " + taxD.table + "(" + taxD.item_id + "," + taxD.tax_id + "," + taxD.b_tax_name_t + "," + taxD.active + "," + taxD.remark + ", " + taxD.b_tax_id + ", " + taxD.date_create + ", " + taxD.date_modi + ", " + taxD.date_cancel + ", " + taxD.user_create + ", " + taxD.user_modi + ", " + taxD.user_cancel + "," + taxD.amount + "," + taxD.item_name_t + "," + taxD.rate1 + "," + taxD.amount + "," + taxD.tax_date + "," + taxD.tax_amount + " " + ") " + "Values ('" + p.item_id + "','" + p.tax_id + "','" + p.b_tax_name_t + "'," + "'" + p.active + "','" + p.remark + "','" + p.b_tax_id + "', " + "now(),'" + p.date_modi + "','" + p.date_cancel + "', " + "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," + "'" + p.amount + "','" + p.item_name_t + "','" + p.rate1 + "'," + "'" + p.amount + "','" + p.tax_date + "','" + p.tax_amount + "' " + ")"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
private void initConfig() { taxD = new TaxDetail(); taxD.tax_detail_id = "tax_detail_id"; taxD.tax_id = "tax_id"; taxD.item_id = "item_id"; taxD.b_tax_id = "b_tax_id"; taxD.b_tax_name_t = "b_tax_name_t"; taxD.amount = "amount"; taxD.active = "active"; taxD.remark = "remark"; taxD.date_create = "date_create"; taxD.date_modi = "date_modi"; taxD.date_cancel = "date_cancel"; taxD.user_create = "user_create"; taxD.user_modi = "user_modi"; taxD.user_cancel = "user_cancel"; taxD.item_name_t = "item_name_t"; taxD.rate1 = "rate1"; taxD.tax_date = "tax_date"; //taxD.amount = "amount"; taxD.tax_amount = "tax_amount"; taxD.table = "t_billing"; taxD.pkField = "tax_detail_id"; lexpn = new List <TaxDetail>(); }
public String update(TaxDetail p, String userId) { String re = "", sql = ""; chkNull(p); sql = "Update " + taxD.table + " Set " + " " + taxD.item_id + "='" + p.item_id + "' " + "," + taxD.b_tax_name_t + "='" + p.b_tax_name_t.Replace("'", "''") + "' " + "," + taxD.tax_id + "='" + p.tax_id.Replace("'", "''") + "' " + "," + taxD.remark + "='" + p.remark.Replace("'", "''") + "' " + "," + taxD.date_modi + "=now() " + "," + taxD.user_modi + "='" + userId.Replace("'", "''") + "' " + "," + taxD.b_tax_id + "='" + p.b_tax_id.Replace("'", "''") + "' " + "," + taxD.amount + "='" + p.amount.Replace("'", "''") + "' " + "," + taxD.item_name_t + "='" + p.item_name_t.Replace("'", "''") + "' " + //"," + taxD.billing_cover_id + "='" + p.billing_cover_id.Replace("'", "''") + "' " + "Where " + taxD.pkField + "='" + p.tax_detail_id + "'" ; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
/// <summary> /// Validates if tax detail entity contains the required information. /// </summary> /// <param name="entity">object</param> /// <param name="fields">list</param> /// <param name="silent">boold</param> /// <returns>bool</returns> public bool IsValid(object entity, out List <string> fields, bool silent) { List <string> errors = new List <string>(); TaxDetail taxDetail = (TaxDetail)entity; if (taxDetail.Kind == null || !IsValidKind(taxDetail.Kind)) { errors.Add("kind"); } if (taxDetail.Amount <= 0) { errors.Add("amount"); } if (taxDetail.Base <= 0 || taxDetail.Base < taxDetail.Amount) { errors.Add("base"); } if (errors?.Any() ?? false) { fields = errors; ThrowValidationException(errors, "TaxDetail", silent); return(false); } fields = null; return(true); }
public virtual cartDto.TaxDetail ToCartTaxDetailDto(TaxDetail taxDetail) { var result = new cartDto.TaxDetail(); result.InjectFrom(taxDetail); return(result); }
public virtual TaxDetail ToTaxDetail(cartDto.TaxDetail taxDeatilDto, Currency currency) { var result = new TaxDetail(currency); result.InjectFrom(taxDeatilDto); return(result); }
public static TaxDetail ToWebModel(this CartModule.Client.Model.TaxDetail taxDetail, Currency currency) { var result = new TaxDetail(currency); result.InjectFrom(taxDetail); return(result); }
private static IEnumerable <TaxDetail> GetTaxDetails(Hashtable properties, string propertyNamespace, string propertyName) { IEnumerable <TaxDetail> taxDetails = null; PaymentProperty[] taxDetailsPropertyArray; if (PaymentProperty.GetPropertyValue(properties, propertyNamespace, propertyName, out taxDetailsPropertyArray)) { if (taxDetailsPropertyArray.Length > 0) { taxDetails = new List <TaxDetail>(); foreach (var taxDetailsProperty in taxDetailsPropertyArray) { PaymentProperty[] taxDetailPropertyArray = taxDetailsProperty.PropertyList; if (taxDetailPropertyArray != null) { Hashtable taxDetailProperties = PaymentProperty.ConvertToHashtable(taxDetailPropertyArray); var taxDetail = new TaxDetail(); taxDetail.TaxTypeIdentifier = PaymentUtilities.GetPropertyStringValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxTypeIdentifier); taxDetail.TaxRate = PaymentUtilities.GetPropertyDecimalValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxRate); taxDetail.TaxDescription = PaymentUtilities.GetPropertyStringValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxDescription); taxDetail.TaxAmount = PaymentUtilities.GetPropertyDecimalValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxAmount); (taxDetails as List <TaxDetail>).Add(taxDetail); } } } } return(taxDetails); }
public static CartModule.Client.Model.TaxDetail ToCartApiModel(this TaxDetail taxDetail) { var result = new CartModule.Client.Model.TaxDetail(); result.InjectFrom(taxDetail); return(result); }
public static QuoteModule.Client.Model.TaxDetail ToQuoteApiModel(this TaxDetail taxDetail) { var result = new QuoteModule.Client.Model.TaxDetail(); result.InjectFrom(taxDetail); return(result); }
public virtual quoteDto.TaxDetail ToQuoteTaxDetailDto(TaxDetail taxDetail) { var result = new quoteDto.TaxDetail(); result.InjectFrom(taxDetail); return(result); }
protected override TaxDetail CalculateTaxSum(PXCache sender, object taxrow, object row) { TaxRev taxrev = PXResult.Unwrap <TaxRev>(taxrow); Tax tax = PXResult.Unwrap <Tax>(taxrow); bool propagateCustomRate = false; var origTaxRate = taxrev.TaxRate; if (taxrev.TaxID != null && tax != null) { SOTaxAmazonExt taxExt = tax.GetExtension <SOTaxAmazonExt>(); if (taxExt.UsrAMPropagateTaxAmt == true) { SOTaxTran soTax = PXResult <SOTaxTran> .Current; if (soTax != null && taxrev.TaxID == soTax.TaxID && soTax.CuryTaxableAmt.GetValueOrDefault() > 0) { var taxRate = soTax.CuryTaxAmt / soTax.CuryTaxableAmt * 100; if (taxRate != origTaxRate && taxRate > 0) { taxrev.TaxRate = taxRate; propagateCustomRate = true; } } } } TaxDetail result = base.CalculateTaxSum(sender, taxrow, row); if (result != null && propagateCustomRate) { result.TaxRate = origTaxRate; taxrev.TaxRate = origTaxRate; } return(result); }
public virtual TaxDetail ToTaxDetail(storeDto.TaxDetail dto, Currency currency) { var result = new TaxDetail(currency); result.InjectFrom(dto); return(result); }
public virtual TaxDetail ToTaxDetail(quoteDto.TaxDetail taxDetail, Currency currency) { var result = new TaxDetail(currency); result.InjectFrom(taxDetail); return(result); }
private static TaxDetail getEntityByModel(TaxDetailModel model) { if (model == null) { return(null); } TaxDetail entity = new TaxDetail(); if (model.Id == 0) { entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; } else { entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; } entity.CodeCombinationId = model.CodeCombinationId; entity.EndDate = model.EndDate; entity.Id = model.Id; entity.Rate = model.Rate; entity.StartDate = model.StartDate; entity.TaxId = model.TaxId; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return(entity); }
public TaxDetail GetSingle(string id, long companyId) { TaxDetail entity = this.GetAll(companyId) .FirstOrDefault(x => x.Id == Convert.ToInt64(id)); return(entity); }
public virtual cartDto.TaxDetail ToCartTaxDetailDto(TaxDetail taxDetail) { var result = new cartDto.TaxDetail(); result.Name = taxDetail.Name; result.Rate = (double)taxDetail.Rate.Amount; return(result); }
public static TaxDetail ToWebModel(this VirtoCommerceDomainCommerceModelTaxDetail taxDetail) { var taxDetailWebModel = new TaxDetail(); taxDetailWebModel.InjectFrom(taxDetail); return(taxDetailWebModel); }
public static VirtoCommerceDomainCommerceModelTaxDetail ToServiceModel(this TaxDetail taxDetail) { var taxDetailServiceModel = new VirtoCommerceDomainCommerceModelTaxDetail(); taxDetailServiceModel.InjectFrom(taxDetail); return(taxDetailServiceModel); }
public virtual TaxDetail ToTaxDetail(cartDto.TaxDetail taxDeatilDto, Currency currency) { var result = new TaxDetail(currency); result.Name = taxDeatilDto.Name; result.Rate = new Money(taxDeatilDto.Rate ?? 0, currency); return(result); }
public static domainModel.TaxDetail ToDomainTaxDetail(this TaxDetail taxDetail) { return(new domainModel.TaxDetail { Amount = taxDetail.Tax, Name = taxDetail.TaxName, Rate = taxDetail.Rate }); }
public virtual TaxDetail ToTaxDetail(storeDto.TaxDetail dto, Currency currency) { var result = new TaxDetail(currency); result.Amount = new Money(dto.Amount ?? 0, currency); result.Rate = new Money(dto.Rate ?? 0, currency); result.Name = dto.Name; return(result); }
public string Update(TaxDetail entity) { var originalEntity = this.Context.TaxDetails.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return(entity.Id.ToString()); }
public virtual TaxDetailEntity FromModel(TaxDetail taxDetail) { if (taxDetail == null) { throw new ArgumentNullException("taxDetail"); } this.InjectFrom(taxDetail); return(this); }
public static cartDto.TaxDetail ToCartTaxDetailDto(this TaxDetail taxDetail) { var result = new cartDto.TaxDetail { Name = taxDetail.Name, Rate = (double)taxDetail.Rate.Amount }; return(result); }
public static TaxDetail ToTaxDetail(this cartDto.TaxDetail taxDeatilDto, Currency currency) { var result = new TaxDetail(currency) { Name = taxDeatilDto.Name, Rate = new Money(taxDeatilDto.Rate ?? 0, currency) }; return(result); }
public static TaxDetail ToCoreModel(this TaxDetailEntity entity) { if (entity == null) throw new ArgumentNullException("entity"); var retVal = new TaxDetail(); retVal.InjectFrom(entity); return retVal; }
public virtual TaxDetail ToModel(TaxDetail taxDetail) { if (taxDetail == null) { throw new ArgumentNullException(nameof(taxDetail)); } taxDetail.InjectFrom(this); return(taxDetail); }
public static TaxDetail ToTaxDetail(this storeDto.TaxDetail dto, Currency currency) { var result = new TaxDetail(currency) { Amount = new Money(dto.Amount ?? 0, currency), Rate = new Money(dto.Rate ?? 0, currency), Name = dto.Name }; return(result); }
public static TaxDetail ToTaxDetail(this orderDto.TaxDetail taxDetailDto, Currency currency) { var result = new TaxDetail(currency) { Name = taxDetailDto.Name, Amount = new Money(taxDetailDto.Amount ?? 0, currency), Rate = new Money(taxDetailDto.Rate ?? 0, currency), }; return(result); }