瀏覽代碼

Task #2530 清单汇总,超计,根据用户设置的超计比例显示

MaiXinRong 6 年之前
父節點
當前提交
c31b09d1aa
共有 4 個文件被更改,包括 65 次插入8 次删除
  1. 29 6
      Forms/OptionFrm.dfm
  2. 13 0
      Forms/OptionFrm.pas
  3. 19 2
      Frames/BillsGatherFme.pas
  4. 4 0
      Units/ConfigDoc.pas

+ 29 - 6
Forms/OptionFrm.dfm

@@ -85,19 +85,33 @@ object OptionForm: TOptionForm
         Left = 11
         Top = 52
         Width = 430
-        Height = 117
+        Height = 141
         Caption = #28165#21333#27719#24635#36229#35745#26174#31034
         TabOrder = 3
         object lblTitleOverRange: TLabel
           Left = 8
-          Top = 22
+          Top = 45
           Width = 102
           Height = 12
           Caption = #32047#35745#23436#25104#21512#21516#35745#37327'>'
         end
+        object Label1: TLabel
+          Left = 8
+          Top = 22
+          Width = 12
+          Height = 12
+          Caption = #36229
+        end
+        object Label2: TLabel
+          Left = 70
+          Top = 22
+          Width = 48
+          Height = 12
+          Caption = '% '#26102#26174#31034
+        end
         object rbLedger: TRadioButton
           Left = 8
-          Top = 43
+          Top = 66
           Width = 113
           Height = 17
           Caption = '0'#21495#21488#36134#25968#37327
@@ -107,7 +121,7 @@ object OptionForm: TOptionForm
         object rbDeal: TRadioButton
           Tag = 1
           Left = 8
-          Top = 67
+          Top = 90
           Width = 113
           Height = 17
           Caption = #31614#32422#28165#21333#25968#37327
@@ -117,17 +131,26 @@ object OptionForm: TOptionForm
         object rbBoth: TRadioButton
           Tag = 2
           Left = 8
-          Top = 91
+          Top = 114
           Width = 209
           Height = 17
           Caption = '0'#21495#21488#36134#25968#37327#25110#31614#32422#28165#21333#25968#37327
           TabOrder = 2
           OnClick = rbLedgerClick
         end
+        object edtOverRangePercent: TEdit
+          Left = 25
+          Top = 19
+          Width = 40
+          Height = 20
+          TabOrder = 3
+          Text = '100'
+          OnKeyPress = edtOverRangePercentKeyPress
+        end
       end
       object GroupBox1: TGroupBox
         Left = 11
-        Top = 176
+        Top = 200
         Width = 430
         Height = 49
         Caption = #23548#20986'Excel'

+ 13 - 0
Forms/OptionFrm.pas

@@ -26,8 +26,12 @@ type
     rbBoth: TRadioButton;
     GroupBox1: TGroupBox;
     cbExcelWithMis: TCheckBox;
+    Label1: TLabel;
+    edtOverRangePercent: TEdit;
+    Label2: TLabel;
     procedure cbAutoSaveClick(Sender: TObject);
     procedure rbLedgerClick(Sender: TObject);
+    procedure edtOverRangePercentKeyPress(Sender: TObject; var Key: Char);
   private
     procedure SetSaveIntervalEnable(AEnable: Boolean);
     function GetOverRangeType: Integer;
@@ -74,6 +78,7 @@ begin
     SetSaveIntervalEnable(cbAutoSave.Checked);
     cbbSaveIntervall.Text := IntToStr(AutoSaveInterval);
     Self.OverRangeType := OverRangeType;
+    edtOverRangePercent.Text := IntToStr(OverRangePercent);
     cbExcelWithMis.Checked := ExcelWithMis;
   end;
 end;
@@ -85,6 +90,7 @@ begin
     AutoSave := cbAutoSave.Checked;
     AutoSaveInterval := StrToIntDef(cbbSaveIntervall.Text, 15);
     OverRangeType := Self.OverRangeType;
+    OverRangePercent := StrToIntDef(edtOverRangePercent.Text, 100);
     ExcelWithMis := cbExcelWithMis.Checked;
   end;
 end;
@@ -123,4 +129,11 @@ begin
   TRadioButton(Sender).Checked := True;
 end;
 
+procedure TOptionForm.edtOverRangePercentKeyPress(Sender: TObject;
+  var Key: Char);
+begin
+  if not (Key in ['0'..'9', #8, #13]) then
+    Key := #0;
+end;
+
 end.

+ 19 - 2
Frames/BillsGatherFme.pas

@@ -160,10 +160,21 @@ procedure TBillsGatherFrame.zgGclBillsCellGetColor(Sender: TObject;
     Result := bHasSame and bHasDiffer;
   end;
 
+  function CheckOverRangePercent(AQty, ACompareQty: Double): Boolean;
+  var
+    fCompare: Double;
+  begin
+    fCompare := TProjectData(FBillsGatherData.ProjectData).ProjProperties.DecimalManager.Common.Quantity.CompareValue;
+    if Abs(AQty) > fCompare then
+      Result := (ACompareQty / AQty * 100) > SupportManager.ConfigInfo.OverRangePercent
+    else
+      Result := Abs(ACompareQty) > fCompare;
+  end;
+
   function CheckOverRange(ARecIndex: Integer): Boolean;
   var
     Rec: TsdDataRecord;
-    fQuantity, fDealQuantity, fEndDealQuantity, fCompare: Double;
+    fQuantity, fDealQuantity, fEndDealQuantity: Double;
   begin
     Rec := saGclBills.DataView.Records[ARecIndex];
     Result := False;
@@ -172,13 +183,19 @@ procedure TBillsGatherFrame.zgGclBillsCellGetColor(Sender: TObject;
     fDealQuantity := Rec.ValueByName('DealQuantity').AsFloat;
     fQuantity := Rec.ValueByName('Quantity').AsFloat;
     fEndDealQuantity := Rec.ValueByName('EndDealQuantity').AsFloat;
-    fCompare := TProjectData(FBillsGatherData.ProjectData).ProjProperties.DecimalManager.Common.Quantity.CompareValue;
+    case SupportManager.ConfigInfo.OverRangeType of
+      0: Result := CheckOverRangePercent(fQuantity, fEndDealQuantity);
+      1: Result := CheckOverRangePercent(fDealQuantity, fEndDealQuantity);
+      2: Result := CheckOverRangePercent(fQuantity, fEndDealQuantity) or CheckOverRangePercent(fDealQuantity, fEndDealQuantity);
+    end;
+    (*
     case SupportManager.ConfigInfo.OverRangeType of
       0: Result := QuantityRoundTo(fEndDealQuantity - fQuantity) > fCompare;
       1: Result := QuantityRoundTo(fEndDealQuantity - fDealQuantity) > fCompare;
       2: Result := (QuantityRoundTo(fEndDealQuantity - fQuantity) > fCompare)
                 or (QuantityRoundTo(fEndDealQuantity - fDealQuantity) > fCompare);
     end;
+    *)
   end;
 
 var

+ 4 - 0
Units/ConfigDoc.pas

@@ -25,6 +25,7 @@ type
     FIsLog: Boolean;
     FBatchInsertFrmHeight: Integer;
     FBatchInsertFrmWidth: Integer;
+    FOverRangePercent: Integer;
 
     procedure LoadSectionOfCustomize;
     procedure LoadSectionOfUnitList;
@@ -64,6 +65,7 @@ type
     property AutoSave: Boolean read FAutoSave write FAutoSave;
     property AutoSaveInterval: Integer read FAutoSaveInterval write FAutoSaveInterval;
     property OverRangeType: Integer read FOverRangeType write FOverRangeType;
+    property OverRangePercent: Integer read FOverRangePercent write FOverRangePercent;
     property ExcelWithMis: Boolean read FExcelWithMis write FExcelWithMis;
 
     // Customize
@@ -133,6 +135,7 @@ begin
   FAutoSave := FIniFile.ReadBool('Options', 'AutoSave', True);
   FAutoSaveInterval := FIniFile.ReadInteger('Options', 'AutoSaveInterval', 15);
   FOverRangeType := FIniFile.ReadInteger('Options', 'OverRangeType', 0);
+  FOverRangePercent := FIniFile.ReadInteger('Options', 'OverRangePercent', 100);
   FExcelWithMis := FIniFile.ReadBool('Options', 'ExcelWithMis', False);
 end;
 
@@ -179,6 +182,7 @@ begin
   FIniFile.WriteBool('Options', 'AutoSave', FAutoSave);
   FIniFile.WriteInteger('Options', 'AutoSaveInterval', FAutoSaveInterval);
   FIniFile.WriteInteger('Options', 'OverRangeType', FOverRangeType);
+  FIniFile.WriteInteger('Options', 'OverRangePercent', FOverRangePercent);
   FIniFile.WriteBool('Options', 'ExcelWithMis', FExcelWithMis);
 end;