Ejemplo n.º 1
0
        public void restante()
        {
            if (Dgb_pedidosEspeciales.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in Dgb_pedidosEspeciales.Rows)
                {
                    string id     = row.Cells[0].Value.ToString();
                    string nombre = row.Cells[2].Value.ToString();

                    string prod         = mo.ObtenerSimple2("productos", "id_producto", "nombre_producto", nombre);
                    string cantidad     = mo.ObtenerSimple3("inventarios_produccion", "cantidad_total", "id_producto", prod);
                    string rendimientof = row.Cells[6].Value.ToString();
                    string cantidadfr   = row.Cells[7].Value.ToString();



                    double cant  = Convert.ToDouble(cantidad);
                    double rendf = Convert.ToDouble(rendimientof);
                    double cantf = Convert.ToDouble(cantidadfr);
                    if (cantf != 0)
                    {
                        double restante = (rendf * cant) / cantf;

                        string restante1 = Convert.ToString(restante);
                        mo.updateestados("detalles_recetas", "rendimiento_restante", restante1, "id_detalle", id);
                    }
                }

                actualizardatagriew2(lbl_noProcesp.Text);
            }
        }
Ejemplo n.º 2
0
        public void restante()
        {
            if (Dgb_pedidosEspeciales.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in Dgb_pedidosEspeciales.Rows)
                {
                    string id     = row.Cells[0].Value.ToString();
                    string nombre = row.Cells[2].Value.ToString();

                    string prod         = mo.ObtenerSimple2("productos", "id_producto", "nombre_producto", nombre);
                    string cantidad     = mo.ObtenerSimple3("inventarios_produccion", "cantidad_total", "id_producto", prod);
                    string rendimientof = row.Cells[6].Value.ToString();
                    string cantidadfr   = row.Cells[7].Value.ToString();



                    if (cantidad != "")
                    {
                        double cant  = Convert.ToDouble(cantidad);
                        double rendf = Convert.ToDouble(rendimientof);
                        double cantf = Convert.ToDouble(cantidadfr);
                        if (cantf != 0)
                        {
                            double restante = (rendf * cant) / cantf;

                            string restante1 = Convert.ToString(restante);
                            mo.updateestados("detalles_recetas", "rendimiento_restante", restante1, "id_detalle", id);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Este elemento fue eliminado de la base de datos, elimine este proceso y cree uno nuevo luego de asignar el producto en inventarios ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                        /*   if ()
                         * {
                         *
                         *     this.Close();
                         * }*/
                    }
                }

                actualizardatagriew2(lbl_noProcesp.Text);
            }
        }
Ejemplo n.º 3
0
        public void suministros()
        {
            DataTable dt = mo.inventarios();

            if (dt.Rows.Count != 0)
            {
                int i = 0;

                string idmax = mo.idmax("solicitudes_encabezados", "cod_solicitud");


                foreach (DataRow row in dt.Rows)
                {
                    string fecha = DateTime.Now.ToString("yyyy-MM-dd");
                    var    dato  = dt.Rows[i]["id_producto"].ToString();


                    var maximo   = dt.Rows[i]["maximo"].ToString();
                    var cantidad = dt.Rows[i]["cantidad_total"].ToString();

                    string existe = mo.ObtenerSimple3("solicitudes_detalles", "id_producto", "id_producto", dato);


                    if (existe == "")
                    {
                        double max  = Convert.ToDouble(maximo);
                        double cant = Convert.ToDouble(cantidad);

                        double resultado = max - cant;



                        string cadena = "INSERT INTO solicitudes_encabezados (cod_solicitud, fecha_solicitud , prioridad) VALUES(NULL, '" + fecha + "', 'Alta' );";
                        mo.insertar(cadena);
                        string detalle = " INSERT INTO solicitudes_detalles (cod_solicitud, id_producto, cantidad ) VALUES (" + idmax + " , " + dato + " , '" + resultado + "' ) ;";
                        mo.insertar(detalle);
                    }

                    i++;
                }
            }
        }