コード例 #1
0
ファイル: SalesInvoice.cs プロジェクト: lulzzz/allors2
        public void AppsPrint(PrintablePrint method)
        {
            if (!method.IsPrinted)
            {
                var singleton = this.Strategy.Session.GetSingleton();
                var logo      = this.BilledFrom?.ExistLogoImage == true ?
                                this.BilledFrom.LogoImage.MediaContent.Data :
                                singleton.LogoImage.MediaContent.Data;

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

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

                var printModel = new Print.SalesInvoiceModel.Model(this);
                this.RenderPrintDocument(this.BilledFrom?.SalesInvoiceTemplate, printModel, images);

                this.PrintDocument.Media.FileName = $"{this.InvoiceNumber}.odt";
            }
        }
コード例 #2
0
        public void GivenSalesInvoice_WhenCreatingPrintModel_ThenPrintModelIsNotNull()
        {
            // Arrange
            var demo = new Demo(this.Session, null);

            demo.Execute();
            this.Session.Derive(true);

            var invoice = new SalesInvoices(this.Session).Extent().First;

            // Act
            var printModel = new Print.SalesInvoiceModel.Model(invoice);

            // Assert
            Assert.NotNull(printModel);
        }