예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MantenimientoAlmacenes rc = new MantenimientoAlmacenes();

            rc.btnSeleccionar.Enabled = true;
            rc.btnBorrar.Enabled      = false;
            rc.btnModificar.Enabled   = false;
            rc.btnNuevo.Enabled       = false;
            rc.ShowDialog();

            tbxCodigoAlmacen.Text = rc.nombre_almacen;
            idAlmacen             = rc.codigo_almacen;
            //MessageBox.Show(idAlmacen);
            if (idAlmacen != "")
            {
                cmd = "select * from articulo_vs_almacen where idArticulo='" + tbxCodigoArticulo.Text + "'and idAlmacen='" + idAlmacen + "'";
                //rtbxIndicaciones.Text = cmd;
                ds = Utilidades.EjecutarDS(cmd);
                //MessageBox.Show(ds.Tables[0].Rows[0]["cantidad"].ToString());
                if (ds.Tables[0].Rows.Count > 0)
                {
                    tkbCantidad.Maximum  += Convert.ToInt32(ds.Tables[0].Rows[0]["cantidad"].ToString());
                    tkbCantidad.Value     = Convert.ToInt32(ds.Tables[0].Rows[0]["cantidad"].ToString());
                    lbCantidad.Text       = "(" + tkbCantidad.Value + ")";
                    rtbxIndicaciones.Text = ds.Tables[0].Rows[0]["indicaciones"].ToString();
                }
            }
        }
예제 #2
0
        private void btnbuscararticulo_Click(object sender, EventArgs e)
        {
            ListadoArticulosSucursal frm = new ListadoArticulosSucursal();

            cmd            = "select * from sucursal where nombre_sucursal='" + cbxsucursal.Text + "'";
            ds             = Utilidades.EjecutarDS(cmd);
            frm.idSucursal = ds.Tables[0].Rows[0]["id"].ToString();


            frm.btnBorrar.Enabled      = false;
            frm.btnModificar.Enabled   = false;
            frm.btnNuevo.Enabled       = false;
            frm.btnSeleccionar.Enabled = true;
            frm.ShowDialog();

            codigo_articulo = frm.codigo_articulo;
            nombre_articulo = frm.nombre_articulo;
            stock_articulo  = frm.stock_articulo;
            precio_articulo = frm.precio_articulo;
            itebis          = frm.itebis;

            lbcodigoarticulo.Text = " Codigo Articulo: " + codigo_articulo;
            txtarticulo.Text      = nombre_articulo;
            lbstock.Text          = "STOCK: " + stock_articulo;
            txtprecioventa.Text   = precio_articulo;
            txtitebis.Text        = itebis;
        }
예제 #3
0
        public override void Modificar()
        {
            RegistoInventario rc = new RegistoInventario();

            rc.tbxCodigo.Text           = (dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString());
            rc.tbxNombre.Text           = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[1].Value.ToString();
            rc.tbxPrecio_compra.Text    = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[2].Value.ToString();
            rc.tbxPrecio_venta.Text     = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[3].Value.ToString();
            rc.tbxExistencia.Text       = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[4].Value.ToString();
            rc.tbxDescripcion.Text      = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[5].Value.ToString();
            rc.tbxCantidad_maxima.Text  = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[6].Value.ToString();
            rc.tbxCantidad_minima.Text  = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[7].Value.ToString();
            rc.dtFecha_renovacion.Value = Convert.ToDateTime(dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[8].Value.ToString());
            rc.cbxMedida.SelectedItem   = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[9].Value.ToString();
            rc.cbxMarca.SelectedItem    = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[10].Value.ToString();
            rc.cbxTipo.SelectedItem     = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[11].Value.ToString();
            rc.chxEstado.Checked        = Convert.ToBoolean(dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[12].Value.ToString());
            cmd = "select * from cantidad_caja where idArticulo='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "';";
            ds  = Utilidades.EjecutarDS(cmd);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                rc.tbxCantidad_caja.Visible = true;
                rc.tbxCantidad_caja.Text    = ds.Tables[0].Rows[0]["cantidad_caja"].ToString();
                //MessageBox.Show("errror: "+ds.Tables[0].Rows[0]["cantidad_caja"].ToString());
                rc.etCantidad.Visible = true;
            }
            rc.ShowDialog();


            refrescarDatos(BuscarDatos);
        }
예제 #4
0
        public override void Guardar()
        {
            if (ComprobarCampos())
            {
                if (tbxRNC.Text != "")
                {
                    if (tbxCodigo.Text != "Nuevo")
                    {
                        cmd = "begin " +
                              "update tercero set nombre='" + tbxNombre.Text.Trim() + "',estado='1',RNC='" + tbxRNC.Text + "' where id='" + tbxCodigo.Text + "';" +
                              "update suplidor set estado='1' where idTercero='" + tbxCodigo.Text + "';" +
                              "end";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Sin Modificaciones.");
                        //Limpiar();
                        this.Close();
                    }
                    else
                    {
                        cmd = "begin " +
                              "declare @id uniqueidentifier= newid();" +
                              "insert into tercero(id,nombre,fecha_in,RNC,estado)values(@id,'" + tbxNombre.Text.Trim() + "',GETDATE(),'" + tbxRNC.Text + "','1');" +
                              "insert into suplidor(idTercero,estado)values(@id,'1');" +
                              "end";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Guardado exitosamente");
                        this.Close();
                    }
                }
                else
                {
                    if (tbxCodigo.Text != "Nuevo")
                    {
                        cmd = "begin " +
                              "update tercero set nombre='" + tbxNombre.Text.Trim() + "',estado='1' where id='" + tbxCodigo.Text + "';" +
                              "update suplidor set estado='1' where idTercero='" + tbxCodigo.Text + "';" +
                              "end";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Sin Modificaciones.");
                        //Limpiar();
                        this.Close();
                    }
                    else
                    {
                        cmd = "begin " +
                              "declare @id uniqueidentifier= newid();" +
                              "insert into tercero(id,nombre,fecha_in,estado)values(@id,'" + tbxNombre.Text.Trim() + "',GETDATE(),'1');" +
                              "insert into suplidor(idTercero,estado)values(@id,'1');" +
                              "end";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Guardado exitosamente");
                        this.Close();
                    }
                }
            }
        }
예제 #5
0
        public override void Modificar()
        {
            cmd = "select p.fecha_nacimiento,h.descripcion,te.numero,c.correo_electronico,p.cedula,p.sexo " +
                  "from telefono as te,telefono_vs_tercero as tev,correo as c,correo_vs_tercero as cv, tercero as t, persona as p, empleado as e, puesto as pu,departamento as d, horario as h " +
                  "where p.idTercero='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "' and p.idTercero='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "' and e.idTercero='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "' and e.idPuesto=pu.id and  e.idHorario=h.id and pu.idDepartamento=d.id and te.id=tev.idTelefono and c.id=cv.idCorreo and tev.idTercero='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "' and cv.idTercero='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "';";
            //MessageBox.Show(cmd);
            ds = Utilidades.EjecutarDS(cmd);
            RegistroEmpleados rc = new RegistroEmpleados();

            rc.tbxCodigo.Text   = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString();
            rc.tbxNombre.Text   = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[1].Value.ToString();
            rc.tbxApellido.Text = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[2].Value.ToString();
            rc.dtFecha.Value    = Convert.ToDateTime(ds.Tables[0].Rows[0]["fecha_nacimiento"].ToString());
            rc.cbxSexo.Text     = ds.Tables[0].Rows[0]["sexo"].ToString();
            rc.cbxPuesto.Text   = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[3].Value.ToString();
            rc.cbxHorario.Text  = ds.Tables[0].Rows[0]["descripcion"].ToString();
            rc.tbxTelefono.Text = ds.Tables[0].Rows[0]["numero"].ToString();
            rc.tbxCorreo.Text   = ds.Tables[0].Rows[0]["correo_electronico"].ToString();
            rc.tbxCedula.Text   = ds.Tables[0].Rows[0]["cedula"].ToString();
            //rc.chxEstado.Checked = Convert.ToBoolean(dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[7].Value.ToString());
            rc.ShowDialog();



            //rc.tbxLocalidad.Text = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[7].Value.ToString();
            //rc.tbxDireccion.Text = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[8].Value.ToString();
            //rc.tbxCodigo_postal.Text = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[9].Value.ToString();
            //rc.rtbxIndicaciones.Text = dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[10].Value.ToString();

            refrescarDatos(BuscarDatos);
        }
예제 #6
0
 public override void Guardar()
 {
     if (ComprobarCampos())
     {
         if (nuevo)
         {
             cmd = "select * from vehiculo where Matricula='" + tbxMatricula.Text.Trim() + "'";
             ds  = Utilidades.EjecutarDS(cmd);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 MessageBox.Show("Ya hay un vehiculo con esta matricula: " + tbxMatricula.Text);
             }
             else
             {
                 cmd = "insert into vehiculo(Matricula,idMarca,idModelo,reparacion,transporte,estado)" +
                       "values('" + tbxMatricula.Text.Trim() + "','" + idMarca + "','" + idModelo + "','0','0','1');";
                 ds = Utilidades.EjecutarDS(cmd);
                 MessageBox.Show("Se ha guardado exitosamente.");
                 //MessageBox.Show(cmd);
                 //tbxMatricula.Text = cmd;
                 this.Close();
             }
         }
         else
         {
             cmd = "update vehiculo set idMarca='" + idMarca + "',idModelo='" + idModelo + "' where Matricula='" + tbxMatricula.Text + "';";
             ds  = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Se ha modificado exitosamente.");
             //MessageBox.Show(cmd);
             this.Close();
         }
     }
 }
예제 #7
0
        public override void Modificar()
        {
            //cmd = "begin" +
            //        "select fecha_ultimo_pago from pagos where idEmpleado='"+ dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "';" +
            //    "end";
            //MessageBox.Show(""+dgvPadre.CurrentCell.RowIndex);
            if ((ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
            {
                hoy = DateTime.Now;
                //DateTime fechaPago = Convert.ToDateTime(ds.Tables[0].Rows[0]["fecha_ultimo_pago"].ToString());
                //dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString()
                //cmd = "select * from pagos where fecha_ultimo_pago between '1/" + hoy.Month + "/" + hoy.Year + "' and '30/" + hoy.Month + "/" + hoy.Year + "' and idEmpleado='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "'";
                cmd = "select * from pagos where idEmpleado='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "'";
                ds  = Utilidades.EjecutarDS(cmd);
                if (!(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
                {
                    cmd = "insert into pagos(idEmpleado,fecha_ultimo_pago,estado)values('" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "',getdate(),'1')";
                    ds  = Utilidades.EjecutarDS(cmd);
                    MessageBox.Show("se a realizado el pago exitosamente");
                }
                else
                {
                    cmd = "update  pagos set idEmpleado='" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "', fecha_ultimo_pago=getdate(), estado='1';";
                    ds  = Utilidades.EjecutarDS(cmd);
                    MessageBox.Show("se a realizado el pago exitosamente");
                }
            }
            else
            {
                MessageBox.Show("No hay ningun empleado pendiente de pago");
            }

            refrescarDatos(BuscarDatos);
        }
예제 #8
0
 public override void Guardar()
 {
     cmd = "select t.id,t.nombre,t.RNC from tercero as t,EmpresaDelSistema as e where t.id=e.terceroEmpresa";
     ds  = Utilidades.EjecutarDS(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         string       idTercero = ds.Tables[0].Rows[0]["id"].ToString();
         string       nombre    = ds.Tables[0].Rows[0]["nombre"].ToString();
         string       rnc       = ds.Tables[0].Rows[0]["RNC"].ToString();
         DialogResult result    = MessageBox.Show("Seguro que quiere cambiar a la empresa del sistema: " + nombre + " " + " RNC: " + rnc, "Atención", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             cmd = "update tercero set nombre='" + tbxNombre.Text.Trim() + "',RNC='" + tbxRNC.Text + "' where id='" + idTercero + "'";
             ds  = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Se ha cambiado Exitosamente");
         }
         else
         {
             // No hacer nada
         }
     }
     else
     {
         cmd =
             "begin " +
             "declare @idTercero uniqueidentifier=newid();" +
             "insert into tercero(id,nombre,RNC,fecha_in,estado)values(@idTercero,'" + tbxNombre.Text + "','" + tbxRNC.Text + "',getdate(),'1');" +
             "insert into EmpresaDelSistema(id,terceroEmpresa)values('1',@idTercero);" +
             "end";
         ds = Utilidades.EjecutarDS(cmd);
         MessageBox.Show("Se ha Guardado Exitosamente");
     }
 }
예제 #9
0
파일: FrmCompra.cs 프로젝트: jordaly/SGF
        public FrmCompra()
        {
            InitializeComponent();
            btnbuscarsuplidor.TabIndex = 0;
            lbfecha.Text += " " + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;

            //string cmdtipo_factura = "Select * from tipo_factura";
            string cmdtipo_pago = "Select * from tipo_pago";
            string cmddivisa    = "Select * from divisa";

            //string cmdNumeroFactura = "select top(1) numero_factura from factura order by fecha DESC";

            //ds = Utilidades.EjecutarDS(cmdtipo_factura);
            //cbxtipofactura.DisplayMember = "descripcion";
            //cbxtipofactura.DataSource = ds.Tables[0].DefaultView;


            ds = Utilidades.EjecutarDS(cmdtipo_pago);
            cbxtipopago.DisplayMember = "descripcion";
            cbxtipopago.DataSource    = ds.Tables[0].DefaultView;

            ds = Utilidades.EjecutarDS(cmddivisa);
            cbxdivisa.DisplayMember = "descripcion";
            cbxdivisa.DataSource    = ds.Tables[0].DefaultView;



            //ds = Utilidades.EjecutarDS(cmdNumeroFactura);
            //lbnumfactura.Text = (Convert.ToInt32(ds.Tables[0].Rows[0]["numero_factura"].ToString()) + 1).ToString().PadLeft((20 - ds.Tables[0].Rows[0]["numero_factura"].ToString().Length), '0');
        }
예제 #10
0
 public override void Guardar()
 {
     if (resolver)
     {
         cmd = "update quejas set resolucion='" + rtbxParrafo.Text + "',fecha_re = getdate(),estado='0' where id='" + tbxCodigo.Text + "';";
         ds  = Utilidades.EjecutarDS(cmd);
         MessageBox.Show("Modificada exitosamente");
         this.Close();
     }
     else
     {
         if (tbxCodigo.Text == "Nuevo")
         {
             cmd = "insert into quejas(queja,idEmpleado,idCliente,idArticulo,fecha_in,estado)values('" + rtbxParrafo.Text.Trim() + "','" + codigoEmpleado + "','" + codigoCliente + "','" + codigoArticulo + "',getdate(),'1')";
             ds  = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Guardada Exitosamente");
             //rtbxParrafo.Text = cmd;
             this.Close();
         }
         else
         {
             cmd = "update quejas set queja='" + rtbxParrafo.Text + "' where id='" + tbxCodigo.Text + "';";
             ds  = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Modificada exitosamente");
             this.Close();
         }
     }
 }
예제 #11
0
        public override void Buscar()
        {
            FormBarraBusqueda bb = new FormBarraBusqueda();

            bb.ShowDialog();
            string parametro = bb.parametro;
            string v         = "";

            if (almacenSucursal)
            {
                cmd = "select * from almacen as al, sucursal_vs_almacen as sva where al.id!=sva.idAlmacen and al.estado='1' ";
                v   = "al.";
            }
            else
            {
                cmd = BuscarDatos;
            }
            //MessageBox.Show("se esta ejecuetando");
            if (!String.IsNullOrEmpty(parametro.Trim()))
            {
                cmd += " and " + v + cbxBuscar.Text.Trim() + " like('%" + parametro.Trim() + "%')";
            }
            ds = Utilidades.EjecutarDS(cmd);
            //MessageBox.Show(cmd);
            if (ds.Tables.Count > 0)
            {
                dgvPadre.DataSource = ds.Tables[0];
            }
        }
예제 #12
0
 public override void Guardar()
 {
     if (ComprobarCampos())
     {
         if (tbxCodigo.Text == "Nuevo")
         {
             cmd =
                 "begin " +
                 "declare @idTerceroSistema uniqueidentifier;" +
                 "declare @idSucursal uniqueidentifier = newid();" +
                 "select @idTerceroSistema=terceroSistema from EmpresaDelSistema where id='1';" +
                 "insert into sucursal(id,idTercero,nombre_sucursal,estado)values(@idSucursal,@idTerceroSistema,'" + tbxNombre.Text.Trim() + "','1');" +
                 "insert into sucursal_vs_almacen(idSucursal,idAlmacen)values(@idSucursal,'" + codigoAlmacen + "');" +
                 "end";
             ds = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Guardado Exitosamente.");
             this.Close();
         }
         else
         {
             cmd =
                 "begin " +
                 "declare @idTerceroSistema uniqueidentifier;" +
                 "select @idTerceroSistema=terceroSistema from EmpresaDelSistema where id='1';" +
                 "update sucursal set nombre_sucursal='" + tbxNombre.Text.Trim() + "' where id = '" + tbxCodigo.Text + "';" +
                 "update sucursal_vs_almacen set idAlmacen='" + codigoAlmacen + "' where  idSucursal='" + tbxCodigo.Text + "';" +
                 "end";
             ds = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Guardado Exitosamente.");
             this.Close();
         }
     }
 }
예제 #13
0
        private void cajaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cmd = "select top(1) * from caja  order by id desc";
            ds  = Utilidades.EjecutarDS(cmd);
            MantenimientoCaja rc = new MantenimientoCaja();

            if (Convert.ToBoolean(ds.Tables[0].Rows[0]["estado"].ToString()))
            {
                rc.tbxCantidadInicial.Text = ds.Tables[0].Rows[0]["cantidad_inicial"].ToString();
                rc.tbxCantidadActual.Text  = ds.Tables[0].Rows[0]["cantidad_actual"].ToString();
                rc.tbxVentasTotales.Text   = ds.Tables[0].Rows[0]["ventas_totales"].ToString();
                rc.tbxGanancias.Text       = ds.Tables[0].Rows[0]["ganancias"].ToString();
                rc.lbFechaInicio.Text     += ds.Tables[0].Rows[0]["fecha_in"].ToString();
                rc.idCaja                     = ds.Tables[0].Rows[0]["id"].ToString();
                rc.btnInicio.Enabled          = false;
                rc.btnFinalizar.Enabled       = true;
                rc.tbxCantidadInicial.Enabled = false;
                rc.MdiParent                  = this;
                rc.Show();
            }
            else
            {
                rc.MdiParent = this;
                rc.Show();
            }
        }
예제 #14
0
        public override void Buscar()
        {
            FormBarraBusqueda bb = new FormBarraBusqueda();

            bb.ShowDialog();
            string parametro = bb.parametro;
            string v         = "";

            if (cbxBuscar.Text == "id" || cbxBuscar.Text == "nombre")
            {
                v = "t.";
            }
            else if (cbxBuscar.Text == "puesto" || cbxBuscar.Text == "salario")
            {
                v = "pu.";
            }
            else
            {
                v = "p.";
            }

            cmd = BuscarDatos;
            //MessageBox.Show("se esta ejecuetando");
            if (!String.IsNullOrEmpty(parametro.Trim()))
            {
                cmd += "and " + v + cbxBuscar.Text + " like('%" + parametro.Trim() + "%')";
            }
            ds = Utilidades.EjecutarDS(cmd);
            //MessageBox.Show(cmd);
            if (ds.Tables.Count > 0)
            {
                dgvPadre.DataSource = ds.Tables[0];
            }
        }
예제 #15
0
        public override void Buscar()
        {
            FormBarraBusqueda bb = new FormBarraBusqueda();

            bb.ShowDialog();
            string parametro = bb.parametro;
            string v         = "";

            if (cbxBuscar.Text == "Matricula" || cbxBuscar.Text == "idMarca" || cbxBuscar.Text == "idModelo" || cbxBuscar.Text == "Valor" || cbxBuscar.Text == "capacidad" || cbxBuscar.Text == "consumoKpG")
            {
                v = "v.";
            }
            else if (cbxBuscar.Text == "marca")
            {
                v = "ma.";
            }
            else
            {
                v = "mo.";
            }

            cmd = BuscarDatos;
            //MessageBox.Show("se esta ejecuetando");
            if (!String.IsNullOrEmpty(parametro.Trim()))
            {
                cmd += " and " + v + cbxBuscar.Text + " like('%" + parametro.Trim() + "%')";
            }
            ds = Utilidades.EjecutarDS(cmd);
            //MessageBox.Show(cmd);
            if (ds.Tables.Count > 0)
            {
                dgvPadre.DataSource = ds.Tables[0];
            }
        }
예제 #16
0
        public override void Guardar()
        {
            if (ComprobarCampos())
            {
                if (confirmacion)
                {
                    cmd = "update reparacion set fecha_fin=getdate(),reseña='" + rtbxParrafo.Text.Trim() + "',estado='0' where id='" + tbxCodigo.Text + "'";

                    ds = Utilidades.EjecutarDS(cmd);
                    MessageBox.Show("Confirmado exitosamente.");
                    //Limpiar();
                    this.Close();
                }
                else
                {
                    if (tbxCodigo.Text != "Nuevo")
                    {
                        cmd = "update reparacion set idTaller='" + idTaller + "',matricula_vehiculo='" + tbxMatricula.Text + "',razon_reparacion='" + rtbxParrafo.Text.Trim() + "' where id='" + tbxCodigo.Text + "'";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Modificado exitosamente.");
                        //Limpiar();
                        this.Close();
                    }
                    else
                    {
                        cmd = "insert into reparacion(idTaller,matricula_vehiculo,razon_reparacion,fecha_inicio,estado)values('" + idTaller + "','" + tbxMatricula.Text + "','" + rtbxParrafo.Text.Trim() + "',getdate(),'1')";

                        ds = Utilidades.EjecutarDS(cmd);
                        MessageBox.Show("Guardado exitosamente");
                        this.Close();
                    }
                }
            }
        }
예제 #17
0
 public override void Guardar()
 {
     cmd = "update vacaciones set fecha_inicio='" + dtFechaInicio.Value + "', fecha_fin='" + dtFechaFin.Value + "',estado='" + chxEstado.Checked + "' where idEmpleado='" + tbxCodigo.Text + "';";
     ds  = Utilidades.EjecutarDS(cmd);
     MessageBox.Show("Guardado exitosamente");
     //Limpiar();
     this.Close();
 }
예제 #18
0
        public override void Nuevo()
        {
            RegistroQuejas rc = new RegistroQuejas();

            ds = Utilidades.EjecutarDS("select idEmpleado from usuario where id='" + codigoUsuario + "';");
            rc.codigoEmpleado = ds.Tables[0].Rows[0]["idEmpleado"].ToString();
            rc.ShowDialog();
            refrescarDatos(BuscarDatos);
        }
예제 #19
0
 public override void Guardar()
 {
     //(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
     //cmd = "";
     //string cmdCliente = string.Format("select * from cliente where idTercero='{0}'",
     //    tbxCodigo.Text.Trim());
     //ds = Utilidades.EjecutarDS(cmdCliente);
     if (tbxNombre.Text == "" || tbxApellido.Text == "" || tbxCodigo_postal.Text == "" || tbxDireccion.Text == "" || tbxLocalidad.Text == "" || tbxCodigo.Text == "" || tbxTelefono.Text == "" || rtbxIndicaciones.Text == "")
     {
         MessageBox.Show("Faltan campos por reyenar");
     }
     else
     {
         if (tbxCodigo.Text != "Nuevo")
         {
             cmd = "begin" +
                   " declare @idDireccion uniqueidentifier;" +
                   "declare @idTelefono uniqueidentifier;" +
                   "declare @idCorreo uniqueidentifier;" +
                   "select @idTelefono=te.idTelefono from telefono_vs_tercero as te,tercero as t where t.id='" + tbxCodigo.Text.Trim() + "' and te.idTercero=t.id;" +
                   "select @idCorreo = c.idCorreo from correo_vs_tercero as c,tercero as t where t.id = '" + tbxCodigo.Text.Trim() + "' and c.idTercero = t.id; " +
                   "select @idDireccion=c.idDireccion_cleinte from cliente as c,tercero as t where t.id='" + tbxCodigo.Text.Trim() + "' and c.idTercero=t.id;" +
                   "update telefono set numero='" + tbxTelefono.Text.Trim() + "'where id=@idTelefono;" +
                   "update correo set correo_electronico='" + tbxCorreo.Text.Trim() + "'where id=@idCorreo;" +
                   "update tercero " +
                   "set nombre='" + tbxNombre.Text.Trim() + "',estado='" + chxEstado.Checked + "'" +
                   "where id='" + tbxCodigo.Text.Trim() + "';" +
                   "update persona " +
                   "set apellido='" + tbxApellido.Text.Trim() + "',fecha_nacimiento='" + dtFecha.Value.Day + "/" + dtFecha.Value.Month + "/" + dtFecha.Value.Year + "',sexo='" + cbxSexo.Text.Trim() + "'" +
                   "where idTercero='" + tbxCodigo.Text.Trim() + "';" +
                   "update direccion_cliente " +
                   "set provincia='" + cbxProvincia.Text.Trim() + "',localidad='" + tbxLocalidad.Text.Trim() + "',direccion='" + tbxDireccion.Text.Trim() + "',indicaciones='" + rtbxIndicaciones.Text.Trim() + "',codigo_postal='" + tbxCodigo_postal.Text.Trim() + "'" +
                   "where id=@idDireccion " +
                   "end";
             //MessageBox.Show(cmd);
             //rtbxIndicaciones.Text = cmd;
             //Console.Out(cmd);
             ds = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Modificado exitosamente");
             Limpiar();
             this.Close();
         }
         else
         {
             cmd = String.Format("exec crearCliente '{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}'",
                                 tbxNombre.Text.Trim(), tbxApellido.Text.Trim(), dtFecha.Value.Day + "/" + dtFecha.Value.Month + "/" + dtFecha.Value.Year,
                                 cbxSexo.Text.Trim(), cbxProvincia.Text.Trim(), tbxLocalidad.Text.Trim(), tbxDireccion.Text.Trim(), rtbxIndicaciones.Text.Trim(),
                                 tbxCodigo_postal.Text.Trim(), chxEstado.Checked, tbxCorreo.Text.Trim(), tbxTelefono.Text.Trim());
             //rtbxIndicaciones.Text = cmd;
             //MessageBox.Show(cmd);
             ds = Utilidades.EjecutarDS(cmd);
             MessageBox.Show("Guardado exitosamente");
             Limpiar();
             this.Close();
         }
     }
 }
예제 #20
0
파일: FrmCompra.cs 프로젝트: jordaly/SGF
        private void btnguardar_Click(object sender, EventArgs e)
        {
            if (ComprobarCamposFactura())
            {
                cmd = "select * from divisa where descripcion='" + cbxdivisa.Text + "'";
                ds  = Utilidades.EjecutarDS(cmd);
                string idDivisa = ds.Tables[0].Rows[0]["id"].ToString();

                cmd = "select * from tipo_pago where descripcion='" + cbxtipopago.Text + "'";
                ds  = Utilidades.EjecutarDS(cmd);
                string idTipo_pago = ds.Tables[0].Rows[0]["id"].ToString();


                cmd = "begin " +
                      "insert into Compra(fecha,idSuplidor,idTipopago,idDivisa,total)values(getdate(),'" + codigo_suplidor + "','" + idTipo_pago + "','" + idDivisa + "','" + total.ToString().Replace(",", ".") + "');" +
                      "select top(1) id as id from Compra order by id desc;" +
                      "end";
                //txtcantidad.Text = cmd;
                MessageBox.Show(cmd);
                ds = Utilidades.EjecutarDS(cmd);
                if (ds != null)
                {
                    string idcompra = ds.Tables[0].Rows[0]["id"].ToString();

                    foreach (DataGridViewRow fila in gridarticulosuplidor.Rows)
                    {
                        cmd = "begin insert into detalle_compra(idCompra,idArticulo,cantidad,importe)values('" + idcompra + "','" + fila.Cells[0].Value.ToString() + "','" + fila.Cells[3].Value.ToString() + "','" + fila.Cells[4].Value.ToString().Replace(",", ".") + "'); " +
                              "end";
                        ds = Utilidades.EjecutarDS(cmd);
                    }

                    MessageBox.Show("Se ha hecho la compra con exito");
                    this.Close();

                    /*
                     * //C:\Users\Jorda\source\repos\SGF\SGF\Reportes\Factura con su detalle3.rpt
                     * string RutaReporte = root + @"Reportes\Factura con su detalle.rpt";
                     * //MessageBox.Show(RutaReporte);
                     * VisorDeReportes form = new VisorDeReportes();
                     * ReportDocument oRep = new ReportDocument();
                     * ParameterField pf = new ParameterField();
                     * ParameterFields pfs = new ParameterFields();
                     * ParameterDiscreteValue pdv = new ParameterDiscreteValue();
                     * pf.Name = "@numFact"; // variable del store procedure
                     * pdv.Value = idfactura; // variable donde se  guarda el numero de factura
                     * pf.CurrentValues.Add(pdv);
                     * pfs.Add(pf);
                     * form.crvVisor.ParameterFieldInfo = pfs;
                     * oRep.Load(RutaReporte);
                     * form.crvVisor.ReportSource = oRep;
                     * form.Show();
                     * this.Close();*/
                    //oRep.ExportToDisk(ExportFormatType.PortableDocFormat, @"C:\Users\Usuario\Documents\(" + idfactura + ") Factura.pdf");
                }
            }
        }
예제 #21
0
 public override void Guardar()
 {
     cmd = "begin " +
           "declare @idPuesto uniqueidentifier;" +
           "select @idPuesto=id from puesto where puesto='" + cbxPuesto.Text + "';" +
           "insert into vacante(idPuesto,fecha,estado)values(@idPuesto,getdate(),'1');" +
           "end";
     ds = Utilidades.EjecutarDS(cmd);
     MessageBox.Show("Guardado exitosamente.");
     this.Close();
 }
예제 #22
0
 public ConsultaVentasHoy()
 {
     InitializeComponent();
     cmd = "select sum(ganancias) as gananciahoy,sum(ventas_totales) as ventashoy from caja where fecha_in<getdate() and '" + (DateTime.Now.Day + 1) + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + "'>getdate();";
     ds  = Utilidades.EjecutarDS(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         lbVentas.Text    = ds.Tables[0].Rows[0]["ventashoy"].ToString();
         lbGanancias.Text = ds.Tables[0].Rows[0]["gananciahoy"].ToString();
     }
 }
예제 #23
0
        public RegistroVacante()
        {
            InitializeComponent();
            string cmdPuesto = "Select * from puesto";


            //Puesto
            ds = Utilidades.EjecutarDS(cmdPuesto);
            cbxPuesto.DisplayMember = "puesto";
            cbxPuesto.DataSource    = ds.Tables[0].DefaultView;
        }
예제 #24
0
 public EmpresaSistema()
 {
     InitializeComponent();
     cmd = "select t.id,t.nombre,t.RNC from tercero as t,EmpresaDelSistema as e where t.id=e.terceroEmpresa";
     ds  = Utilidades.EjecutarDS(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         tbxNombre.Text = ds.Tables[0].Rows[0]["nombre"].ToString();
         tbxRNC.Text    = ds.Tables[0].Rows[0]["RNC"].ToString();
     }
 }
예제 #25
0
 public void alertaFechaRenovacionArticulo()
 {
     cmd = "select * from articulo  as a where  fecha_renovacion<getdate()";
     ds  = Utilidades.EjecutarDS(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         cmd = "";
         foreach (DataRow fila in ds.Tables[0].Rows)
         {
             cmd += fila["nombre"].ToString();
         }
     }
 }
예제 #26
0
        public override void Guardar()
        {
            cmd =
                "begin " +
                "update transporte set hora_llegada=getdate(), confirmacion_cliente='" + rtbxConfirmacion.Text.Trim() + "', estado='0' where id='" + tbxCodigo.Text + "'; " +
                "update vehiculo set transporte='0' where Matricula='" + matriculaVehiculo + "'; " +
                "end";

            ds = Utilidades.EjecutarDS(cmd);

            MessageBox.Show("Confirmacion de llegada exitosa.");

            this.Close();
        }
예제 #27
0
        private void btnFinalizar_Click(object sender, EventArgs e)
        {
            string v = DateTime.Now.TimeOfDay.ToString();

            v = v.Substring(0, DateTime.Now.TimeOfDay.ToString().Length - 4);
            string cmd = "update caja set estado='0', fecha_fin='" + DateTime.Now.Year + "-" + DateTime.Now.Day + "-" + DateTime.Now.Month + " " + v + "' where id='" + idCaja + "';";

            ds = Utilidades.EjecutarDS(cmd);
            MessageBox.Show("Caja cerrada exitosamente");
            tbxCantidadInicial.Text    = "";
            tbxCantidadActual.Text     = "0";
            tbxVentasTotales.Text      = "0";
            tbxGanancias.Text          = "0";
            lbFechaInicio.Text         = "Fecha Inicio: ";
            tbxCantidadInicial.Enabled = true;
        }
예제 #28
0
        public override void Borrar()
        {
            DialogResult result = MessageBox.Show("Seguro que quiere eliminar la Cotizacion : " + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[1].Value.ToString() + " Codigo: " + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString(), "Atención", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                cmd = "delete from cotizacion where id = '" + dgvPadre.Rows[dgvPadre.CurrentCell.RowIndex].Cells[0].Value.ToString() + "';";
                ds  = Utilidades.EjecutarDS(cmd);
                MessageBox.Show("Se ha eliminado Exitosamente");
                refrescarDatos(BuscarDatos);
            }
            else
            {
                // No hacer nada
            }
        }
예제 #29
0
        public override void Guardar()
        {
            DataSet ds = new DataSet();

            if (tbxCodigo.Text.Trim() == "Nuevo")
            {
                string cmdUsuario = string.Format("select * from usuario where usuario='{0}'",
                                                  tbxUsuario.Text.Trim());
                ds = Utilidades.EjecutarDS(cmdUsuario);
                if (!(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0))
                {
                    string cmd = "insert into usuario(id,usuario,password,modificar_articulos,ajuste_stock,modificar_clientes,modificar_suplidores,modificar_vendedores,ingresar_compras,ingresar_ventas,despacho_transporte,consulta_ventas,consultar_reportes,reimprimir_facturas,actualizar_caja,limite_descuento,estado)" +
                                 "values(newid(),'" + tbxUsuario.Text.Trim() + "','" + tbxContraseña.Text.Trim() + "','" + chxModificarArticulos.Checked + "','" + chxAjusteStock.Checked + "','" + chxModificarClientes.Checked + "','" + chxModificarSuplidores.Checked + "','" + chxModificarVendedores.Checked + "','" + chxIngresarCompras.Checked + "','" + chxIngresarVentas.Checked + "','" + chxDespachoTransporte.Checked + "','" + chxConsultaVentas.Checked + "','" + chxConsultaReportes.Checked + "','" + chxReimprimirFacturas.Checked + "','" + chxActualizarCaja.Checked + "','" + tbxLimiteDescuento.Text.Trim() + "','" + chxEstado.Checked + "');";
                    //MessageBox.Show(cmd);
                    ds = Utilidades.EjecutarDS(cmd);
                    tbxLimiteDescuento.Text = cmd;
                    //Limpiar();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("El nombre de usuario " + tbxUsuario.Text + " ya esta en uso.");
                    //Limpiar();
                }
            }
            else
            {
                string cmdUsuario = string.Format("select * from usuario where usuario='{0}'",
                                                  tbxUsuario.Text.Trim());
                ds = Utilidades.EjecutarDS(cmdUsuario);
                if (!(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) || tbxUsuario.Text.Trim() == usuarioViejo)
                {
                    string cmd = "update usuario " +
                                 "set usuario='" + tbxUsuario.Text.Trim() + "', password='******',modificar_articulos='" + chxModificarArticulos.Checked + "',ajuste_stock='" + chxAjusteStock.Checked + "',modificar_clientes='" + chxModificarClientes.Checked + "',modificar_suplidores='" + chxModificarSuplidores.Checked + "',modificar_vendedores='" + chxModificarVendedores.Checked + "',ingresar_compras='" + chxIngresarCompras.Checked + "',ingresar_ventas='" + chxIngresarVentas.Checked + "',despacho_transporte='" + chxDespachoTransporte.Checked + "',consulta_ventas='" + chxConsultaVentas.Checked + "',consultar_reportes='" + chxConsultaReportes.Checked + "',reimprimir_facturas='" + chxReimprimirFacturas.Checked + "',actualizar_caja='" + chxActualizarCaja.Checked + "',limite_descuento='" + tbxLimiteDescuento.Text.Trim() + "',estado='" + chxEstado.Checked + "' " +
                                 "where id='" + tbxCodigo.Text.Trim() + "';";
                    MessageBox.Show(cmd);
                    ds = Utilidades.EjecutarDS(cmd);
                    //Limpiar();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("El nombre de usuario " + tbxUsuario.Text + " ya esta en uso.");
                    //Limpiar();
                }
            }
        }
예제 #30
0
 public void alertaStockBajoArticulo()
 {
     cmd = "select * from articulo  as a where a.existencia<a.cantidad_minima";
     ds2 = Utilidades.EjecutarDS(cmd);
     if (ds2.Tables[0].Rows.Count > 0)
     {
         cmd = "";
         foreach (DataRow fila in ds2.Tables[0].Rows)
         {
             cmd += "Codigo: " + fila["id"].ToString() + "     |    Nombre del articulo: " + fila["nombre_articulo"].ToString() + "    |        stock actual:" + fila["existencia"].ToString() + "           |    stock minimo: " + fila["cantidad_minima"].ToString() + "\r\n";
         }
         principal rc = new principal();
         rc.richTextBox1.Text = cmd;
         rc.Text = "Alerta de inventaria bajo";
         rc.ShowDialog();
     }
 }