Esempio n. 1
0
        private void save()
        {
            string _idUsuario;

            if (update == false)
            {
                //REGISTRAMOS
                fn.RegistrarOficial("Usuario", "Nombres,Telefono,Usuario,Contraseña,Tipo,Habilitado,PermisosEspeciales,IDSucursal,Tactil,Mozo",
                                    "'" + txttrabajador.Text + "','" + txtTelefono.Text + "','" + txtusuario.Text + "','" + txtpass.Text + "','" + cboTipo.Text + "','True','" + chbxPermisosEspciales.Checked + "','" + cboSucursal.SelectedValue + "','" + chbxTactil.Checked + "','" + chbxMozo.Checked + "'");

                _idUsuario = fn.selectValue("select max(IDUsuario) from usuario");
            }
            else
            {
                fn.Modificar("Usuario", "IDSucursal = '" + cboSucursal.SelectedValue + "',Nombres='" + txttrabajador.Text + "',Usuario ='" + txtusuario.Text + "',Telefono='" + txtTelefono.Text + "',PermisosEspeciales='" + chbxPermisosEspciales.Checked + "',Tactil='" + chbxTactil.Checked + "',Mozo='" + chbxMozo.Checked + "'", "idusuario='" + IDUsuario + "'");
                fn.Eliminar("FormularioUsuario", "IDUsuario='" + IDUsuario + "'");
                update     = false;
                _idUsuario = IDUsuario;
            }


            foreach (DataGridViewRow row in dgvPermisos.Rows)
            {
                fn.RegistrarOficial("FormularioUsuario", "IDUsuario,IDFormulario,Permiso", "'" + _idUsuario + "','" + row.Cells["Item"].Value + "','" + Convert.ToBoolean(row.Cells["Permiso"].Value) + "'");
            }
        }
 private void EGuardar()
 {
     try
     {
         if (fn.Existencia("*", "Condimento", "Condimento='" + txtCategoria.Text.TrimEnd() + "'") == true)
         {
             MessageBox.Show("EL Condimento ya se encuentra Registrada", "San Agustin", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         if (txtCategoria.Text == "")
         {
             MessageBox.Show("Ingrese el Insumo", "San Agustin", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtCategoria.Focus(); return;
         }
         if (QuiereGuardar == true)
         {
             fn.Registrar("Condimento", "'" + txtCategoria.Text.TrimEnd() + "','" + cbxCategoria.SelectedValue + "'");
         }
         else
         {
             fn.Modificar("CondimEnto", "Condimento='" + txtCategoria.Text.TrimEnd() + "',IDCategoria='" + cbxCategoria.SelectedValue + "'", "IDCondimento='" + IDCategoria + "'");
         }
         Bloquear(true);
         txtCategoria.Clear();
         MostrarDatosGrid();
         QuiereGuardar = true;
     }
     catch
     {
     }
 }
Esempio n. 3
0
        private void aCTIVARVENTAToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dgVentas.CurrentRow.Cells["ESTADO"].Value.ToString() == "OK")
            {
                MessageBox.Show("La Venta ya se Encuentra Activa", "FactuTED", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            string idVenta = dgVentas.CurrentRow.Cells[0].Value.ToString();

            DialogResult msj = MessageBox.Show("Desea ACTIVAR la Venta " + idVenta, "FactuTED", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (msj == DialogResult.OK)
            {
                SqlDataReader lectorPresentaciones = fn.selectMultiValues("select * from VentaDetalle where IDVenta = '" + idVenta + "'");
                while (lectorPresentaciones.Read())
                {
                    string idpresentacion = lectorPresentaciones["IDPresentacion"].ToString();
                    string cantidad       = lectorPresentaciones["Cantidad"].ToString();

                    SqlConnection conexion = new SqlConnection(Funciones.preconex);
                    string        oncod    = "select IDStockAlmacen,Cantidad from Receta WHERE IDPresentacion = '" + idpresentacion + "'";
                    SqlCommand    cmd      = new SqlCommand(oncod, conexion);
                    conexion.Open();
                    SqlDataReader lector = cmd.ExecuteReader();
                    while (lector.Read())
                    {
                        string idStockAlmacen = lector[0].ToString();
                        string IDInsumo       = fn.select_one_value("IDInsumo", "StockAlmacen", "IDStockAlmacen='" + idStockAlmacen + "'", 0);

                        //Descontando receta de producto paraventa
                        decimal cantidadSalida = Convert.ToDecimal(lector["Cantidad"].ToString()) * Convert.ToDecimal(cantidad);
                        fn.Modificar("StockAlmacen", "Stock=Stock-(" + cantidadSalida + ")", "IDStockAlmacen='" + idStockAlmacen + "'");
                    }
                }

                fn.Modificar("Venta", "Anulada='False'", "IDVenta='" + idVenta + "'");

                //REGISTRAMOS
                fn.RegistrarOficial("[Venta.Seguridad]", "Fecha,Hora,IDVenta,IDUsuario,Movimiento", "'" + DateTime.Now.ToShortDateString() + "','" + DateTime.Now.ToLongTimeString() + "','" + idVenta + "','" + Datos.idUsuario + "','VENTA ACTIVADA'");

                MessageBox.Show("Venta Activada", "FactuTED", MessageBoxButtons.OK, MessageBoxIcon.Information);

                buscar();
            }
        }
Esempio n. 4
0
 private void save()
 {
     if (Guardar)
     {
         fn.RegistrarOficial("Proveedor", "IDTipoDocumento,Numero,RazonSocial,Telefono,Direccion,Contacto",
                             "'" + cboTipoDocumento.SelectedValue + "','" + txtidentificacion.Text + "','" + txtrazonsocial.Text + "','" + txttelefono.Text + "','" + txtdireccion.Text + "','" + txtcontacto.Text + "'");
     }
     else
     {
         fn.Modificar("Proveedor", "Numero='" + txtidentificacion.Text + "',RazonSocial='" + txtrazonsocial.Text + "',Telefono='" + txttelefono.Text + "',Direccion='" + txtdireccion.Text + "',Contacto='" + txtcontacto.Text + "',IDTipoDocumento='" + cboTipoDocumento.SelectedValue + "'", "IDProveedor='" + IDProveedor + "'");
     }
 }
Esempio n. 5
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Guardar == true)
            {
                fn.Registrar("Productos", "'" + txtnombre.Text + "','" + txtDescripcion.Text.TrimEnd() + "','" + cbTipo.SelectedValue + "'");
                if (dgPresentacion.Rows.Count == 0)
                {
                    return;
                }

                string CodigoProducto = fn.select_one_value("max(IDProducto)", "Productos", "IDProducto!=0", 0);

                foreach (DataGridViewRow row in dgPresentacion.Rows)
                {
                    fn.Registrar("Presentacion", "'" + CodigoProducto + "','" + row.Cells["Nombre"].Value.ToString() + "','" + row.Cells["Costo"].Value.ToString() + "','" + row.Cells["Precio"].Value.ToString() + "'");
                }
            }
            else
            {
                fn.Modificar("Productos", "Nombre='" + txtnombre.Text.TrimEnd() + "',Descripcion='" + txtDescripcion.Text.TrimEnd() + "',IDCondicion='" + cbTipo.SelectedValue + "'", "IDProducto='" + IDProducto + "'");
            }
            CargarGrid();
            Desbloquear(false);
        }
Esempio n. 6
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (Guardar == true)
     {
         fn.Registrar("Cliente", "'" + txtnombre.Text + "','" + txtnumero.Text + "','" + txttelefono.Text + "','" + txtdireccion.Text + "'");
         Limpiar();
     }
     else
     {
         fn.Modificar("cliente", "nombre = '" + txtnombre.Text + "',numero ='" + txtnumero.Text + "',Telefono ='" + txttelefono.Text + "',Direccion ='" + txtdireccion.Text + "'", "IDCliente ='" + IDCliente + "'");
         Limpiar();
     }
     CargarGrid();
     Guardar = true;
 }
Esempio n. 7
0
        private void registrar()
        {
            string permitirControl;

            if (checkBox1.Checked == true)
            {
                permitirControl = "True";
            }
            else
            {
                permitirControl = "False";
            }

            //GUARDAR
            if (QuiereGuardar == true)
            {
                DialogResult msj = MessageBox.Show("¿Desea REGISTRAR el Insumo?", "San Agustin", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (msj == DialogResult.OK)
                {
                    fn.RegistrarOficial("StockAlmacen", "IDInsumo,IDAlmacen,Stock,PermitirControl", "'" + cbxInsumo.SelectedValue + "','" + cbxAlmacen.SelectedValue + "','" + txtStockTotal.Text + "','" + permitirControl + "'");
                }
                else
                {
                    return;
                }
            }
            else
            {
                DialogResult msj = MessageBox.Show("¿Desea ACTUALIZAR el Insumo?", "San Agustin", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (msj == DialogResult.OK)
                {
                    fn.Modificar("StockAlmacen", "IDAlmacen='" + cbxAlmacen.SelectedValue + "',IDInsumo='" + cbxInsumo.SelectedValue + "',Stock='" + txtStockTotal.Text + "',PermitirControl='" + permitirControl + "'", "IDStockAlmacen='" + IDStockAlamcen + "'");

                    //REGISTRAMOS KARDEX
                    fn.RegistrarOficial("Kardex", "Fecha,Proceso,CodProceso,Entrada,Salida,Saldo,IDStockAlmacen",
                                        "'" + DateTime.Now.ToShortDateString() + "','EDICION DE INSUMO','" + IDStockAlamcen + "','0','0','" + txtStockTotal.Text + "','" + IDStockAlamcen + "'");
                }
                else
                {
                    return;
                }
            }
        }
Esempio n. 8
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Validar() != true)
            {
                return;
            }

            if (Guardar)
            {
                fn.Registrar("Proveedor", "'" + txtidentificacion.Text + "','" + txtrazonsocial.Text + "','" + txttelefono.Text + "','" + txtdireccion.Text + "','" + txtcontacto.Text + "'");
            }
            else
            {
                fn.Modificar("Proveedor", "Numero='" + txtidentificacion.Text + "',RazonSocial='" + txtrazonsocial.Text + "',Telefono='" + txttelefono.Text + "',Direccion='" + txtdireccion.Text + "',Contacto='" + txtcontacto.Text + "'", "IDProveedor='" + IDProveedor + "'");
            }
            Limpiar();
            CargarGrid();
            Bloquear(true);
        }
Esempio n. 9
0
 private void btnPagar_Click(object sender, EventArgs e)
 {
     //MessageBox.Show(""+ dgVentas.CurrentRow.Cells["ESTÁ PAGADO"].Value.ToString());return;
     if (dgVentas.Rows.Count == 0)
     {
         MessageBox.Show("No existen datos", ".: AVISO DEL SITEMA :.", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     //v.IDVenta as [COD VENTA],v.Fecha AS [FECHA], v.Hora as [HORA],v.Igv as [IGV],v.SubTotal as [SUBTOTAL], v.Total AS [TOTAL],a.Descripcion as [TIPO],Pagado AS [ESTÁ PAGADO]
     if (Convert.ToBoolean(dgVentas.CurrentRow.Cells["ESTÁ PAGADO"].Value) == false)
     {
         fn.Modificar("venta", "pagado = '1'", "IDVenta = '" + dgVentas.CurrentRow.Cells["COD VENTA"].Value.ToString() + "'");
         MessageBox.Show("Exito: proceso de pago finalizado", ".: AVISO DEL SISTEMA :.", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("La venta ya fue cancelada", ".: AVISO DEL SISTEMA :.", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     CargarGrid();
 }
Esempio n. 10
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (txtnombreAlmacen.Text == "")
     {
         error.SetError(txtnombreAlmacen, "Debe ingresar el nombre de almacén");
         return;
     }
     error.Clear();
     if (Guardar)
     {
         fn.Registrar("Almacen", "'" + txtnombreAlmacen.Text + "','" + Convert.ToBoolean(chVender.CheckState) + "'");
     }
     else
     {
         fn.Modificar("Almacen", "Almacen = '" + txtnombreAlmacen.Text + "',PuedeVender='" + Convert.ToBoolean(chVender.Checked) + "'", "IDAlmacen='" + dgAlmacen.CurrentRow.Cells["IDAlmacen"].Value.ToString() + "'");
     }
     Limpiar();
     Grid();
     Bloquear(true);
 }