|
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:omni_datetime_picker/omni_datetime_picker.dart';
|
|
import 'package:omni_datetime_picker/omni_datetime_picker.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
+import 'package:turquessa_app/views/venta/venta_csv.dart';
|
|
import '../../widgets/widgets_components.dart';
|
|
import '../../widgets/widgets_components.dart';
|
|
import '../../models/models.dart';
|
|
import '../../models/models.dart';
|
|
import '../../viewmodels/viewmodels.dart';
|
|
import '../../viewmodels/viewmodels.dart';
|
|
@@ -15,11 +16,14 @@ class VentaScreen extends StatefulWidget {
|
|
}
|
|
}
|
|
|
|
|
|
class _VentaScreenState extends State<VentaScreen> {
|
|
class _VentaScreenState extends State<VentaScreen> {
|
|
- DateTime? fechaSeleccionada;
|
|
|
|
|
|
+ DateTime? fechaInicialSeleccionada;
|
|
|
|
+ DateTime? fechaFinalSeleccionada;
|
|
List<Pedido> pedidosNoCancelados = [];
|
|
List<Pedido> pedidosNoCancelados = [];
|
|
List<Pedido> pedidosCancelados = [];
|
|
List<Pedido> pedidosCancelados = [];
|
|
|
|
+ List<Propinas> listaPropinas = [];
|
|
final _busqueda = TextEditingController(text: '');
|
|
final _busqueda = TextEditingController(text: '');
|
|
double totalDelDia = 0.0;
|
|
double totalDelDia = 0.0;
|
|
|
|
+ double totalPropinas = 0.0;
|
|
double totalCancelados = 0.0;
|
|
double totalCancelados = 0.0;
|
|
|
|
|
|
double totalEfectivoDelDia = 0.0;
|
|
double totalEfectivoDelDia = 0.0;
|
|
@@ -36,7 +40,8 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
void clearSearchAndReset() {
|
|
void clearSearchAndReset() {
|
|
setState(() {
|
|
setState(() {
|
|
_busqueda.clear();
|
|
_busqueda.clear();
|
|
- fechaSeleccionada = null;
|
|
|
|
|
|
+ fechaInicialSeleccionada = null;
|
|
|
|
+ fechaFinalSeleccionada = null;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -45,9 +50,18 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
return Scaffold(
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
appBar: AppBar(
|
|
title: Text(
|
|
title: Text(
|
|
- "Resumen de Pedidos por Día",
|
|
|
|
|
|
+ "Resumen de Pedidos por Periodo",
|
|
style: TextStyle(color: AppTheme.secondary),
|
|
style: TextStyle(color: AppTheme.secondary),
|
|
),
|
|
),
|
|
|
|
+ actions: <Widget>[
|
|
|
|
+ IconButton(
|
|
|
|
+ icon: const Icon(Icons.save_alt),
|
|
|
|
+ onPressed: () {
|
|
|
|
+ exportCSV(fechaInicialSeleccionada, fechaFinalSeleccionada);
|
|
|
|
+ },
|
|
|
|
+ tooltip: 'Exportar a CSV',
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
iconTheme: IconThemeData(color: AppTheme.secondary)),
|
|
iconTheme: IconThemeData(color: AppTheme.secondary)),
|
|
body: Padding(
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16.0),
|
|
padding: const EdgeInsets.all(16.0),
|
|
@@ -62,16 +76,16 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
child: tarjeta(
|
|
child: tarjeta(
|
|
ListTile(
|
|
ListTile(
|
|
title: Text(
|
|
title: Text(
|
|
- "Fecha",
|
|
|
|
|
|
+ "Fecha Inicial",
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
color: AppTheme.quaternary,
|
|
color: AppTheme.quaternary,
|
|
fontWeight: FontWeight.bold),
|
|
fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
subtitle: Text(
|
|
subtitle: Text(
|
|
- fechaSeleccionada == null
|
|
|
|
|
|
+ fechaInicialSeleccionada == null
|
|
? ""
|
|
? ""
|
|
: DateFormat("dd/MM/yyyy")
|
|
: DateFormat("dd/MM/yyyy")
|
|
- .format(fechaSeleccionada!),
|
|
|
|
|
|
+ .format(fechaInicialSeleccionada!),
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
color: AppTheme.quaternary,
|
|
color: AppTheme.quaternary,
|
|
fontWeight: FontWeight.bold),
|
|
fontWeight: FontWeight.bold),
|
|
@@ -80,15 +94,58 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
color: AppTheme.quaternary),
|
|
color: AppTheme.quaternary),
|
|
onTap: () async {
|
|
onTap: () async {
|
|
DateTime? d = await showDatetimePicker(
|
|
DateTime? d = await showDatetimePicker(
|
|
- context, fechaSeleccionada,
|
|
|
|
- inicia: fechaSeleccionada,
|
|
|
|
|
|
+ context, fechaInicialSeleccionada,
|
|
|
|
+ inicia: fechaInicialSeleccionada,
|
|
tipo: OmniDateTimePickerType.date,
|
|
tipo: OmniDateTimePickerType.date,
|
|
solofecha: true);
|
|
solofecha: true);
|
|
if (d == null) return;
|
|
if (d == null) return;
|
|
setState(() {
|
|
setState(() {
|
|
- fechaSeleccionada = d;
|
|
|
|
|
|
+ fechaInicialSeleccionada = d;
|
|
});
|
|
});
|
|
- cargarPedidos(fechaSeleccionada!);
|
|
|
|
|
|
+ cargarPedidos(fechaInicialSeleccionada,
|
|
|
|
+ fechaFinalSeleccionada);
|
|
|
|
+ }),
|
|
|
|
+ color: AppTheme.tertiary,
|
|
|
|
+ ),
|
|
|
|
+ )),
|
|
|
|
+ const SizedBox(
|
|
|
|
+ width: 10,
|
|
|
|
+ ),
|
|
|
|
+ Expanded(
|
|
|
|
+ flex: 3,
|
|
|
|
+ child: Padding(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 0.0),
|
|
|
|
+ child: tarjeta(
|
|
|
|
+ ListTile(
|
|
|
|
+ title: Text(
|
|
|
|
+ "Fecha Final",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ color: AppTheme.quaternary,
|
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
|
+ ),
|
|
|
|
+ subtitle: Text(
|
|
|
|
+ fechaFinalSeleccionada == null
|
|
|
|
+ ? ""
|
|
|
|
+ : DateFormat("dd/MM/yyyy")
|
|
|
|
+ .format(fechaFinalSeleccionada!),
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ color: AppTheme.quaternary,
|
|
|
|
+ fontWeight: FontWeight.bold),
|
|
|
|
+ ),
|
|
|
|
+ trailing: Icon(Icons.calendar_month,
|
|
|
|
+ color: AppTheme.quaternary),
|
|
|
|
+ onTap: () async {
|
|
|
|
+ DateTime? d = await showDatetimePicker(
|
|
|
|
+ context, fechaFinalSeleccionada,
|
|
|
|
+ inicia: fechaFinalSeleccionada,
|
|
|
|
+ tipo: OmniDateTimePickerType.date,
|
|
|
|
+ solofecha: true);
|
|
|
|
+ if (d == null) return;
|
|
|
|
+ setState(() {
|
|
|
|
+ fechaFinalSeleccionada = d;
|
|
|
|
+ });
|
|
|
|
+ cargarPedidos(fechaInicialSeleccionada,
|
|
|
|
+ fechaFinalSeleccionada);
|
|
}),
|
|
}),
|
|
color: AppTheme.tertiary,
|
|
color: AppTheme.tertiary,
|
|
),
|
|
),
|
|
@@ -136,6 +193,16 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
fontSize: 20, fontWeight: FontWeight.w500),
|
|
fontSize: 20, fontWeight: FontWeight.w500),
|
|
),
|
|
),
|
|
Text(
|
|
Text(
|
|
|
|
+ "Fecha/Hora: ${_formatDateTime(pedido.peticion)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
|
|
+ "Propina: \$${formatCurrency(_propinaPedido(pedido.id) ?? 0)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
"Total: \$${formatCurrency(pedido.totalPedido ?? 0)}",
|
|
"Total: \$${formatCurrency(pedido.totalPedido ?? 0)}",
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 20, fontWeight: FontWeight.w500)),
|
|
fontSize: 20, fontWeight: FontWeight.w500)),
|
|
@@ -155,6 +222,16 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
color: Colors.red),
|
|
color: Colors.red),
|
|
),
|
|
),
|
|
Text(
|
|
Text(
|
|
|
|
+ "Fecha/Hora: ${_formatDateTime(pedido.peticion)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
|
|
+ "Propina: \$${formatCurrency(_propinaPedido(pedido.id) ?? 0)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.w500),
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
"Total: \$${formatCurrency(pedido.totalPedido ?? 0)}",
|
|
"Total: \$${formatCurrency(pedido.totalPedido ?? 0)}",
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 20,
|
|
fontSize: 20,
|
|
@@ -194,13 +271,25 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
Column(
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
children: [
|
|
- Padding(
|
|
|
|
- padding: const EdgeInsets.all(16.0),
|
|
|
|
- child: Text(
|
|
|
|
- "Total del día: \$${formatCurrency(totalDelDia)}",
|
|
|
|
- style: TextStyle(
|
|
|
|
- fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
|
- ),
|
|
|
|
|
|
+ Row(
|
|
|
|
+ children: [
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.all(16.0),
|
|
|
|
+ child: Text(
|
|
|
|
+ "Total Propina: \$${formatCurrency(totalPropinas)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.all(16.0),
|
|
|
|
+ child: Text(
|
|
|
|
+ "Total: \$${formatCurrency(totalDelDia)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
),
|
|
),
|
|
Row(
|
|
Row(
|
|
children: [
|
|
children: [
|
|
@@ -263,62 +352,153 @@ class _VentaScreenState extends State<VentaScreen> {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- void cargarPedidos(DateTime fecha) async {
|
|
|
|
- // Convertir el inicio y fin del día local a UTC
|
|
|
|
- final inicioDelDia = DateTime(fecha.year, fecha.month, fecha.day)
|
|
|
|
- .toUtc(); // Convierte la fecha local de inicio del día a UTC
|
|
|
|
-
|
|
|
|
- final finDelDia = DateTime(fecha.year, fecha.month, fecha.day, 23, 59, 59)
|
|
|
|
- .toUtc(); // Convierte la fecha local de fin del día a UTC
|
|
|
|
-
|
|
|
|
- print('Buscando pedidos desde: $inicioDelDia hasta: $finDelDia (en UTC)');
|
|
|
|
-
|
|
|
|
- // Realizar la búsqueda en UTC
|
|
|
|
- final pedidos = await Provider.of<PedidoViewModel>(context, listen: false)
|
|
|
|
- .buscarPorFecha(inicioDelDia, finDelDia);
|
|
|
|
-
|
|
|
|
- print('Pedidos obtenidos: ${pedidos.length}');
|
|
|
|
- pedidos.forEach((pedido) => print(
|
|
|
|
- 'Pedido: ${pedido.folio}, Total: ${pedido.totalPedido}, Estatus: ${pedido.estatus}'));
|
|
|
|
-
|
|
|
|
- final pedidosNoCancelados =
|
|
|
|
- pedidos.where((p) => p.estatus != "CANCELADO").toList();
|
|
|
|
- final pedidosCancelados =
|
|
|
|
- pedidos.where((p) => p.estatus == "CANCELADO").toList();
|
|
|
|
-
|
|
|
|
- totalDelDia = 0.0;
|
|
|
|
- totalCancelados = 0.0;
|
|
|
|
- totalEfectivoDelDia = 0.0;
|
|
|
|
- totalTarjetaDelDia = 0.0;
|
|
|
|
- totalTransferenciaDelDia = 0.0;
|
|
|
|
- cambio = 0.0;
|
|
|
|
- totalSinCambio = 0.0;
|
|
|
|
-
|
|
|
|
- for (var pedido in pedidosNoCancelados) {
|
|
|
|
- totalDelDia += pedido.totalPedido ?? 0.0;
|
|
|
|
- totalEfectivoDelDia += pedido.cantEfectivo ?? 0.0;
|
|
|
|
- totalTarjetaDelDia += pedido.cantTarjeta ?? 0.0;
|
|
|
|
- totalTransferenciaDelDia += pedido.cantTransferencia ?? 0.0;
|
|
|
|
- totalSinCambio =
|
|
|
|
- totalEfectivoDelDia + totalTarjetaDelDia + totalTransferenciaDelDia;
|
|
|
|
-
|
|
|
|
- cambio = totalSinCambio - totalDelDia;
|
|
|
|
|
|
+ void cargarPedidos(DateTime? fechaInicial, DateTime? fechaFinal) async {
|
|
|
|
+ if (fechaInicial != null && fechaFinal != null) {
|
|
|
|
+ // Convertir el inicio y fin del día local a UTC
|
|
|
|
+ final inicioDelDia =
|
|
|
|
+ DateTime(fechaInicial.year, fechaInicial.month, fechaInicial.day)
|
|
|
|
+ .toUtc(); // Convierte la fecha local de inicio del día a UTC
|
|
|
|
+
|
|
|
|
+ final finDelDia = DateTime(
|
|
|
|
+ fechaFinal.year, fechaFinal.month, fechaFinal.day, 23, 59, 59)
|
|
|
|
+ .toUtc(); // Convierte la fecha local de fin del día a UTC
|
|
|
|
+
|
|
|
|
+ print('Buscando pedidos desde: $inicioDelDia hasta: $finDelDia (en UTC)');
|
|
|
|
+
|
|
|
|
+ // Realizar la búsqueda en UTC
|
|
|
|
+ final pedidos = await Provider.of<PedidoViewModel>(context, listen: false)
|
|
|
|
+ .buscarPorFecha(inicioDelDia, finDelDia);
|
|
|
|
+
|
|
|
|
+ print('Pedidos obtenidos: ${pedidos.length}');
|
|
|
|
+ pedidos.forEach((pedido) => print(
|
|
|
|
+ 'Pedido: ${pedido.folio}, Total: ${pedido.totalPedido}, Estatus: ${pedido.estatus}, Propinas: ${pedido.propinas.length}'));
|
|
|
|
+
|
|
|
|
+ final pedidosNoCancelados =
|
|
|
|
+ pedidos.where((p) => p.estatus != "CANCELADO").toList();
|
|
|
|
+ final pedidosCancelados =
|
|
|
|
+ pedidos.where((p) => p.estatus == "CANCELADO").toList();
|
|
|
|
+
|
|
|
|
+ totalDelDia = 0.0;
|
|
|
|
+ totalPropinas = 0.0;
|
|
|
|
+ totalCancelados = 0.0;
|
|
|
|
+ totalEfectivoDelDia = 0.0;
|
|
|
|
+ totalTarjetaDelDia = 0.0;
|
|
|
|
+ totalTransferenciaDelDia = 0.0;
|
|
|
|
+ cambio = 0.0;
|
|
|
|
+ totalSinCambio = 0.0;
|
|
|
|
+
|
|
|
|
+ for (var pedido in pedidosNoCancelados) {
|
|
|
|
+ totalDelDia += pedido.totalPedido ?? 0.0;
|
|
|
|
+ totalEfectivoDelDia += pedido.cantEfectivo ?? 0.0;
|
|
|
|
+ totalTarjetaDelDia += pedido.cantTarjeta ?? 0.0;
|
|
|
|
+ totalTransferenciaDelDia += pedido.cantTransferencia ?? 0.0;
|
|
|
|
+ totalSinCambio =
|
|
|
|
+ totalEfectivoDelDia + totalTarjetaDelDia + totalTransferenciaDelDia;
|
|
|
|
+
|
|
|
|
+ cambio = totalSinCambio - totalDelDia;
|
|
|
|
+
|
|
|
|
+ print("Propinas: ${pedido.propinas.length}");
|
|
|
|
+ // if (pedido.propinas.length > 0) {
|
|
|
|
+ // for (var propina in pedido.propinas) {
|
|
|
|
+ // totalPropinas += propina.cantidad ?? 0.0;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ final propinas =
|
|
|
|
+ await Provider.of<PropinaViewModel>(context, listen: false)
|
|
|
|
+ .obtenerPropinasPorPedido(pedido.id);
|
|
|
|
+
|
|
|
|
+ listaPropinas = propinas;
|
|
|
|
+ for (var propina in propinas) {
|
|
|
|
+ totalPropinas += propina.cantidad ?? 0.0;
|
|
|
|
+ }
|
|
|
|
+ print("Total propinas: ${totalPropinas}");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ totalCancelados = pedidosCancelados.fold(
|
|
|
|
+ 0.0, (sum, current) => sum + (current.totalPedido ?? 0.0));
|
|
|
|
+
|
|
|
|
+ setState(() {
|
|
|
|
+ this.pedidosNoCancelados = pedidosNoCancelados;
|
|
|
|
+ this.pedidosCancelados = pedidosCancelados;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- totalCancelados = pedidosCancelados.fold(
|
|
|
|
- 0.0, (sum, current) => sum + (current.totalPedido ?? 0.0));
|
|
|
|
|
|
+ void exportCSV(DateTime? fechaInicial, DateTime? fechaFinal) async {
|
|
|
|
+ final pedidosViewModel =
|
|
|
|
+ Provider.of<PedidoViewModel>(context, listen: false);
|
|
|
|
+ List<Pedido> pedidosConProductos = [];
|
|
|
|
+ List<Propinas> propinas = [];
|
|
|
|
+ List<Propinas> altPropinas = [];
|
|
|
|
|
|
- setState(() {
|
|
|
|
- this.pedidosNoCancelados = pedidosNoCancelados;
|
|
|
|
- this.pedidosCancelados = pedidosCancelados;
|
|
|
|
- });
|
|
|
|
|
|
+ for (Pedido pedido in pedidosViewModel.pedidos) {
|
|
|
|
+ Pedido? pedidoConProductos =
|
|
|
|
+ await pedidosViewModel.fetchPedidoConProductos(pedido.id);
|
|
|
|
+ if (pedidoConProductos != null) {
|
|
|
|
+ pedidosConProductos.add(pedidoConProductos);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (pedidosConProductos.isNotEmpty) {
|
|
|
|
+ String fileName = 'Ventas_Turquessa_POS';
|
|
|
|
+ if (fechaInicial != null && fechaFinal != null) {
|
|
|
|
+ String startDateStr = DateFormat('dd-MM-yyyy').format(fechaInicial!);
|
|
|
|
+ String endDateStr = DateFormat('dd-MM-yyyy').format(fechaFinal!);
|
|
|
|
+ fileName += '_${startDateStr}_al_${endDateStr}';
|
|
|
|
+ }
|
|
|
|
+ fileName += '.csv';
|
|
|
|
+
|
|
|
|
+ for (var pedido in pedidosConProductos) {
|
|
|
|
+ altPropinas =
|
|
|
|
+ await Provider.of<PropinaViewModel>(context, listen: false)
|
|
|
|
+ .obtenerPropinasPorPedido(pedido.id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (var alt in altPropinas) {
|
|
|
|
+ propinas.add(alt);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await exportarVentasACSV(pedidosConProductos, propinas, fileName);
|
|
|
|
+ ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
|
|
|
+ content: Text('Archivo CSV descargado! Archivo: $fileName')));
|
|
|
|
+ } else {
|
|
|
|
+ ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
+ SnackBar(content: Text('No hay pedidos para exportar.')));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
Future<void> imprimirResumenPedidos(List<Pedido> pedidos) async {
|
|
Future<void> imprimirResumenPedidos(List<Pedido> pedidos) async {
|
|
- if (fechaSeleccionada == null) {
|
|
|
|
- print("No se ha seleccionado una fecha.");
|
|
|
|
|
|
+ if (fechaInicialSeleccionada == null) {
|
|
|
|
+ print("No se ha seleccionado una fecha inicial.");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- await VentaTicket.imprimirResumenPedidos(pedidos, fechaSeleccionada!);
|
|
|
|
|
|
+ if (fechaFinalSeleccionada == null) {
|
|
|
|
+ print("No se ha seleccionado una fecha final.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ await VentaTicket.imprimirResumenPedidos(
|
|
|
|
+ pedidos, fechaInicialSeleccionada!);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String _formatDateTime(String? dateTimeString) {
|
|
|
|
+ if (dateTimeString == null) return "Sin fecha";
|
|
|
|
+
|
|
|
|
+ DateTime parsedDate = DateTime.parse(dateTimeString);
|
|
|
|
+
|
|
|
|
+ var formatter = DateFormat('dd-MM-yyyy HH:mm:ss');
|
|
|
|
+ return formatter.format(parsedDate.toLocal());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ double? _propinaPedido(int? idPedido) {
|
|
|
|
+ double? propina = 0.0;
|
|
|
|
+
|
|
|
|
+ for (var p in listaPropinas) {
|
|
|
|
+ if (p.idPedido == idPedido) {
|
|
|
|
+ propina = p.cantidad;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return propina;
|
|
}
|
|
}
|
|
}
|
|
}
|