Beispiel #1
0
        public void productos()
        {
            string    sql = "SELECT id_producto FROM productos p where p.id_tipo_producto = 1 and p.estado = 1 ;";
            DataTable dt  = mo.consultaLogica2(sql);
            int       i   = 0;

            string fecha1 = DateTime.Now.ToString("yyyy-MM-dd");

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    var id = dt.Rows[i]["id_producto"].ToString();

                    string sql2 = "SELECT id_producto FROM costos_produccion where id_producto = " + id + " and estado =1;";

                    string resultado = mo.consulta(sql2);


                    if (resultado == " ")
                    {
                        string insertar = "INSERT INTO costos_produccion (id_producto,fecha) values (" + id + ",'" + fecha1 + "');";
                        mo.insertar(insertar);
                    }



                    i++;
                }
            }
        }
        private void Nud_cantidad_KeyPress(object sender, KeyPressEventArgs e)
        {
            string prod2  = cmb_productos.texto2();
            int    existe = cmb_productos.existe(prod2);

            if (existe != -1 && prod2 != "")
            {
                string sql  = "Select maximo from configuraciones_inventarios ci INNER JOIN  inventarios_produccion ip on ci.cod_config = ip.cod_config WHERE ip.id_producto = '" + cmb_productos.ObtenerIndif() + "' ;";
                string cant = mo.consulta(sql);



                if (cant != null)
                {
                    int canti = Convert.ToInt32(cant);


                    Nud_cantidad.Maximum = canti;
                }
                else
                {
                    MessageBox.Show("Asigne una Configuracion de inventario ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
        void unidadesnew(string un2, double cant2, string un1)
        {
            double resultado  = 1 / cant2;
            double resultador = Math.Round(resultado, 4);
            string sql        = " INSERT INTO unidades_medida (unidad1, cantidad1, unidad2 , cantidad2) VALUES ('" + un2 + "' , " + 1 + " , '" + un1 + "' , " + resultado + ") ;";

            mo.insertar(sql);

            string consultar5 = "Select id_medida from unidades_medida where unidad1 = '" + un1 + "' and unidad2 = '" + un1 + "' and estado = 1 ;";
            string ex         = mo.consulta(consultar5);

            if (ex == " ")
            {
                string sql6 = " INSERT INTO unidades_medida (unidad1, cantidad1, unidad2 , cantidad2) VALUES ('" + un1 + "' ,  " + 1 + "  , '" + un1 + "' , " + 1 + ") ;";
                mo.insertar(sql6);
            }
            string consultar7 = "Select id_medida from unidades_medida where unidad1 = '" + un2 + "' and unidad2 = '" + un2 + "' and estado = 1 ;";
            string ex2        = mo.consulta(consultar7);

            if (ex2 == " ")
            {
                string sql7 = " INSERT INTO unidades_medida (unidad1, cantidad1, unidad2 , cantidad2) VALUES ('" + un2 + "' ,  " + 1 + "  , '" + un2 + "' , " + 1 + ") ;";
                mo.insertar(sql7);
            }
        }
Beispiel #4
0
        private void Dgb_produccionProceso_DoubleClick(object sender, EventArgs e)
        {
            if (dgb_produccionProceso.Rows.Count > 1)
            {
                if (dgb_produccionProceso.SelectedRows.Count == 1)
                {
                    Cmb_producto.Enabled   = false;
                    Btn_insertar.Enabled   = false;
                    Btn_eliminar.Enabled   = true;
                    Btn_actualizar.Enabled = true;
                    Btn_Receta.Enabled     = true;
                    string nombreprod = dgb_produccionProceso.CurrentRow.Cells[2].Value.ToString();
                    string where = dgb_produccionProceso.CurrentRow.Cells[0].Value.ToString();

                    string sql3 = " SELECT id_producto FROM productos where estado = 1 and nombre_producto = '" + nombreprod + "' ";
                    string resultado2;
                    resultado2 = mo.consulta(sql3);
                    string sql   = "Select nombre from produccion_procesos where estado =1 and  id_proceso = " + where + " ;";
                    string razon = mo.consulta(sql);


                    string comboest = resultado2 + "-" + nombreprod;



                    txt_para.Text      = razon;
                    Txt_idproceso.Text = where;

                    Cmb_producto.texto(comboest);

                    Txt_descripcion.Text = dgb_produccionProceso.CurrentRow.Cells[3].Value.ToString();

                    Txt_tiempopp.Text = dgb_produccionProceso.CurrentRow.Cells[4].Value.ToString();


                    txt_para.Enabled      = false;
                    Txt_idproceso.Enabled = false;
                }
                else
                {
                    MessageBox.Show("Seleccione un dato", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                MessageBox.Show("No existen datos en la tabla, Por favor ingrese datos ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Beispiel #5
0
        private void Btn_agregar_Click(object sender, EventArgs e)
        {
            string documento = lbl_noOrden.Text;
            string primero   = cmb_productos.ObtenerIndif();
            string cantidad  = Nud_cantidad.Value.ToString();
            string costo     = nudCosto.Value.ToString();;
            string precio    = nudPrecio.Value.ToString();

            string consulta2 = "select b.codigo_bodega from bodegas b  INNER JOIN existencias e ON b.codigo_bodega=e.codigo_bodega INNER JOIN productos p on e.codigo_producto=p.codigo_producto where p.codigo_producto= '" + cmb_productos.ObtenerIndif() + "'";
            string codbodega = mo.consulta(consulta2);

            Dgb_pedidosEspeciales.Rows.Add(documento, primero, cantidad, costo, precio, codbodega);

            string total  = Dgb_pedidosEspeciales.CurrentRow.Cells[4].Value.ToString();
            string actual = lbltotal.Text;

            float total1  = float.Parse(total);
            float actual2 = float.Parse(actual);

            string cant = Nud_cantidad.Value.ToString();

            float resultado = actual2 + (total1 * float.Parse(cant));

            lbltotal.Text = Convert.ToString(resultado);
        }
Beispiel #6
0
        public void productos()
        {
            string    sql = "SELECT id_producto FROM productos p where p.id_tipo_producto = 1 and p.estado = 1 ;";
            DataTable dt  = mo.consultaLogica2(sql);
            int       i   = 0;



            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    var id = dt.Rows[i]["id_producto"].ToString();

                    string sql2 = "SELECT id_producto FROM costos_produccion where id_producto = " + id + ";";

                    string resultado = mo.consulta(sql2);
                    MessageBox.Show(resultado);

                    if (resultado == " ")
                    {
                        string insertar = "INSERT INTO costos_produccion (id_producto) values (" + id + ");";
                        mo.insertar(insertar);
                    }



                    i++;
                }
            }
        }
Beispiel #7
0
        public Facturas(string id)
        {
            InitializeComponent();
            string sql1     = "SELECT * FROM ventas_encabezado where codigo_cliente = '" + id + "' ";
            string consulta = "select documento_ventaenca from ventas_encabezado where codigo_cliente = '" + id + "' ";
            string con      = mo.consulta(consulta);
            string sql2     = "SELECT * FROM ventas_detalle where documento_ventaenca = '" + con + "' ";

            actualizardatagriew(sql1);
            actualizardatagriew2(sql2);
        }
Beispiel #8
0
        private void Btn_seleccionar_Click(object sender, EventArgs e)
        {
            if (Dgb_ordenesPendientes.SelectedRows.Count == 1)
            {
                string idcliente     = Dgb_ordenesPendientes.CurrentRow.Cells[0].Value.ToString();
                string consulta      = "select nombre_cliente from clientes where codigo_cliente = '" + idcliente + "' ";
                string nombrecliente = mo.consulta(consulta);

                proceso1 frm = new proceso1(nombrecliente, idcliente);
                frm.MdiParent = this.MdiParent;
                frm.Show();
            }
        }
        /*DialogResult resul =  MessageBox.Show("¿Esta seguro que desea validar los documentos? ", "Alerta", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         *
         *  if (resul == DialogResult.Yes)
         *  {                              }*/
        private void Btn_insertar_Click(object sender, EventArgs e)
        {
            string  idprod2   = Cmb_prod.texto2();
            string  idcong2   = cmb_config.texto2();
            decimal cantidad2 = Nud_cantidad.Value;
            string  um        = cmb_unidadmedida.Text;
            int     existe    = Cmb_prod.existe(Cmb_prod.texto2());
            int     existe2   = cmb_config.existe(idcong2);



            if (idprod2 != "" && idcong2 != "" && um != "" && cantidad2 != 0 && um != "")
            {
                if (existe == -1 || existe2 == -1)
                {
                    MessageBox.Show("La Configuracion o el Producto seleccionados no son validos ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }

                else
                {
                    string yaingresado = Cmb_prod.ObtenerIndif();

                    string sql2 = "SELECT id_producto FROM inventarios_produccion where estado = 1 and id_producto = '" + yaingresado + "' ";

                    string resultado;

                    resultado = mo.consulta(sql2);



                    if (resultado == " ")
                    {
                        string idinv  = Txt_idinv.Text;
                        string idprod = Cmb_prod.ObtenerIndif();
                        string idcong = cmb_config.ObtenerIndif();

                        string unidad   = cmb_unidadmedida.Text;
                        string cantidad = Nud_cantidad.Value.ToString();



                        string sql = "INSERT INTO inventarios_produccion (id_inventario, id_producto, cod_config, cantidad_total,unidad_medida, estado) VALUES ( " + idinv + " , '" + idprod + "' , '" + idcong + "' , '" + cantidad + "' , '" + unidad + "' , 1 );";
                        mo.insertar(sql);

                        actualizardatagriew();

                        MessageBox.Show("Registro Realizado con Exito ", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        string limpio = " ";
                        cmb_config.texto(limpio);
                        Cmb_prod.texto(limpio);
                        Nud_cantidad.Minimum = 0;
                        Nud_cantidad.Value   = 0;
                        Txt_idinv.Text       = mo.idmax("inventarios_produccion", "id_inventario");
                    }

                    else
                    {
                        MessageBox.Show("Este registro ya fue ingresado solo puede modificar su configuracion o eliminarlo e ingresar uno nuevo ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
            else
            {
                MessageBox.Show("Por favor llene los campos correspondientes para un registro correcto ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }