Пример #1
0
        private void btnELIMINAR_Click(object sender, EventArgs e)
        {
            if (dgvMATERIALES.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un material");
                return;
            }
            MODELO.Materiales oMATERIAL = (MODELO.Materiales)dgvMATERIALES.CurrentRow.DataBoundItem;
            DialogResult      dr        = MessageBox.Show("¿Confirma que desea eliminar " + oMATERIAL.DESCRIPCION_LARGA + "?", "CONFIRMA", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                MODELO.AuditoriaMateriales oAuditoria = new MODELO.AuditoriaMateriales();
                oAuditoria.FechayHora          = System.DateTime.Now;
                oAuditoria.Movimiento          = "Baja";
                oAuditoria.Username            = "******";
                oAuditoria.COD_MATERIAL        = oMATERIAL.COD_MATERIAL;
                oAuditoria.DESCRIPCION_CORTA   = oMATERIAL.DESCRIPCION_CORTA;
                oAuditoria.DESCRIPCION_LARGA   = oMATERIAL.DESCRIPCION_LARGA;
                oAuditoria.ULTIMA_MODIFICACION = oMATERIAL.ULTIMA_MODIFICACION;
                oAuditoria.PUC    = oMATERIAL.PUC;
                oAuditoria.MAXIMO = oMATERIAL.MAXIMO;
                oAuditoria.MINIMO = oMATERIAL.MINIMO;
                //oAuditoria.CLASE = oMATERIAL.CLASE;
                //   oAuditoria.SUBCLASE = oMATERIAL.SUBCLASE;
                //    oAuditoria.PROVEEDOR = oMATERIAL.PROVEEDOR;
                oAuditoria.GANANCIA = oMATERIAL.GANANCIA;
                ////         oAuditoria.IVA = oMATERIAL.IVA;
                oAuditoria.STOCK = oMATERIAL.STOCK;
                cAuditoria.AGREGAR_AUDITORIA(oAuditoria);
                cMateriales.eliminarMateriales(oMATERIAL);
                ARMO_GRILLA();
            }
        }
Пример #2
0
        public frm_REMITO()
        {
            InitializeComponent();
            oProvedorNew           = new MODELO.Proveedor();
            orderC                 = new MODELO.Factura();
            cREMITO                = CONTROLADORA.cRemito.obtener_instancia();
            cRemitoUpdated         = CONTROLADORA.cRemitoUpdated.obtener_instancia();
            cAuditoria             = CONTROLADORA.cAuditoria.obtenerInstancia();
            cLocalidad             = CONTROLADORA.cLocalidad.obtener_instancia();
            cCANTMAT               = CONTROLADORA.cCantMat.obtener_instancia();
            cOccantmat             = CONTROLADORA.cOccantmat.obtener_instancia();
            cMateriales            = CONTROLADORA.cMateriales.obtener_instancia();
            cCLIENTE               = CONTROLADORA.cCliente.obtener_instancia();
            cORDEN                 = CONTROLADORA.cOrdenCompra.obtener_instancia();
            oMaterial              = new MODELO.Materiales();
            listaCANTMATERIALES    = new List <MODELO.CantidadMat>();
            listanuevax2           = new List <MODELO.Materiales>();
            listaMaterialesUpdated = new List <MODELO.RemitoUpdated>();
            txtNROREMITO.Text      = DateTime.Now.ToString("yyyyMMddHHmmss");
            oRemito                = new MODELO.Remito();
            dgvUPDATED.Enabled     = false;
            //ocantmat = new List<MODELO.CantidadMat>();
            txtCANTIDAD.Enabled = false;


            //dtpFECHARECEPCION.Enabled = false;

            /*dgvMATERIALES.Columns["codigo"].Visible = false;
             * dgvMATERIALES.Columns["ordercompra"].Visible = false;
             *
             * dgvUPDATED.Columns["codigo"].Visible = false;
             * dgvUPDATED.Columns["nroOrden"].Visible = false;*/
        }
Пример #3
0
 private void dgvMATERIALES_Click_1(object sender, EventArgs e)
 {
     oMATERIAL            = (MODELO.Materiales)dgvMATERIALES.CurrentRow.DataBoundItem;
     txtUNIDADMEDIDA.Text = oMATERIAL.MEDIDA;
     txtIVA.Text          = oMATERIAL.IVA.ToString();
     txtCANTIDAD.Enabled  = true;
     txtPUC.Enabled       = true;
     txtDESCUENTO.Enabled = true;
 }
Пример #4
0
        public frm_REMITO(MODELO.Remito unREMITO, string unaACCION)
        {
            InitializeComponent();
            oProvedorNew   = new MODELO.Proveedor();
            orderC         = new MODELO.Factura();
            cREMITO        = CONTROLADORA.cRemito.obtener_instancia();
            oMaterial      = new MODELO.Materiales();
            cCANTMAT       = CONTROLADORA.cCantMat.obtener_instancia();
            cRemitoUpdated = CONTROLADORA.cRemitoUpdated.obtener_instancia();
            cOccantmat     = CONTROLADORA.cOccantmat.obtener_instancia();
            cAuditoria     = CONTROLADORA.cAuditoria.obtenerInstancia();
            cMateriales    = CONTROLADORA.cMateriales.obtener_instancia();
            cCLIENTE       = CONTROLADORA.cCliente.obtener_instancia();
            cORDEN         = CONTROLADORA.cOrdenCompra.obtener_instancia();


            //dgvMATERIALES.Columns["codigo"].Visible = false;
            //dgvMATERIALES.Columns["ordercompra"].Visible = false;

            //dgvUPDATED.Columns["codigo"].Visible = false;
            //dgvUPDATED.Columns["nroOrden"].Visible = false;

            oRemito = unREMITO;
            ACCION  = unaACCION;

            txtNROREMITO.Enabled = false;
            //txtCLIENTE.Enabled = false;
            txtLOCALIDAD_PROV.Enabled = false;
            //txtDIRECCION_CLIENTE.Enabled = false;
            //txtDNI_CLIENTE.Enabled = false;
            txtORDENCOMPRA.Enabled    = false;
            dtpFECHARECEPCION.Enabled = false;
            txtMATERIAL.Enabled       = false;
            txtCANTIDAD.Enabled       = false;
            //cmbCANTIDADCALIF.Enabled = false;
            //cmbTIEMPOCALIF.Enabled = false;
            btnVERIFCANT.Enabled = false;
            txtNROREMITO.Text    = oRemito.NroRemito.ToString();
            //txtCLIENTE.Text = oRemito.Proveedor.ToString();
            txtPROVEEDOR.Text      = oRemito.Proveedor.ToString();
            txtDIRECCION_PROV.Text = oRemito.Proveedor.direccion;
            txtLOCALIDAD_PROV.Text = oRemito.Localidad;
            //txtLOCALIDAD_PROV.Text = oOrden.Localidad.ToString();
            txtCANTIDAD.Text       = oRemito.Cantidad.ToString();
            txtORDENCOMPRA.Text    = oRemito.OrdenDeCompra.ToString();
            btnLUPA_OC.Enabled     = false;
            dtpFECHARECEPCION.Text = oRemito.Fecha.ToString();

            dgvUPDATED.Enabled    = false;
            dgvUPDATED.DataSource = null;
            dgvUPDATED.DataSource = cRemitoUpdated.obtenerPorRemito(txtNROREMITO.Text);

            dgvUPDATED.Columns["codigo"].Visible   = false;
            dgvUPDATED.Columns["nroOrden"].Visible = false;
            //cmbCANTIDADCALIF.Text = oRemito.CalifCantidad.ToString();
            //cmbTIEMPOCALIF.Text = oRemito.CalifTiempo.ToString();
        }
Пример #5
0
        public void btnLUPA_Click(object sender, EventArgs e)
        {
            MATERIALES.frmMATERIALES frm          = new MATERIALES.frmMATERIALES("Buscar");
            DialogResult             dialogResult = frm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                oMaterial        = frm.MaterialSelect;
                txtMATERIAL.Text = oMaterial.DESCRIPCION_CORTA;
            }
        }
Пример #6
0
        private void dgvMATERIALES_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (accionaux == "Buscar")
            {
                if (dgvMATERIALES.CurrentRow == null)
                {
                    MessageBox.Show("Debe seleccionar un material");
                    return;
                }
                oMaterial = (MODELO.Materiales)dgvMATERIALES.CurrentRow.DataBoundItem;

                this.DialogResult = DialogResult.OK;
            }
        }
Пример #7
0
        private void btnCONSULTAR_Click(object sender, EventArgs e)
        {
            if (dgvMATERIALES.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un articulo");
                return;
            }
            MODELO.Materiales      oPROVEEDOR = (MODELO.Materiales)dgvMATERIALES.CurrentRow.DataBoundItem;
            MATERIALES.frmMATERIAL frm        = new MATERIALES.frmMATERIAL(oPROVEEDOR, "C");
            DialogResult           dr         = frm.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ARMO_GRILLA();
            }
        }
Пример #8
0
 public void AGREGAR_AUDITORIA(string movimiento, MODELO.Materiales oMATERIAL)
 {
     MODELO.AuditoriaMateriales oAuditoria = new MODELO.AuditoriaMateriales();
     oAuditoria.FechayHora          = System.DateTime.Now;
     oAuditoria.Movimiento          = movimiento;
     oAuditoria.Username            = "******";
     oAuditoria.COD_MATERIAL        = oMATERIAL.COD_MATERIAL;
     oAuditoria.DESCRIPCION_CORTA   = oMATERIAL.DESCRIPCION_CORTA;
     oAuditoria.DESCRIPCION_LARGA   = oMATERIAL.DESCRIPCION_LARGA;
     oAuditoria.ULTIMA_MODIFICACION = oMATERIAL.ULTIMA_MODIFICACION;
     oAuditoria.PUC    = oMATERIAL.PUC;
     oAuditoria.MAXIMO = oMATERIAL.MAXIMO;
     oAuditoria.MINIMO = oMATERIAL.MINIMO;
     //      oAuditoria.CLASE = oMATERIAL.CLASE;
     //    oAuditoria.SUBCLASE = oMATERIAL.SUBCLASE;
     //    oAuditoria.PROVEEDOR = oMATERIAL.PROVEEDOR;
     oAuditoria.GANANCIA = oMATERIAL.GANANCIA;
     /////       oAuditoria.IVA = oMATERIAL.IVA;
     oAuditoria.STOCK = oMATERIAL.STOCK;
     cAuditoria.AGREGAR_AUDITORIA(oAuditoria);
 }
Пример #9
0
        private void btnAGREGAR_Click(object sender, EventArgs e)
        {
            if (dgvOCM.Rows.Count == 0)
            {
                MessageBox.Show("La orden de Compra se encuentra vacia, por favor ingrese un material");
                return;
            }


            if (string.IsNullOrEmpty(txtNROFACTURA.Text))
            {
                MessageBox.Show("Debe ingresar un numero de orden");
                return;
            }
            if (string.IsNullOrEmpty(txtCLIENTE.Text))
            {
                MessageBox.Show("Debe seleccionar un cliente");
                return;
            }
            if (string.IsNullOrEmpty(dtpFECHA.Text))
            {
                MessageBox.Show("Debe ingresar una fecha");
                return;
            }



            oORDEN.nroFactura = txtNROFACTURA.Text;
            //oORDEN.Proveedor = oPROVEEDOR.razonSocial;
            oORDEN.Cliente = clientesovicj;

            //oORDEN.Proveedor =;
            //oORDEN.Proveedor = (MODELO.Proveedor)ToString();
            //oORDEN.Proveedor = txtPROVEEDOR.Text; /////////////////////////////////////////////////////////////////////////////////
            oORDEN.Fecha          = dtpFECHA.Value;
            oORDEN.IvaTotal       = Convert.ToDecimal(txtIVATOTAL.Text);
            oORDEN.Importe        = Convert.ToDecimal(totalivadesc);
            oORDEN.DescuentoTotal = Convert.ToDecimal(totaldescuento);
            //  oORDEN.CantidadesMat.Add(oCANTMAT);



            //foreach (MODELO.CantidadMat item in listaCantMateriales.ToList())
            //{


            //    MODELO.CantidadMat mat = new MODELO.CantidadMat();
            //    mat.Material = item.Material;
            //    mat.Cantidad_mat = item.Cantidad_mat;
            //    cCantMat.agregarCantMat(mat);
            //    listaCantMateriales.Add(mat);
            //    //oORDEN.CantidadesMat.Add(mat);



            //    // item.OrdenCompra.Add(oORDEN);
            //    // cCantMat.modificarCantMat(item);
            //    //oORDEN.CantidadesMat.Add(item);
            //    // cOrden.modificarOrden(oORDEN);


            //}
            oORDEN.visibily = true;



            MODELO.oCanmatVenta Occantmat = new MODELO.oCanmatVenta();
            foreach (MODELO.CantidadMat item in listaCantMateriales)
            {
                //int cantidadd = Convert.ToInt32(txtCANTIDAD.Text);
                oMATERIAL             = item.Material;
                Occantmat.cantidadmat = item;
                Occantmat.venta       = oORDEN;
                Occantmat.material    = item.Material.DESCRIPCION_CORTA;
                Occantmat.cantidadmat.cantidad_base_venta = item.cantidad_base_venta;

                oMATERIAL = (MODELO.Materiales)cMateriales.obtenerMaterialNombree(item.Material.DESCRIPCION_CORTA)[0];

                oMATERIAL.STOCK -= item.Cantidad_mat;
                cMateriales.modificarMateriales(oMATERIAL);

                cOccantmat.agregarOccantmatVenta(Occantmat);
            }

            //oMATERIAL.STOCK = oMATERIAL.STOCK - Convert.ToInt32(txtCANTIDAD.Text);



            this.DialogResult = DialogResult.OK;
            AGREGAR_AUDITORIA("Alta", oORDEN);
        }
Пример #10
0
        public frmMATERIAL(MODELO.Materiales unMaterial, string unaaccion)
        {
            InitializeComponent();
            cProveedor  = CONTROLADORA.cProveedor.obtener_instancia();
            cMateriales = CONTROLADORA.cMateriales.obtener_instancia();
            cClase      = CONTROLADORA.cClase.obtener_instancia();
            cSubclase   = CONTROLADORA.cSubclase.obtener_instancia();
            cAuditoria  = CONTROLADORA.cAuditoria.obtenerInstancia();
            oMateriales = unMaterial;
            accion      = unaaccion;
            //cmbPROVEEDOR.Visible = false;
            txtPROVEEDOR.Enabled    = false;
            txtCLASE.Enabled        = false;
            txtSUBCLASE.Enabled     = false;
            dateTimePicker1.Enabled = false;
            ARMO_PROVEEDOR();
            ARMO_CLASE();
            ARMO_SUBCLASE();
            if (accion != "A")
            {
                txtCODIGO.Text            = oMateriales.COD_MATERIAL;
                txtDESCRIPCION_CORTA.Text = oMateriales.DESCRIPCION_CORTA;
                txtDESCRIPCION_LARGA.Text = oMateriales.DESCRIPCION_LARGA;
                txtMAXIMO.Text            = oMateriales.MAXIMO.ToString();
                txtPUC.Text       = oMateriales.PUC.ToString();
                txtSTOCK.Text     = oMateriales.STOCK.ToString();
                txtPROVEEDOR.Text = oMateriales.PROVEEDOR.ToString();
                cmbIVA.Text       = oMateriales.IVA.ToString();
                txtGANANCIA.Text  = oMateriales.GANANCIA.ToString();
                txtMINIMO.Text    = oMateriales.MINIMO.ToString();
                cmbIVA.Text       = oMateriales.IVA.ToString();
                txtCLASE.Text     = oMateriales.CLASE.ToString();
                cmbMEDIDA.Text    = oMateriales.MEDIDA.ToString();
                txtSUBCLASE.Text  = oMateriales.SUBCLASE.ToString();
                cmbMEDIDA.Text    = oMateriales.MEDIDA;

                if (accion == "C")
                {
                    txtCODIGO.Enabled            = false;
                    txtDESCRIPCION_CORTA.Enabled = false;
                    txtDESCRIPCION_LARGA.Enabled = false;
                    txtMAXIMO.Enabled            = false;
                    txtPUC.Enabled   = false;
                    txtSTOCK.Enabled = false;
                    //cmbCLASE.Enabled = false;
                    //cmbPROVEEDOR.Enabled = false;
                    //cmbSUBCLASE.Enabled = false;
                    txtGANANCIA.Enabled     = false;
                    txtMINIMO.Enabled       = false;
                    txtPROVEEDOR.Enabled    = false;
                    txtCLASE.Enabled        = false;
                    txtSUBCLASE.Enabled     = false;
                    dateTimePicker1.Enabled = false;
                    cmbIVA.Enabled          = false;
                    btnLUPA.Enabled         = false;
                    cmbMEDIDA.Enabled       = false;
                    btnLUPA.Enabled         = false;
                    btnLUPAclase.Enabled    = false;
                    btnLUPAsubclase.Enabled = false;
                }
            }
        }
Пример #11
0
 public void modificarMateriales(MODELO.Materiales oMateriales)
 {
     oMODELO_SEGURIDAD.Entry(oMateriales).State = System.Data.Entity.EntityState.Modified;
     oMODELO_SEGURIDAD.SaveChanges();
 }
Пример #12
0
 public void eliminarMateriales(MODELO.Materiales oMateriales)
 {
     oMODELO_SEGURIDAD.MATERIALES.Remove(oMateriales);
     oMODELO_SEGURIDAD.SaveChanges();
 }
Пример #13
0
 public void agregarMateriales(MODELO.Materiales oMateriales)
 {
     oMODELO_SEGURIDAD.MATERIALES.Add(oMateriales);
     oMODELO_SEGURIDAD.SaveChanges();
 }
Пример #14
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;
        }