public void Check_custom_price_tag_address() { var address = new Address("Тестовый адрес"); var lines = new List <TagPrintable>(); var line = new TagPrintable() { AddressName = "Тестовый измененный адрес", ClientName = "Тестовый клиент", Nds = 10, RetailCost = 251.20m, Product = "Диклофенак", Quantity = 1 }; lines.Add(line); var priceTagSettings = new PriceTagSettings() { Type = PriceTagType.Custom, Address = address }; var priceTag = PriceTag.Default(TagType.PriceTag, address); var doc = new PriceTagDocument(lines, priceTagSettings, priceTag).Build(); Assert.IsNotNull(doc); var text = doc.Descendants <StackPanel>() .First() .Descendants <Label>() .First() .Content.ToString().Trim(); Assert.AreEqual($"{line.ClientName}, {line.AddressName}", text); }
public void Build_all_tags() { var lines = new List <TagPrintable>(); for (var i = 0; i < 25; i++) { var line = new TagPrintable() { Nds = 10, RetailCost = 251.20m, Product = "Диклофенак", Quantity = 1 }; lines.Add(line); } var priceTagSettings = new PriceTagSettings() { Type = PriceTagType.Normal }; var doc = new PriceTagDocument(lines, priceTagSettings, null).Build(); Assert.IsNotNull(doc); Assert.AreEqual(2, doc.Pages.Count); var page1 = doc.Pages[0].Child; Assert.AreEqual(24, page1.Descendants <Grid>().First().Children.Count); var page2 = doc.Pages[1].Child; Assert.AreEqual(1, page2.Descendants <Grid>().First().Children.Count); }
public void Print_price_tag() { var address = new Address("Тестовый"); var lines = new List <TagPrintable>(); var line = new TagPrintable() { Nds = 10, RetailCost = 251.20m, Product = "Диклофенак", Quantity = 1 }; lines.Add(line); var priceTagSettings = new PriceTagSettings() { Type = PriceTagType.Normal }; var doc = new PriceTagDocument(lines, priceTagSettings, null).Build(); Assert.IsNotNull(doc); var priceTag = PriceTag.Default(TagType.RackingMap, null); var settings = new Settings(address); settings.RackingMap.Size = RackingMapSize.Custom; var doc2 = new RackingMapDocument(lines, settings, priceTag).Build(); Assert.IsNotNull(doc2); }
public static Dictionary <string, string> Map(TagPrintable line, Address address) { return(new Dictionary <string, string> { { "Цена", String.Format(GetFormat(), "{0:0.00}", line.RetailCost) }, { "Наименование клиента", address == null ? line.ClientName : $"{line.ClientName}, {line.AddressName}" }, { "Наименование", line.Product }, { "Страна", line.Country }, { "Производитель", line.Producer }, { "Срок годности", line.Period }, { "Номер накладной", line.ProviderDocumentId }, { "Поставщик", line.SupplierName }, { "Серия товара", line.SerialNumber }, { "Дата накладной", line.DocumentDate.ToShortDateString() }, { "Количество", line.Quantity.ToString() }, { "Номер сертификата", line.Certificates }, }); }
public virtual FrameworkElement ToElement(TagPrintable line, Address address = null) { return(PriceTagItem.ToElement(Width, Height, Items, PriceTagItem.Map(line, address))); }