public static List <TS_BEDetalleInput> InputDetalleAutomaticMethod(TS_BEArticulo item) { return(new List <TS_BEDetalleInput>() { new TS_BEDetalleInput() { item = 1, cdarticulo = item.cdarticulo, cdarticulosunat = item.cdarticulosunat, dsarticulo = item.dsarticulo, precio = item.precio, cantidad = item.cantidad, total = item.total, impuesto = item.impuesto, mtodscto = item.mtodscto, mtoimpuesto = item.mtoimpuesto, subtotal = item.subtotal, moverstock = item.moverstock, cara = item.cara, costo = item.costo, cdunimed = item.cdunimed, nrogasboy = item.nrogasboy, precio_orig = item.precio_orig, tpformula = item.tpformula, impuesto_plastico = item.impuesto_plastico, valorconversion = item.valorconversion, cdmedequiv = item.cdmedequiv, tpconversion = item.tpconversion } }); }
private void Articulos_RespuestaArticulo(TS_BEArticulo Articulo) { if (Contexto.ArticulosTarjeta.Count == 0) { Contexto.ArticulosTarjeta.Add(Articulo); } else { if (Contexto.ArticulosTarjeta.Any(Item => (Item.cdarticulo ?? "").Trim().Equals((Articulo.cdarticulo ?? "").Trim())) == false) { Contexto.ArticulosTarjeta.Add(Articulo); } } }
public async void TerminarAgregarArticulo() { var detal = new TS_BEArticulo() { item = 0, dsarticulo = TSSalesApp.vArticuloSeleccionado.dsarticulo.Trim(), precio = (decimal)TSSalesApp.vArticuloSeleccionado.precio, cantidad = TSSalesApp.CantidadProducto, cdarticulo = TSSalesApp.vArticuloSeleccionado.cdarticulo, hora = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString(), trfgratuita = TSSalesApp.vArticuloSeleccionado.trfgratuita, tipo = "PRODUCTO", cara = "", //TSSalesApp.vArticuloSeleccionado.cara, nrogasboy = "", //TSSalesApp.vArticuloSeleccionado.nrogasboy.Trim(), cdarticulosunat = TSSalesApp.vArticuloSeleccionado.cdarticulosunat, cdunimed = TSSalesApp.vArticuloSeleccionado.cdunimed, precio_orig = TSSalesApp.vArticuloSeleccionado.precio_orig, redondea_indecopi = TSSalesApp.vArticuloSeleccionado.redondea_indecopi, tpformula = TSSalesApp.vArticuloSeleccionado.tpformula ?? "", costo = Convert.ToDecimal(TSSalesApp.vArticuloSeleccionado.costo), impuesto = TSSalesApp.vArticuloSeleccionado.impuesto, moverstock = TSSalesApp.vArticuloSeleccionado.moverstock, impuesto_plastico = TSSalesApp.vArticuloSeleccionado.impuesto_plastico, valorconversion = TSSalesApp.vArticuloSeleccionado.valorconversion, cdmedequiv = TSSalesApp.vArticuloSeleccionado.cdmedequiv, tpconversion = TSSalesApp.vArticuloSeleccionado.tpconversion }; detal.total = Math.Round(detal.cantidad * detal.precio, 2, MidpointRounding.AwayFromZero); decimal MtoSubTot = detal.total / ((100 + detal.impuesto) / 100); detal.subtotal = Math.Round(MtoSubTot, 2, MidpointRounding.AwayFromZero); detal.mtoimpuesto = detal.impuesto <= 0 ? 0 : Math.Round(detal.total - MtoSubTot, 2, MidpointRounding.AwayFromZero); detal.mtodscto = Math.Round((detal.precio_orig - detal.precio) * detal.cantidad, 2, MidpointRounding.AwayFromZero); detal.mtototal = detal.total; detal.total_display = detal.mtototal; var index = TSSalesApp.Detalles.Count(); var indexDisplay = TSSalesApp.DetallesDisplay.Count(); TSSalesApp.Detalles.Insert(index, detal); TSSalesApp.DetallesDisplay.Insert(indexDisplay, detal); TSSalesApp.ArticleAdd = true; await Navigation.PopAsync(); }
private void OnSaveEvent(TS_BEArticulo Producto, string Cara) { var detal = new TS_BEArticulo() { item = 1, dsarticulo = Producto.dsarticulo1, precio = Producto.precio, cantidad = Producto.cantidad, cdarticulo = Producto.cdarticulo, cara = Cara, hora = DateTime.Now.ToString("hh:mm:ss tt"), subtotal = Producto.impuesto > 0 ? Math.Round((Producto.total / (Producto.impuesto + 100)) * 100, 2) : Producto.total, tipo = "COMBUSTIBLE", mtoimpuesto = Producto.impuesto > 0 ? Math.Round((Producto.total / (Producto.impuesto + 100)) * Producto.impuesto, 2) : 0, total = Math.Round(Producto.total, 2), nrogasboy = "", cdarticulosunat = Producto.cdarticulosunat, mtodscto = Producto.precio == Producto.precio_orig ? 0 : (Producto.precio_orig - Producto.precio) * Producto.cantidad, cdunimed = Producto.cdunimed, precio_orig = Producto.precio_orig, redondea_indecopi = Producto.redondea_indecopi, tpformula = Producto.tpformula, impuesto = Producto.impuesto, moverstock = Producto.moverstock, costo = Producto.costo, trfgratuita = Producto.trfgratuita, total_display = Math.Round(Producto.total, 2), impuesto_plastico = Producto.impuesto_plastico, valorconversion = Producto.valorconversion, cdmedequiv = Producto.cdmedequiv, tpconversion = Producto.tpconversion }; var index = TSSalesApp.Detalles.Count(); var indexDisplay = TSSalesApp.DetallesDisplay.Count(); TSSalesApp.Detalles.Insert(index, detal); TSSalesApp.DetallesDisplay.Insert(indexDisplay, detal); PrintTotales(); btnCaraContext.IsBusy = false; }
private void ListService_OnItemTransaction(object sender, ItemTappedEventArgs e) { var vDetalleOutput = e.Item as TS_BEArticulo; var detal = new TS_BEArticulo() { item = vDetalleOutput.item, dsarticulo = vDetalleOutput.dsarticulo1 != null?vDetalleOutput.dsarticulo1.Trim() : vDetalleOutput.dsarticulo1, precio = vDetalleOutput.precio, cantidad = vDetalleOutput.cantidad, cdarticulo = vDetalleOutput.cdarticulo, cara = vDetalleOutput.cara, hora = vDetalleOutput.hora, subtotal = vDetalleOutput.impuesto > 0 ? vDetalleOutput.subtotal : vDetalleOutput.total, tipo = vDetalleOutput.tipo, mtoimpuesto = vDetalleOutput.impuesto > 0 ? vDetalleOutput.mtoimpuesto : 0, impuesto = vDetalleOutput.impuesto, total = vDetalleOutput.total, nrogasboy = vDetalleOutput.nrogasboy.Trim(), cdarticulosunat = vDetalleOutput.cdarticulosunat, mtodscto = vDetalleOutput.mtodscto, cdunimed = vDetalleOutput.cdunimed, precio_orig = vDetalleOutput.precio_orig, redondea_indecopi = vDetalleOutput.redondea_indecopi, tpformula = vDetalleOutput.tpformula, costo = vDetalleOutput.costo, trfgratuita = vDetalleOutput.trfgratuita, moverstock = vDetalleOutput.moverstock, impuesto_plastico = vDetalleOutput.impuesto_plastico, valorconversion = vDetalleOutput.valorconversion, cdmedequiv = vDetalleOutput.cdmedequiv, tpconversion = vDetalleOutput.tpconversion }; var index = TSSalesApp.Detalles.Count(); var indexDisplay = TSSalesApp.DetallesDisplay.Count(); TSSalesApp.Detalles.Insert(index, detal); TSSalesApp.DetallesDisplay.Insert(indexDisplay, detal); PrintTotales(); popupTransPendiente.IsVisible = false; }
public TSSales(SalesEstado resultado, TS_BEArticulo cDetalle) { EstadoRespuesta = resultado; vDetalle = cDetalle; }
public static TS_BEMensaje SynchronizedSetSale(TerminalSIGES.Models.Lado Cara, TS_BEArticulo Transaccion) { TS_BELoadInput cLoadingInput = TSSalesInput.LoadInput(); TS_BEClienteInput cClienteInput = TSSalesInput.InputClienteAutomaticMethod(Cara); TS_BECabeceraInput cCabeceraInput = TSSalesInput.InputCabeceraAutomaticMethod(Cara); TS_BEDetalleInput[] cDetalleInput = TSSalesInput.InputDetalleAutomaticMethod(Transaccion).ToArray(); List <TS_BEPagoInput> vPagos = TSSalesInput.InputPagosAutomaticMethod(Cara, Transaccion); TS_BEGrabarConfig vConfiguracion = new TS_BEGrabarConfig() { IsNotPrint = Cara.IsImprimir }; if (vPagos == null) { return(new TS_BEMensaje() { mensaje = "EL MONTO TOTAL NO COINCIDE CON LOS PAGOS DE LA VENTA", Ok = false }); } TS_BEPagoInput[] cPagoInput = vPagos.ToArray(); TSSalesInput.InputMoneyAutomaticMethod(Cara, cCabeceraInput, cDetalleInput, cPagoInput); TS_SISalesClient client = null; try { client = new TS_SISalesClient(Helper.ServicioSoapBinding(), new EndpointAddress(Config.Services.Sales)); TS_BERetornoTransaccion respuesta = client.GrabarTransaccion(cDetalleInput, cCabeceraInput, cPagoInput, cClienteInput, cLoadingInput, vConfiguracion); if (respuesta.Ok) { return(new TS_BEMensaje() { mensaje = respuesta.Codigo, Ok = true }); } else { return(new TS_BEMensaje() { mensaje = respuesta.Mensaje, Ok = false }); } } catch (Exception e) { if (client != null) { if (client.State == CommunicationState.Opened) { client.Close(); } } return(new TS_BEMensaje() { mensaje = e.Message, Ok = false }); } }
public async Task Start_Automatic(Lado Lado) { /** COMIENZA REVISION DE VENTAS PENDIENTES **/ await Task.Run(() => { if (Convert.ToBoolean(TSSalesApp.vTerminal.conexion_dispensador ?? 0) == false || Convert.ToBoolean(TSSalesApp.vParemetros.conexiondispensador ?? false) == false) { Contexto.Progreso = "CONEXION A DISPENSADOR CERRADA"; return; } string codigo = "XXXXXXXXXXX"; TS_BECabeceraOutPut vTransaccion = TSSalesApp.SynchronizedGetOPTransaction(Lado.Cara, codigo, false); if (vTransaccion.Ok) { if (vTransaccion.cDetalleOutPut.Length > 0) { List <TS_BEArticulo> Lista = new List <TS_BEArticulo>(vTransaccion.cDetalleOutPut); if (IsButtonAutomatic == false) { Lista.RemoveAt(Lista.Count - 1); } int Progreso = 0; foreach (TS_BEArticulo Producto in Lista) { Contexto.Mensaje = "ENVIANDO VENTA"; Contexto.Progreso = "PROCESANDO CARA: " + Lado.Cara + "\nPROCESADO " + Progreso + " de " + Lista.Count; var Venta = new TS_BEArticulo() { item = Producto.item, dsarticulo = (Producto.dsarticulo1 ?? "").Trim(), precio = Producto.precio, cantidad = Producto.cantidad, cdarticulo = Producto.cdarticulo, cara = Producto.cara, hora = Producto.hora, subtotal = Producto.subtotal, tipo = Producto.tipo, mtoimpuesto = Producto.mtoimpuesto, total = Producto.total, nrogasboy = Producto.nrogasboy.Trim(), cdarticulosunat = Producto.cdarticulosunat, mtodscto = Producto.mtodscto, cdunimed = Producto.cdunimed, precio_orig = Producto.precio_orig, redondea_indecopi = Producto.redondea_indecopi, tpformula = Producto.tpformula, impuesto = Producto.impuesto, moverstock = Producto.moverstock, costo = Producto.costo, trfgratuita = Producto.trfgratuita, total_display = Producto.total_display, impuesto_plastico = Producto.impuesto_plastico, valorconversion = Producto.valorconversion, cdmedequiv = Producto.cdmedequiv, tpconversion = Producto.tpconversion }; TS_BEMensaje respuesta = TSSalesApp.SynchronizedSetSale(Lado, Venta); if (respuesta.Ok) { try { string[] mensaje = respuesta.mensaje.Split('|'); BindingDocument Item = new BindingDocument() { Documento = mensaje[0], Estado = mensaje[1], Respuesta = mensaje[2] }; Device.BeginInvokeOnMainThread(() => { Contexto.Documentos.Add(Item); }); } catch (Exception ex) { } } Progreso++; } } } else { /** * 1 ERROR GENERAL * 2 ERROR DESCUENTOS * 3 ERROR TABLAS DBF * 4 SIN TRANSACCIONES * 5 SIN CONEXION DISPENSADO * 6 TERMINAL SIN CONEXION DISPENSADOR **/ if (vTransaccion.Estado == 4) { Contexto.Progreso = "SIN TRANSACCIONES"; return; } } }); }
private void ListView_SwipeEnded(object sender, Syncfusion.ListView.XForms.SwipeEndedEventArgs e) { itemIndex = (TS_BEArticulo)e.ItemData; }
private void ListView_SwipeStarted(object sender, Syncfusion.ListView.XForms.SwipeStartedEventArgs e) { itemIndex = null; }
public async Task Start_Automatic(TerminalSIGES.Models.Lado Lado) { /** COMIENZA REVISION DE VENTAS PENDIENTES **/ await Task.Run(() => { if (Convert.ToBoolean(TSSalesApp.vTerminal.conexion_dispensador ?? 0) == false || Convert.ToBoolean(TSSalesApp.vParemetros.conexiondispensador ?? false) == false) { Lado.Mensaje = "CONEXION A DISPENSADOR CERRADA"; return; } string codigo = Lado.Documento == TerminalSIGES.Models.EDocumento.NotaDespacho ? Lado.Tarjeta : Lado.Documento == TerminalSIGES.Models.EDocumento.TranferenciaGratuita ? "XXXXXXXXXXX" : Lado.Documento == TerminalSIGES.Models.EDocumento.Serafin ? "XXXXXXXXXXX" : Lado.Codigo; TS_BECabeceraOutPut vTransaccion = TSSalesApp.SynchronizedGetOPTransaction(Lado.Cara, codigo, true); if (vTransaccion.Ok) { if (vTransaccion.cDetalleOutPut.Length > 0) { Lado.Mensaje = "ENVIANDO VENTA"; var Venta = new TS_BEArticulo() { item = vTransaccion.cDetalleOutPut[0].item, dsarticulo = (vTransaccion.cDetalleOutPut[0].dsarticulo1 ?? "").Trim(), precio = vTransaccion.cDetalleOutPut[0].precio, cantidad = vTransaccion.cDetalleOutPut[0].cantidad, cdarticulo = vTransaccion.cDetalleOutPut[0].cdarticulo, cara = vTransaccion.cDetalleOutPut[0].cara, hora = vTransaccion.cDetalleOutPut[0].hora, subtotal = vTransaccion.cDetalleOutPut[0].subtotal, tipo = vTransaccion.cDetalleOutPut[0].tipo, mtoimpuesto = vTransaccion.cDetalleOutPut[0].mtoimpuesto, total = vTransaccion.cDetalleOutPut[0].total, nrogasboy = vTransaccion.cDetalleOutPut[0].nrogasboy.Trim(), cdarticulosunat = vTransaccion.cDetalleOutPut[0].cdarticulosunat, mtodscto = 0, cdunimed = vTransaccion.cDetalleOutPut[0].cdunimed, precio_orig = vTransaccion.cDetalleOutPut[0].precio_orig, redondea_indecopi = vTransaccion.cDetalleOutPut[0].redondea_indecopi, tpformula = vTransaccion.cDetalleOutPut[0].tpformula, impuesto = vTransaccion.cDetalleOutPut[0].impuesto, moverstock = vTransaccion.cDetalleOutPut[0].moverstock, costo = vTransaccion.cDetalleOutPut[0].costo, trfgratuita = vTransaccion.cDetalleOutPut[0].trfgratuita, total_display = vTransaccion.cDetalleOutPut[0].total_display, impuesto_plastico = vTransaccion.cDetalleOutPut[0].impuesto_plastico, valorconversion = vTransaccion.cDetalleOutPut[0].valorconversion, cdmedequiv = vTransaccion.cDetalleOutPut[0].cdmedequiv, tpconversion = vTransaccion.cDetalleOutPut[0].tpconversion }; TS_BEMensaje respuesta = TSSalesApp.SynchronizedSetSale(Lado, Venta); if (respuesta.Ok) { Lado.Codigo = ""; Lado.Ruc = ""; Lado.RazonSocial = ""; Lado.Correo = ""; Lado.Direccion = ""; Lado.Placa = ""; Lado.Odometro = ""; Lado.Chofer = ""; Lado.Tarjeta_afiliacion = ""; Lado.Pago = ""; Lado.Tarjeta = ""; Lado.Fecha_Nacimiento = null; Lado.Telefono = ""; Lado.Marca = ""; Lado.Modelo = ""; Lado.Mensaje = ""; Lado.Pago = "EFECTIVO"; Lado.Pagos.Clear(); Lado.Documento = TerminalSIGES.Models.EDocumento.BoletaFactura; } else { Lado.Estado.estado = false; Lado.Mensaje = respuesta.mensaje; } } } else { /** * 1 ERROR GENERAL * 2 ERROR DESCUENTOS * 3 ERROR TABLAS DBF * 4 SIN TRANSACCIONES * 5 SIN CONEXION DISPENSADO * 6 TERMINAL SIN CONEXION DISPENSADOR **/ if (vTransaccion.Estado == 4) { Lado.Mensaje = "SIN TRANSACCIONES"; return; } Lado.Estado.estado = false; Lado.Mensaje = vTransaccion.Mensaje; } }); /** TERMINA REVISION DE VENTAS PENDIENTES **/ }
private void _SalesDetalle(TSSales respuesta) { TSSalesApp.SalesDetalle -= _SalesDetalle; Device.BeginInvokeOnMainThread(async() => { busyindicator.IsVisible = false; if (respuesta.EstadoRespuesta == SalesEstado.InformacionNoObtenida) { btnCaraContext.IsBusy = true; // segmentedControlCara.IsEnabled = true; await DisplayAlert("Aviso", "No hay transaccion disponible", "Aceptar"); return; } if (respuesta.EstadoRespuesta == SalesEstado.ErrorSistema) { btnCaraContext.IsBusy = true; await DisplayAlert("Aviso", "Hubo un problema en la comunicación con el servidor, por favor intente después.", "Aceptar"); return; } if (respuesta.EstadoRespuesta == SalesEstado.InformacionObtenida) { btnAutomatic.IsEnabled = false; btnCredito.IsEnabled = false; btnCliente.IsEnabled = false; var vDetalleOutput = respuesta.vTransaccion.cDetalleOutPut; if (vDetalleOutput.Length == 1) { var detal = new TS_BEArticulo() { item = vDetalleOutput[0].item, dsarticulo = vDetalleOutput[0].dsarticulo1 != null ? vDetalleOutput[0].dsarticulo1.Trim() : vDetalleOutput[0].dsarticulo1, precio = vDetalleOutput[0].precio, cantidad = vDetalleOutput[0].cantidad, cdarticulo = vDetalleOutput[0].cdarticulo, cara = vDetalleOutput[0].cara, hora = vDetalleOutput[0].hora, subtotal = vDetalleOutput[0].impuesto > 0 ? vDetalleOutput[0].subtotal : vDetalleOutput[0].total, tipo = vDetalleOutput[0].tipo, mtoimpuesto = vDetalleOutput[0].impuesto > 0 ? vDetalleOutput[0].mtoimpuesto : 0, total = vDetalleOutput[0].total, nrogasboy = vDetalleOutput[0].nrogasboy.Trim(), cdarticulosunat = vDetalleOutput[0].cdarticulosunat, mtodscto = vDetalleOutput[0].mtodscto, cdunimed = vDetalleOutput[0].cdunimed, precio_orig = vDetalleOutput[0].precio_orig, redondea_indecopi = vDetalleOutput[0].redondea_indecopi, tpformula = vDetalleOutput[0].tpformula, impuesto = vDetalleOutput[0].impuesto, moverstock = vDetalleOutput[0].moverstock, costo = vDetalleOutput[0].costo, trfgratuita = vDetalleOutput[0].trfgratuita, total_display = vDetalleOutput[0].total_display, impuesto_plastico = vDetalleOutput[0].impuesto_plastico, valorconversion = vDetalleOutput[0].valorconversion, cdmedequiv = vDetalleOutput[0].cdmedequiv, tpconversion = vDetalleOutput[0].tpconversion }; var index = TSSalesApp.Detalles.Count(); var indexDisplay = TSSalesApp.DetallesDisplay.Count(); TSSalesApp.Detalles.Insert(index, detal); TSSalesApp.DetallesDisplay.Insert(indexDisplay, detal); PrintTotales(); } else { popupTransPendiente.IsVisible = true; transactionPendiente.ItemsSource = respuesta.vTransaccion.cDetalleOutPut; transactionPendiente.HeightRequest = transactionPendiente.HeightRequest + (respuesta.vTransaccion.cDetalleOutPut.Count() * 30); } } }); }
public static List <TS_BEPagoInput> InputPagosAutomaticMethod(TerminalSIGES.Models.Lado Cara, TS_BEArticulo Transaccion) { if (Cara.Documento == TerminalSIGES.Models.EDocumento.BoletaFactura) { if (Cara.Pagos.Count > 1) { decimal TotalProducto = Transaccion.total; decimal TotalPagos = 0; List <TS_BEPagoInput> Pagos = new List <TS_BEPagoInput>(); foreach (TerminalSIGES.Models.Pago Pago in Cara.Pagos) { TotalPagos += (Pago.Dolares * TSSalesApp.TipoCambio) + (Pago.Soles); Pagos.Add(new TS_BEPagoInput() { cdtppago = Pago.Codigo, cdbanco = "", nrocuenta = "", nrocheque = "", nrotarjeta = Pago.Referencia, cdtarjeta = Pago.Tipo, mtopagosol = Pago.Soles, mtopagodol = Pago.Dolares }); } if (TotalProducto > TotalPagos) { return(null); } return(Pagos); } if (Cara.Pagos.Count == 1) { if (Cara.Pagos[0].Dolares > 0) { if (Transaccion.total > (Cara.Pagos[0].Dolares * TSSalesApp.TipoCambio) + (Cara.Pagos[0].Soles)) { return(null); } } else { Cara.Pagos[0].Soles = Transaccion.total; } return(new List <TS_BEPagoInput>() { new TS_BEPagoInput() { cdtppago = Cara.Pagos[0].Codigo, cdbanco = "", nrocuenta = "", nrocheque = "", nrotarjeta = Cara.Pagos[0].Referencia, cdtarjeta = Cara.Pagos[0].Tipo, mtopagosol = Cara.Pagos[0].Soles, mtopagodol = Cara.Pagos[0].Dolares } }); } else { return(new List <TS_BEPagoInput>() { new TS_BEPagoInput() { cdtppago = "00001", cdbanco = "", nrocuenta = "", nrocheque = "", nrotarjeta = "", cdtarjeta = "", mtopagosol = Transaccion.total, mtopagodol = 0 } }); } } if (Cara.Documento == TerminalSIGES.Models.EDocumento.NotaDespacho) { return(new List <TS_BEPagoInput>() { new TS_BEPagoInput() { cdtppago = "00004", cdbanco = "", nrocuenta = "", nrotarjeta = "", nrocheque = "", cdtarjeta = "", mtopagosol = Transaccion.total, mtopagodol = 0 } }); } return(new List <TS_BEPagoInput>() { new TS_BEPagoInput() { cdtppago = "00001", cdbanco = "", nrocuenta = "", nrotarjeta = "", nrocheque = "", cdtarjeta = "", mtopagosol = Transaccion.total, mtopagodol = 0 } }); }