private void btnAGREGAR_Click(object sender, EventArgs e) { if (listaMaterialesUpdated.Count == 0) { MessageBox.Show("Debe agregar por lo menos un material"); return; } listanuevax2 = new List <MODELO.Materiales>(); listanuevax3 = new List <Int32>(); listanuevax2 = cOccantmat.obtenerNuevax2(oOrden); listanuevax3 = cOccantmat.obtenerCantidadxD(oOrden); oRemito.NroRemito = txtNROREMITO.Text; oRemito.Proveedor = oProvedorNew; oRemito.OrdenDeCompra = orderC; oRemito.Fecha = DateTime.Now; oRemito.Localidad = oOrden.Localidad; #region eval. prov //A = FECHA Y CANTIDAD OK, B = CANTIDAD OK Y FECHA MAL, C = CANTIDAD MAL O CANTIDAD Y FECHA MAL for (int i = 0; i < ocantmat.LongCount(); i++) { cantidadRequerida += ocantmat[i].cantidadmat.Cantidad_mat; } if (cantidadRequerida == cantidadIngresada) { if (oOrden.Fecha_Recepcion.Date >= dtpFECHARECEPCION.Value.Date) { oProvedorNew.tipo = "A"; } else if (oOrden.Fecha_Recepcion.Date < dtpFECHARECEPCION.Value.Date) { oProvedorNew.tipo = "B"; } } else if (cantidadRequerida > cantidadIngresada) { if (oOrden.Fecha_Recepcion.Date >= dtpFECHARECEPCION.Value.Date || oOrden.Fecha_Recepcion.Date <= dtpFECHARECEPCION.Value.Date) { oProvedorNew.tipo = "C"; } } #endregion foreach (var item in listaMaterialesUpdated) { oUpdated = item; for (int i = 0; i < ocantmat.LongCount(); i++) { if (ocantmat[i].cantidadmat.Cantidad_mat == oUpdated.Cantidad_Ingresada) { oRemito.CalifCantidad = "A"; if (oOrden.Fecha_Recepcion.Date == dtpFECHARECEPCION.Value.Date) { oRemito.CalifTiempo = "A tiempo"; } } else if (ocantmat[i].cantidadmat.Cantidad_mat != oUpdated.Cantidad_Ingresada) { oRemito.CalifCantidad = "B"; if (oOrden.Fecha_Recepcion.Date == dtpFECHARECEPCION.Value.Date) { oRemito.CalifTiempo = "A tiempo"; } else if (oOrden.Fecha_Recepcion.Date < dtpFECHARECEPCION.Value.Date) { oRemito.CalifTiempo = "Tarde"; } } } } //oMaterial int count = 0; foreach (var item in listaMaterialesUpdated) { oUpdated = item; cRemitoUpdated.agregarRemitoUpdated(oUpdated); for (int i = 0; i < ocantmat.LongCount(); i++) { if (ocantmat[i].material == oUpdated.material) { ocantmat[i].cantidadmat.Cantidad_mat -= oUpdated.Cantidad_Ingresada; cCANTMAT.modificarCantMat(ocantmat[i].cantidadmat); oMaterial = (MODELO.Materiales)cMateriales.obtenerMaterialNombree(ocantmat[i].material)[0]; oMaterial.STOCK += oUpdated.Cantidad_Ingresada; cMateriales.modificarMateriales(oMaterial); } } } for (int i = 0; i < ocantmat.LongCount(); i++) { if (ocantmat[i].cantidadmat.Cantidad_mat == 0) { count++; } } if (count == ocantmat.LongCount()) { oOrden.visibily = false; } cREMITO.agregarRemito(oRemito); AGREGAR_AUDITORIA("Alta", oRemito); this.DialogResult = DialogResult.OK; }