Exemplo n.º 1
0
        public void GuardaRetiro()
        {
            int    sCaja       = Generales.nCaja;
            int    sCajero     = Generales.nUsuario;
            int    nMonInicial = Convert.ToInt16(usrMonto.nValor);
            string sConcepto   = txtConcepto.Text;

            string sTipo = "";

            if (rbtnPrimero.Checked)
            {
                sTipo = rbtnPrimero.Text;
            }
            else if (radioButton3.Checked)
            {
                sTipo = radioButton3.Text;
            }
            else if (radioButton1.Checked)
            {
                sTipo = radioButton1.Text;
            }



            int nTurno = Generales.nCaja;

            if (usrMonto.nValor == 0)
            {
                Mensajes.Aviso("Ingresa la cantidad a retirar");

                this.usrMonto.txtNumero.BackColor = Color.Red;
            }
            else
            {
                cmd             = new SqlCommand("SP_Registra_Retiro", XSQL.gSqlCon);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int);
                //pTurno.Direction = ParameterDirection.InputOutput;
                pTurno.Value = nTurno;
                cmd.Parameters.Add(pTurno);



                SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int);
                pCaja.Value = sCaja;
                cmd.Parameters.Add(pCaja);

                SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int);
                pCajero.Value = sCajero;
                cmd.Parameters.Add(pCajero);


                SqlParameter pUsuario = new SqlParameter("@idSupervisor", SqlDbType.VarChar, 50);
                pUsuario.Value = cbxUsuario.SelectedValue;
                cmd.Parameters.Add(pUsuario);


                SqlParameter pMinicial = new SqlParameter("@nImporte", SqlDbType.Money);
                pMinicial.Value = nMonInicial;
                cmd.Parameters.Add(pMinicial);

                SqlParameter pConcepto = new SqlParameter("@nConcepto", SqlDbType.VarChar, 50);
                pConcepto.Value = sConcepto;
                cmd.Parameters.Add(pConcepto);

                SqlParameter pTipo = new SqlParameter("@nTipo", SqlDbType.VarChar, 20);
                pTipo.Value = sTipo;
                cmd.Parameters.Add(pTipo);

                SqlParameter pidTurno = new SqlParameter("@nIdturno", SqlDbType.Int);
                pidTurno.Value = Generales.nTurno;
                cmd.Parameters.Add(pidTurno);


                try
                {
                    XSQL.gSqlCon.Open();
                    cmd.ExecuteNonQuery();

                    //  Generales.nTurno = (int)pTurno.Value;

                    Mensajes.Aviso("Registro guardado Satisfactoriamente ");
                }
                catch (Exception ex)
                {
                    Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
                }
                finally
                {
                    XSQL.gSqlCon.Close();
                }
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void Registra_Cliente()
        {
            int    nFolio        = Convert.ToInt16(usrNumFolio.txtNumero.Text);
            string sNombre       = txtNombre.Text;
            string sApaterno     = txtApaterno.Text;
            string sAmaterno     = txtAmaterno.Text;
            string sTelefono     = txtTelefono.Text;
            string sCelular      = txtCelular.Text;
            string sDireccion    = txtDireccion.Text;
            string sStatus       = cbxEstatus.Text;
            int    sLimdeCredito = Convert.ToInt16(usrNumLimCred.nValor);

            if (string.IsNullOrEmpty(txtNombre.Text) || string.IsNullOrEmpty(txtApaterno.Text) || string.IsNullOrEmpty(txtAmaterno.Text) || string.IsNullOrEmpty(txtDireccion.Text) || string.IsNullOrEmpty(usrNumLimCred.txtNumero.Text))
            {
                Mensajes.Error("Llena los campos mandatorios");
                if (string.IsNullOrEmpty(txtNombre.Text))
                {
                    txtNombre.BackColor = Color.Red;
                }
                if (string.IsNullOrEmpty(txtApaterno.Text))
                {
                    txtApaterno.BackColor = Color.Red;
                }
                if (string.IsNullOrEmpty(txtAmaterno.Text))
                {
                    txtAmaterno.BackColor = Color.Red;
                }
                if (string.IsNullOrEmpty(txtDireccion.Text))
                {
                    txtDireccion.BackColor = Color.Red;
                }

                if (string.IsNullOrEmpty(usrNumLimCred.txtNumero.Text))
                {
                    usrNumLimCred.txtNumero.BackColor = Color.Red;
                }
            }
            else
            {
                cmd             = new SqlCommand("SP_Inserta_Cliente", XSQL.gSqlCon);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter pFolio = new SqlParameter("@nId", SqlDbType.Int);
                pFolio.Direction = ParameterDirection.InputOutput;
                pFolio.Value     = nFolio;
                cmd.Parameters.Add(pFolio);

                SqlParameter pNombre = new SqlParameter("@cNombre", SqlDbType.VarChar, 50);
                pNombre.Value = sNombre;
                cmd.Parameters.Add(pNombre);

                SqlParameter pApaterno = new SqlParameter("@cApaterno", SqlDbType.VarChar, 50);
                pApaterno.Value = sApaterno;
                cmd.Parameters.Add(pApaterno);

                SqlParameter pAmaterno = new SqlParameter("@cAmaterno", SqlDbType.VarChar, 50);
                pAmaterno.Value = sAmaterno;
                cmd.Parameters.Add(pAmaterno);

                SqlParameter pTelefono = new SqlParameter("@cTelefono", SqlDbType.VarChar, 50);
                pTelefono.Value = sTelefono;
                cmd.Parameters.Add(pTelefono);

                SqlParameter pCelular = new SqlParameter("@cCelular", SqlDbType.VarChar, 50);
                pCelular.Value = sCelular;
                cmd.Parameters.Add(pCelular);

                SqlParameter pDireccion = new SqlParameter("@cDireccion", SqlDbType.VarChar, 80);
                pDireccion.Value = sDireccion;
                cmd.Parameters.Add(pDireccion);

                SqlParameter pEstatus = new SqlParameter("@cEstatus", SqlDbType.VarChar, 50);
                pEstatus.Value = sStatus;
                cmd.Parameters.Add(pEstatus);

                SqlParameter pLimCredito = new SqlParameter("@mLimCredito", SqlDbType.Int);
                pLimCredito.Value = sLimdeCredito;
                cmd.Parameters.Add(pLimCredito);


                try
                {
                    XSQL.gSqlCon.Open();
                    cmd.ExecuteNonQuery();

                    nFolio = (int)pFolio.Value;

                    Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString());
                }
                catch (Exception ex)
                {
                    Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
                }
                finally
                {
                    XSQL.gSqlCon.Close();
                }
            }
        }
Exemplo n.º 3
0
        public void  GuardaTurno()
        {
            int sCaja       = Generales.nCaja;
            int sCajero     = Generales.nUsuario;
            int nMonInicial = Convert.ToInt16(usrMonto.nValor);

            string sTipo = "";

            if (rbtnPrimero.Checked)
            {
                sTipo = rbtnPrimero.Text;
            }
            else if (radioButton3.Checked)
            {
                sTipo = radioButton3.Text;
            }
            else if (radioButton4.Checked)
            {
                sTipo = radioButton4.Text;
            }
            else if (radioButton5.Checked)
            {
                sTipo = radioButton5.Text;
            }


            int nTurno = 0;


            cmd             = new SqlCommand("SP_Registra_Turno", XSQL.gSqlCon);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int);

            pTurno.Direction = ParameterDirection.InputOutput;
            pTurno.Value     = nTurno;
            cmd.Parameters.Add(pTurno);



            SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int);

            pCaja.Value = sCaja;
            cmd.Parameters.Add(pCaja);

            SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int);

            pCajero.Value = sCajero;
            cmd.Parameters.Add(pCajero);

            SqlParameter pMinicial = new SqlParameter("@nMonto_ini", SqlDbType.Money);

            pMinicial.Value = nMonInicial;
            cmd.Parameters.Add(pMinicial);


            SqlParameter pTipo = new SqlParameter("@nTipo", SqlDbType.VarChar, 20);

            pTipo.Value = sTipo;
            cmd.Parameters.Add(pTipo);



            try
            {
                XSQL.gSqlCon.Open();
                cmd.ExecuteNonQuery();

                Generales.nTurno = ( int)pTurno.Value;

                Mensajes.Aviso("Turno abierto con el folio " + Generales.nTurno.ToString());
            }
            catch (Exception ex)
            {
                Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
            }
            finally
            {
                XSQL.gSqlCon.Close();
            }
        }
Exemplo n.º 4
0
        public void CierraTurno()
        {
            int nTurno = Generales.nTurno;

            int nMonFinal = Convert.ToInt16(usrMontoFin.nValor);

            string sEstado = "";

            if (rbtnPrimero.Checked)
            {
                sEstado = rbtnPrimero.Text;
            }
            else if (radioButton3.Checked)
            {
                sEstado = radioButton3.Text;
            }


            if (sEstado == "Definitivo" & usrMontoFin.nValor == 0)
            {
                this.usrMontoFin.txtNumero.BackColor = Color.Red;

                Mensajes.Aviso("Captura  el monto final");
            }
            else
            {
                cmd             = new SqlCommand("SP_Cierra_Turno", XSQL.gSqlCon);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int);
                pTurno.Direction = ParameterDirection.InputOutput;
                pTurno.Value     = nTurno;
                cmd.Parameters.Add(pTurno);



                SqlParameter pEstado = new SqlParameter("@sEstado", SqlDbType.VarChar, 50);
                pEstado.Value = sEstado;
                cmd.Parameters.Add(pEstado);



                SqlParameter pMonFinal = new SqlParameter("@nMonto_Fin", SqlDbType.Money);
                pMonFinal.Value = nMonFinal;
                cmd.Parameters.Add(pMonFinal);



                try
                {
                    XSQL.gSqlCon.Open();
                    cmd.ExecuteNonQuery();

                    nTurno = (int)pTurno.Value;

                    if (sEstado == "Temporal")
                    {
                        Mensajes.Aviso("Turno cerrado Temporalmente con el folio " + nTurno.ToString());
                        this.Close();
                    }
                    else
                    {
                        Mensajes.Aviso("Turno cerrado Definitivamente con el folio " + nTurno.ToString());
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
                }
                finally
                {
                    XSQL.gSqlCon.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void Detalle_Venta()
        {
            int     nDetalle  = Generales.gFolioVentas;
            int     sArticulo = 0;
            decimal nPrecio   = 0;
            // decimal nIVA = 0;
            decimal nImporte     = 0;
            decimal nImporte_Iva = 0;
            int     nCantidad    = 0;


            cmd             = new SqlCommand("SP_Registra_DetalleVenta", XSQL.gSqlCon);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pVenta = new SqlParameter("@nDetalle", SqlDbType.Int);

            pVenta.Direction = ParameterDirection.InputOutput;
            pVenta.Value     = Generales.gFolioVentas;
            cmd.Parameters.Add(pVenta);


            SqlParameter pArticulo = new SqlParameter("@nArticulo", SqlDbType.Int);

            pArticulo.Value = sArticulo;
            cmd.Parameters.Add(pArticulo);

            SqlParameter pCantidad = new SqlParameter("@nCantidad", SqlDbType.Int);

            pCantidad.Value = nCantidad;
            cmd.Parameters.Add(pCantidad);

            SqlParameter pPrecio = new SqlParameter("@nPrecio", SqlDbType.Money);

            pPrecio.Value = nPrecio;
            cmd.Parameters.Add(pPrecio);

            SqlParameter pIva = new SqlParameter("@nIva", SqlDbType.Money);

            pIva.Value = Convert.ToDecimal(nIVA);
            cmd.Parameters.Add(pIva);


            SqlParameter pImporte = new SqlParameter("@nImporte", SqlDbType.Money);

            pImporte.Value = nImporte;
            cmd.Parameters.Add(pImporte);


            SqlParameter pImporteIva = new SqlParameter("@nImporte_iva", SqlDbType.Money);

            pImporteIva.Value = nImporte_Iva;
            cmd.Parameters.Add(pImporteIva);



            try
            {
                foreach (DataGridViewRow row in dtgVenta.Rows)
                {
                    if (!row.IsNewRow)
                    {
                        cmd.Parameters["@nDetalle"].Value  = Generales.gFolioVentas;
                        cmd.Parameters["@nArticulo"].Value = row.Cells[0].Value;
                        cmd.Parameters["@nCantidad"].Value = row.Cells[1].Value;
                        cmd.Parameters["@nPrecio"].Value   = row.Cells[3].Value;
                        cmd.Parameters["@nImporte"].Value  = row.Cells[4].Value;
                        cmd.Parameters["@nIva"].Value      = row.Cells[8].Value;
                        //cmd.Parameters["@nIva"].Value = nIVA;
                        cmd.Parameters["@nImporte_iva"].Value = row.Cells[6].Value;

                        XSQL.gSqlCon.Open();

                        cmd.ExecuteNonQuery();

                        //i++;
                        XSQL.gSqlCon.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
            }
            finally
            {
                XSQL.gSqlCon.Close();
            }
        }
Exemplo n.º 6
0
        public void GuardaVenta()
        {
            int     nFolioVenta = 0;
            int     sCaja       = Generales.nCaja;
            int     sCajero     = Generales.nUsuario;
            decimal nCambio     = Generales.Cambio;
            string  sDireccion  = "lomas taurinas";
            int     nTurno      = Generales.nTurno;
            decimal Subtotal    = Generales.subtotal;
            decimal nIVA        = Convert.ToDecimal(txtIva.Text);
            decimal nTotal      = Convert.ToDecimal(txtTotal.Text);
            int     nCantidad   = Convert.ToInt16(txtCantArticulos.Text);

            cmd             = new SqlCommand("SP_Registra_Venta", XSQL.gSqlCon);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pVenta = new SqlParameter("@nVenta", SqlDbType.Int);

            pVenta.Direction = ParameterDirection.InputOutput;
            pVenta.Value     = nFolioVenta;

            cmd.Parameters.Add(pVenta);



            SqlParameter pCajero = new SqlParameter("@nCajero", SqlDbType.Int);

            pCajero.Value = sCajero;
            cmd.Parameters.Add(pCajero);



            SqlParameter pDireccion = new SqlParameter("@sDireccion", SqlDbType.VarChar, 50);

            pDireccion.Value = sDireccion;
            cmd.Parameters.Add(pDireccion);

            SqlParameter pCaja = new SqlParameter("@nCaja", SqlDbType.Int);

            pCaja.Value = sCaja;
            cmd.Parameters.Add(pCaja);

            SqlParameter pTurno = new SqlParameter("@nTurno", SqlDbType.Int);

            pTurno.Value = nTurno;
            cmd.Parameters.Add(pTurno);

            SqlParameter pCambio = new SqlParameter("@nCambio", SqlDbType.Money);

            pCambio.Value = Generales.Cambio;
            cmd.Parameters.Add(pCambio);

            SqlParameter pSubtotal = new SqlParameter("@nSubtotal", SqlDbType.Money);

            pSubtotal.Value = Subtotal;
            cmd.Parameters.Add(pSubtotal);

            SqlParameter pIva = new SqlParameter("@nIva", SqlDbType.Money);

            pIva.Value = nIVA;
            cmd.Parameters.Add(pIva);

            SqlParameter pTotal = new SqlParameter("@nTotal", SqlDbType.Money);

            pTotal.Value = nTotal;
            cmd.Parameters.Add(pTotal);

            SqlParameter pCantidad = new SqlParameter("@nCantidad", SqlDbType.Int);

            pCantidad.Value = nCantidad;
            cmd.Parameters.Add(pCantidad);

            try
            {
                XSQL.gSqlCon.Open();
                cmd.ExecuteNonQuery();

                Generales.gFolioVentas = (int)pVenta.Value;

                Mensajes.Aviso("Gracias por su compra ");
            }
            catch (Exception ex)
            {
                Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
            }
            finally
            {
                XSQL.gSqlCon.Close();
            }
        }
Exemplo n.º 7
0
        private void AbrirTurno()
        {
            string sqlMac = this.Maccaddress();

            Boolean bPasa = false;

            cmd             = new SqlCommand("SP_Valida_Caja", XSQL.gSqlCon);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pMac = new SqlParameter("@cMac", SqlDbType.VarChar, 30);

            pMac.Value = sqlMac;
            cmd.Parameters.Add(pMac);

            SqlParameter sqlBpasa = new SqlParameter("@bPasa", SqlDbType.Bit);

            sqlBpasa.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(sqlBpasa);

            SqlParameter sqlnCaja = new SqlParameter("@nCaja", SqlDbType.Int);

            sqlnCaja.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(sqlnCaja);

            SqlParameter sqlcCaja = new SqlParameter("@cCaja", SqlDbType.VarChar, 30);

            sqlcCaja.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(sqlcCaja);

            try
            {
                XSQL.gSqlCon.Open();
                cmd.ExecuteNonQuery();

                bPasa = (Boolean)sqlBpasa.Value;


                if (!bPasa)
                {
                    Mensajes.Error("Este equipo no esta habilitado como Caja");
                }
                else
                {
                    Generales.nCaja = (int)sqlnCaja.Value;
                    Generales.sCaja = (string)sqlcCaja.Value;



                    // Mensajes.Aviso("Turno Abierto  ");
                }
            }
            catch (Exception ex)
            {
                Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
            }
            finally
            {
                XSQL.gSqlCon.Close();
            }
            if (bPasa)
            {
                serAbreTurno ser = new serAbreTurno();
                ser.ShowDialog();

                this.btnCierraTurno.Enabled = true;
                this.btnRetiro.Enabled      = true;
                this.btnAbrirTurno.Enabled  = false;
                this.btnDesbloquea.Enabled  = false;

                this.ControlaControles(true);
            }
        }
Exemplo n.º 8
0
        private void Guardar()
        {
            int     nFolio    = Convert.ToInt16(usrNumProd.nValor);
            string  sProducto = txtProducto.Text;
            string  sBarCode  = txtCodBar.Text;
            string  sClave    = txtClave.Text;
            double  sImpuesto = Convert.ToDouble(usrNumTasa.txtNumero.Text);
            bool    sSeCuenta = chkSecuenta.Checked;
            decimal sPrecio   = Convert.ToDecimal(usrPrecio.txtNumero.Text);

            cmd             = new SqlCommand("SP_Inserta_Producto", XSQL.gSqlCon);
            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter pFolio = new SqlParameter("@nIdProducto", SqlDbType.Int);

            pFolio.Direction = ParameterDirection.InputOutput;
            pFolio.Value     = nFolio;
            cmd.Parameters.Add(pFolio);

            SqlParameter pProducto = new SqlParameter("@cProducto", SqlDbType.VarChar, 50);

            pProducto.Value = sProducto;
            cmd.Parameters.Add(pProducto);

            SqlParameter pDepartamento = new SqlParameter("@nDepartamento", SqlDbType.VarChar, 50);

            pDepartamento.Value = cbxDepartamento.SelectedValue;
            cmd.Parameters.Add(pDepartamento);

            SqlParameter pCodBarras = new SqlParameter("@cCodBarras", SqlDbType.VarChar, 50);

            pCodBarras.Value = sBarCode;
            cmd.Parameters.Add(pCodBarras);

            SqlParameter pSeCuenta = new SqlParameter("@bSeCuenta", SqlDbType.Bit);

            pSeCuenta.Value = sSeCuenta;
            cmd.Parameters.Add(pSeCuenta);

            SqlParameter pClave = new SqlParameter("@cClave", SqlDbType.VarChar, 20);

            pClave.Value = sClave;
            cmd.Parameters.Add(pClave);

            SqlParameter pTasaInt = new SqlParameter("@nTasaInteres", SqlDbType.Money);

            pTasaInt.Value = sImpuesto;
            cmd.Parameters.Add(pTasaInt);

            SqlParameter pPrecio = new SqlParameter("@nPrecio", SqlDbType.Decimal);

            pPrecio.Value = sPrecio;
            cmd.Parameters.Add(pPrecio);
            try
            {
                XSQL.gSqlCon.Open();
                cmd.ExecuteNonQuery();

                nFolio = (int)pFolio.Value;

                Mensajes.Aviso("Registro guardado con el folio: " + nFolio.ToString());
            }
            catch (Exception ex)
            {
                Mensajes.Error("A ocurrido un error en el sistema, " + ex.Message);
            }
            finally
            {
                XSQL.gSqlCon.Close();
            }
        }