Browse Source

Bug #890 台账分解,用户删除数量/金额时,应同步清除公式

MaiXinRong 9 years ago
parent
commit
45d8389397
3 changed files with 23 additions and 2 deletions
  1. 8 2
      DataModules/BillsCompileDm.pas
  2. 1 0
      Frames/BillsCompileFme.dfm
  3. 14 0
      Frames/BillsCompileFme.pas

+ 8 - 2
DataModules/BillsCompileDm.pas

@@ -556,7 +556,10 @@ procedure TBillsCompileData.sdvBillsCompileSetText(var Text: String;
   begin
   begin
     sPre := StringReplace(AFieldName, 'Quantity', '', [rfIgnoreCase, rfReplaceAll]);
     sPre := StringReplace(AFieldName, 'Quantity', '', [rfIgnoreCase, rfReplaceAll]);
     if CheckStringNull(Text) or CheckNumeric(Text) then
     if CheckStringNull(Text) or CheckNumeric(Text) then
-      Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)))
+    begin
+      ARecord.ValueByName(sPre + 'Formula').AsString := '';
+      Text := FloatToStr(QuantityRoundTo(StrToFloatDef(Text, 0)));
+    end
     else
     else
     begin
     begin
       ARecord.ValueByName(sPre + 'Formula').AsString := Text;
       ARecord.ValueByName(sPre + 'Formula').AsString := Text;
@@ -571,7 +574,10 @@ procedure TBillsCompileData.sdvBillsCompileSetText(var Text: String;
   begin
   begin
     sPre := StringReplace(AFieldName, 'TotalPrice', '', [rfIgnoreCase, rfReplaceAll]);
     sPre := StringReplace(AFieldName, 'TotalPrice', '', [rfIgnoreCase, rfReplaceAll]);
     if CheckStringNull(Text) or CheckNumeric(Text) then
     if CheckStringNull(Text) or CheckNumeric(Text) then
-      Text := FloatToStr(TotalPriceRoundTo(StrToFloatDef(Text, 0)))
+    begin
+      ARecord.ValueByName(sPre + 'Formula').AsString := '';
+      Text := FloatToStr(TotalPriceRoundTo(StrToFloatDef(Text, 0)));
+    end
     else
     else
     begin
     begin
       ARecord.ValueByName(sPre + 'Formula').AsString := Text;
       ARecord.ValueByName(sPre + 'Formula').AsString := Text;

+ 1 - 0
Frames/BillsCompileFme.dfm

@@ -63,6 +63,7 @@ object BillsCompileFrame: TBillsCompileFrame
       Selection.TransparentColor = False
       Selection.TransparentColor = False
       FrozenCol = 0
       FrozenCol = 0
       FrozenRow = 0
       FrozenRow = 0
+      OnCellTextChanged = zgBillsCompileCellTextChanged
       OnCustomPaste = zgBillsCompileCustomPaste
       OnCustomPaste = zgBillsCompileCustomPaste
       OnCopy = zgBillsCompileCopy
       OnCopy = zgBillsCompileCopy
       OnPaste = zgBillsCompilePaste
       OnPaste = zgBillsCompilePaste

+ 14 - 0
Frames/BillsCompileFme.pas

@@ -67,6 +67,8 @@ type
     procedure actnImportGclBillsToXmjUpdate(Sender: TObject);
     procedure actnImportGclBillsToXmjUpdate(Sender: TObject);
     procedure actnImportGclBillsToXmjExecute(Sender: TObject);
     procedure actnImportGclBillsToXmjExecute(Sender: TObject);
     procedure actnImportPlaneFxBillsToXmjExecute(Sender: TObject);
     procedure actnImportPlaneFxBillsToXmjExecute(Sender: TObject);
+    procedure zgBillsCompileCellTextChanged(Sender: TObject; Col,
+      Row: Integer);
   private
   private
     FBillsCompileData: TBillsCompileData;
     FBillsCompileData: TBillsCompileData;
     FShowIDField: Boolean;
     FShowIDField: Boolean;
@@ -646,4 +648,16 @@ begin
     CommonExpand(stnNode);
     CommonExpand(stnNode);
 end;
 end;
 
 
+procedure TBillsCompileFrame.zgBillsCompileCellTextChanged(Sender: TObject;
+  Col, Row: Integer);
+begin
+  if CheckExprsColumn then
+    laEdtExprs.Text := zgBillsCompile.CurCell.EditText
+  else
+    laEdtExprs.Text := '';
+  with stdBillsCompile.DataView do
+    if Assigned(Current) then
+      laEdtExprs.ReadOnly := Current.ValueByName('LockedInfo').AsBoolean;
+end;
+
 end.
 end.