Ejemplo n.º 1
0
 private async void MethodLoadDetails(ESGR_Pedido ESGR_Pedido)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             var vrCollectionMSGR_PedidoDetalle = new BSGR_PedidoDetalle().GetCollectionPedidoDetalle(ESGR_Pedido);
             Application.Current.Dispatcher.Invoke(() =>
             {
                 CollectionMSGR_PedidoDetalle.Clear();
                 foreach (var item in vrCollectionMSGR_PedidoDetalle)
                 {
                     CollectionMSGR_PedidoDetalle.Add(new VMSGR_PedidoDetalle()
                     {
                         ESGR_Producto  = item.ESGR_Producto,
                         PrecioDolar    = (ESGR_TipoCambio != null) ? (item.ESGR_Producto.Precio / (decimal)ESGR_TipoCambio.SelRate) : 0,
                         Cantidad       = item.Cantidad,
                         CantidadAux    = item.Cantidad,
                         CantidadMesa   = item.CantidadMesa,
                         CantidadLlevar = item.CantidadLlevar,
                         Enviado        = true
                     });
                 }
                 MethodCalcularCuenta();
             });
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar);
         }
     });
 }
Ejemplo n.º 2
0
        private async void MethodGuardarVenta()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    ESGR_Venta.CuentasXML = MethodCuentasXML();
                    ESGR_Venta.DetalleXML = MethodDetalleXML();
                    new BSGR_Venta().TransVenta(ESGR_Venta);

                    if (OpcionGuardado == "VR")
                    {
                        var CollectionMSGR_PedidoDetalle = new BSGR_PedidoDetalle().GetCollectionPedidoDetalle(ESGR_Venta.ESGR_Pedido);
                        #region REALIZA IMPRESION

                        CrearTicket ticket = new CrearTicket();
                        ticket.TextoCentro(SGRVariables.ESGR_Usuario.ESGR_Empresa.RazonSocial);
                        ticket.TextoIzquierda("RUC:   " + SGRVariables.ESGR_Usuario.ESGR_Empresa.Ruc);
                        ticket.TextoIzquierda("DIREC: " + SGRVariables.ESGR_Usuario.ESGR_Empresa.DireccionFiscal);
                        ticket.TextoIzquierda("TELEF: " + SGRVariables.ESGR_Usuario.ESGR_Empresa.Telefono);
                        ticket.TextoIzquierda("");
                        ticket.lineasIgual();
                        ticket.TextoIzquierda("");
                        ticket.TextoDerecha("Ticket #001-" + ESGR_Venta.ESGR_Pedido.IdPedido.ToString("00000#"));
                        ticket.TextoIzquierda(SGRVariables.ESGR_Usuario.ESGR_Perfil.NombrePerfil + ": " + SGRVariables.ESGR_Usuario.IdUsuario + " " + SGRVariables.ESGR_Usuario.Nombres);
                        ticket.TextoExtremos("Fecha: " + DateTime.Now.ToShortDateString(), "Hora: " + DateTime.Now.ToShortTimeString());
                        ticket.TextoExtremos("Mesa: " + ESGR_Venta.ESGR_Pedido.Identificador, "Personas: " + ESGR_Venta.ESGR_Pedido.Cubierto);
                        ticket.TextoIzquierda("");
                        ticket.lineasIgual();
                        ticket.TextoIzquierda("");
                        //Articulos a vender.
                        ticket.EncabezadoVenta();//NOMBRE DEL ARTICULO, CANT, PRECIO, IMPORTE
                        ticket.lineasGuion();
                        foreach (var item in CollectionMSGR_PedidoDetalle)
                        {
                            ticket.AgregaArticulo(item.ESGR_Producto.Producto, (int)item.Cantidad, (decimal)item.ESGR_Producto.Precio, ((int)item.Cantidad * (decimal)item.ESGR_Producto.Precio));
                        }
                        ticket.lineasGuion();
                        decimal Total = CollectionMSGR_PedidoDetalle.Sum(x => ((int)x.Cantidad * (decimal)x.ESGR_Producto.Precio));
                        ticket.AgregarTotales("         TOTAL S/", Total);
                        ticket.TextoIzquierda("");
                        ticket.TextoIzquierda("Razon Social:");
                        ticket.lineasSubGuion();
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("RUC:");
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("Direccion:");
                        ticket.lineasSubGuion();
                        ticket.lineasSubGuion();
                        ticket.TextoIzquierda("");
                        ticket.TextoCentro("¡ GRACIAS POR SU PREFERENCIA !");
                        ticket.TextoIzquierda("ESTE NO ES UN COMPROBANTE FISCAL CANJEAR POR BOLETA O FACTURA");

                        if (SGRVariables.NotificacionPreCuenta != null && SGRVariables.NotificacionPreCuenta.Trim().Length != 0)
                        {
                            ticket.TextoIzquierda("");
                            ticket.lineasAsteriscos();
                            ticket.TextoIzquierda("");
                            ticket.TextoIzquierda(SGRVariables.NotificacionPreCuenta);
                            ticket.TextoIzquierda("");
                        }

                        ticket.ImprimirTicket(SGRVariables.ImpresoraCaja);

                        #endregion
                    }

                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, SGRMessageContent.ContentSaveOK, CmpButton.Aceptar, () => Volver(null));
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
                }
            });
        }