private void TraerDetalleOC(string _codEmp, int _ordenCompra_id, int _nivel_aut) { try { BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR _detalle = new BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR(); this.dataGridViewDetalle.Rows.Clear(); int indice; foreach (Entities.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR item in _detalle.ItemList(_codEmp, _ordenCompra_id, _nivel_aut)) { indice = dataGridViewDetalle.Rows.Add(); dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CODIGO].Value = item.articulo_id; //CODIGO PRODUCTO dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.NROITEM].Value = item.nroitem; //NRO ITEM dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.DESCRIPCION].Value = item.art_descgen; //DESCRIPCION PRODUCTO dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.UNIMED].Value = item.unimed; //UNIDAD DE MEDIDA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CANT_ORIGINAL].Value = item.cantidad.ToString().Replace(",", "."); //CANTIDAD PEDIDA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.CANT_ADEUDADA].Value = item.cantidadadeudada.ToString().Replace(",", "."); //CANTIDAD ADEUDADA dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.PORCTOLERANCIA].Value = item.porctoleranciareposicion.ToString().Replace(",", "."); //PORCENTAJE DE TOLERANCIA PARA RECEPCIÓN dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.LLEVA_VENCIMIENTO].Value = item.llevavencimiento; //LLEVA VENCIMIENTO if (Convert.ToBoolean(dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.LLEVA_VENCIMIENTO].Value)) { DataGridViewDisableButtonCell buttonCell = (DataGridViewDisableButtonCell)dataGridViewDetalle.Rows[indice].Cells[(int)Col_DetalleOC.VTOS]; //HABILITRO LA CELDA... LE CAMBIO EL VALOR A TRUE buttonCell.Enabled = true; } } labelNumeroFactura.Text = _ordenCompra_id.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridViewOCCab_CellClick(object sender, DataGridViewCellEventArgs e) { try { BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR _item = new BLL.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR(); this.dataGridViewOCItem.Rows.Clear(); int indice; foreach (Entities.Procedures.TRAEORDENCOMPRAITEM_PENDIENTE_DE_ENTREGAR item in _item.ItemList(dataGridViewOCCab.Rows[e.RowIndex].Cells[(int)Col_OCCab.CODEMP].Value.ToString(), Convert.ToInt32(dataGridViewOCCab.Rows[e.RowIndex].Cells[(int)Col_OCCab.NRO_OC].Value), 2)) { indice = dataGridViewOCItem.Rows.Add(); dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.CODEMP].Value = item.codemp; //CODIGO EMPRESA dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.ARTICULO_ID].Value = item.articulo_id; //ARTICULO dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.NRO_OC].Value = item.ordencompra_id; //OC dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.NRO_ITEM].Value = item.nroitem; //NRO ITEM dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.ARTICULO].Value = item.art_descgen.ToString(); //DESCRIP ARTICULO dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.UNIDAD_DE_MEDIDA].Value = item.unimed; //TRAE UNIMED dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.PRECIO].Value = item.precio; //PRECIO dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.CANTIDADPEDIDA].Value = item.cantidad.ToString().Replace(",", ".");; //CANTIDAD PEDIDA dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.CANTIDADADEUDADA].Value = item.cantidadadeudada.ToString().Replace(",", ".");; //CANTIDAD ADEUDADA dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.CANTIDADENTREGADA].Value = (item.cantidad - item.cantidadadeudada).ToString().Replace(",", "."); //CANTIDAD ENTREGADA dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.MARCA].Value = item.marca; //MARCA dataGridViewOCItem.Rows[indice].Cells[(int)Col_OCItem.FECHA_ENTREGA].Value = item.fechaentrega; //FECHA ENTREGA if (item.cantidadadeudada > 0) { dataGridViewOCItem.Rows[indice].DefaultCellStyle.BackColor = Color.Yellow; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }