public void BuildBody()
        {
            Customer customer = folio.Customer;
            Product  product  = folio.Product;

            ticket.TextLocationMode = TicketPaperLocation.Body;
            ticket.SideText("Fecha de expedición:", DateTime.Today.ToShortDateString());
            ticket.SideText("Recepción de equipos", $"Folio: {folio.ID}");
            ticket.Separator(TicketSeparator.Dash);
            ticket.CenterText("[Datos del cliente]");
            ticket.LeftText($"Nombre: {customer.Firstname} {customer.Lastname}");
            //if (!string.IsNullOrWhiteSpace(customer.Telephone))
            //    ticket.LeftText($"Teléfono: {customer.Telephone}");
            if (!string.IsNullOrWhiteSpace(customer.Email))
            {
                ticket.LeftText($"Email: {customer.Email}");
            }
            ticket.Separator(TicketSeparator.Asterisk);
            ticket.CenterText("[Datos del equipo]");
            ticket.LeftText($"Marca: {product.Trademark}");
            ticket.LeftText($"Modelo: {product.Model}");
            ticket.LeftText($"No. de Serie:");
            ticket.LeftText($"{product.SerialNumber}");
            ticket.LeftText($"Descripción de la falla:");
            foreach (Issue i in issues)
            {
                ticket.RightText($"* {i.Text}");
            }
            ticket.Separator(TicketSeparator.Dash);
        }
        public void BuildBody()
        {
            Customer customer = order.Customer;

            ticket.TextLocationMode = TicketPaperLocation.Body;
            ticket.SideText("Expidation date:", DateTime.Today.ToShortDateString());
            ticket.SideText("Date of sale:", order.DateAdded.ToShortDateString());
            ticket.SideText("Folio:", $"#{order.ID}");
            ticket.Separator(TicketSeparator.Dash);
            // Customer
            ticket.CenterText("[Customer]");
            ticket.LeftText($"Fullname: {customer.Firstname} {customer.Lastname}");
            if (!string.IsNullOrWhiteSpace(customer.Email))
            {
                ticket.LeftText($"Email: {customer.Email}");
            }

            ticket.Separator(TicketSeparator.Asterisk);
            // Order
            ticket.CenterText("[Order]");
            ticket.SideText("Payment method:", order.PaymentMethod.ToString());
            ticket.SideText("Shipping method:", order.ShippingMethod.ToString());
            ticket.Separator(TicketSeparator.Blank);
            ticket.Separator(TicketSeparator.Dash);
            ticket.LeftText("Product\tU/P\tQuantity\tTotal");
            ticket.Separator(TicketSeparator.Dash);
            // Products
            foreach (OrderProduct op in order.Products)
            {
                decimal unitPrice    = op.Price;
                decimal totalProduct = op.Total;
                string  prod         = (op.Name.Length < 8) ? op.Name.PadRight(8) : op.Name.Substring(0, 8);
                ticket.LeftText($"-{prod}\t${unitPrice.ToString("#.##")}\t{op.Quantity}\t${totalProduct.ToString("#.##")}");
            }
            ticket.Separator(TicketSeparator.Dash);
            // Totals
            var orderTotals = order.OrderTotals.OrderBy(o => o.SortOrder);

            foreach (OrderTotal ot in orderTotals)
            {
                if (ot.Code == "sub_total")
                {
                    decimal subtotal = ot.Value;
                    ticket.LeftText($"Subtotal: ${subtotal.ToString("#.##")}");
                }
                else
                {
                    ticket.LeftText($"{ot.Title}: ${ot.Value.ToString("#.##")}");
                }
            }
            ticket.Separator(TicketSeparator.Dash);
        }
示例#3
0
        private static void BuildHeader(TicketDocument ticket)
        {
            string[] header = new string[]
            {
                "Rosalio Barajas Amezquita",
                "R.F.C. BAAR820625AH9",
                "Av. de los Normalistas 564, Colinas de La Normal, 44270 Guadalajara, Jal.",
                "Tel: (33) 3854-54-63 Ext 4",
                "E-mail: [email protected]",
                "www.tecnomarketing.com.mx",
                "Horario: L-V. De 9-14 hrs y 16-19 hrs",
                "Sábados de 9 a 14 hrs"
            };
            foreach (string ht in header)
            {
                ticket.CenterText(ht);
            }

            ticket.Separator(TicketSeparator.Dash);
        }
示例#4
0
        private static void BuildBody(TicketDocument ticket, OrderDataModel order)
        {
            CustomerModel customer = order.Customer;

            ticket.TextLocationMode = TextTicketLocation.Body;
            ticket.SideText("Fecha de expedición:", DateTime.Today.ToShortDateString());
            ticket.SideText("Fecha de venta:", order.DateAdded.ToShortDateString());
            ticket.SideText("Folio:", $"#{order.ID}");
            ticket.Separator(TicketSeparator.Dash);

            // Cliente
            ticket.CenterText("[Datos del cliente]");
            ticket.LeftText($"Nombre: {customer.Firstname} {customer.Lastname}");
            if (!string.IsNullOrWhiteSpace(customer.Email))
            {
                ticket.LeftText($"Email: {customer.Email}");
            }

            ticket.Separator(TicketSeparator.Asterisk);

            // Venta
            ticket.CenterText("[Datos de venta]");
            ticket.SideText("Método de pago:", order.PaymentMethod.ToString());
            ticket.SideText("Método de envío:", order.ShippingMethod.ToString());
            ticket.Separator(TicketSeparator.Blank);
            ticket.Separator(TicketSeparator.Dash);
            ticket.LeftText("Producto\tP/U\tCant\tTotal");
            ticket.Separator(TicketSeparator.Dash);

            // Productos
            StringBuilder serials    = new StringBuilder();
            bool          hasSerials = false;

            foreach (OrderProductModel op in order.Cart)
            {
                string prod = (op.Name.Length < 8) ? op.Name.PadRight(8) : op.Name.Substring(0, 8);

                ticket.LeftText($"-{prod}\t${op.Price:#.##}\t{op.Quantity}\t${op.Total:#.##}");

                if (op.SerialNumbers.Count() > 0)
                {
                    hasSerials = true;
                    foreach (ProductSerialModel serial in op.SerialNumbers)
                    {
                        serials
                        .Append($"-{prod} {serial.SerialNumber}"
                                .PadRight(TicketLen))
                        .Append($"{serial.DateStart.ToShortDateString()} {serial.DateEnd.ToShortDateString()}"
                                .PadRight(TicketLen));
                    }
                }
            }
            if (hasSerials)
            {
                ticket.Separator(TicketSeparator.Dash);
                // Serials
                ticket.CenterText("# Serie | Garantía");
                ticket.Separator(TicketSeparator.Blank);
                ticket.LeftText(serials.ToString());
            }

            ticket.Separator(TicketSeparator.Dash);

            // Totales
            var orderTotals = order.OrderTotals.OrderBy(o => o.SortOrder);

            foreach (OrderTotalModel ot in orderTotals)
            {
                ticket.RightText($"{ot.Title}: {((ot.Value != 0) ? $"{ot.Value:#.##}" : "N/A")}");
            }
            ticket.RightText($"IVA: 16%");
            ticket.Separator(TicketSeparator.Dash);
        }