/// <summary> /// Schreibt den Briefkopf. /// </summary> /// <param name="letterhead"></param> protected virtual void WriteLetterHead(LetterHead letterhead) { if (letterhead != null) { var par = this.Document.LastSection.AddParagraph(); par.AddFormattedText(letterhead.Topline, "LetterHeadTopLine"); par.AddLineBreak(); par.AddLineBreak(); foreach (string line in letterhead.Lines) { par.AddText(line); par.AddLineBreak(); } par.Format.SpaceAfter = "20mm"; par.Format.SpaceBefore = "10mm"; } }
/// <summary> /// Erstelle den Rechnugnskopf /// </summary> protected override void WriteCoverSheet() { Adress dispatchAdress = null; if (!Preview && this.Invoice.OrderInvoice.FirstOrDefault() != null && this.Invoice.OrderInvoice.FirstOrDefault().Order != null) { dispatchAdress = Invoice.GetInvoiceDispatchAdress(this.Invoice.Customer.Id, this.Invoice.OrderInvoice.First().Order.LocationId, _dbContext); } else { if (this.Invoice.Customer.LargeCustomer != null && this.Invoice.Customer.LargeCustomer.Location1!=null) { dispatchAdress = Invoice.GetInvoiceDispatchAdress(this.Invoice.Customer.Id, this.Invoice.Customer.LargeCustomer.Location1.Id, _dbContext); } else { dispatchAdress = Invoice.GetInvoiceDispatchAdress(this.Invoice.Customer.Id, null, _dbContext); } } if (this.Invoice.Adress.ContentEquals(dispatchAdress) == false) { var coverLetterHead = new LetterHead(_dbContext); coverLetterHead.Topline = this.Letterhead.Topline; coverLetterHead.Lines = new List<string>(){ this.Invoice.Customer.Name, this.Invoice.InvoiceRecipient, dispatchAdress.Street + " " + dispatchAdress.StreetNumber, dispatchAdress.Zipcode + " " + dispatchAdress.City, dispatchAdress.Country}; if (this.Invoice.Customer.LargeCustomer != null) { this.WriteLetterHead(coverLetterHead); this.Document.LastSection.AddPageBreak(); } } //else //{ // var coverLetterHead = new LetterHead(_dbContext); // coverLetterHead.Topline = this.Letterhead.Topline; // coverLetterHead.Lines = new List<string>(){ // this.Invoice.Customer.Name, // this.Invoice.InvoiceRecipient, // this.Invoice.Adress.Street + " " + this.Invoice.Adress.StreetNumber, // this.Invoice.Adress.Zipcode + " " + this.Invoice.Adress.City, // this.Invoice.Adress.Country}; //} }