|
@@ -206,34 +206,27 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
|
|
|
|
final sucursalVariable =
|
|
final sucursalVariable =
|
|
await Provider.of<VariableViewModel>(context, listen: false)
|
|
await Provider.of<VariableViewModel>(context, listen: false)
|
|
- .getVariableByClave('sucursal');
|
|
|
|
|
|
+ .getVariableByClave('Sucursal');
|
|
final sucursalDescripcion = sucursalVariable?.descripcion ?? '';
|
|
final sucursalDescripcion = sucursalVariable?.descripcion ?? '';
|
|
|
|
|
|
List<pw.Widget> content = [
|
|
List<pw.Widget> content = [
|
|
- pw.SizedBox(height: 20),
|
|
|
|
- pw.Text('.', style: pw.TextStyle(fontSize: 1)),
|
|
|
|
pw.Row(
|
|
pw.Row(
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceAround,
|
|
children: [
|
|
children: [
|
|
pw.Text('${pedido.folio}/ ',
|
|
pw.Text('${pedido.folio}/ ',
|
|
- style: pw.TextStyle(fontSize: 12, fontWeight: pw.FontWeight.bold)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
if (sucursalDescripcion.isNotEmpty)
|
|
if (sucursalDescripcion.isNotEmpty)
|
|
pw.Text('$sucursalDescripcion/ ',
|
|
pw.Text('$sucursalDescripcion/ ',
|
|
- style:
|
|
|
|
- pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
|
+ pw.Text('${pedido.peticion}',
|
|
|
|
+ style: pw.TextStyle(fontSize: 7, fontWeight: pw.FontWeight.bold)),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
- pw.SizedBox(height: 5),
|
|
|
|
- pw.Row(children: [
|
|
|
|
- pw.Text('${pedido.peticion}',
|
|
|
|
- style: pw.TextStyle(fontSize: 12, fontWeight: pw.FontWeight.bold)),
|
|
|
|
- ]),
|
|
|
|
- if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
|
|
- pw.SizedBox(height: 5),
|
|
|
|
|
|
+ pw.SizedBox(height: 2),
|
|
if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
if (pedido.nombreCliente != null && pedido.nombreCliente!.isNotEmpty)
|
|
pw.Text('Cliente: ${pedido.nombreCliente}',
|
|
pw.Text('Cliente: ${pedido.nombreCliente}',
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
- pw.SizedBox(height: 10),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
|
|
+ pw.SizedBox(height: 2),
|
|
];
|
|
];
|
|
|
|
|
|
// Mostrar los productos con la cantidad, el precio total y el precio de los toppings
|
|
// Mostrar los productos con la cantidad, el precio total y el precio de los toppings
|
|
@@ -255,14 +248,14 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
flex: 3,
|
|
flex: 3,
|
|
child: pw.Text(
|
|
child: pw.Text(
|
|
'-${topping.topping?.nombre ?? "Topping no especificado"}',
|
|
'-${topping.topping?.nombre ?? "Topping no especificado"}',
|
|
- style: const pw.TextStyle(fontSize: 9)),
|
|
|
|
|
|
+ style: const pw.TextStyle(fontSize: 6)),
|
|
),
|
|
),
|
|
if (toppingPrice > 0)
|
|
if (toppingPrice > 0)
|
|
pw.Expanded(
|
|
pw.Expanded(
|
|
flex: 1,
|
|
flex: 1,
|
|
child: pw.Text(
|
|
child: pw.Text(
|
|
'\$${numberFormat.format(toppingTotal)}',
|
|
'\$${numberFormat.format(toppingTotal)}',
|
|
- style: const pw.TextStyle(fontSize: 9),
|
|
|
|
|
|
+ style: const pw.TextStyle(fontSize: 6),
|
|
textAlign: pw.TextAlign.right,
|
|
textAlign: pw.TextAlign.right,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
@@ -277,22 +270,23 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
pw.Expanded(
|
|
pw.Expanded(
|
|
flex: 1,
|
|
flex: 1,
|
|
child: pw.Text('${producto.cantidad}',
|
|
child: pw.Text('${producto.cantidad}',
|
|
- style: const pw.TextStyle(fontSize: 12)),
|
|
|
|
|
|
+ style: const pw.TextStyle(fontSize: 7)),
|
|
),
|
|
),
|
|
pw.Expanded(
|
|
pw.Expanded(
|
|
- flex: 3,
|
|
|
|
|
|
+ flex: 5,
|
|
child: pw.Text(
|
|
child: pw.Text(
|
|
producto.producto?.nombre ?? "Producto no especificado",
|
|
producto.producto?.nombre ?? "Producto no especificado",
|
|
- style: const pw.TextStyle(fontSize: 11)),
|
|
|
|
|
|
+ style: const pw.TextStyle(fontSize: 7)),
|
|
),
|
|
),
|
|
pw.Expanded(
|
|
pw.Expanded(
|
|
- flex: 2,
|
|
|
|
- child: pw.Text(
|
|
|
|
- '\$${numberFormat.format(productTotal)}',
|
|
|
|
- style: const pw.TextStyle(fontSize: 12),
|
|
|
|
- textAlign: pw.TextAlign.right,
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
|
|
+ flex: 2,
|
|
|
|
+ child: pw.Align(
|
|
|
|
+ alignment: pw.Alignment.centerRight,
|
|
|
|
+ child: pw.Text(
|
|
|
|
+ '\$${numberFormat.format(productTotal)}',
|
|
|
|
+ style: const pw.TextStyle(fontSize: 7),
|
|
|
|
+ ),
|
|
|
|
+ )),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
...toppingsList,
|
|
...toppingsList,
|
|
@@ -313,22 +307,18 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
children: [
|
|
pw.Text('Subtotal:',
|
|
pw.Text('Subtotal:',
|
|
- style:
|
|
|
|
- pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
pw.Text('\$${numberFormat.format(subtotal)}',
|
|
pw.Text('\$${numberFormat.format(subtotal)}',
|
|
- style:
|
|
|
|
- pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
pw.Row(
|
|
pw.Row(
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
children: [
|
|
pw.Text('Descuento:',
|
|
pw.Text('Descuento:',
|
|
- style:
|
|
|
|
- pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
pw.Text('-\$${numberFormat.format(precioDescuento)}',
|
|
- style:
|
|
|
|
- pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
]);
|
|
]);
|
|
@@ -339,32 +329,30 @@ Future<pw.Page> generarPaginaSegundoTicket(
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
children: [
|
|
pw.Text('Total:',
|
|
pw.Text('Total:',
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
pw.Text(
|
|
pw.Text(
|
|
'\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
'\$${numberFormat.format(descuento > 0 ? totalConDescuento : subtotal)}',
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)),
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
);
|
|
|
|
|
|
if (pedido.comentarios != null && pedido.comentarios!.isNotEmpty) {
|
|
if (pedido.comentarios != null && pedido.comentarios!.isNotEmpty) {
|
|
- content.add(pw.SizedBox(height: 10));
|
|
|
|
|
|
+ content.add(pw.SizedBox(height: 1));
|
|
content.add(pw.Text('Comentarios:',
|
|
content.add(pw.Text('Comentarios:',
|
|
- style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 12)));
|
|
|
|
|
|
+ style: pw.TextStyle(fontWeight: pw.FontWeight.bold, fontSize: 7)));
|
|
content.add(pw.Padding(
|
|
content.add(pw.Padding(
|
|
padding: const pw.EdgeInsets.only(right: 15),
|
|
padding: const pw.EdgeInsets.only(right: 15),
|
|
child:
|
|
child:
|
|
- pw.Text(pedido.comentarios!, style: const pw.TextStyle(fontSize: 12)),
|
|
|
|
|
|
+ pw.Text(pedido.comentarios!, style: const pw.TextStyle(fontSize: 7)),
|
|
));
|
|
));
|
|
- content.add(pw.Text('.', style: pw.TextStyle(fontSize: 1)));
|
|
|
|
- content.add(pw.Text('.', style: pw.TextStyle(fontSize: 1)));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- content.add(pw.SizedBox(height: 20));
|
|
|
|
- content.add(pw.Text('.', style: pw.TextStyle(fontSize: 1)));
|
|
|
|
|
|
+ content.add(pw.SizedBox(height: 1));
|
|
|
|
|
|
return pw.Page(
|
|
return pw.Page(
|
|
pageFormat: PdfPageFormat.roll57,
|
|
pageFormat: PdfPageFormat.roll57,
|
|
|
|
+ margin: pw.EdgeInsets.all(5),
|
|
build: (pw.Context context) {
|
|
build: (pw.Context context) {
|
|
return pw.Column(
|
|
return pw.Column(
|
|
crossAxisAlignment: pw.CrossAxisAlignment.center, children: content);
|
|
crossAxisAlignment: pw.CrossAxisAlignment.center, children: content);
|