Browse Source

1. Bug #768 清单编号含有中文时,调用变更令,变更清单已变更数量未更新
2. Task #861 复制粘贴整块时,提供节点位置选择

MaiXinRong 9 years ago
parent
commit
4634300988
4 changed files with 39 additions and 9 deletions
  1. 23 2
      DataModules/BGLDm.pas
  2. 2 0
      Frames/BillsCompileFme.dfm
  3. 13 7
      Frames/BillsCompileFme.pas
  4. 1 0
      Units/BillsClipboard.pas

+ 23 - 2
DataModules/BGLDm.pas

@@ -127,6 +127,7 @@ type
     function CheckBGLUsed(ABGID: Integer): Boolean;
 
     function LocateBGL(const ACode: string): Boolean;
+    function LocateBGBills(ABGID: Integer; const AB_Code: string): Boolean;
 
     procedure LockAllBGL;
     procedure LockAllBGBills;
@@ -376,7 +377,7 @@ var
 begin
   for I := 0 to ABGLInfo.Count - 1 do
     if LocateBGL(ABGLInfo.Codes[I]) and
-        cdsBGBills.Locate('BGID;B_Code', VarArrayOf([cdsBGLID.AsInteger, ABGLInfo.B_Code]), []) then
+        LocateBGBills(cdsBGLID.AsInteger, ABGLInfo.B_Code) then
     begin
       cdsBGBills.Edit;
       if ABGLInfo.IsOrg then
@@ -617,7 +618,10 @@ begin
   if cdsBGL.FindKey([ABGLID]) then
   begin
     cdsBGL.Edit;
-    cdsBGLExecutionRate.AsFloat := AdvRoundTo(GetBGLExecutionTotalPrice/cdsBGLTotalPrice.AsFloat*100);
+    if cdsBGLTotalPrice.AsFloat <> 0 then
+      cdsBGLExecutionRate.AsFloat := AdvRoundTo(GetBGLExecutionTotalPrice/cdsBGLTotalPrice.AsFloat*100)
+    else
+      cdsBGLExecutionRate.AsFloat := 0;
     cdsBGL.Post;
   end;
 end;
@@ -667,4 +671,21 @@ begin
   end;
 end;
 
+function TBGLData.LocateBGBills(ABGID: Integer;
+  const AB_Code: string): Boolean;
+begin
+  Result := False;
+  cdsBGBills.First;
+  while (not cdsBGBills.Eof) do
+  begin
+    if (cdsBGBillsBGID.AsInteger = ABGID) and
+       SameText(cdsBGBillsB_Code.AsString, AB_Code) then
+    begin
+      Result := True;
+      Break;
+    end;
+    cdsBGBills.Next;
+  end;
+end;
+
 end.

+ 2 - 0
Frames/BillsCompileFme.dfm

@@ -61,6 +61,8 @@ object BillsCompileFrame: TBillsCompileFrame
       DefaultFixedColWidth = 30
       Selection.AlphaBlend = False
       Selection.TransparentColor = False
+      FrozenCol = 0
+      FrozenRow = 0
       OnCustomPaste = zgBillsCompileCustomPaste
       OnCopy = zgBillsCompileCopy
       OnPaste = zgBillsCompilePaste

+ 13 - 7
Frames/BillsCompileFme.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   BillsCompileDm, UtilMethods, BillsClipboard, sdIDTree, BatchReplaceBillsFrm,
-  CheckAndClearFrm, DealBillsFrm,
+  CheckAndClearFrm, DealBillsFrm, BillsPasteSelectFrm,
   sdDB,
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
   Dialogs, ActnList, sdGridDBA, sdGridTreeDBA, dxBar, ZJGrid, StdCtrls,
@@ -130,13 +130,19 @@ procedure TBillsCompileFrame.PasteBillsBlock(ANode: TsdIDTreeNode;
   ABounds: TRect);
 var
   Clipboard: TBillsClipboard;
+  iPos: Integer;
 begin
-  Clipboard := TBillsClipboard.Create(FBillsCompileData.BillsData);
-  try
-    Clipboard.Paste(ANode, 1);
-  finally
-    FBillsCompileData.CalculateAll;
-    Clipboard.Free;
+  if SelectBillsPasteType(iPos) then
+  begin
+    if iPos = -1 then Exit;
+
+    Clipboard := TBillsClipboard.Create(FBillsCompileData.BillsData);
+    try
+      Clipboard.Paste(ANode, iPos);
+    finally
+      FBillsCompileData.CalculateAll;
+      Clipboard.Free;
+    end;
   end;
 end;
 

+ 1 - 0
Units/BillsClipboard.pas

@@ -68,6 +68,7 @@ type
     destructor Destroy; override;
 
     procedure Copy(ANode: TsdIDTreeNode; ACount: Integer);
+    // APos: 0[×ÓÏî] 1[ºóÏî] 2[ǰÏî]
     procedure Paste(ANode: TsdIDTreeNode; APos: Integer);
   end;