Ver código fonte

增加重编号子项方法

MaiXinRong 9 anos atrás
pai
commit
77267a1f85
1 arquivos alterados com 40 adições e 1 exclusões
  1. 40 1
      Units/BillsTree.pas

+ 40 - 1
Units/BillsTree.pas

@@ -3,7 +3,7 @@ unit BillsTree;
 interface
 
 uses
-  sdIDTree, sdDB, mDataRecord;
+  sdIDTree, sdDB, mDataRecord, ZhAPI;
 
 type
   TBillsIDTreeNode = class(TsdIDTreeNode)
@@ -40,6 +40,9 @@ type
     function CountPriceEnable: Boolean;
     function TotalPriceEnable: Boolean;
 
+    procedure RecodeChildrenCode(const AParentCode: string);
+    procedure RecodeChildrenB_Code(const AParentCode: string);
+
     property Rec: TBillsRecord read GetRec;
 
     property ChapterParent: TBillsIDTreeNode read GetChapterParent;
@@ -357,6 +360,42 @@ begin
          or (Rec.AddPcTotalPrice.AsFloat <> 0);
 end;
 
+procedure TBillsIDTreeNode.RecodeChildrenB_Code(const AParentCode: string);
+var
+  iChild: Integer;
+  vChild: TBillsIDTreeNode;
+begin
+  if (AParentCode = '') then Exit;
+
+  for iChild := 0 to Self.ChildCount - 1 do
+  begin
+    vChild := TBillsIDTreeNode(Self.ChildNodes[iChild]);
+    if vChild.Rec.B_Code.AsString <> '' then
+    begin
+      vChild.Rec.SetStrValue(vChild.Rec.B_Code, AParentCode + '-' + GetLastSetmentOfCode(AParentCode));
+      vChild.Rec.SetBoolValue(vChild.Rec.LockedInfo, False);
+    end;
+  end;
+end;
+
+procedure TBillsIDTreeNode.RecodeChildrenCode(const AParentCode: string);
+var
+  iChild: Integer;
+  vChild: TBillsIDTreeNode;
+begin
+  if (AParentCode = '') then Exit;
+
+  for iChild := 0 to Self.ChildCount - 1 do
+  begin
+    vChild := TBillsIDTreeNode(Self.ChildNodes[iChild]);
+    if vChild.Rec.Code.AsString <> '' then
+    begin
+      vChild.Rec.SetStrValue(vChild.Rec.Code, AParentCode + '-' + GetLastSetmentOfCode(AParentCode));
+      vChild.Rec.SetBoolValue(vChild.Rec.LockedInfo, False);
+    end;
+  end;
+end;
+
 function TBillsIDTreeNode.TotalPriceEnable: Boolean;
 begin
   Result := not HasCountPrice;