Beispiel #1
0
        public void AppsPrint(PrintablePrint method)
        {
            if (!method.IsPrinted)
            {
                var singleton = this.Strategy.Session.GetSingleton();
                var logo      = this.TakenBy?.ExistLogoImage == true ?
                                this.TakenBy.LogoImage.MediaContent.Data :
                                singleton.LogoImage.MediaContent.Data;

                var images = new Dictionary <string, byte[]>
                {
                    { "Logo", logo },
                };

                if (this.ExistOrderNumber)
                {
                    var session        = this.Strategy.Session;
                    var barcodeService = session.ServiceProvider.GetRequiredService <IBarcodeService>();
                    var barcode        = barcodeService.Generate(this.OrderNumber, BarcodeType.CODE_128, 320, 80);
                    images.Add("Barcode", barcode);
                }

                var model = new Print.SalesOrderModel.Model(this);
                this.RenderPrintDocument(this.TakenBy?.SalesOrderTemplate, model, images);

                this.PrintDocument.Media.FileName = $"{this.OrderNumber}.odt";
            }
        }
Beispiel #2
0
        public void BasePrint(PrintablePrint method)
        {
            if (!method.IsPrinted)
            {
                var singleton = this.Strategy.Session.GetSingleton();
                var logo      = this.Issuer?.ExistLogoImage == true ?
                                this.Issuer.LogoImage.MediaContent.Data :
                                singleton.LogoImage.MediaContent.Data;

                var images = new Dictionary <string, byte[]>
                {
                    { "Logo1", logo },
                    { "Logo2", logo },
                };

                if (this.ExistQuoteNumber)
                {
                    var session        = this.Strategy.Session;
                    var barcodeService = session.ServiceProvider.GetRequiredService <IBarcodeService>();
                    var barcode        = barcodeService.Generate(this.QuoteNumber, BarcodeType.CODE_128, 320, 80, pure: true);
                    images.Add("Barcode", barcode);
                }

                var printModel = new Print.ProductQuoteModel.Model(this, images);
                this.RenderPrintDocument(this.Issuer?.ProductQuoteTemplate, printModel, images);

                this.PrintDocument.Media.InFileName = $"{this.QuoteNumber}.odt";
            }
        }