protected virtual string TaxGroupToString(FiscalPrinterTaxGroup group) { switch (group) { case FiscalPrinterTaxGroup.A: return("А"); case FiscalPrinterTaxGroup.B: return("Б"); case FiscalPrinterTaxGroup.C: return("В"); case FiscalPrinterTaxGroup.D: return("Г"); default: return("Б"); } }
public override void AddItem(string itemCode, string itemName, double quantity, string measUnit, double price, double vatPercent, double extraPercent, FiscalPrinterTaxGroup taxGroup) { itemName = itemName.FilterControlCharacters(); itemName = itemName.Wrap(itemNameCharsPerLine); StringBuilder res = new StringBuilder(itemName); res.Append("\t"); res.Append(TaxGroupToString(taxGroup)); NumberFormatInfo numberFormat = new NumberFormatInfo { NumberDecimalSeparator = priceDecimalSeparator, NumberGroupSeparator = string.Empty }; price = Math.Round(price, 2, MidpointRounding.AwayFromZero); price = Math.Min(price, 99999999); res.Append(price.ToString("G8", numberFormat)); quantity = Math.Round(quantity, 3, MidpointRounding.AwayFromZero); quantity = Math.Min(quantity, 99999999); quantity = Math.Max(quantity, 0); if (!quantity.IsEqualTo(1d)) { numberFormat.NumberDecimalSeparator = quantityDecimalSeparator; res.AppendFormat("*{0}", quantity.ToString("G8", numberFormat)); } extraPercent = Math.Round(extraPercent, 2, MidpointRounding.AwayFromZero); extraPercent = Math.Min(extraPercent, 99.99); extraPercent = Math.Max(extraPercent, -99.99); if (!extraPercent.IsZero()) { numberFormat.NumberDecimalSeparator = priceDecimalSeparator; res.AppendFormat(",{0}", extraPercent.ToString("G2", numberFormat)); } IncrementBalance(quantity, price, extraPercent); SendMessage(CommandCodes.AddItem, GetTextBytes(res.ToString())); }
public virtual void AddItem(string itemCode, string itemName, double quantity, string measUnit, double price, double vatPercent, double extraPercent, FiscalPrinterTaxGroup taxGroup) { throw new NotSupportedException(); }
public static string GetVATCode(FiscalPrinterTaxGroup vatCode) { string ret; return(VatCodes.TryGetValue(vatCode, out ret) ? ret : string.Empty); }
public virtual void AddModifiedItemNonFiscal(string itemCode, string itemName, double oldQuantity, double quantity, string measUnit, double price, double vatPercent, double extraPercent, FiscalPrinterTaxGroup taxGroup, string[] oldModifiers, string[] modifiers) { throw new NotSupportedException(); }