public TemplateEditor(InvoiceTemplateModel invoiceTemplateModel) { InitializeComponent(); _invoiceTemplateModel = invoiceTemplateModel; _templatesListBox.SelectedIndexChanged += _templatesListBoxSelectionChanged; LoadTemplates(); _isInitialLoad = false; }
public ImportApplicationConfigurationForm(InvoiceTemplateModel invoiceTemplateModel) { InitializeComponent(); _invoiceTemplateModel = invoiceTemplateModel; _setAppLocationButton.Click += OnSetAppLocationClick; _setInvoiceFileLocationButton.Click += OnSetInvoiceFileLocationClick; _saveButton.Click += OnSaveClick; _appLocationTextBox.DataBindings.Add(new Binding("Text", _invoiceTemplateModel, "ImportAppLocation", false, DataSourceUpdateMode.OnPropertyChanged)); _invoiceFileLocationTextBox.DataBindings.Add(new Binding("Text", _invoiceTemplateModel, "ImportAppInvoiceFileLocation", false,DataSourceUpdateMode.OnPropertyChanged)); }
public InvoiceImportMain() { InitializeComponent(); InitialiseEvents(); _invoiceTemplateModel = new InvoiceTemplateModel(); }
public FileResult GenerateInvoice(OrderModel order, string basePath) { string html = AssetsFileLibrary.GetInvoiceTemplate(basePath); var invoiceTemplate = new InvoiceTemplateModel { CreatedDateLabel = "Datum vystavení:", DueDateLabel = "Datum splatnosti:", PriceWithoutVatLabel = "Cena bez DPH", PriceWithVatLabel = "Cena s DPH", TotalPriceLabel = "Cena celkem s DPH", VatLabel = "DPH", InvoiceLabel = "Faktura", ItemsLabel = "Položky", Supplier = @"Hradištská 216 688 01 Uherský Brod IČ: 29032393 DIČ: CZ29032393", PaymentInfo = $@"Bankovní účet: 1111111111/0080 Variabilní symbol: {order.OrderNumber} Způsob platby: {order.CalculatedData.Payment.SourceData.Name}" }; // base html = InsertValue(html, "logoUrl", LogoUrl); html = InsertValue(html, "supplier", invoiceTemplate.Supplier); html = InsertValue(html, "paymentInfo", invoiceTemplate.PaymentInfo); // labels html = InsertValue(html, "invoiceLabel", invoiceTemplate.InvoiceLabel); html = InsertValue(html, "itemsLabel", invoiceTemplate.ItemsLabel); html = InsertValue(html, "priceWithVatLabel", invoiceTemplate.PriceWithVatLabel); html = InsertValue(html, "priceWithoutVatLabel", invoiceTemplate.PriceWithoutVatLabel); html = InsertValue(html, "vatLabel", invoiceTemplate.VatLabel); html = InsertValue(html, "totalPriceLabel", invoiceTemplate.TotalPriceLabel); html = InsertValue(html, "createdDateLabel", invoiceTemplate.CreatedDateLabel); html = InsertValue(html, "dueDateLabel", invoiceTemplate.DueDateLabel); // values html = InsertValue(html, "invoiceNumber", order.OrderNumberFormatted); html = InsertValue(html, "createdDate", order.CreatedDate.ToString("d.M.yyyy")); html = InsertValue(html, "dueDate", order.CreatedDate.AddDays(14).ToString("d.M.yyyy")); html = InsertValue(html, "customerNameLine", order.Customer.GetName()); html = InsertValue(html, "customerStreetLine", order.Customer.GetAddress().GetStreetLine()); html = InsertValue(html, "customerCityLine", order.Customer.GetAddress().GetCityLine()); html = InsertValue(html, "totalPrice", order.CalculatedData.Total.TotalPrice.CzkWithVat.ToStringPriceFormat()); string items = ""; // generate all products if (order.CalculatedData != null) { List <string> products = order.CalculatedData.Products .Select(x => GenerateProductItem( x.Count, x.Product.Name, x.TotalPrice)) .ToList(); items += string.Join(string.Empty, products); // add payment method to items if (order.CalculatedData.Payment != null) { items += GenerateInvoiceItem(order.CalculatedData.Payment.SourceData.Name, order.CalculatedData.Payment.SourceData.TotalPrice); } // add transport to items if (order.CalculatedData.Transport != null) { items += GenerateInvoiceItem(order.CalculatedData.Transport.SourceData.Name, order.CalculatedData.Transport.SourceData.TotalPrice); } } html = InsertValue(html, "items", items); FileResult result = _documentHtmlLibrary.HtmlToFile(html, $"faktura_{order.OrderNumberFormatted}.pdf"); return(result); }