Beispiel #1
0
        public void cargarDatos(admAlmacenes talmacen, int idProducto)
        {
            InicializarCiadricula();
            grdDatos.Rows.Clear();
            grdDatos.Rows.Add(nRenglon, "");

            grdDatos.Rows[nRenglon].Cells[0].Value = almacen.CNOMBREALMACEN;
            nRenglon++;
            List <admCapasProducto> lProductosCaducos;

            tProducto = almacen.listarProductos().Where(c => c.CIDPRODUCTO == idProducto).FirstOrDefault();
            if (tProducto != null)
            {
                lProductosCaducos = tProducto.listarLotesCaducos(almacen.CIDALMACEN)
                                    .Where(c => c.CIDPRODUCTO == idProducto).ToList();
                DesplegarLista(lProductosCaducos);
            }
            lProductosCaducos = tProducto.listarLotesSinCaducar(almacen.CIDALMACEN)
                                .Where(c => c.CIDPRODUCTO == idProducto).ToList();
            DesplegarLista(lProductosCaducos, false);
        }
Beispiel #2
0
        private void procesarProductos()
        {
            #region "CODIGO COMENTADO"

            /*foreach (var item in almacen.ExistenciaCosto) {
             *  var producto= conAlmacen.buscarProducto(item.CIDPRODUCTO);
             *
             *  if (producto != null)
             *  {
             *      grdDatos.Rows.Insert(nRenglon, "");
             * //                    grdDatos.Rows[nRenglon].Cells[1].Value = item.CIDPRODUCTO;
             *      grdDatos.Rows[nRenglon].Cells[1].Value = producto.CCODIGOPRODUCTO.ToUpper() + " -- "+ item.CIDPRODUCTO.ToString();
             *      grdDatos.Rows[nRenglon].Cells[2].Value = producto.CNOMBREPRODUCTO.ToUpper();
             *      grdDatos.Rows[nRenglon].Cells[3].Value = item.CalcularExistencia();
             *
             *      double[] tem = almacen.tPrimerRango(producto.CIDPRODUCTO);
             *      grdDatos.Rows[nRenglon].Cells[4].Value = tem[1];
             *      grdDatos.Rows[nRenglon].Cells[5].Value = tem[2];
             *      grdDatos.Rows[nRenglon].Cells[6].Value = tem[3];
             *      grdDatos.Rows[nRenglon].Cells[7].Value = tem[4];
             *      grdDatos.Rows[nRenglon].Cells[8].Value = tem[0];
             *
             *      nRenglon++;
             *      //TODO: PROCESAR LOS TIEMPOS DE CADUCIDAD Y METERLOS EN EL RANGO
             *  }
             * }*/
            #endregion

            foreach (admProductos item in almacen.listarProductos())
            {
                if (item.CSTATUSPRODUCTO == 1)
                {
                    double merma = 0;
                    grdDatos.Rows.Insert(nRenglon, "");
                    //grdDatos.Rows[nRenglon].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    grdDatos.Rows[nRenglon].Cells[1].Value       = item.CCODIGOPRODUCTO.ToUpper();
                    grdDatos.Rows[nRenglon].Cells[1].ToolTipText = item.CIDPRODUCTO.ToString();
                    grdDatos.Rows[nRenglon].Cells[2].Value       = item.CNOMBREPRODUCTO.ToUpper();

                    grdDatos.Rows[nRenglon].Cells[4].Value = item.CalcularTotalRango17(almacen.CIDALMACEN).ToString("N");
                    grdDatos.Rows[nRenglon].Cells[5].Value = item.CalcularTotalRango816(almacen.CIDALMACEN).ToString("N");
                    grdDatos.Rows[nRenglon].Cells[6].Value = item.CalcularTotalRango1730(almacen.CIDALMACEN).ToString("N");
                    grdDatos.Rows[nRenglon].Cells[7].Value = item.CalcularTotalRango3100(almacen.CIDALMACEN).ToString("N");

                    merma = item.CalcularTotalCaducos(almacen.CIDALMACEN);
                    grdDatos.Rows[nRenglon].Cells[8].Value = merma.ToString("N");

                    /*double tStock = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[4].Value) +
                     *  Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[5].Value) +
                     *  Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[6].Value) +
                     *  Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[7].Value) +
                     *  Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[8].Value);*/
                    double tStock = item.calcularStrock(almacen.CIDALMACEN);
                    grdDatos.Rows[nRenglon].Cells[3].Value = tStock.ToString("N"); //almacen.stockProducto(item.CIDPRODUCTO)  + " [ " + tStock + " ]";

                    double costo = item.CalcularCostoPromedio(almacen.CIDALMACEN);
                    grdDatos.Rows[nRenglon].Cells[9].Value  = "$ " + costo.ToString("N");
                    grdDatos.Rows[nRenglon].Cells[10].Value = "$ " + (costo * merma).ToString("N");

                    if (!item.tieneCaducidad(almacen.CIDALMACEN))
                    {
                        grdDatos.Rows[nRenglon].Cells[0].Value = "S/C";
                    }

                    #region "FORMATO"
                    double temp = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[8].Value);
                    //CADUCOS
                    if (temp > 0)
                    {
                        grdDatos.Rows[nRenglon].Cells[8].Style.ForeColor  = System.Drawing.Color.Red;
                        grdDatos.Rows[nRenglon].Cells[8].Style.BackColor  = cRojo;
                        grdDatos.Rows[nRenglon].Cells[10].Style.BackColor = cRojo;
                    }
                    else
                    {
                        grdDatos.Rows[nRenglon].Cells[8].Style.ForeColor = System.Drawing.Color.Black;
                    }

                    //PRIMER RANGO
                    temp = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[4].Value);
                    if (temp > 0)
                    {
                        grdDatos.Rows[nRenglon].Cells[4].Style.BackColor = cRojo;
                    }
                    //SEGUNDO RANGO
                    temp = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[5].Value);
                    if (temp > 0)
                    {
                        grdDatos.Rows[nRenglon].Cells[5].Style.BackColor = cAmarillo;
                    }
                    temp = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[6].Value);
                    if (temp > 0)
                    {
                        grdDatos.Rows[nRenglon].Cells[6].Style.BackColor = cAmarillo;
                    }
                    //ULTIMO RANGO
                    temp = Convert.ToDouble(grdDatos.Rows[nRenglon].Cells[7].Value);
                    if (temp > 0)
                    {
                        grdDatos.Rows[nRenglon].Cells[7].Style.BackColor = cVerde;
                    }

                    //CENTRADO
                    grdDatos.Rows[nRenglon].Cells[4].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    grdDatos.Rows[nRenglon].Cells[5].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    grdDatos.Rows[nRenglon].Cells[6].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    grdDatos.Rows[nRenglon].Cells[7].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    grdDatos.Rows[nRenglon].Cells[8].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

                    #endregion

                    nRenglon++;
                }
            }
        }