37 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using Elwig.Helpers;
 | 
						|
using Elwig.Models.Entities;
 | 
						|
 | 
						|
namespace Elwig.Documents {
 | 
						|
    public abstract class BusinessDocument : Document {
 | 
						|
 | 
						|
        public bool ShowDateAndLocation = false;
 | 
						|
 | 
						|
        public Member Member;
 | 
						|
        public bool IncludeSender = false;
 | 
						|
        public bool UseBillingAddress = false;
 | 
						|
        public string Aside;
 | 
						|
        public string? Location;
 | 
						|
 | 
						|
        public BusinessDocument(string title, Member m, bool includeSender = false) : base(title) {
 | 
						|
            Member = m;
 | 
						|
            Location = App.BranchLocation;
 | 
						|
            IncludeSender = includeSender;
 | 
						|
            var uid = (m.UstIdNr ?? "-") + (m.IsBuchführend ? "" : " <i>(pauschaliert)</i>");
 | 
						|
            Aside = $"<table><colgroup><col span='1' style='width: 22.5mm;'/><col span='1' style='width: 42.5mm;'/></colgroup>" +
 | 
						|
                $"<thead><tr><th colspan='2'>Mitglied</th></tr></thead><tbody>" +
 | 
						|
                $"<tr><th>Mitglieds-Nr.</th><td>{m.MgNr}</td></tr>" +
 | 
						|
                $"<tr><th>Betriebs-Nr.</th><td>{m.LfbisNr}</td></tr>" +
 | 
						|
                $"<tr><th>UID</th><td>{uid}</td></tr>" +
 | 
						|
                $"</tbody></table>";
 | 
						|
        }
 | 
						|
 | 
						|
        public string Address {
 | 
						|
            get {
 | 
						|
                IAddress addr = (Member.BillingAddress != null && UseBillingAddress) ? Member.BillingAddress : Member;
 | 
						|
                var plz = addr.PostalDest.AtPlz;
 | 
						|
                return (addr is BillingAddr ? $"{addr.Name}\n" : "") + $"{Member.AdministrativeName}\n{addr.Address}\n{plz?.Plz} {plz?.Ort.Name.Split(",")[0]}\n{addr.PostalDest.Country.Name}";
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |