private void CargarItemsRequerimiento(int _index, int _nivelAutorizazion) { try { BLL.Procedures.TRAEREQUERIMIENTOITEM _item = new BLL.Procedures.TRAEREQUERIMIENTOITEM(); this.dataGridViewReqItems.Rows.Clear(); int indice; foreach (Entities.Procedures.TRAEREQUERIMIENTOITEM item in _item.ItemList(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.CODEMP].Value.ToString(), Convert.ToInt32(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.REQ_ID].Value), _nivelAutorizazion)) { indice = dataGridViewReqItems.Rows.Add(); dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CODEMP].Value = item.codemp; //CODIGO EMPRESA dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CODIGO].Value = item.articulo_id; //ARTICULO dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.NROREQ].Value = item.requerimiento_id; //OC dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.NROITEM].Value = item.nroitem; //NRO ITEM dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.DESCRIPCION].Value = item.art_descgen.ToString(); //DESCRIP ARTICULO dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.UNIDAD].Value = item.unimed; //TRAE UNIMED dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CANTIDAD].Value = item.cantidad.ToString().Replace(",", "."); //CANTIDAD dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.FENTREGA].Value = item.fechaentrega; //FECHA ENTREGA } REQ_ID = Convert.ToInt32(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.REQ_ID].Value); // Salvo Orden de compra ID _codemp = dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.CODEMP].Value.ToString(); // Salvo el CODEMP //TRAIGO LAS OBSERVACIOENS EN EL TEXT.. POR SI LA QUIERE MODIFICAR this.textBoxObs.Text = dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.OBSERVACIONES].Value.ToString(); //TRAIGO ARTICULOS PROVISORIOS SI LOS TIVIERA DE ESTE REQUERIMIENTO BLL.Tables.COMARTICULOSPROVISORIOS _provisorios = new BLL.Tables.COMARTICULOSPROVISORIOS(); indice = 0; this.dataGridViewProvisorios.Rows.Clear(); _provisorios.WhereParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, _codemp); _provisorios.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.requerimiento_id, DAL.SqlEnums.OperandEnum.Equal, REQ_ID); _provisorios.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.pendienteEnBejerman, DAL.SqlEnums.OperandEnum.Equal, 1); foreach (Entities.Tables.COMARTICULOSPROVISORIOS itemprov in _provisorios.Items()) { indice = dataGridViewProvisorios.Rows.Add(); dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.DESCRIPCION].Value = itemprov.DESCRIPCION; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.PRESENTACION].Value = itemprov.PRESENTACION; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.UNIDAD].Value = itemprov.UNIMED; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.MARCA].Value = itemprov.MARCA; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.EMBALAJE].Value = itemprov.EMBALAJE; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CANTIDAD].Value = itemprov.CANTIDAD; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.ID].Value = itemprov.ID; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CODPROVISORIO].Value = itemprov.CODPROVISORIO; NroProvisorio = itemprov.CODPROVISORIO; //GUARDO ESTE NUMERO PARA HACR MODIFICACIONES EN ESA TABLA dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CODEMP].Value = itemprov.CODEMP; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.REQUERIMIENTO_ID].Value = itemprov.REQUERIMIENTO_ID; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.NROITEM].Value = itemprov.NROITEM; dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.PENDIENTEENBEJERMAN].Value = itemprov.PENDIENTEENBEJERMAN; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridViewReqCab_CellClick(object sender, DataGridViewCellEventArgs e) { try { BLL.Procedures.TRAEREQUERIMIENTOITEM _item = new BLL.Procedures.TRAEREQUERIMIENTOITEM(); this.dataGridViewReqItem.Rows.Clear(); int indice; int _requerimiento_id = Convert.ToInt32(dataGridViewReqCab.Rows[e.RowIndex].Cells[(int)Col_RequerimientoCab.NRO_REQUERIMIENTO].Value); string _codEmpresa = dataGridViewReqCab.Rows[e.RowIndex].Cells[(int)Col_RequerimientoCab.CODEMP].Value.ToString(); //ANTES DE TRAER LOS ITEMS VERIFICO SI ESTE REQUERIMIENTO TIENE ARTICULOS PROVISORIOS BLL.Tables.COMARTICULOSPROVISORIOS _provisorio = new BLL.Tables.COMARTICULOSPROVISORIOS(); _provisorio.WhereParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.requerimiento_id, DAL.SqlEnums.OperandEnum.Equal, _requerimiento_id); _provisorio.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, _codEmpresa); _provisorio.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.pendienteEnBejerman, DAL.SqlEnums.OperandEnum.Equal, 1); if (_provisorio.Items().Count > 0) { MessageBox.Show("Este requerimiento tiene artículos provisorios, antes de autorizarlo debe asignar los códigos de Bejerman", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { foreach (Entities.Procedures.TRAEREQUERIMIENTOITEM item in _item.ItemList(_codEmpresa, _requerimiento_id, 1)) { indice = dataGridViewReqItem.Rows.Add(); dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.CODEMPRESA].Value = item.codemp.ToString(); //DESCRIPCION DEL ARTICULO dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.ARTICULO].Value = item.art_descgen; //DESCRIPCION DEL ARTICULO dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.NRO_REQUERIMIENTO].Value = item.requerimiento_id; //DESCRIPCION DEL ARTICULO dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.ARTICULO_ID].Value = item.articulo_id; //ID DEL ARTICULO dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.CANTIDAD].Value = item.cantidad.ToString().Replace(",", "."); //TRAE CANTIDAD dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.FECHA_DE_ENTREGA].Value = item.fechaentrega.ToShortDateString(); //FECHA DE ENTREGA dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.UNIDAD_DE_MEDIDA].Value = item.unimed; //TRAE UNIMED dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.MARCA].Value = item.Marca; //MARCA dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.NRO_ITEM].Value = item.nroitem; //TRAE NRO ITEM } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }