Example #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);
        }
Example #2
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);
        }
Example #3
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);
        }