public ProfitReportsController(IAdditionalCostsManager additionalCostsManager, IEmployeeRateRspManager employeeRateRspManager, IEmployeesManager employeeManager, IOrdersManager orderManager, IForeignProductsManager foreignProductsManager, IMaterialDeliveryRspManager materialDeliveryRspManager, ISocialTaxesManager socialTaxesManager, IInstrumentsManager instrumentsManager, IOwnProductsManager ownProductsManager, ITermPositionsManager termPositionsManager, IPositionsManager positionsManager, ITermCostsManager termCostsManager, ITaxesManager taxesManager, IInvoicesManager invoicesManager, IInterestsManager interestsManager, ITermsManager termsManager) { this.additionalCostsManager = additionalCostsManager; this.employeeRateRspManager = employeeRateRspManager; this.employeeManager = employeeManager; this.orderManager = orderManager; this.foreignProductsManager = foreignProductsManager; this.ownProductsManager = ownProductsManager; this.materialDeliveryRspManager = materialDeliveryRspManager; this.socialTaxesManager = socialTaxesManager; this.instrumentsManager = instrumentsManager; this.interestsManager = interestsManager; this.termPositionsManager = termPositionsManager; this.positionsManager = positionsManager; this.termCostsManager = termCostsManager; this.taxesManager = taxesManager; this.invoicesManager = invoicesManager; this.termsManager = termsManager; }
public GenerateMonthInvoicesController(IInvoicesManager invoicesManager, IOrdersManager ordersManager, ITaxesManager taxesManager, IInvoicePositionsManager invoicePositionsManager, IUniqueNumberProvider numberProvider, ITermPositionsManager termPositionsManager, IPositionsManager positionsManager, ITermCostsManager termCostsManager, IPrinterManager printerManager) : base(invoicesManager, ordersManager, taxesManager, invoicePositionsManager, numberProvider, termPositionsManager, positionsManager, termCostsManager) { this.printerManager = printerManager; }
public ReportOrdersController(IOrdersManager manager, ITermPositionsManager termPositionsManager, IPositionsManager positionsManager, ITermCostsManager termCostsManager, ITaxesManager taxesManager, IInvoicesManager invoicesManager) : base(manager) { this.termPositionsManager = termPositionsManager; this.positionsManager = positionsManager; this.termCostsManager = termCostsManager; this.taxesManager = taxesManager; this.invoicesManager = invoicesManager; }
public AddInvoicesController(IInvoicesManager invoicesManager, IOrdersManager ordersManager, ITaxesManager taxesManager, IInvoicePositionsManager invoicePositionsManager, IUniqueNumberProvider numberProvider, ITermPositionsManager termPositionsManager, IPositionsManager positionsManager, ITermCostsManager termCostsManager) { this.invoicesManager = invoicesManager; this.numberProvider = numberProvider; this.ordersManager = ordersManager; this.taxesManager = taxesManager; this.invoicePositionsManager = invoicePositionsManager; this.termPositionsManager = termPositionsManager; this.positionsManager = positionsManager; this.termCostsManager = termCostsManager; }
public PrintController(IOrdersManager manager, IInvoicesManager invoicesManager, IInvoiceStornosManager invoiceStornosManager, ITaxesManager taxesManager, ITransportOrdersManager transportOrdersManager, IPrinterManager printerManager, ITermsManager termsManager) : base() { this.taxesManager = taxesManager; this.invoicesManager = invoicesManager; this.invoiceStornosManager = invoiceStornosManager; this.transportOrdersManager = transportOrdersManager; this.printerManager = printerManager; this.termsManager = termsManager; Manager = manager; FilterExpressionCreator = new FilterExpressionCreator(); }
public MemoryStream PrepareMonthInvoicePrintData(IEnumerable<Invoices> invoices, string path, IInvoicesManager invoicesManager, ITaxesManager taxesManager, IOrdersManager ordersManager) { var result = new MemoryStream(); try { Package pkg; PackagePart part; XmlReader xmlReader; XDocument xmlMainXMLDoc; GetXmlDoc(path, result, out pkg, out part, out xmlReader, out xmlMainXMLDoc); var temp = xmlMainXMLDoc.Descendants().LastOrDefault(o => o.Value.Contains("#CustomerName")); var parentElement = GetParentElementByName(temp, "<w:body "); var bodyText = String.Join("", parentElement.Elements()); var templateBody = xmlMainXMLDoc.Root.ToString(); bool firstElem = true; foreach (var invoice in invoices) { if (!firstElem) { var index = templateBody.IndexOf("</w:body"); var pageBreak = @"<w:p w:rsidRDefault=""00C97ADC"" w:rsidR=""00C97ADC""><w:pPr><w:rPr><w:lang w:val=""en-GB""/></w:rPr></w:pPr><w:r><w:rPr><w:lang w:val=""en-GB""/> </w:rPr><w:br w:type=""page""/></w:r></w:p><w:p w:rsidRDefault=""009A5AB0"" w:rsidRPr=""00905C57"" w:rsidR=""009A5AB0"" w:rsidP=""0030272E""> <w:pPr><w:rPr><w:lang w:val=""en-GB""/></w:rPr></w:pPr><w:bookmarkStart w:name=""_GoBack"" w:id=""0""/><w:bookmarkEnd w:id=""0""/></w:p>"; templateBody = templateBody.Substring(0, index) + pageBreak + bodyText + templateBody.Substring(index); } else { firstElem = false; } //replace fields templateBody = ReplaceFields(ordersManager, 0, PrintTypes.Invoice, templateBody, invoicesManager, taxesManager, invoice); } xmlMainXMLDoc = SaveDoc(result, pkg, part, xmlReader, xmlMainXMLDoc, templateBody); } catch { } return result; }
public MemoryStream PrepareInvoicePrintData(int id, string path, IInvoicesManager invoicesManager, IOrdersManager ordersManager) { return PrepareCommonOrderPrintData(ordersManager, id, path, PrintTypes.Invoice, invoicesManager, null); }
private MemoryStream PrepareCommonOrderPrintData(IOrdersManager ordersManager, int id, string path, PrintTypes type, IInvoicesManager invoicesManager, ITaxesManager taxesManager, IInvoiceStornosManager invoiceStornosManager = null, ITransportOrdersManager transportOrdersManager = null, ITermsManager termsManager = null) { var result = new MemoryStream(); try { Package pkg; PackagePart part; XmlReader xmlReader; XDocument xmlMainXMLDoc; GetXmlDoc(path, result, out pkg, out part, out xmlReader, out xmlMainXMLDoc); var images = new List<Image>(); if (type == PrintTypes.DeliveryNote) { var term = termsManager.GetById(id); for (var i = 0; i < term.DeliveryNoteSignatures.Count; i++) { var deliveryNoteSignature = term.DeliveryNoteSignatures.ElementAt(term.DeliveryNoteSignatures.Count - i - 1); //TODO doesnt work (( //pkg.CreateRelationship(uri, TargetMode.Internal, // "Http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", // "barcodeImageId"); byte[] bytes = Convert.FromBase64String(deliveryNoteSignature.Signature.Replace("data:image/png;base64,", "")); Image image; using (MemoryStream ms = new MemoryStream(bytes)) { image = Image.FromStream(ms); } images.Add(image); } } //replace fields var templateBody = ReplaceFields(ordersManager, id, type, xmlMainXMLDoc.Root.ToString(), invoicesManager, taxesManager, null, invoiceStornosManager, transportOrdersManager, termsManager, images); xmlMainXMLDoc = SaveDoc(result, pkg, part, xmlReader, xmlMainXMLDoc, templateBody); InsertImages(result, images); var doc = new Spire.Doc.Document(); doc.LoadFromStream(result, Spire.Doc.FileFormat.Docx); doc.JPEGQuality = 100; result = new MemoryStream(); doc.SaveToStream(result, Spire.Doc.FileFormat.PDF); } catch { } return result; }
public InvoicesController(IInvoicesManager invoicesManager) { _invoicesManager = invoicesManager; }
public PayBillController(IInvoicesManager manager) { this.manager = manager; }
public DashboardsController(IInvoicesManager invoicesManager, IOrdersManager orderManager) { _invoicesManager = invoicesManager; _orderManager = orderManager; }
private string ReplaceFields(IOrdersManager ordersManager, int id, PrintTypes printType, string xmlMainXMLDoc, IInvoicesManager invoicesManager, ITaxesManager taxesManager, Invoices invoice = null, IInvoiceStornosManager invoiceStornosManager = null, ITransportOrdersManager transportOrdersManager = null, ITermsManager termsManager = null, IEnumerable<Image> images = null) { string result = xmlMainXMLDoc; switch (printType) { case PrintTypes.Order: var order = ordersManager.GetById(id); result = ReplaceCommonFields(order, result); result = ReplaceBaseOrderFields(order, result); result = result.Replace("#SignatureDate", order.CreateDate.AddDays(2).ToShortDateString()); result = ReplaceRentPositions(order, result, taxesManager); result = ReplaceTotalPrice(order, result, taxesManager); result = ReplaceRentAdditionalCostPositions(order, result); break; case PrintTypes.Offer: order = ordersManager.GetById(id); result = ReplaceCommonFields(order, result); result = ReplaceBaseOfferFields(order, result); result = ReplaceBaseOrderFields(order, result); result = ReplaceRentPositions(order, result, taxesManager); result = ReplaceRentAdditionalCostPositions(order, result); break; case PrintTypes.Invoice: if (invoice == null) { invoice = invoicesManager.GetById(id); } order = invoice.Orders; result = ReplaceCommonFields(order, result); result = ReplaceBaseOrderFields(order, result); result = ReplaceBaseInvoiceFields(invoice, result, printType); bool manualPricePrinted = false; result = ReplaceInvoicePositions(invoice, invoice.InvoicePositions.ToList(), result, "#PositionDescription", "#PositionPrice", "Leistungen: ", ref manualPricePrinted); result = ReplaceInvoicePrices(invoice, result); break; case PrintTypes.InvoiceStorno: var invoiceStorno = invoiceStornosManager.GetById(id); invoice = invoiceStorno.Invoices; order = invoice.Orders; result = ReplaceCommonFields(order, result); result = ReplaceBaseOrderFields(order, result); result = ReplaceBaseInvoiceFields(invoice, result, printType); result = ReplaceInvoiceStornoPrices(invoiceStorno, result); result = ReplaceFieldValue(result, "#FreeText", invoiceStorno.FreeText); break; case PrintTypes.ReminderMail: invoice = invoicesManager.GetById(id); order = invoice.Orders; result = ReplaceCommonFields(order, result); result = ReplaceReminderPositions(invoice.InvoicePositions.ToList(), result); result = ReplaceReminderTotalPrice(invoice, result, taxesManager); break; case PrintTypes.DeliveryNote: var term = termsManager.GetById(id); result = ReplaceCommonFields(term.Orders, result); result = ReplaceBaseOrderFields(term.Orders, result); result = result.Replace("#DeliveryNoteType", "Lieferschein"); result = result.Replace("#DateType", "Liefertermin"); result = result.Replace("#AdressType", "Lieferanschrift"); result = result.Replace("#OrderNumber", term.Orders.OrderNumber); result = ReplacePositionWithDescription(term, result); if (term.DeliveryNoteSignatures.Count != 0) { var doc = XDocument.Parse(result); var signatureElement = doc.Descendants().FirstOrDefault(o => o.Value.Equals("#Signature", StringComparison.InvariantCultureIgnoreCase)); if (signatureElement != null && images != null && images.Count() != 0) { var currentElement = signatureElement; for (var i = 0; i < images.Count(); i++) { var image = images.ElementAt(images.Count() - i - 1); //TODO doesnt work (( //pkg.CreateRelationship(uri, TargetMode.Internal, // "Http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", // "barcodeImageId"); //insert image XmlElement tagDrawing = GetImageTag(image.Width, image.Height, term.DeliveryNoteSignatures.Count - i); signatureElement.AddAfterSelf(XDocument.Parse(tagDrawing.InnerXml).Root); } signatureElement.Remove(); result = doc.Root.ToString(); } else { result = result.Replace("#Signature", String.Empty); } } else { result = result.Replace("#Signature", String.Empty); } break; default: throw new NotImplementedException(); } return result; }