Beispiel #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);
        }
Beispiel #2
0
        private void FormatReport(StoreFileRpt rpt, ReportFilter filter, ReportFormat format)
        {
            switch (format.Vista)
            {
            case EReportVista.Detallado:
            {
                rpt.Detalle.SectionFormat.EnableSuppress = false;
            }
            break;

            case EReportVista.Resumido:
            {
                rpt.Detalle.SectionFormat.EnableSuppress = true;
            }
            break;
            }

            rpt.ReportDefinition.ReportObjects["FacturaLB"].ObjectFormat.EnableSuppress = filter.SoloMermas;
            rpt.ReportDefinition.ReportObjects["AlbaranLB"].ObjectFormat.EnableSuppress = filter.SoloMermas;
        }
        protected void ShowStoreFileReport(Library.Store.QueryConditions conditions)
        {
            ExpedientInfo expediente_ini = Rango_RB.Checked ? _expediente_ini : null;
            ExpedientInfo expediente_fin = Rango_RB.Checked ? _expediente_fin : null;

            if (PorExpediente_RB.Checked)
            {
                ExpedientReportMng reportMng = new ExpedientReportMng(AppContext.ActiveSchema, this.Text, GetFilterValues());

                MovimientosStockListPorExpedienteRpt rpt = null;

                if (TodosExpediente_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetList(conditions.TipoExpediente, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }
                else if (Seleccion_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedientInfo.Get(conditions.Expedient.Oid, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format, false);
                }
                else if (Rango_RB.Checked)
                {
                    rpt = reportMng.GetMovimientosStockListAgrupado(ExpedienteList.GetListByRango(expediente_ini, expediente_fin, false), conditions.Producto, SerieInfo.New(conditions.Serie.Oid), _report_filter, _report_format);
                }

                PgMng.FillUp();

                ShowReport(rpt);
            }
            else if (PorProducto_RB.Checked)
            {
                StoreReportMng reportMng = new StoreReportMng(AppContext.ActiveSchema, this.Text, GetFilterValues());

                StockList stocks = null;

                if (TodosExpediente_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Seleccion_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, null, null, _report_filter.SoloStock, false);
                }
                else if (Rango_RB.Checked)
                {
                    stocks = StockList.GetReportList(conditions, expediente_ini, expediente_fin, _report_filter.SoloStock, false);
                }

                stocks.FillPurchasePrices();

                string stock_purchase_price_type = string.Empty;

                if (LastPurchasePrice_RB.Checked)
                {
                    stock_purchase_price_type = "Last";
                }
                else if (AveragePrice_RB.Checked)
                {
                    stock_purchase_price_type = "Average";
                }

                StoreFileRpt rpt = reportMng.GetStoreFile(stocks
                                                          , _report_filter
                                                          , _report_format
                                                          , StoreFileKg_RB.Checked
                                                          , stock_purchase_price_type);

                PgMng.FillUp();

                ShowReport(rpt);
            }
        }