From 3ef592a0cd20ce531526b3ecbe73c3e0f31838b0 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期三, 18 九月 2024 16:13:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 _Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl |  236 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 128 insertions(+), 108 deletions(-)

diff --git a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
index 7df872f..63f7b8e 100644
--- a/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_Initialize.qbl
@@ -46,43 +46,47 @@
           periodname         := periodtime.Format( "M2/D2/Y" );
           
           column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
-          traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
-            quantity         := [Number]pit.Quantity();
-            row              := table.GetRow( pit.ProductID() );
-            product          := pit.Product_MP();
-            productparents   := product.GetAllParent();
-            if( isccrent ){//鐩殑鍦版槸闀挎槬澶栫搴�
-              //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-              enginecost     := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
-                                                 and engine.MLB_MQB() = product.MQBMLB()
-                                                 and engine.Factory() = ccunit );
-              if( not isnull( enginecost ) ){
-                products.Add( product );
-                cell         := selectobject( row, Cell, cell, cell.Column() = column );
-                cell.CCRentQuantity( cell.CCRentQuantity() + quantity );
-                //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
-                entercost    := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
-                //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
-                outcost      := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
-                cell.CCRentEnterCost( cell.CCRentEnterCost() + entercost );
-                cell.CCRentOutCost( cell.CCRentOutCost() + outcost );
+          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.StartDate() <= trip.Departure().Date() and engine.EndDate() >= trip.Departure().Date() );
+          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.StartDate() <= trip.Departure().Date() and trans.EndDate() >= trip.Departure().Date() );
+          if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
+            traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 and not isnull( column ) and exists( pit.Product_MP().GetAllParent(), Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
+              quantity       := [Number]pit.Quantity();
+              row            := table.GetRow( pit.ProductID() );
+              product        := pit.Product_MP();
+              productparents := product.GetAllParent();
+              if( isccrent ){//鐩殑鍦版槸闀挎槬澶栫搴�
+                //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                enginecost   := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower()
+                                                   and engine.MLB_MQB() = product.MQBMLB()
+                                                   and engine.Factory() = ccunit );
+                if( not isnull( enginecost ) ){
+                  products.Add( product );
+                  cell       := selectobject( row, Cell, cell, cell.Column() = column );
+                  cell.CCRentQuantity( cell.CCRentQuantity() + quantity );
+                  //闀挎槬澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环
+                  entercost  := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  //闀挎槬澶栫搴撳嚭搴撹垂鐢�: 鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环
+                  outcost    := ceil( quantity / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                  cell.CCRentEnterCost( cell.CCRentEnterCost() + entercost );
+                  cell.CCRentOutCost( cell.CCRentOutCost() + outcost );
+                }
               }
-            }
-            if( isdlrent ){//鐩殑鍦版槸澶ц繛澶栫搴�
-              //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-              enginecost     := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
-                                                 and engine.MLB_MQB() = product.MQBMLB()
-                                                 and engine.Factory() = dlunit  );
-              //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
-              transcost      := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = laneleg.OriginStockingPointID() 
-                                                and trans.Destination() = laneleg.DestinationStockingPointID() 
-                                                and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
-              if( not isnull( enginecost ) and not isnull( transcost ) ){
-                products.Add( product );
-                cell         := selectobject( row, Cell, cell, cell.Column() = column );
-                //杩愯緭鏁伴噺/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环
-                cost         := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
-                cell.FactoryToDLRentTransCost( cell.FactoryToDLRentTransCost() + cost );
+              if( isdlrent ){//鐩殑鍦版槸澶ц繛澶栫搴�
+                //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                enginecost   := selectobject( enginecosts, Elements, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+                                                   and engine.MLB_MQB() = product.MQBMLB()
+                                                   and engine.Factory() = dlunit  );
+                //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
+                transcost    := selectobject( transcosts, Elements, trans, trans.Origin() = laneleg.OriginStockingPointID() 
+                                                  and trans.Destination() = laneleg.DestinationStockingPointID() 
+                                                  and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
+                if( not isnull( enginecost ) and not isnull( transcost ) ){
+                  products.Add( product );
+                  cell       := selectobject( row, Cell, cell, cell.Column() = column );
+                  //杩愯緭鏁伴噺/鍖呰瀹归噺/瑁呰浇瀹归噺*杩愯緭鍗曚环
+                  cost       := ceil( ceil( quantity / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();//鍥涜垗浜斿叆
+                  cell.FactoryToDLRentTransCost( cell.FactoryToDLRentTransCost() + cost );
+                }
               }
             }
           }
@@ -92,21 +96,25 @@
     //澶ц繛澶栫搴撳叆搴撹垂鐢細鍏ュ簱閲�/鍖呰瀹归噺*鍏ュ簱鍗曚环锛屽叆搴撻噺绛変簬澶ц繛宸ュ巶璇ヤ骇鍝佷骇閲忓噺鍘诲彂寰�闀挎槬鐨勬暟閲�
     traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//璐㈠姟浜ч噺鎶ヨ〃闈炲鍏�
       traverse( source, FinancialProductionReport, report, not report.IsShow() ){//璐㈠姟浜ч噺鎶ヨ〃涓嶆樉绀�
-        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑澶ц繛浜ч噺, 涓嶄负0
-          product             := row.Product_MP();
-          products.Add( product );
-          productparents      := product.GetAllParent();
+        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ) ){//璐㈠姟浜ч噺鎶ヨ〃閲岀殑澶ц繛浜ч噺, 涓嶄负0
+          product            := row.Product_MP();
+          productparents     := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-            enginecost        := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+            enginecosts      := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = dlunit );
-            if( not isnull( enginecost ) ){
-              ccrow               := table.GetRow( row.Name() );
-              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' ){
-                column        := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
-                //澶ц繛澶栫搴撳叆搴撹垂鐢�
-                ccrow.SetDLRentEnterCost( column, enginecost, cell );
+            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
+              products.Add( product );
+              ccrow          := table.GetRow( row.Name() );
+              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ){
+                cellcolumn   := cell.FinancialProductionColumn();
+                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
+                if( not isnull( enginecost ) ){
+                  column     := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
+                  //澶ц繛澶栫搴撳叆搴撹垂鐢�
+                  ccrow.SetDLRentEnterCost( column, enginecost, cell );
+                }
               }
             }
           }
@@ -116,21 +124,25 @@
     //澶ц繛澶栫搴撳嚭搴撹垂鐢細鍑哄簱閲�/鍖呰瀹归噺*鍑哄簱鍗曚环锛屽嚭搴撻噺绛変簬澶ц繛宸ュ巶璇ヤ骇鍝侀攢閲忓噺鍘诲彂寰�闀挎槬鐨勬暟閲�
     traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//璐㈠姟閿�閲忔姤琛ㄩ潪瀵煎叆
       traverse( source, FinancialSalesReport, report, not report.IsShow() ){//璐㈠姟閿�閲忔姤琛ㄤ笉鏄剧ず
-        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勫ぇ杩炰骇閲�, 涓嶄负0
-          product             := row.Product_MP();
-          productparents      := product.GetAllParent();
+        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ) ){//璐㈠姟閿�閲忔姤琛ㄩ噷鐨勫ぇ杩炰骇閲�, 涓嶄负0
+          product            := row.Product_MP();
+          productparents     := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
-            products.Add( product );
             //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-            enginecost        := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+            enginecosts      := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = dlunit );
-            if( not isnull( enginecost ) ){
-              ccrow               := table.GetRow( row.Name() );
-              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' ){
-                column        := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
-                //澶ц繛澶栫搴撳嚭搴撹垂鐢�
-                ccrow.SetDLRentOutCost( column, enginecost, cell );
+            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
+              products.Add( product );
+              ccrow          := table.GetRow( row.Name() );
+              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ){
+                cellcolumn   := cell.FinancialSalesColumn();
+                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
+                if(  not isnull( enginecost ) ){
+                  column     := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
+                  //澶ц繛澶栫搴撳嚭搴撹垂鐢�
+                  ccrow.SetDLRentOutCost( column, enginecost, cell );
+                }
               }
             }
           }
@@ -150,24 +162,29 @@
         iscc                   := table.IsInUnit( destisp, ccunit );
         if( isdl and iscc ){
           //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-          enginecost           := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+          enginecosts          := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = ccunit );
           //鍦ㄨ繍杈撴垚鏈弬鏁拌〃閲屾壘鍒板彂鍔ㄦ満瀵瑰簲杩愯緭鍗曚环鍜岃杞藉閲�
-          transcost            := selectobject( owner, LogisticsCostTransport, trans, trans.Origin() = tprow.SourceStockpoingPointID() 
+          transcosts           := selectset( owner, LogisticsCostTransport, trans, trans.Origin() = tprow.SourceStockpoingPointID() 
                                                   and trans.Destination() = tprow.TargetStockpoingPointID() 
                                                   and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '鍙戝姩鏈�', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
-          if( not isnull( enginecost ) and not isnull( transcost ) ){
+          if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
             row                := table.GetRow( product.ID() );
             products.Add( product );
             traverse( tprow,TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() and [Number]tpcell.Value() > 0){
-              periodtime       := tpcell.TransferPlanColumn().ColumnDate().StartOfMonth();
-              periodname       := periodtime.Format( "M2/D2/Y" );
-              column           := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
-               
-              cost             := ceil( ceil( [Number]tpcell.Value() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
-              cell             := selectobject( row, Cell, cell, cell.Column() = column );
-              cell.CCLongTransCoat( cell.CCLongTransCoat() + cost );
+              tpcolumndate     := tpcell.TransferPlanColumn().ColumnDate();
+              enginecost       := selectobject( enginecosts, Elements, engine, engine.StartDate() <= tpcolumndate and engine.EndDate() >= tpcolumndate );
+              transcost        := selectobject( transcosts, Elements, trans, trans.StartDate() <= tpcolumndate and trans.EndDate() >= tpcolumndate );
+              if( not isnull( enginecost ) and not isnull( transcost ) ){
+                periodtime     := tpcolumndate.StartOfMonth();
+                periodname     := periodtime.Format( "M2/D2/Y" );
+                column         := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
+                 
+                cost           := ceil( ceil( [Number]tpcell.Value() / enginecost.PackagingCapacity() ) / transcost.LoadingCapacity() ) * transcost.TransportPrice();
+                cell           := selectobject( row, Cell, cell, cell.Column() = column );
+                cell.CCLongTransCoat( cell.CCLongTransCoat() + cost );
+              }
             }
           }
         }
@@ -183,23 +200,25 @@
         product               := forecast.Product_MP();
         productparents        := product.GetAllParent();
         if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
-          products.Add( forecast.Product_MP() );
-          
           //鏌ヨ瀵瑰簲鐨勫彂鍔ㄦ満鎴愭湰
-          enginecost          := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
+          enginecosts         := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
                                                  and engine.MLB_MQB() = product.MQBMLB()
                                                  and engine.Factory() = ccunit );
-          if( not isnull( enginecost ) ){
-            row                 := table.GetRow( forecast.ProductID() );
+          if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
+            products.Add( forecast.Product_MP() );
+            row               := table.GetRow( forecast.ProductID() );
             traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() > 0 ){
-              periodtime       := psdip.StartDate().StartOfMonth();
-              periodname       := periodtime.Format( "M2/D2/Y" );
-        //      info( '-------------------------', periodname, periodtime );
-              column           := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
-        //      info( '-------------------------', column.Name() );
-              cost             := ceil( [Number]psdip.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
-              cell             := selectobject( row, Cell, cell, cell.Column() = column );
-              cell.CCShortTransCost( cell.CCShortTransCost() + cost );
+              enginecost      := selectobject( enginecosts, Elements, engine, engine.StartDate() <= psdip.StartDate() and engine.EndDate() >= psdip.StartDate() );
+              if( not isnull( enginecost ) ){
+                periodtime    := psdip.StartDate().StartOfMonth();
+                periodname    := periodtime.Format( "M2/D2/Y" );
+          //      info( '-------------------------', periodname, periodtime );
+                column         := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
+          //      info( '-------------------------', column.Name() );
+                cost           := ceil( [Number]psdip.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
+                cell           := selectobject( row, Cell, cell, cell.Column() = column );
+                cell.CCShortTransCost( cell.CCShortTransCost() + cost );
+              }
             }
           }
         }
@@ -221,33 +240,34 @@
           productparents      := product.GetAllParent();
           if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
             row               := table.GetRow( pisp.ProductID() );
-            products.Add( pisp.Product_MP() );
-            traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0  ){
-              periodtime      := pispip.Start().StartOfMonth().Date();
-              periodname      := periodtime.Format( "M2/D2/Y" );
-              column          := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
-              cell            := selectobject( row, Cell, cell, cell.Column() = column );
-              
-              if( isccrent ){
-                //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                enginecost     := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
-                                                   and engine.MLB_MQB() = product.MQBMLB()
-                                                   and engine.Factory() = ccunit );
-                 if( not isnull( enginecost ) ){
-                   cost        := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
-                   cell.CCRentStorageCost( cell.CCRentStorageCost() + cost );
-                 }
-              } else {
-                //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
-                enginecost     := selectobject( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() 
-                                                   and engine.MLB_MQB() = product.MQBMLB()
-                                                   and engine.Factory() = dlunit  );
-                 if( not isnull( enginecost ) ){
-                   cost        := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
-                   cell.DLRentStorageCost( cell.DLRentStorageCost() + cost );;
-                 }
-              }
-            }   
+            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower() and engine.MLB_MQB() = product.MQBMLB() );
+            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
+              products.Add( pisp.Product_MP() );
+              traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0  ){
+                periodtime    := pispip.Start().StartOfMonth().Date();
+                periodname    := periodtime.Format( "M2/D2/Y" );
+                column        := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
+                cell          := selectobject( row, Cell, cell, cell.Column() = column );
+                
+                if( isccrent ){
+                  //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                  enginecost     := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                                                     and engine.Factory() = ccunit );
+                   if( not isnull( enginecost ) ){
+                     cost        := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                     cell.CCRentStorageCost( cell.CCRentStorageCost() + cost );
+                   }
+                } else {
+                  //鍦ㄥ彂鍔ㄦ満鎴愭湰鍙傛暟琛ㄦ壘鍒板搴旂殑鍖呰瀹归噺
+                  enginecost     := selectobject( enginecosts, Elements, engine, engine.StartDate() <= pispip.Start().Date() and engine.EndDate() >= pispip.Start().Date()
+                                                     and engine.Factory() = dlunit  );
+                   if( not isnull( enginecost ) ){
+                     cost        := ceil( [Number]pispip.NewSupplyQuantity() / enginecost.PackagingCapacity() ) * enginecost.StoragePrice();//鍥涜垗浜斿叆
+                     cell.DLRentStorageCost( cell.DLRentStorageCost() + cost );;
+                   }
+                }
+              }   
+            }
           }
         }
       }

--
Gitblit v1.9.3