Browse Source

哈白定制表,金额计算全部调整
为报表在台账主表提供签约清单关联,提供单独表筛选签约清单与台账无关联的清单。

MaiXinRong 9 năm trước cách đây
mục cha
commit
8b9cd68ab3
2 tập tin đã thay đổi với 40 bổ sung2 xóa
  1. 8 2
      Units/DataBaseTables.pas
  2. 32 0
      Units/ProjectData.pas

+ 8 - 2
Units/DataBaseTables.pas

@@ -103,7 +103,7 @@ const
 
   {헌데鑒앴 -- 憩瑯긍서썹충}
   SBills = 'Bills';
-  tdBills: array [0..76] of TScFieldDef =(
+  tdBills: array [0..78] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ParentID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'NextSiblingID'; FieldType: ftInteger; Size: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
@@ -261,7 +261,13 @@ const
     // 쒔셌寧깃
     (FieldName: 'DgnPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 작셕쒔셌寧깃
-    (FieldName: 'AddDgnPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    (FieldName: 'AddDgnPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    {------------------- Begin reports -----------------------}
+    // 푯獨헌데鑒좆
+    (FieldName: 'GclDealQuantity'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 푯獨헌데쏜띨
+    (FieldName: 'GclDealTotalPrice'; FieldType: ftDouble; Size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False)
+    {------------------ End Reports --------------------------}
   );
 
   {북谿連마}

+ 32 - 0
Units/ProjectData.pas

@@ -932,9 +932,41 @@ procedure TProjectData.CopyPhaseData;
     ExecuteSql(sSql);
   end;
 
+  procedure UpdateBillsByDealBills;
+  const
+    sUpdateSql = 'Update Bills As B, DealBills As D' +
+                 '    Set B.GclDealQuantity = D.Quantity, B.GclDealTotalPrice = D.TotalPrice' +
+                 '  Where (B.B_Code = D.B_Code) and (B.Name = D.Name) and (B.Units = D.Units) and (B.Price = D.Price)';
+  begin
+    ExecuteSql(sUpdateSql);
+  end;
+
+  procedure FilterDealBillsByBills;
+  const
+    sFilterSql = 'Select D.*' +
+                 '  Into P_FilterDealBills' +
+                 '  From DealBills As D inner join' +
+                 '    (Select D.ID' +
+                 '       From DealBills As D Left join Bills As B' +
+                 '       On (D.B_Code = B.B_Code) and (D.Name = B.Name) and (D.Units = B.Units) and (D.Price = B.Price)' +
+                 '     where B.ID is Null) As R' +
+                 '  On (D.ID = R.ID)';
+  begin
+    ExecuteSql(sFilterSql);
+  end;
+
+  procedure CopyCacheReportsData;
+  begin
+    // DealBills的数量金额填至Bills中
+    UpdateBillsByDealBills;
+    // 过滤DealBills中在Bills中不存在的清单
+    FilterDealBillsByBills;
+  end;
+
 begin
   Save;
   DeletePhaseTable;
+  CopyCacheReportsData;
   if FPhaseIndex > 0 then
     CopyCurPhaseData;
   FDealPaymentData.UpdateLinkSerialNo;