Exemplo n.º 1
0
        public StoreFileRpt GetStoreFile(StockList list, ReportFilter filter
                                         , ReportFormat format
                                         , bool byKg = false
                                         , string stockPurchasePriceType = "Average")
        {
            StoreFileRpt doc = new StoreFileRpt();

            //Si no existen elementos no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (list.Count <= 0)
            {
                return(null);
            }

            List <StockPrint> print_list = new List <StockPrint>();

            foreach (StockInfo item in list)
            {
                print_list.Add(StockPrint.New(item));
            }

            doc.SetDataSource(print_list);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            doc.SetParameterValue("ByKg", byKg);
            doc.SetParameterValue("StockPurchasePriceType", stockPurchasePriceType);

            return(doc);
        }
Exemplo n.º 2
0
        public virtual bool CheckStock(ETipoFacturacion saleType, decimal amount, out ProductInfo noStockProduct)
        {
            noStockProduct = this;

            if (IsKit)
            {
                ProductInfo product = null;
                if (Components == null || Components.Count == 0)
                {
                    LoadChilds(typeof(Kit), false);
                }

                foreach (KitInfo item in Components)
                {
                    product = ProductInfo.Get(item.OidProduct, false);

                    if (!product.CheckStock(saleType, amount * item.Amount, out noStockProduct))
                    {
                        noStockProduct = product;
                        return(false);
                    }
                }

                noStockProduct = null;
                return(true);
            }
            else
            {
                noStockProduct = this;

                StockList stock = StockList.GetListByProducto(Oid, false, false);

                switch (saleType)
                {
                case ETipoFacturacion.Peso: return(stock.TotalKgs() >= amount);

                case ETipoFacturacion.Unidad: return(stock.TotalUds() >= amount);

                case ETipoFacturacion.Unitaria: return(stock.TotalUds() >= amount);
                }

                return(false);
            }
        }
Exemplo n.º 3
0
        public StockLineListRpt GetStockLineList(StockList list, ReportFilter filter, ReportFormat format)
        {
            StockLineListRpt doc = new StockLineListRpt();

            //Si no existen elementos no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (list.Count <= 0)
            {
                return(null);
            }

            List <StockPrint> print_list = new List <StockPrint>();

            foreach (StockInfo item in list)
            {
                print_list.Add(StockPrint.New(item));
            }

            doc.SetDataSource(print_list);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            return(doc);
        }
Exemplo n.º 4
0
        public MovimientosStockListPorExpedienteRpt GetMovimientosStockListAgrupado(ExpedienteList items,
                                                                                    ProductInfo producto,
                                                                                    SerieInfo serie,
                                                                                    ReportFilter filter,
                                                                                    ReportFormat format)
        {
            MovimientosStockListPorExpedienteRpt doc = new MovimientosStockListPorExpedienteRpt();
            List <ExpedientePrint> pList             = new List <ExpedientePrint>();
            List <StockPrint>      movs = new List <StockPrint>();
            StockList stocks            = null;

            int movsCount = 0;

            foreach (ExpedientInfo item in items)
            {
                if (filter.SoloStock)
                {
                    if ((item.StockKilos == 0) || (item.StockBultos == 0))
                    {
                        continue;
                    }
                }

                movsCount = movs.Count;
                stocks    = (item.Stocks == null) ? StockList.GetListByExpediente(item.Oid, false) : item.Stocks;
                foreach (StockInfo stock in stocks)
                {
                    if (filter.SoloMermas)
                    {
                        if ((stock.OidAlbaran != 0) || (stock.Kilos >= 0))
                        {
                            continue;
                        }
                    }

                    if ((filter.FechaIni <= stock.Fecha) && (stock.Fecha <= filter.FechaFin))
                    {
                        if ((producto == null) && (serie == null))
                        {
                            movs.Add(StockPrint.New(stock));
                        }
                        else if (producto != null)
                        {
                            if ((producto.Oid == stock.OidProducto) && (serie == null))
                            {
                                movs.Add(StockPrint.New(stock));
                            }
                            else if ((producto.Oid == stock.OidProducto) && (serie.Oid == stock.OidSerie))
                            {
                                movs.Add(StockPrint.New(stock));
                            }
                        }
                        else if (serie.Oid == stock.OidSerie)
                        {
                            movs.Add(StockPrint.New(stock));
                        }
                    }
                }

                if (movsCount < movs.Count)
                {
                    pList.Add(item.GetPrintObject());
                }
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (movs.Count <= 0)
            {
                return(null);
            }

            doc.SetDataSource(pList);
            doc.Subreports["StocksSubReport"].SetDataSource(movs);

            FormatHeader(doc);
            FormatReport(doc, filter, format);

            return(doc);
        }