Пример #1
0
        private void dgvUPDATED_DoubleClick(object sender, EventArgs e)
        {
            oUpdated = (MODELO.RemitoUpdated)dgvUPDATED.CurrentRow.DataBoundItem;
            listaMaterialesUpdated.Remove(oUpdated);


            dgvUPDATED.DataSource = null;
            dgvUPDATED.DataSource = listaMaterialesUpdated;

            dgvUPDATED.Columns["codigo"].Visible   = false;
            dgvUPDATED.Columns["nroOrden"].Visible = false;
        }
Пример #2
0
        private void dgvMATERIALES_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            dgvUPDATED.Enabled = true;
            oPEPE = (MODELO.Occantmat)dgvMATERIALES.CurrentRow.DataBoundItem;



            oUpdated          = new MODELO.RemitoUpdated();
            oUpdated.nroOrden = oPEPE.ordercompra;
            oUpdated.material = oPEPE.material;

            oUpdated.remito = txtNROREMITO.Text;
            //oUpdated.material.DESCRIPCION_CORTA = oPEPE.material;

            //oUpdated.Material = oPEPE.cantidadmat.Material.DESCRIPCION_CORTA;


            txtCANTIDAD.Enabled = true;
        }
Пример #3
0
 public void agregarRemitoUpdated(MODELO.RemitoUpdated oRemitoUpdated)
 {
     oMODELO_SEGURIDAD.RemitoUpdated.Add(oRemitoUpdated);
     oMODELO_SEGURIDAD.SaveChanges();
 }
Пример #4
0
        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;
        }