Browse Source

Task #2537 项目属性,小数位数,新增单价设置

MaiXinRong 6 years ago
parent
commit
9a8d939fcb
4 changed files with 123 additions and 68 deletions
  1. 80 58
      Forms/ProjectPropertiesFrm.dfm
  2. 16 2
      Forms/ProjectPropertiesFrm.pas
  3. 4 3
      Units/ProjectData.pas
  4. 23 5
      Units/ProjectProperty.pas

+ 80 - 58
Forms/ProjectPropertiesFrm.dfm

@@ -1,5 +1,5 @@
 object ProjectPropertiesForm: TProjectPropertiesForm
-  Left = 663
+  Left = 938
   Top = 261
   ActiveControl = leProjectName
   BorderIcons = [biSystemMenu]
@@ -225,8 +225,8 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           Width = 438
           Height = 247
           HorzScrollBar.Range = 401
-          VertScrollBar.Position = 597
-          VertScrollBar.Range = 1380
+          VertScrollBar.Position = 822
+          VertScrollBar.Range = 1410
           Align = alClient
           AutoScroll = False
           BevelInner = bvNone
@@ -243,7 +243,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           OnVScroll = msbBaseVScroll
           object lblDealInfo: TLabel
             Left = 7
-            Top = -593
+            Top = -818
             Width = 48
             Height = 12
             Caption = #21512#21516#20449#24687
@@ -256,28 +256,28 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblBuilder: TLabel
             Left = 34
-            Top = -489
+            Top = -714
             Width = 60
             Height = 12
             Caption = #24314#35774#21333#20301#65306
           end
           object lblConstructor: TLabel
             Left = 34
-            Top = -405
+            Top = -630
             Width = 66
             Height = 12
             Caption = #25215#21253#21333#20301'1'#65306
           end
           object lblSupervisor: TLabel
             Left = 34
-            Top = -237
+            Top = -462
             Width = 66
             Height = 12
             Caption = #30417#29702#21333#20301'1'#65306
           end
           object lblTechParameters: TLabel
             Left = 7
-            Top = -58
+            Top = -283
             Width = 48
             Height = 12
             Caption = #25216#26415#21442#25968
@@ -290,14 +290,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblLoadLevel: TLabel
             Left = 34
-            Top = -36
+            Top = -261
             Width = 60
             Height = 12
             Caption = #20844#36335#31561#32423#65306
           end
           object lblDealPayTitle: TLabel
             Left = 7
-            Top = 102
+            Top = -123
             Width = 48
             Height = 12
             Caption = #21512#21516#25903#20184
@@ -310,7 +310,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblSafeTitel: TLabel
             Left = 7
-            Top = 227
+            Top = 2
             Width = 48
             Height = 12
             Caption = #25991#20214#23433#20840
@@ -323,14 +323,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblUnlockPassword: TLabel
             Left = 36
-            Top = 252
+            Top = 27
             Width = 84
             Height = 12
             Caption = #35299#38145#33410#28857#23494#30721#65306
           end
           object lblPasswordHint: TLabel
             Left = 128
-            Top = 253
+            Top = 28
             Width = 90
             Height = 12
             Caption = 'lblPasswordHint'
@@ -344,21 +344,21 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblSupervisor_2: TLabel
             Left = 34
-            Top = -153
+            Top = -378
             Width = 66
             Height = 12
             Caption = #30417#29702#21333#20301'2'#65306
           end
           object lblConstructor_2: TLabel
             Left = 34
-            Top = -323
+            Top = -548
             Width = 66
             Height = 12
             Caption = #25215#21253#21333#20301'2'#65306
           end
           object pnlDealInfoBar: TPanel
             Left = 62
-            Top = -588
+            Top = -813
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -366,7 +366,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leProjectName: TLabeledEdit
             Left = 33
-            Top = -561
+            Top = -786
             Width = 330
             Height = 18
             Ctl3D = False
@@ -378,7 +378,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealName: TLabeledEdit
             Left = 33
-            Top = -521
+            Top = -746
             Width = 152
             Height = 18
             Ctl3D = False
@@ -390,7 +390,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealIndex: TLabeledEdit
             Left = 195
-            Top = -521
+            Top = -746
             Width = 80
             Height = 18
             Ctl3D = False
@@ -402,7 +402,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBName: TLabeledEdit
             Left = 101
-            Top = -474
+            Top = -699
             Width = 261
             Height = 18
             Ctl3D = False
@@ -414,7 +414,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBLegal: TLabeledEdit
             Left = 101
-            Top = -433
+            Top = -658
             Width = 137
             Height = 18
             Ctl3D = False
@@ -426,7 +426,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBDate: TLabeledEdit
             Left = 245
-            Top = -433
+            Top = -658
             Width = 119
             Height = 18
             Ctl3D = False
@@ -438,7 +438,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCName: TLabeledEdit
             Left = 101
-            Top = -390
+            Top = -615
             Width = 262
             Height = 18
             Ctl3D = False
@@ -450,7 +450,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCLegal: TLabeledEdit
             Left = 101
-            Top = -349
+            Top = -574
             Width = 137
             Height = 18
             Ctl3D = False
@@ -462,7 +462,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCDate: TLabeledEdit
             Left = 245
-            Top = -349
+            Top = -574
             Width = 119
             Height = 18
             Ctl3D = False
@@ -474,7 +474,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSName: TLabeledEdit
             Left = 101
-            Top = -222
+            Top = -447
             Width = 262
             Height = 18
             Ctl3D = False
@@ -486,7 +486,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSLegal: TLabeledEdit
             Left = 101
-            Top = -182
+            Top = -407
             Width = 137
             Height = 18
             Ctl3D = False
@@ -498,7 +498,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSDate: TLabeledEdit
             Left = 245
-            Top = -182
+            Top = -407
             Width = 119
             Height = 18
             Ctl3D = False
@@ -510,7 +510,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlTechParametersBar: TPanel
             Left = 62
-            Top = -53
+            Top = -278
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -518,7 +518,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartPeg: TLabeledEdit
             Left = 34
-            Top = 22
+            Top = -203
             Width = 132
             Height = 18
             Ctl3D = False
@@ -530,7 +530,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leEndPeg: TLabeledEdit
             Left = 176
-            Top = 22
+            Top = -203
             Width = 131
             Height = 18
             Ctl3D = False
@@ -542,7 +542,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLength: TLabeledEdit
             Left = 34
-            Top = 62
+            Top = -163
             Width = 132
             Height = 18
             Ctl3D = False
@@ -554,7 +554,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLaneCount: TLabeledEdit
             Left = 176
-            Top = 62
+            Top = -163
             Width = 132
             Height = 18
             Ctl3D = False
@@ -566,7 +566,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object cbLoadLevel: TComboBox
             Left = 34
-            Top = -19
+            Top = -244
             Width = 132
             Height = 20
             Ctl3D = False
@@ -583,7 +583,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDealPayBar: TPanel
             Left = 62
-            Top = 108
+            Top = -117
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -591,7 +591,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leContractPrice: TLabeledEdit
             Left = 190
-            Top = 123
+            Top = -102
             Width = 117
             Height = 18
             BiDiMode = bdLeftToRight
@@ -609,7 +609,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartedSubsist: TLabeledEdit
             Left = 190
-            Top = 150
+            Top = -75
             Width = 118
             Height = 18
             Ctl3D = False
@@ -623,7 +623,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leMaterialSubsist: TLabeledEdit
             Left = 190
-            Top = 176
+            Top = -49
             Width = 119
             Height = 18
             Ctl3D = False
@@ -637,7 +637,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlSafeBar: TPanel
             Left = 62
-            Top = 233
+            Top = 8
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -645,7 +645,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlUnlockPassword: TPanel
             Left = 40
-            Top = 269
+            Top = 44
             Width = 361
             Height = 85
             BevelOuter = bvNone
@@ -873,7 +873,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealType: TLabeledEdit
             Left = 283
-            Top = -521
+            Top = -746
             Width = 80
             Height = 18
             Ctl3D = False
@@ -885,7 +885,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealPhase: TLabeledEdit
             Left = 177
-            Top = -19
+            Top = -244
             Width = 131
             Height = 18
             Ctl3D = False
@@ -897,7 +897,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSName_2: TLabeledEdit
             Left = 101
-            Top = -138
+            Top = -363
             Width = 262
             Height = 18
             Ctl3D = False
@@ -909,7 +909,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSLegal_2: TLabeledEdit
             Left = 101
-            Top = -98
+            Top = -323
             Width = 137
             Height = 18
             Ctl3D = False
@@ -921,7 +921,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSDate_2: TLabeledEdit
             Left = 245
-            Top = -98
+            Top = -323
             Width = 119
             Height = 18
             Ctl3D = False
@@ -933,7 +933,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCName_2: TLabeledEdit
             Left = 101
-            Top = -308
+            Top = -533
             Width = 262
             Height = 18
             Ctl3D = False
@@ -945,7 +945,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCLegal_2: TLabeledEdit
             Left = 101
-            Top = -267
+            Top = -492
             Width = 137
             Height = 18
             Ctl3D = False
@@ -957,7 +957,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCDate_2: TLabeledEdit
             Left = 245
-            Top = -267
+            Top = -492
             Width = 119
             Height = 18
             Ctl3D = False
@@ -969,7 +969,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSubsistStart: TLabeledEdit
             Left = 190
-            Top = 201
+            Top = -24
             Width = 119
             Height = 18
             Ctl3D = False
@@ -984,9 +984,9 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDateTimeRela: TPanel
             Left = 0
-            Top = 539
+            Top = 342
             Width = 421
-            Height = 95
+            Height = 105
             BevelOuter = bvNone
             TabOrder = 34
             object lblDateTime: TLabel
@@ -1062,9 +1062,9 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlTechRela: TPanel
             Left = 8
-            Top = 352
+            Top = 127
             Width = 421
-            Height = 182
+            Height = 215
             BevelOuter = bvNone
             TabOrder = 35
             object lblCalcParametersTitel: TLabel
@@ -1132,7 +1132,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
             end
             object cbDealPayAloneDigiy: TCheckBox
               Left = 62
-              Top = 79
+              Top = 105
               Width = 131
               Height = 17
               Caption = #21512#21516#25903#20184#21333#29420#35774#32622
@@ -1141,7 +1141,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
             end
             object leDealPayTotalPriceDigit: TLabeledEdit
               Left = 100
-              Top = 103
+              Top = 129
               Width = 87
               Height = 18
               EditLabel.Width = 36
@@ -1153,7 +1153,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
             end
             object udDealPayTotalPriceDigit: TUpDown
               Left = 187
-              Top = 103
+              Top = 129
               Width = 16
               Height = 18
               Associate = leDealPayTotalPriceDigit
@@ -1162,7 +1162,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
             end
             object gbPM_Digit: TGroupBox
               Left = 52
-              Top = 131
+              Top = 157
               Width = 349
               Height = 44
               Caption = #20215#24046
@@ -1198,10 +1198,32 @@ object ProjectPropertiesForm: TProjectPropertiesForm
               BevelOuter = bvLowered
               TabOrder = 8
             end
+            object lePriceDigit: TLabeledEdit
+              Left = 100
+              Top = 78
+              Width = 87
+              Height = 18
+              EditLabel.Width = 36
+              EditLabel.Height = 12
+              EditLabel.Caption = #21333#20215#65306
+              LabelPosition = lpLeft
+              TabOrder = 9
+              Text = '2'
+            end
+            object udPrice: TUpDown
+              Left = 187
+              Top = 78
+              Width = 16
+              Height = 18
+              Associate = lePriceDigit
+              Max = 5
+              Position = 2
+              TabOrder = 10
+            end
           end
           object udSubsistStart: TUpDown
             Left = 309
-            Top = 201
+            Top = -24
             Width = 16
             Height = 18
             Associate = leSubsistStart

+ 16 - 2
Forms/ProjectPropertiesFrm.pas

@@ -143,6 +143,8 @@ type
     udPM_PriceDigit: TUpDown;
     pnlCalcParametersBar: TPanel;
     udSubsistStart: TUpDown;
+    lePriceDigit: TLabeledEdit;
+    udPrice: TUpDown;
     procedure btnOkClick(Sender: TObject);
     procedure leContractPriceClick(Sender: TObject);
     procedure msbBaseMouseWheel(Sender: TObject; Shift: TShiftState;
@@ -371,7 +373,7 @@ begin
     ResetContentsCheck(tobtnDealPayment.Tag)
   else if msbBase.VertScrollBar.Position < 957 then
     ResetContentsCheck(tobtnSafe.Tag)
-  else if msbBase.VertScrollBar.Position < 1133 then
+  else if msbBase.VertScrollBar.Position < 1163 then
     ResetContentsCheck(tobtnCalcParameters.Tag)
   else
     ResetContentsCheck(tobtnDateTime.Tag);
@@ -396,7 +398,7 @@ begin
   else if ATag = tobtnCalcParameters.Tag then
     msbBase.VertScrollBar.Position := 957
   else if ATag = tobtnDateTime.Tag then
-    msbBase.VertScrollBar.Position := 1133;
+    msbBase.VertScrollBar.Position := 1163;
 end;
 
 procedure TProjectPropertiesForm.InitDealInfo;
@@ -626,14 +628,21 @@ begin
   begin
     FProjProperties.QuantityDigit := udQuantity.Position;
     FProjProperties.TotalPriceDigit := udTotalPrice.Position;
+    FProjProperties.PriceDigit := udPrice.Position;
     FProjectData.ResetFloatDigitView;
     FProjProperties.DecimalManager.Common.Quantity.Digit := udQuantity.Position;
     FProjProperties.DecimalManager.Common.TotalPrice.Digit := udTotalPrice.Position;
+    FProjProperties.DecimalManager.Common.Price.Digit := udPrice.Position;
     FProjProperties.DecimalManager.PriceMargin.Quantity.Digit := udQuantity.Position;
     FProjProperties.DecimalManager.PriceMargin.TotalPrice.Digit := udTotalPrice.Position;
 
     FProjProperties.DealPayAloneDigit := cbDealPayAloneDigiy.Checked;
     FProjProperties.DecimalManager.DealPay.TotalPrice.Digit := udDealPayTotalPriceDigit.Position;
+  end else if ((FProjProperties.PhaseCount > 0) and (not FProjectData.PhaseData.StageDataReadOnly) and (FProjectData.PhaseData.StageIndex = 0)) then
+  begin
+    FProjProperties.PriceDigit := udPrice.Position;
+    FProjProperties.DecimalManager.Common.Price.Digit := udPrice.Position;
+    FProjectData.ResetFloatDigitView;
   end;
   if (FProjProperties.PhaseCount = 1) and not FProjectData.PriceMarginReadOnly then
     FProjProperties.DecimalManager.PriceMargin.Price.Digit := udPM_PriceDigit.Position;
@@ -648,6 +657,11 @@ begin
   leTotalPriceDigit.ReadOnly := FProjProperties.PhaseCount > 0;
   udTotalPrice.Enabled := FProjProperties.PhaseCount = 0;
 
+  udPrice.Position := FProjProperties.PriceDigit;
+  udPrice.Min := FProjProperties.PriceDigitMin;
+  lePriceDigit.ReadOnly := (FProjProperties.PhaseCount > 0) and (FProjectData.PhaseData.StageDataReadOnly or (FProjectData.PhaseData.StageIndex > 0));
+  udPrice.Enabled := not lePriceDigit.ReadOnly;
+
   udPM_PriceDigit.Position := FProjProperties.DecimalManager.PriceMargin.Price.Digit;
   lePM_PriceDigit.ReadOnly := FProjectData.PriceMarginReadOnly and (FProjProperties.PhaseCount > 1);
   udPM_PriceDigit.Enabled := not lePM_PriceDigit.ReadOnly;

+ 4 - 3
Units/ProjectData.pas

@@ -340,7 +340,8 @@ end;
 procedure TProjectData.CreateNewPhase;
 var
   sPhaseFileName: string;
-begin                       
+begin
+  FProjProperties.PriceDigitMin := FProjProperties.PriceDigit;              
   FProjProperties.Save;
   FBillsData.LockedBaseData;
   FProjProperties.PhaseCount := FProjProperties.PhaseCount + 1;
@@ -2156,7 +2157,7 @@ begin
     CheckCalcBeforeSave;
 
     UpdateSysProgress(5, '正在保存数据');
-    SaveLastestPhaseMainData; 
+    SaveLastestPhaseMainData;
     SaveDealPayFinalData;
     UpdateSysProgress(10, '正在保存数据');
     if (FPhaseData.Active) and (FPhaseIndex = ProjProperties.PhaseCount) then
@@ -2339,7 +2340,7 @@ end;
 
 procedure TProjectData.SaveDealPayFinalData;
 begin
-  if (FPhaseIndex = ProjProperties.PhaseCount) and PhaseData.IsLastStage then
+  if (FProjProperties.PhaseCount > 0) and (FPhaseIndex = ProjProperties.PhaseCount) and PhaseData.IsLastStage then
     FDealPayFinalData.LoadLastestDealPayData;
 end;
 

+ 23 - 5
Units/ProjectProperty.pas

@@ -93,6 +93,7 @@ type
     FShowOverRange: Boolean;
     FShowApprovalCode: Boolean;
     FSubsistStart: Integer;
+    FPriceDigitMin: Integer;
 
     function GetDisplayFormat(ADigit: Integer): string;
 
@@ -140,6 +141,8 @@ type
     procedure SetShowOverRange(const Value: Boolean);
     procedure SetShowApprovalCode(const Value: Boolean);
     procedure SetSubsistStart(const Value: Integer);
+    procedure SetPriceDigit(const Value: Integer);
+    procedure SetPriceDigitMin(const Value: Integer);
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -243,8 +246,9 @@ type
     property TotalPriceDigit: Integer read FTotalPriceDigit write SetTotalPriceDigit;
     property TotalPriceFormat: string read FTotalPriceFormat;
     // µ¥¼Û
-    property PriceDigit: Integer read FPriceDigit;
+    property PriceDigit: Integer read FPriceDigit write SetPriceDigit;
     property PriceFormat: string read FPriceFormat;
+    property PriceDigitMin: Integer read FPriceDigitMin write SetPriceDigitMin;
 
     {ʱ¼ä}
     // Æðʼʱ¼ä
@@ -483,20 +487,21 @@ begin
   FQuantityFormat := GetDisplayFormat(FQuantityDigit);
   FTotalPriceDigit := GetIntPropertyDef('TotalPriceDigit', 0);
   FTotalPriceFormat := GetDisplayFormat(FTotalPriceDigit);
-  FPriceDigit := 2;
+  FPriceDigit := GetIntPropertyDef('PriceDigit', 2);
   FPriceFormat := GetDisplayFormat(FPriceDigit);
+  FPriceDigitMin := GetIntPropertyDef('PriceDigitMin', 0);
 
   with FDecimalManager.Common do
   begin
     Quantity.Digit := GetIntPropertyDef('QuantityDigit', 3);
     TotalPrice.Digit := GetIntPropertyDef('TotalPriceDigit', 0);
-    Price.Digit := 2;
+    Price.Digit := GetIntPropertyDef('PriceDigit', 2);
   end;
   with FDecimalManager do
   begin
     Compile.Quantity.Digit := GetIntPropertyDef('QuantityDigit1', Common.Quantity.Digit);
     Compile.TotalPrice.Digit := GetIntPropertyDef('TotalPriceDigit1', Common.TotalPrice.Digit);
-    Compile.Price.Digit := 2;
+    Compile.Price.Digit := Common.Price.Digit;
   end;
   with FDecimalManager do
   begin
@@ -612,7 +617,7 @@ end;
 procedure TProjProperties.SaveCalcParameters;
 begin
   if FPhaseCount > 0 then Exit;
-  
+
   FPropertyInqurity.Value['DealPayAloneDigit'] := FDealPayAloneDigit;
   with FDecimalManager do
   begin
@@ -725,6 +730,19 @@ begin
   FPropertyInqurity.Value['PhaseIndex'] := Value;
 end;
 
+procedure TProjProperties.SetPriceDigit(const Value: Integer);
+begin
+  FPriceDigit := Value;
+  FPropertyInqurity.Value['PriceDigit'] := Value;
+  FPriceFormat := GetDisplayFormat(FPriceDigit);
+end;
+
+procedure TProjProperties.SetPriceDigitMin(const Value: Integer);
+begin
+  FPriceDigitMin := Value;
+  FPropertyInqurity.Value['PriceDigitMin'] := Value;
+end;
+
 procedure TProjProperties.SetQuantityDigit(const Value: Integer);
 begin
   FQuantityDigit := Value;