public void Add(fin_article pArticle, Guid pPlaceOid, Guid pTableOid, PriceType pPriceType, decimal pQuantity, fin_configurationvatexemptionreason pVatExemptionReason) { ArticleBagKey articleBagKey; ArticleBagProperties articleBagProps; //Get Place Object to extract TaxSellType Normal|TakeWay pos_configurationplace configurationPlace = (pos_configurationplace)GlobalFramework.SessionXpo.GetObjectByKey(typeof(pos_configurationplace), pPlaceOid); TaxSellType taxSellType = (configurationPlace.MovementType.VatDirectSelling) ? TaxSellType.TakeAway : TaxSellType.Normal; PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(pArticle, taxSellType); //Prepare articleBag Key and Props articleBagKey = new ArticleBagKey( pArticle.Oid, pArticle.Designation, priceProperties.PriceNet, priceProperties.DiscountArticle, priceProperties.Vat, pVatExemptionReason.Oid ); articleBagProps = new ArticleBagProperties( pPlaceOid, pTableOid, pPriceType, pArticle.Code, pQuantity, pArticle.UnitMeasure.Acronym ); //Send to Bag Add(articleBagKey, articleBagProps); }
public void Insert(Guid pArticleId, decimal pQuantity, TaxSellType pTaxSellType) { FIN_Article article = (FIN_Article)FrameworkUtils.GetXPGuidObject(typeof(FIN_Article), pArticleId); PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(article, pTaxSellType); priceProperties.Quantity = pQuantity; Insert(article.Oid, article.Designation, priceProperties); }
void _entryBoxSelectArticle_ClosePopup(object sender, EventArgs e) { //Prepare Objects fin_article article = _entryBoxSelectArticle.Value; fin_configurationpricetype configurationPriceTypeDefault = (fin_configurationpricetype)GlobalFramework.SessionXpo.GetObjectByKey(typeof(fin_configurationpricetype), SettingsApp.XpoOidConfigurationPriceTypeDefault); _entryBoxSelectArticleCode.Entry.Text = article.Code; _entryBoxSelectArticle.Entry.Text = article.Designation; //Get PriceType from Customer.PriceType or from default if a New Customer or a Customer without PriceType Defined in BackOffice, always revert to Price1 PriceType priceType = (_customer != null) ? (PriceType)_customer.PriceType.EnumValue : (PriceType)configurationPriceTypeDefault.EnumValue ; //Common changes for MediaNova | Non-MediaNova Articles | Here Prices are always in Retail Mode PriceProperties priceProperties = FrameworkUtils.GetArticlePrice(article, priceType, TaxSellType.Normal); //Price _articlePrice = priceProperties.PriceNet; //Display Price _entryBoxValidationPrice.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice); _entryBoxValidationPriceDisplay.EntryValidation.Text = FrameworkUtils.DecimalToString(_articlePrice * _currencyDisplay.ExchangeRate); _entryBoxValidationQuantity.EntryValidation.Text = (article.DefaultQuantity > 0) ? FrameworkUtils.DecimalToString(article.DefaultQuantity) : FrameworkUtils.DecimalToString(1.0m); _entryBoxValidationDiscount.EntryValidation.Text = FrameworkUtils.DecimalToString(article.Discount); //VatRate _entryBoxSelectVatRate.Value = article.VatDirectSelling; _entryBoxSelectVatRate.Entry.Text = article.VatDirectSelling.Designation; //Default Vat Exception Reason if (article.VatExemptionReason != null) { _entryBoxSelectVatExemptionReason.Value = article.VatExemptionReason; _entryBoxSelectVatExemptionReason.Entry.Text = article.VatExemptionReason.Designation; } //Toggle ToggleVatExemptionReasonEditMode Validation ToggleVatExemptionReasonEditMode(); //Update Price Properties UpdatePriceProperties(); }