Ver código fonte

Bills表新增ChapterParentID,以供报表使用

MaiXinRong 9 anos atrás
pai
commit
221d13e3a7

+ 3 - 0
DataModules/BillsCompileDm.dfm

@@ -91,6 +91,9 @@ object BillsCompileData: TBillsCompileData
       end
       item
         FieldName = 'DgnPrice'
+      end
+      item
+        FieldName = 'ChapterParentID'
       end>
     AfterAddRecord = sdvBillsCompileAfterAddRecord
     BeforeValueChange = sdvBillsCompileBeforeValueChange

+ 4 - 1
DataModules/BillsDm.dfm

@@ -212,6 +212,9 @@ object BillsData: TBillsData
       080F4E65656450726F636573734E616D65090001044E616D650610504D5F4164
       64546F74616C5072696365094669656C644E616D650610504D5F416464546F74
       616C50726963650844617461547970650206084461746153697A650208054973
-      4B6579080F4E65656450726F636573734E616D65090000}
+      4B6579080F4E65656450726F636573734E616D65090001044E616D65060F4368
+      6170746572506172656E744944094669656C644E616D65060F43686170746572
+      506172656E7449440844617461547970650203084461746153697A6502040549
+      734B6579080F4E65656450726F636573734E616D65090000}
   end
 end

+ 3 - 1
DataModules/BillsDm.pas

@@ -178,7 +178,7 @@ procedure TBillsData.Save;
   var
     iIndex: Integer;
     stnNode: TBillsIDTreeNode;
-    iLeafXmjParentID: Integer;
+    iLeafXmjParentID, iChapterParentID: Integer;
     sIndexCode: string;
   begin
     sddBills.BeginUpdate;
@@ -202,6 +202,8 @@ procedure TBillsData.Save;
             iLeafXmjParentID := -1;
           stnNode.Rec.SetIntValue(stnNode.Rec.LeafXmjParentID, iLeafXmjParentID);
 
+          stnNode.Rec.SetIntValue(stnNode.Rec.ChapterParentID, stnNode.ChapterParentID);
+
           // 分解项目节编号为项、目、节、细目
           if stnNode.Rec.Code.AsString <> '' then
             ResolveCode(stnNode.Rec);

+ 23 - 0
Frames/BillsCompileFme.dfm

@@ -642,6 +642,7 @@ object BillsCompileFrame: TBillsCompileFrame
       item
         Title.Caption = 'ID'
         Title.CaptionAcrossCols = '1'
+        Title.CaptionAcrossRows = 3
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Height = -12
@@ -661,6 +662,7 @@ object BillsCompileFrame: TBillsCompileFrame
       item
         Title.Caption = 'ParentID'
         Title.CaptionAcrossCols = '1'
+        Title.CaptionAcrossRows = 3
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Height = -12
@@ -680,6 +682,7 @@ object BillsCompileFrame: TBillsCompileFrame
       item
         Title.Caption = 'NextSiblingID'
         Title.CaptionAcrossCols = '1'
+        Title.CaptionAcrossRows = 3
         Title.Font.Charset = GB2312_CHARSET
         Title.Font.Color = clWindowText
         Title.Font.Height = -12
@@ -695,6 +698,26 @@ object BillsCompileFrame: TBillsCompileFrame
         Width = 50
         Visible = False
         ReadOnly = True
+      end
+      item
+        Title.Caption = 'ChapterParentID'
+        Title.CaptionAcrossCols = '1'
+        Title.CaptionAcrossRows = 3
+        Title.Font.Charset = GB2312_CHARSET
+        Title.Font.Color = clWindowText
+        Title.Font.Height = -12
+        Title.Font.Name = #23435#20307
+        Title.Font.Style = []
+        Alignment = taLeftJustify
+        Font.Charset = GB2312_CHARSET
+        Font.Color = clWindowText
+        Font.Height = -12
+        Font.Name = #23435#20307
+        Font.Style = []
+        FieldName = 'ChapterParentID'
+        Width = 50
+        Visible = False
+        ReadOnly = False
       end>
     Grid = zgBillsCompile
     ExtendRowCount = 3

+ 26 - 0
Units/BillsTree.pas

@@ -23,6 +23,8 @@ type
     function HasTotalPrice: Boolean;
 
     function GetRec: TBillsRecord;
+    function GetChapterParentID: Integer;
+    function GetChapterParent: TBillsIDTreeNode;
   public
     function CanUpLevel: Boolean; override;
     function CanDownLevel: Boolean; override;
@@ -40,6 +42,9 @@ type
 
     property Rec: TBillsRecord read GetRec;
 
+    property ChapterParent: TBillsIDTreeNode read GetChapterParent;
+    property ChapterParentID: Integer read GetChapterParentID;
+
     property DealQuantity: Double read FDealQuantity write FDealQuantity;
     property DealTotalPrice: Double read FDealTotalPrice write FDealTotalPrice;
     property QcQuantity: Double read FQcQuantity write FQcQuantity;
@@ -281,6 +286,27 @@ begin
   TBillsIDTree(Owner).DoOnReCalcNode(iOrgParentID);
 end;
 
+function TBillsIDTreeNode.GetChapterParent: TBillsIDTreeNode;
+begin
+  Result := nil;
+  if Self.Level <= 1 then Exit;
+
+  Result := TBillsIDTreeNode(Self.Parent);
+  while Result.Level > 1 do
+    Result := TBillsIDTreeNode(Result.Parent);
+end;
+
+function TBillsIDTreeNode.GetChapterParentID: Integer;
+var
+  vNode: TBillsIDTreeNode;
+begin
+  vNode := GetChapterParent;
+  if Assigned(vNode) then
+    Result := vNode.ID
+  else
+    Result := -1;
+end;
+
 function TBillsIDTreeNode.GetRec: TBillsRecord;
 begin
   Result := TBillsRecord(TsdIDTreeNode(Self).Rec);

+ 1 - 1
Units/Connections.pas

@@ -8,7 +8,7 @@ uses
 const
   ProductName = 'Measure';
   EmptyFileVersion = '1.0.0.0';
-  FileVersion = '1.0.1.0';
+  FileVersion = '1.0.1.1';
   EncryptVersion = 'Auto1.0';
 
 type

+ 3 - 1
Units/DataBaseTables.pas

@@ -103,7 +103,7 @@ const
 
   {헌데鑒앴 -- 憩瑯긍서썹충}
   SBills = 'Bills';
-  tdBills: array [0..83] of TScFieldDef =(
+  tdBills: array [0..84] 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),
@@ -124,6 +124,8 @@ const
     (FieldName: 'XiMuCode'; FieldType: ftString; Size: 30; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 묏넋좆헌데탤埼긍뵀
     (FieldName: 'IndexCode'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 覽섬만淃ID
+    (FieldName: 'ChapterParentID'; FieldType: ftInteger; size: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // --------- End   괩깊淚痰 -------
     (FieldName: 'Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'B_Code'; FieldType: ftString; Size: 50; NotNull: False; PrimaryKey: False; ForceUpdate: False),

+ 1 - 1
Units/ProjectData.pas

@@ -1627,7 +1627,7 @@ end;
 
 function TProjectData.GetStageDataReadOnly: Boolean;
 begin
- if FPhaseData.Active then
+  if FPhaseData.Active then
     Result := FPhaseData.StageDataReadOnly
   else
     Result := True;

+ 3 - 0
Units/mDataRecord.pas

@@ -31,6 +31,7 @@ type
     FJieCode: TsdValue;
     FXimuCode: TsdValue;
     FIndexCode: TsdValue;
+    FChapterParentID: TsdValue;
     // »ù´¡Êý¾Ý
     FCode: TsdValue;
     FB_Code: TsdValue;
@@ -119,6 +120,7 @@ type
     property JieCode: TsdValue read FJieCode;
     property XimuCode: TsdValue read FXimuCode;
     property IndexCode: TsdValue read FIndexCode;
+    property ChapterParentID: TsdValue read FChapterParentID;
 
     property Code: TsdValue read FCode;
     property B_Code: TsdValue read FB_Code;
@@ -483,6 +485,7 @@ begin
   FJieCode := ValueByName('JieCode');
   FXimuCode := ValueByName('XimuCode');
   FIndexCode := ValueByName('IndexCode');
+  FChapterParentID := ValueByName('ChapterParentID');
 
   FCode := ValueByName('Code');
   FB_Code := ValueByName('B_Code');