private async void btnaceptar_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            var metroWindow = this;

            if (get_cierre == null)
            {
                metroWindow.MetroDialogOptions.ColorScheme = MetroDialogOptions.ColorScheme;
                await metroWindow.ShowMessageAsync(Ent_Msg.msginfomacion, "No hay datos para imprimir.", MessageDialogStyle.Affirmative, metroWindow.MetroDialogOptions);
            }
            else
            {
                DateTime _fecha   = Convert.ToDateTime(dtpfecha.Text);
                string   _imprime = ImprimirCierre.Generar_Impresion_Cierre(_fecha);
                if (_imprime != "ok")
                {
                    await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Hubo un problema con la impresion.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);
                }
            }
            Mouse.OverrideCursor = null;
        }
예제 #2
0
        private async void btnaceptar_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            Boolean chkfin = chkcierre.IsChecked.Value;

            if (chkfin)
            {
                if (get_cierre.total_efectivo > 0)
                {
                    string  _ban_id     = dwbanco.EditValue.ToString();
                    string  _ope        = txtoperacion.Text.ToString();
                    decimal _monto_edit = Convert.ToDecimal(txtmonto.Text);

                    if (_ban_id == "-1")
                    {
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Debe de seleccionar el banco del deposito.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);

                        dwbanco.Focus();
                        Mouse.OverrideCursor = null;
                        return;
                    }
                    if (_ope.Length == 0)
                    {
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Ingrese el numero de operacion.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);

                        txtoperacion.Focus();
                        Mouse.OverrideCursor = null;
                        return;
                    }

                    if (_monto_edit == 0)
                    {
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Ingrese el monto de la operacion.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);

                        txtmonto.Focus();
                        Mouse.OverrideCursor = null;
                        return;
                    }
                }
            }


            string mensaje = (chkfin) ? "Esta seguro de realizar el cierre de dia" : "Solo se va imprimir el cierre y no se cerrara el dia de venta";

            this.MetroDialogOptions.ColorScheme = MetroDialogOptions.ColorScheme;

            var mySettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = "Si",
                NegativeButtonText    = "No",
                //FirstAuxiliaryButtonText = "Cancelar",
                ColorScheme = MetroDialogOptions.ColorScheme,
            };

            MessageDialogResult result = await this.ShowMessageAsync(Ent_Msg.msginfomacion, mensaje,
                                                                     MessageDialogStyle.AffirmativeAndNegative, mySettings);

            if (result == MessageDialogResult.Affirmative)
            {
                if (chkfin)
                {
                    string     _ban_id      = dwbanco.EditValue.ToString();
                    string     _nroope      = txtoperacion.Text;
                    Decimal    _monto_op    = Convert.ToDecimal(txtmonto.Text);
                    Dat_Basico updatecierre = new Dat_Basico();
                    Boolean    _valida      = updatecierre.update_cierre_venta(2, Ent_Global._fecha_cierre_ult, 0, _ban_id, _nroope, _monto_op);
                    if (_valida)
                    {
                        ImprimirCierre.Generar_Impresion_Cierre(Ent_Global._fecha_cierre_ult);
                        Dat_Basico.VerificaFechaServer_Cierre();
                        Dat_Basico.VerificaCierreVenta();
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Se Realizo el cierre de venta.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);

                        Mouse.OverrideCursor = null;
                        this.Close();
                    }
                    else
                    {
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "!Hubo un problema al momento de cerrar la venta, por favor consulte con sistemas.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);
                    }
                }
                else
                {
                    string _imprime = ImprimirCierre.Generar_Impresion_Cierre(Ent_Global._fecha_cierre_ult);
                    if (_imprime != "ok")
                    {
                        await this.ShowMessageAsync(Ent_Msg.msginfomacion, "Hubo un problema con la impresion.", MessageDialogStyle.Affirmative, this.MetroDialogOptions);
                    }
                }
            }
            Mouse.OverrideCursor = null;
        }