private async void MethodLoadPedido() { await Task.Factory.StartNew(() => { try { CollectionESGR_PedidoDetalle.Source = new BSGR_PedidoDetalle().GetCollectionPedidoDetalle(ESGR_Venta.ESGR_Pedido); if (CollectionESGR_PedidoDetalle.Count == 0) { PropertyFiltroPedido = string.Empty; } if (ESGR_Venta.Opcion == "I") { CollectionESGR_PedidoDetalle.ToList().ForEach(x => { x.CantidadAux = x.Cantidad; x.Importe = x.Cantidad *x.ESGR_Producto.Precio; }); } else { CollectionESGR_PedidoDetalle.ToList().ForEach(x => { x.Cantidad = 0; x.Importe = x.Cantidad *x.ESGR_Producto.Precio; }); } MethodCalcular(); } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar); } }); }
private async void MethodLoadDetails(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria) { await Task.Factory.StartNew(() => { CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria); Application.Current.Dispatcher.Invoke(() => { CollectionESGR_PedidoDetalle.Clear(); CollectionESGR_Producto.ToList().ForEach(x => { var vrDetalle = CollectionESGR_Detalle.FirstOrDefault(y => y.ESGR_Producto.IdProducto == x.IdProducto); if (vrDetalle != null) { CollectionESGR_PedidoDetalle.Add(vrDetalle); } else { CollectionESGR_PedidoDetalle.Add(new ESGR_PedidoDetalle() { ESGR_Producto = x, Cantidad = 0, CantidadAux = 0, Enviado = false }); } }); }); }); }
private bool MethodValidaDatos() { if (CollectionESGR_PedidoDetalle.Count == 0) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, "El pedido no puede estar vacío", CmpButton.Aceptar); return(true); } else if (CollectionESGR_PedidoDetalle.ToList().Exists(x => x.Cantidad == 0)) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, "No puede existir Producto con Cantidad 0", CmpButton.Aceptar); return(true); } return(false); }
private bool MethodValidaDatos() { if (CollectionESGR_VentaDetalle.Count() == 0) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, "No hay detalle que guardar.", CmpButton.Aceptar); return(true); } else if (CollectionESGR_PedidoDetalle.Count(x => x.Cantidad > 0) > 0) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, "Aun hay platos pendientes de pago.", CmpButton.Aceptar); return(true); } return(false); }
private string MethodCadenaDetallePedidoXML() { string strCadena = "<ROOT>"; CollectionESGR_PedidoDetalle.ToList().ForEach((x) => { strCadena += "<Listar "; strCadena += "xIdProducto = \'" + x.ESGR_Producto.IdProducto; strCadena += "\' xCantidad = \'" + x.CantidadAux; strCadena += "\' xCantidadMesa = \'" + 0; strCadena += "\' xCantidadLlevar = \'" + 0; strCadena += "\' xPrecio = \'" + x.ESGR_Producto.Precio; strCadena += "\' xObservacion = \'" + x.Observacion; strCadena += "\' xEnviado = \'" + "true"; strCadena += "\'></Listar>"; }); strCadena += "</ROOT>"; return(strCadena); }
private async void MethodLoadPedido(ESGR_Pedido ESGR_Pedido) { await Task.Factory.StartNew(() => { try { ESGR_VentaCuenta.ESGR_Venta.ESGR_Pedido = ESGR_Pedido; if (CollectionESGR_PedidoDetalle.Count == 0) { PropertyFiltroPedido = string.Empty; } Application.Current.Dispatcher.Invoke(() => { if (ESGR_VentaCuenta.Opcion == "I") { CollectionESGR_VentaDetalle.Clear(); CollectionESGR_PedidoDetalle.ToList().ForEach(x => { CollectionESGR_VentaDetalle.Add(new ESGR_VentaDetalle() { Cantidad = x.Cantidad, ESGR_Producto = x.ESGR_Producto, ESGR_VentaCuenta = this.ESGR_VentaCuenta, Importe = 0 }); }); } }); MethodCalcularTotales(); } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar); } }); }
private void MethodCalcular() { Total = CollectionESGR_PedidoDetalle.Sum(x => x.ESGR_Producto.Precio * x.Cantidad); TotalDolar = (ESGR_TipoCambio != null) ? TotalDolar / (decimal)ESGR_TipoCambio.SelRate : 0; }
private void MethodCalcular() { SumaTotalPedido = CollectionESGR_PedidoDetalle.Sum(x => x.ESGR_Producto.Precio * x.Cantidad); SumaTotalDetalle = CollectionESGR_VentaDetalle.Sum(x => x.Importe); }
private void MethodClear() { CollectionESGR_PedidoDetalle.Clear(); CollectionESGR_VentaDetalle.Clear(); }