Esempio n. 1
0
        private void FormInflacion_Load(object sender, EventArgs e)
        {
            if (AccesoInternet() == false)
            {
                MessageBox.Show("No hay internet, intente en un momento"); return;
            }
            DbObject db = new DbObject();

            cambio = db.datoinfla();
            if (cambio == "1")
            {
                cmbmarca.DataSource    = productos.listamarcas();
                cmbmarca.SelectedIndex = -1;
            }
            else
            {
                cmbmarca.Visible = false;
                label4.Text      = "Actualizar precios para todos los productos en stock";
            }
        }
Esempio n. 2
0
        private void FormProductoSpec_Load(object sender, EventArgs e)
        {
            tablacodigos = prdoducto_codigos.tabla(CATALOGO.Text, productoSeleccionadoi.Id.ToString());
            string rutaDataSheet = @"DataSheet\" + productoSeleccionadoi.CATALOGO + ".pdf";

            if (File.Exists(rutaDataSheet))
            {
                buttonDataSheet.BackColor      = System.Drawing.Color.GreenYellow;
                productoSeleccionadoi.ADJUNTOS = productoSeleccionadoi.CATALOGO;
                productoSeleccionadoi.Update("Id");
            }
            if (productoSeleccionadoi.DOCUMENTOS != "")
            {
                button3.BackColor = System.Drawing.Color.GreenYellow;
            }
            button2.Visible = false;
            if (AccesoInternet() == false)
            {
                MessageBox.Show("No hay internet, intente en un momento"); return;
            }
            if (productoSeleccionadoi == null)
            {
                nuevo2 = true;
                productoSeleccionadoi = new productos();
            }
            productoSeleccionadoi.MostrarValores(this, false);
            DESCRIPCION.Text = productoSeleccionadoi.DESCRIPCION;
            double precio_oferta = productoSeleccionadoi.PrecioAlmacen;

            if (productoSeleccionadoi.STOCKMUERTO == 1)
            {
                ckmuerto.Checked = true;
                precio_oferta    = Math.Round(precio_oferta * 0.5, 2);
            }
            double porcentaje37 = precio_oferta * 1.37;
            double porcentaje50 = precio_oferta * 1.5;

            PrecioAlmacen.Text      = precio_oferta.ToString();
            textBox37.Text          = porcentaje37.ToString();
            textBox50.Text          = porcentaje50.ToString();
            labelActualizacion.Text = productoSeleccionadoi.FECHA_FACTURA.ToShortDateString();
            DateTime oldDate = productoSeleccionadoi.FECHA_FACTURA;
            DateTime newDate = DateTime.Now;
            // Difference in days, hours, and minutes.
            TimeSpan ts = newDate - oldDate;
            // Difference in days.
            int differenceInDays = ts.Days;

            //MessageBox.Show(newDate.Date.ToShortDateString()+"   "+oldDate.Date.ToShortDateString()+"   "+ differenceInDays.ToString());
            rutaImagen = @"IMAGEN\" + productoSeleccionadoi.CATALOGO + ".jpg";
            if (File.Exists(rutaImagen))
            {
                fs = new FileStream(rutaImagen, FileMode.Open, FileAccess.Read);
                Bitmap imagen     = (Bitmap)System.Drawing.Image.FromStream(fs);
                double ladoMaximo = 450;
                double factorReduccion;
                double factorAltoAncho = (double)imagen.Height / (double)imagen.Width;
                if (imagen.Width > ladoMaximo || imagen.Height > 450)
                {
                    if (factorAltoAncho >= 1)
                    {
                        factorReduccion = 450 / imagen.Height;
                    }
                    else
                    {
                    }
                }
                pictureBox1.Image = imagen;
                fs.Close();
            }
            else
            {
                fs = new FileStream(rutaLogo, FileMode.Open, FileAccess.Read);
                pictureBox1.Image = System.Drawing.Image.FromStream(fs);
                fs.Close();
            }
            int diferencia = 0;

            /*if (DateTime.Now.Month < 4)
             *  diferencia = 90;
             * else if (DateTime.Now.Month == 4)
             *  diferencia = 90;
             * else if (DateTime.Now.Month == 5)
             *  diferencia = 90;
             * else if (DateTime.Now.Month == 6)
             *  diferencia = 90;
             * else if (DateTime.Now.Month ==7)
             *  diferencia = 120;
             * else if (DateTime.Now.Month == 8)
             *  diferencia = 150;
             * else if (DateTime.Now.Month > 8)
             *  diferencia = 180;*/
            diferencia = 180;
            if (differenceInDays > diferencia)
            {
                PrecioAlmacen.Visible = false;
                textBox37.Visible     = false;
                textBox50.Visible     = false;
            }
            if (productoSeleccionadoi.STOCKMUERTO == 1)
            {
                PrecioAlmacen.Visible = true;
                textBox37.Visible     = true;
                textBox50.Visible     = true;
            }
            DbObject db     = new DbObject();
            string   cambio = db.datoinfla();

            /* if (productoSeleccionadoi.STOCK == 0)
             * {
             *   labelAdvertencia1.Visible = true;
             *   PrecioAlmacen.Visible = false;
             *   textBox37.Visible = false;
             *   textBox50.Visible = false;
             * }*/
            /*if (cambio == "0")
             * {
             *  labelAdvertencia1.Visible = true;
             *  labelAdvertencia1.Text = "Agrege el porcentaje de inflacion";
             *  PrecioAlmacen.Visible = false;
             *  textBox37.Visible = false;
             *  textBox50.Visible = false;
             * }*/
            // MessageBox.Show(DateTime.Now.Month.ToString());
            //MessageBox.Show(productoSeleccionadoi.Id.ToString());
            ADJUNTOS.Text = productoSeleccionadoi.ADJUNTOS;
            var a1 = productoSeleccionadoi.ADJUNTOS;

            string[] adjuntos = a1.Split(',');
            for (int i = 0; i < adjuntos.Count(); i++)//mustra adjuntos
            {
                if (adjuntos[i] != "")
                {
                    //comboBox1.Items.Add(adjuntos[i]);
                }
            }
        }