예제 #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);
            }
        }
        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);
            }
        }