From 628700bb251d908486dd24dc225e5c9ac2cfada8 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期二, 08 十月 2024 15:29:09 +0800
Subject: [PATCH] 财务产量/销量报表添加年汇总和往前串一天

---
 _Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
index bfd4632..4afd265 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_InitializeNew.qbl
@@ -24,15 +24,15 @@
     table                     := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
     showtable                 := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
     startofplanning           := owner.StartOfPlanning().Date();
-    //startofyear               := startofplanning.StartOfYear();
-    startofnextyear           := startofplanning.StartOfNextYear();
+    startofyear               := ( startofplanning.StartOfYear() - Duration::Days( 1 ) ).Date();
+    startofnextyear           := ( startofplanning.StartOfNextYear() - Duration::Days( 1 ) ).Date();
     
     search                    := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
     
     table.GenerateColumn( owner );
     
     //棣栧厛鍦╢orecast鐣岄潰鏌ユ壘sales segment涓洪暱鏄ョ殑鎵�鏈夐渶姹傦紝璇嗗埆鍑篗LB鐨勬墍鏈変骇鍝侊紝姣忎釜浜у搧鎸夋湀姹囨�婚渶姹傛暟閲�
-    traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < startofnextyear and forecast.Quantity() <> 0 
+    traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() <= startofnextyear and forecast.Quantity() <> 0 
               and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){
       salessegment            := forecast.SalesSegment_MP();
       parentsalessegments     := salessegment.GetAllParent();
@@ -74,18 +74,18 @@
     //浠嶱roduct planning鏌ユ壘搴撳瓨鐐逛负澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴擄紝鍙朜ew supply瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
     traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID() = '澶ц繛鍙戝姩鏈虹殑闀挎槬澶栫搴�' ){
         traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf()
-                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear 
+                  and exists( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear and pispip.Period_MP().StartDate() < startofnextyear 
                               and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ) ){//浜у搧涓篗QB
           product           := pisp.Product_MP();
           allrow            := table.GetRow( allunit, product );
           factoryrow        := table.GetRow( dlunit, product );
           products.Add( product );
-          traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
+          traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear
                     and pispip.Period_MP().StartDate() < startofnextyear 
                     and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){
-            dayperiodtime   := pispip.Start().Date();
+            dayperiodtime   := ( pispip.Start() + Duration::Days( 1 ) ).Date();
             dayperiodname   := dayperiodtime.Format( "M2/D2/Y" );
-            periodtime      := pispip.Start().StartOfMonth().Date();
+            periodtime      := dayperiodtime.StartOfMonth();
             periodname      := periodtime.Format( "M2/D2/Y" );
             daycolumn       := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() );
             column          := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() );

--
Gitblit v1.9.3