示例#1
0
        //Evento click en Botón órdenes hijas
        private void clickBotonImprimir(Object sender, EventArgs o)
        {
            try
            {
                Button botonImprimir = sender as Button;

                //FUNCION PARA VERIFICAR SI LA COMANDA YA FUE COBRADA
                //=====================================================================================
                sSql  = "";
                sSql += "select estado_orden" + Environment.NewLine;
                sSql += "from cv403_cab_pedidos" + Environment.NewLine;
                sSql += "where id_pedido = " + Convert.ToInt32(botonImprimir.Tag) + Environment.NewLine;
                sSql += "and estado = 'A'";

                dtConsulta = new DataTable();
                dtConsulta.Clear();

                bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql);

                if (bRespuesta == false)
                {
                    catchMensaje = new VentanasMensajes.frmMensajeCatch();
                    catchMensaje.LblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql;
                    catchMensaje.ShowDialog();
                    return;
                }

                string sEstado_R = dtConsulta.Rows[0]["estado_orden"].ToString().Trim().ToUpper();

                if (sEstado_R == "PAGADA")
                {
                    ok = new VentanasMensajes.frmMensajeOK();
                    ok.LblMensaje.Text = "La comanda ya ha sido cobrada.";
                    ok.ShowDialog();
                    this.Close();
                    return;
                }

                //=====================================================================================

                //INICIAMOS UNA NUEVA TRANSACCION
                if (!conexion.GFun_Lo_Maneja_Transaccion(Program.G_INICIA_TRANSACCION))
                {
                    ok = new VentanasMensajes.frmMensajeOK();
                    ok.LblMensaje.Text = "Error al iniciar la transacción";
                    ok.ShowDialog();
                    return;
                }

                sSql  = "";
                sSql += "update cv403_cab_pedidos set" + Environment.NewLine;
                sSql += "estado_orden = 'Pre-Cuenta' " + Environment.NewLine;
                sSql += "where id_pedido = " + Convert.ToInt32(botonImprimir.Tag);

                if (!conexion.GFun_Lo_Ejecuta_SQL(sSql))
                {
                    catchMensaje = new VentanasMensajes.frmMensajeCatch();
                    catchMensaje.LblMensaje.Text = "ERROR EN LA SIGUIENTE INSTRUCCIÓN:" + Environment.NewLine + sSql;
                    catchMensaje.ShowDialog();
                    goto reversa;
                }

                conexion.GFun_Lo_Maneja_Transaccion(Program.G_TERMINA_TRANSACCION);
                Pedidos.frmVerPrecuentaTextBox precuenta = new Pedidos.frmVerPrecuentaTextBox(botonImprimir.Tag.ToString(), 1, "Pre-Cuenta");
                precuenta.ShowDialog();

                return;
            }

            catch (Exception ex)
            {
                catchMensaje = new VentanasMensajes.frmMensajeCatch();
                catchMensaje.LblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
                goto reversa;
            }

            reversa : { conexion.GFun_Lo_Maneja_Transaccion(Program.G_REVERSA_TRANSACCION); }
        }
示例#2
0
        //Evento click en Botón órdenes hijas
        private void clickBotonPagos(Object sender, EventArgs o)
        {
            try
            {
                if (Program.iPuedeCobrar == 1)
                {
                    Button botonpagos = sender as Button;

                    //FUNCION PARA VERIFICAR SI LA COMANDA YA FUE COBRADA
                    //=====================================================================================
                    sSql  = "";
                    sSql += "select estado_orden" + Environment.NewLine;
                    sSql += "from cv403_cab_pedidos" + Environment.NewLine;
                    sSql += "where id_pedido = " + Convert.ToInt32(botonpagos.Tag) + Environment.NewLine;
                    sSql += "and estado = 'A'";

                    dtConsulta = new DataTable();
                    dtConsulta.Clear();

                    bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql);

                    if (bRespuesta == false)
                    {
                        catchMensaje = new VentanasMensajes.frmMensajeCatch();
                        catchMensaje.LblMensaje.Text = "ERROR EN LA INSTRUCCIÓN:" + Environment.NewLine + sSql;
                        catchMensaje.ShowDialog();
                        return;
                    }

                    string sEstado_R = dtConsulta.Rows[0]["estado_orden"].ToString().Trim().ToUpper();

                    if (sEstado_R == "PAGADA")
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = "La comanda ya ha sido cobrada.";
                        ok.ShowDialog();
                        this.Close();
                        return;
                    }

                    //=====================================================================================

                    dSubtotal  = 0;
                    dIVA       = 0;
                    dServicio  = 0;
                    dDescuento = 0;
                    Program.iBanderaCerrarVentana = 1;

                    if (Convert.ToInt32(botonpagos.AccessibleDescription) == 1)
                    {
                        ComandaNueva.frmCobros frmCobros = new ComandaNueva.frmCobros(botonpagos.Tag.ToString(), 0);
                        frmCobros.ShowDialog();

                        if (frmCobros.DialogResult == DialogResult.OK)
                        {
                            if (iContador == 1)
                            {
                                DialogResult = DialogResult.OK;
                                Close();
                            }
                            else
                            {
                                iCoordenadaX = 0;
                                iContador    = 0;
                                panel1.Controls.Clear();
                                llenarArreglo();
                            }
                        }
                    }

                    else
                    {
                        Pedidos.frmCobrosEspeciales frmCobros = new Pedidos.frmCobrosEspeciales(botonpagos.Tag.ToString());
                        frmCobros.ShowDialog();

                        if (frmCobros.DialogResult == DialogResult.OK)
                        {
                            if (iContador == 1)
                            {
                                DialogResult = DialogResult.OK;
                                Close();
                            }
                            else
                            {
                                iCoordenadaX = 0;
                                iContador    = 0;
                                panel1.Controls.Clear();
                                llenarArreglo();
                            }
                        }
                    }
                }

                else
                {
                    ok = new VentanasMensajes.frmMensajeOK();
                    ok.LblMensaje.Text = "Su usuario no le permite realizar el cobro de la cuenta.";
                    ok.ShowDialog();
                }
            }

            catch (Exception ex)
            {
                catchMensaje = new VentanasMensajes.frmMensajeCatch();
                catchMensaje.LblMensaje.Text  = ex.Message;
                Program.iBanderaCerrarVentana = 0;
                catchMensaje.ShowDialog();
            }
        }
示例#3
0
        private void btnValorSugerido_Click(object sender, EventArgs e)
        {
            txt_valor.Text = string.Format("{0:0.00}", btnValorSugerido.Text);

            if (iConciliacion == 1)
            {
                if (txtNumeroLote.Text.Trim() == "")
                {
                    ok = new VentanasMensajes.frmMensajeOK();
                    ok.LblMensaje.Text = "Ingrese el número de lote.";
                    ok.ShowDialog();
                    txtNumeroLote.Focus();
                    return;
                }

                if (Program.iManejaPropinaSoloTarjetas == 1)
                {
                    Propina.frmPropina propina = new Propina.frmPropina();
                    propina.ShowDialog();

                    if (propina.DialogResult == DialogResult.OK)
                    {
                        Decimal dbValue = propina.dbPropina;
                        propina.Close();
                        txtPropina.Text = dbValue.ToString("N2");
                    }

                    else
                    {
                        return;
                    }
                }
            }

            if (Convert.ToDouble(txt_valor.Text) <= Convert.ToDouble(btnValorSugerido.Text))
            {
                dbValorGrid = Convert.ToDecimal(txt_valor.Text);
            }

            else
            {
                dbValorGrid = Convert.ToDecimal(btnValorSugerido.Text);
            }

            if (rdbDatafast.Checked == true)
            {
                iOperadorTarjeta = Convert.ToInt32(rdbDatafast.Tag);
            }

            else
            {
                iOperadorTarjeta = Convert.ToInt32(rdbMedianet.Tag);
            }

            if (rdbCredito.Checked == true)
            {
                iTipoTarjeta = Convert.ToInt32(rdbCredito.Tag);
            }

            else
            {
                iTipoTarjeta = Convert.ToInt32(rdbDebito.Tag);
            }

            dbValorIngresado  = Convert.ToDecimal(txt_valor.Text);
            sNumeroLote       = txtNumeroLote.Text.Trim();
            dbValorPropina    = Convert.ToDecimal(txtPropina.Text.Trim());
            this.DialogResult = DialogResult.OK;
        }
示例#4
0
        //FUNCION PARA CONCATENAR
        private void concatenarValores(string sValor)
        {
            try
            {
                textBoxcodigo.Text = textBoxcodigo.Text + sValor;
                textBoxcodigo.Focus();
                textBoxcodigo.SelectionStart = textBoxcodigo.Text.Trim().Length;
            }

            catch (Exception)
            {
                ok.LblMensaje.Text = "Ocurrió un problema al concatenar los valores.";
                ok.ShowInTaskbar   = false;
                ok.ShowDialog();
            }
        }
示例#5
0
        //FUNCION PARA VALIDAR LA CEDULA O RUC
        private void validarIdentificacion(int iOp)
        {
            try
            {
                iBandera = 0;

                if (txtIdentificacion.Text.Length >= 10)
                {
                    iTercerDigito = Convert.ToInt32(txtIdentificacion.Text.Substring(2, 1));
                }
                else
                {
                    goto mensaje;
                }

                if (txtIdentificacion.Text.Length == 10)
                {
                    if (validarCedula.validarCedulaConsulta(txtIdentificacion.Text.Trim()) == "SI")
                    {
                        //CONSULTAR EN LA BASE DE DATOS
                        iIdTipoPersona        = 2447;
                        iIdTipoIdentificacion = 178;

                        if (iOp == 1)
                        {
                            consultarRegistro();
                        }

                        iBandera = 1;
                        goto fin;
                    }

                    else
                    {
                        goto mensaje;
                    }
                }

                else if (txtIdentificacion.Text.Length == 13)
                {
                    if (iTercerDigito == 9)
                    {
                        if (validarRuc.validarRucPrivado(txtIdentificacion.Text.Trim()) == true)
                        {
                            //CONSULTAR EN LA BASE DE DATOS
                            iIdTipoPersona        = 2448;
                            iIdTipoIdentificacion = 179;

                            if (iOp == 1)
                            {
                                consultarRegistro();
                            }

                            iBandera = 1;
                            goto fin;
                        }

                        else
                        {
                            goto mensaje;
                        }
                    }

                    else if (iTercerDigito == 6)
                    {
                        if (validarRuc.validarRucPublico(txtIdentificacion.Text.Trim()) == true)
                        {
                            //CONSULTAR EN LA BASE DE DATOS
                            iIdTipoPersona        = 2448;
                            iIdTipoIdentificacion = 179;

                            if (iOp == 1)
                            {
                                consultarRegistro();
                            }

                            iBandera = 1;
                            goto fin;
                        }

                        else
                        {
                            goto mensaje;
                        }
                    }

                    else if ((iTercerDigito <= 5) || (iTercerDigito >= 0))
                    {
                        if (validarRuc.validarRucNatural(txtIdentificacion.Text.Trim()) == true)
                        {
                            //CONSULTAR EN LA BASE DE DATOS
                            iIdTipoPersona        = 2447;
                            iIdTipoIdentificacion = 179;

                            if (iOp == 1)
                            {
                                consultarRegistro();
                            }

                            iBandera = 1;
                            goto fin;
                        }

                        else
                        {
                            goto mensaje;
                        }
                    }

                    else
                    {
                        goto mensaje;
                    }
                }

                else
                {
                    goto mensaje;
                }
            }

            catch (Exception ex)
            {
                catchMensaje.LblMensaje.Text = ex.ToString();
                catchMensaje.ShowDialog();
            }

mensaje:
            {
                ok.LblMensaje.Text = "El número de identificación ingresado es incorrecto.";
                ok.ShowDialog();
                //txtIdentificacion.Clear();
                txtIdentificacion.Text = sIdentificacionRespaldo;
                txtIdentificacion.Focus();
            }
fin:
            { }
        }
        private void llenarArreglo()
        {
            string sFechaActual1 = Program.sFechaSistema.ToString("yyyy-MM-dd");

            sSql  = "";
            sSql += "select CP.id_pedido, CP.id_pos_mesa, M.descripcion," + Environment.NewLine;
            sSql += "C.descripcion, origen.descripcion," + Environment.NewLine;
            sSql += "CP.fecha_orden, CP.numero_personas," + Environment.NewLine;
            //sSql += "CP.comentarios, MS.descripcion" + Environment.NewLine;
            sSql += "CP.comentarios, MS.descripcion, seccion.descripcion" + Environment.NewLine;
            sSql += "from cv403_cab_pedidos as CP," + Environment.NewLine;
            sSql += "pos_mesa as M," + Environment.NewLine;
            sSql += "pos_cajero as C," + Environment.NewLine;
            sSql += "pos_origen_orden as origen," + Environment.NewLine;
            //sSql += "pos_mesero as MS" + Environment.NewLine;
            sSql += "pos_mesero as MS," + Environment.NewLine;
            sSql += "pos_seccion_mesa as seccion" + Environment.NewLine;
            sSql += "where (M.id_pos_mesa = CP.id_pos_mesa)" + Environment.NewLine;
            sSql += "and (seccion.id_pos_seccion_mesa = M.id_pos_seccion_mesa)" + Environment.NewLine;
            sSql += "and (MS.id_pos_mesero = CP.id_pos_mesero)" + Environment.NewLine;
            sSql += "and (C.id_pos_cajero = CP.id_pos_cajero)" + Environment.NewLine;
            sSql += "and (origen.id_pos_origen_orden = CP.id_pos_origen_orden)" + Environment.NewLine;
            sSql += "and CP.id_pos_mesa = " + iIdPosMesa + Environment.NewLine;
            sSql += "and CP.estado_orden in('Abierta', 'Pre-Cuenta')" + Environment.NewLine;
            sSql += "and CP.fecha_orden = '" + sFechaActual1 + "'" + Environment.NewLine;
            sSql += "and CP.id_localidad = " + Program.iIdLocalidad + Environment.NewLine;
            sSql += "and CP.estado = 'A'" + Environment.NewLine;
            sSql += "and M.estado = 'A'" + Environment.NewLine;
            sSql += "and C.estado = 'A'" + Environment.NewLine;
            sSql += "and seccion.estado = 'A'" + Environment.NewLine;
            sSql += "and origen.estado = 'A'" + Environment.NewLine;
            sSql += "and MS.estado = 'A'" + Environment.NewLine;
            sSql += "order by CP.id_pedido";

            DataTable dtConsulta = new DataTable();

            dtConsulta.Clear();
            bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta, sSql);


            if (bRespuesta == true)
            {
                if (dtConsulta.Rows.Count > 0)
                {
                    Font fuente = new Font("Microsoft Sans Serif", 14);
                    //Microsoft Sans Serif; 18pt

                    for (int i = 0; i < dtConsulta.Rows.Count; i++)
                    {
                        int iIdPedido = Convert.ToInt32(dtConsulta.Rows[i][0].ToString());
                        subtotal1          = 0;
                        subtotal           = 0;
                        lista[i]           = new TextBox();
                        lista[i].Multiline = true;
                        //lista[i].ScrollToCaret();
                        lista[i].ScrollBars            = ScrollBars.Vertical;
                        lista[i].Width                 = 317;                              //292
                        lista[i].Height                = 540;
                        lista[i].Left                  = iContador * 300;                  //300
                        lista[i].Name                  = dtConsulta.Rows[i][4].ToString(); //Guardo el origen de la orden
                        lista[i].Tag                   = iIdPedido;                        //Guardo el id del pedido
                        lista[i].AccessibleDescription = dtConsulta.Rows[i][2].ToString(); //guardo la descripción de la mesa
                        lista[i].AccessibleDefaultActionDescription = dtConsulta.Rows[i][7].ToString();
                        lista[i].TabIndex = i;

                        sSql  = "";
                        sSql += "select numero_pedido " + Environment.NewLine;
                        sSql += "from cv403_numero_cab_pedido" + Environment.NewLine;
                        sSql += "where id_pedido = " + iIdPedido + "";

                        DataTable dtConsulta1 = new DataTable();
                        dtConsulta1.Clear();
                        bRespuesta = conexion.GFun_Lo_Busca_Registro(dtConsulta1, sSql);
                        if (bRespuesta == true)
                        {
                            lista[i].AccessibleName = dtConsulta1.Rows[0][0].ToString();
                        }
                        else
                        {
                            ok.LblMensaje.Text = "Ocurrió un problema al recuperar el número de orden";
                            ok.ShowDialog();
                        }

                        //AGREGAR ETIQUETA SOBRE LA CAJA DE TEXTO
                        etiqueta[i]           = new Label();
                        etiqueta[i].Font      = new Font("Consolas", 15, FontStyle.Bold);
                        etiqueta[i].Location  = new Point(iCoordenadaX, 0);
                        etiqueta[i].Height    = 40;
                        etiqueta[i].Width     = 315; //290
                        etiqueta[i].ForeColor = System.Drawing.SystemColors.ControlLightLight;
                        etiqueta[i].Text      = "Clic en la comanda\npara editar la orden";
                        etiqueta[i].TextAlign = ContentAlignment.MiddleCenter;
                        panel1.Controls.Add(etiqueta[i]);

                        //PARA CARGAR LOS DATOS EN EL TEXTBOX
                        lista[i].Click   += listaClic;
                        lista[i].Font     = new Font("Consolas", 10);
                        lista[i].Location = new Point(iCoordenadaX, 50);
                        ttMensaje.SetToolTip(lista[i], "Clic aquí para editar la orden.");
                        this.Controls.Add(lista[i]);
                        llenarDatosPreCuenta(lista[i]);
                        panel1.Controls.Add(lista[i]);

                        //Cargar los botones de imprimir
                        botonImprimir[i]             = new Button();
                        botonImprimir[i].Cursor      = Cursors.Hand;
                        botonImprimir[i].Font        = fuente;
                        botonImprimir[i].BackColor   = Color.FromArgb(255, 192, 128);
                        botonImprimir[i].TextAlign   = ContentAlignment.MiddleRight;
                        botonImprimir[i].ImageAlign  = ContentAlignment.MiddleLeft;
                        botonImprimir[i].Image       = Palatium.Properties.Resources.impresora_icono;
                        botonImprimir[i].Width       = 137;
                        botonImprimir[i].Height      = 55;
                        botonImprimir[i].Click      += clickBotonImprimir;
                        botonImprimir[i].MouseEnter += imprimir_mouse_enter;
                        botonImprimir[i].MouseLeave += imprimir_mouse_leave;
                        botonImprimir[i].Left        = iContador * 350;
                        botonImprimir[i].Text        = "Imprimir";
                        botonImprimir[i].Location    = new Point(iCoordenadaX, 597);
                        botonImprimir[i].Tag         = iIdPedido;
                        botonImprimir[i].TabIndex    = i;
                        ttMensaje.SetToolTip(botonImprimir[i], "Clic aquí para imprimir la comanda.");
                        panel1.Controls.Add(botonImprimir[i]);

                        //Cargar los botones de pagar
                        botonPagar[i]             = new Button();
                        botonPagar[i].Cursor      = Cursors.Hand;
                        botonPagar[i].Font        = fuente;
                        botonPagar[i].BackColor   = Color.FromArgb(255, 192, 128);
                        botonPagar[i].TextAlign   = ContentAlignment.MiddleRight;
                        botonPagar[i].ImageAlign  = ContentAlignment.MiddleLeft;
                        botonPagar[i].Image       = Palatium.Properties.Resources.cobrar_icono;
                        botonPagar[i].Width       = 137;
                        botonPagar[i].Height      = 55;
                        botonPagar[i].Click      += clickBotonPagos;
                        botonPagar[i].MouseEnter += pagos_mouse_enter;
                        botonPagar[i].MouseLeave += pagos_mouse_leave;
                        botonPagar[i].Left        = iContador * 350;
                        botonPagar[i].Text        = "Cobrar";
                        botonPagar[i].Location    = new Point(iCoordenadaX + 180, 597); //iCoordenadaX + 155, 597
                        botonPagar[i].Tag         = iIdPedido;
                        botonPagar[i].TabIndex    = i;
                        ttMensaje.SetToolTip(botonPagar[i], "Clic aquí para realizar el cobro de la comanda.");
                        iCoordenadaX += 325;    //300
                        panel1.Controls.Add(botonPagar[i]);
                        iContador++;
                    }
                }
            }
        }
示例#7
0
        //FUNCION PARA CONSULTAR Y PERMITIR EL ACCESO A LA COMANDA
        private void abrirMenuComanda()
        {
            try
            {
                if (iBanderaPersonas == 1)
                {
                    Program.iNuevoNumeroPersonas = Convert.ToInt32(txtValor.Text);
                    this.DialogResult            = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    //int numeroMaximo = 99;

                    if (txtValor.Text.Trim() == "")
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = "Favor ingrese la cantidad de personas para la mesa.";
                        ok.ShowDialog();

                        txtValor.Focus();
                        txtValor.SelectionStart = txtValor.Text.Trim().Length;
                    }

                    else if (Convert.ToInt32(txtValor.Text.Trim()) > 99)
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = "El número de Personas ha excedido el límite.";
                        ok.ShowDialog();
                        txtValor.Text = "";

                        txtValor.Focus();
                        txtValor.SelectionStart = txtValor.Text.Trim().Length;
                    }

                    else if (Convert.ToInt32(txtValor.Text.Trim()) == 0)
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = "El número de Personas debe ser diferente de 0.";
                        ok.ShowDialog();
                        txtValor.Text = "";

                        txtValor.Focus();
                        txtValor.SelectionStart = txtValor.Text.Trim().Length;
                    }

                    else if ((lblMesero.Text == "MESERO") && (Program.iLeerMesero == 1))
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = "Favor seleccione un mesero para continuar.";
                        ok.ShowDialog();

                        txtValor.Focus();
                        txtValor.SelectionStart = txtValor.Text.Trim().Length;
                    }

                    else
                    {
                        //Program.iIdMesero = Convert.ToInt32(cmbMesero.SelectedValue);
                        //Program.nombreMesero = cmbMesero.Text;

                        if (Program.iLeerMesero == 1)
                        {
                            Program.iIdMesero    = iIdMesero;
                            Program.nombreMesero = lblMesero.Text;
                        }

                        else
                        {
                            iIdMesero = Program.iIdMesero;
                        }

                        //ACTUALIZACION ELVIS COMANDA

                        int iIdPersona_Rec;

                        if (Program.iBanderaConsumoVale == 1)
                        {
                            iIdPersona_Rec = Program.iIdPersonaConsumoVale;
                        }
                        else
                        {
                            iIdPersona_Rec = Program.iIdPersona;
                        }

                        //=======================================================================================================================
                        ComandaNueva.frmComanda o = new ComandaNueva.frmComanda(Program.iIdOrigenOrden, Program.sDescripcionOrigenOrden, Convert.ToInt32(txtValor.Text.Trim()), iIdMesa, 0, "", Program.CAJERO_ID, iIdMesero, sNombreMesero, Program.sNombreMesa, 0, 0, iIdPersona_Rec);
                        this.DialogResult = DialogResult.OK;
                        o.ShowDialog();
                        //=======================================================================================================================

                        //Orden o = new Orden(Program.iIdOrigenOrden, Program.sDescripcionOrigenOrden, Convert.ToInt32(txtValor.Text.Trim()), iIdMesa, 0, "", Program.iIdPersona, Program.CAJERO_ID, iIdMesero, sNombreMesero, 0, 0);
                        //this.DialogResult = DialogResult.OK;
                        //o.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                catchMensaje = new VentanasMensajes.frmMensajeCatch();
                catchMensaje.LblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
            }
        }