Browse Source

Task #1262 材料调差,输入控制

MaiXinRong 8 years ago
parent
commit
52a32935ee

+ 11 - 1
DataModules/PriceMarginBillsDm.pas

@@ -4,7 +4,7 @@ interface
 
 uses
   SysUtils, Classes, sdDB, sdProvider, BillsTree, mDataRecord,
-  GclBillsGatherModel, DB;
+  GclBillsGatherModel, DB, CalcDecimal;
 
 type
   TPriceMarginBillsData = class(TDataModule)
@@ -34,6 +34,7 @@ type
     FProjectData: TObject;
     procedure WriteGclBillsData(AGcls, AXmjs: TList);
     function GetMainBillsTree: TBillsIDTree;
+    function GetDecimal: TCalcDecimal;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -46,6 +47,7 @@ type
 
     property ProjectData: TObject read FProjectData;
     property MainBillsTree: TBillsIDTree read GetMainBillsTree;
+    property Decimal: TCalcDecimal read GetDecimal;
   end;
 
 implementation
@@ -387,6 +389,14 @@ begin
   if AValue.DataType in [ftInteger, ftFloat] then
     if not CheckNumeric(Text) then
       Text := '';
+
+  if SameText(AValue.FieldName, 'Quantity') then
+    Text := Decimal.Quantity.StrRoundTo(Text);
+end;
+
+function TPriceMarginBillsData.GetDecimal: TCalcDecimal;
+begin
+  Result := TProjectData(FProjectData).ProjProperties.DecimalManager.PriceMargin;
 end;
 
 end.

+ 7 - 0
DataModules/ProjectGLDm.pas

@@ -532,6 +532,13 @@ begin
       sddProjectGL.Remove(AValue.Owner);
     end;
   end;
+
+  if AValue.FieldName = 'BasePrice' then
+    Text := Decimal.Price.StrRoundTo(Text)
+  else if AValue.FieldName = 'InfoPrice' then
+    Text := Decimal.Price.StrRoundTo(Text)
+  else if SameText(AValue.FieldName, 'UsedQuantity') then
+    Text := Decimal.Quantity.StrRoundTo(Text);
 end;
 
 procedure TProjectGLData.LoadStagePM_CalcData;

+ 52 - 52
Forms/ProjectPropertiesFrm.dfm

@@ -225,7 +225,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           Width = 438
           Height = 247
           HorzScrollBar.Range = 401
-          VertScrollBar.Position = 886
+          VertScrollBar.Position = 782
           VertScrollBar.Range = 1133
           Align = alClient
           AutoScroll = False
@@ -243,7 +243,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           OnVScroll = msbBaseVScroll
           object lblDealInfo: TLabel
             Left = 7
-            Top = -882
+            Top = -778
             Width = 48
             Height = 12
             Caption = #21512#21516#20449#24687
@@ -256,28 +256,28 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblBuilder: TLabel
             Left = 34
-            Top = -778
+            Top = -674
             Width = 60
             Height = 12
             Caption = #24314#35774#21333#20301#65306
           end
           object lblConstructor: TLabel
             Left = 34
-            Top = -694
+            Top = -590
             Width = 60
             Height = 12
             Caption = #25215#21253#21333#20301#65306
           end
           object lblSupervisor: TLabel
             Left = 34
-            Top = -610
+            Top = -506
             Width = 60
             Height = 12
             Caption = #30417#29702#21333#20301#65306
           end
           object lblTechParameters: TLabel
             Left = 7
-            Top = -515
+            Top = -411
             Width = 48
             Height = 12
             Caption = #25216#26415#21442#25968
@@ -290,14 +290,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblLoadLevel: TLabel
             Left = 34
-            Top = -493
+            Top = -389
             Width = 60
             Height = 12
             Caption = #20844#36335#31561#32423#65306
           end
           object lblDealPayTitle: TLabel
             Left = 7
-            Top = -355
+            Top = -251
             Width = 48
             Height = 12
             Caption = #21512#21516#25903#20184
@@ -310,7 +310,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblSafeTitel: TLabel
             Left = 7
-            Top = -251
+            Top = -147
             Width = 48
             Height = 12
             Caption = #25991#20214#23433#20840
@@ -323,14 +323,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblUnlockPassword: TLabel
             Left = 36
-            Top = -227
+            Top = -123
             Width = 84
             Height = 12
             Caption = #35299#38145#33410#28857#23494#30721#65306
           end
           object lblPasswordHint: TLabel
             Left = 128
-            Top = -226
+            Top = -122
             Width = 90
             Height = 12
             Caption = 'lblPasswordHint'
@@ -344,7 +344,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblCalcParametersTitel: TLabel
             Left = 7
-            Top = -123
+            Top = -19
             Width = 48
             Height = 12
             Caption = #35745#31639#21442#25968
@@ -357,14 +357,14 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object Label1: TLabel
             Left = 36
-            Top = -99
+            Top = 5
             Width = 84
             Height = 12
             Caption = #20445#30041#23567#25968#20301#25968#65306
           end
           object lblDateTime: TLabel
             Left = 7
-            Top = 4
+            Top = 108
             Width = 48
             Height = 12
             Caption = #26102#38388#21442#25968
@@ -377,21 +377,21 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object lblBaseline: TLabel
             Left = 36
-            Top = 27
+            Top = 131
             Width = 60
             Height = 12
             Caption = #36215#22987#26085#26399#65306
           end
           object lblDeadline: TLabel
             Left = 36
-            Top = 51
+            Top = 155
             Width = 60
             Height = 12
             Caption = #25130#27490#26085#26399#65306
           end
           object lblDateHint: TLabel
             Left = 37
-            Top = 72
+            Top = 176
             Width = 192
             Height = 12
             Caption = #24403#21069#25130#27490#26085#26399' '#65308' '#36215#22987#26085#26399#65292#35831#26680#26597
@@ -404,7 +404,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDealInfoBar: TPanel
             Left = 62
-            Top = -877
+            Top = -773
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -412,7 +412,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leProjectName: TLabeledEdit
             Left = 33
-            Top = -850
+            Top = -746
             Width = 330
             Height = 18
             Ctl3D = False
@@ -424,7 +424,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealName: TLabeledEdit
             Left = 33
-            Top = -810
+            Top = -706
             Width = 152
             Height = 18
             Ctl3D = False
@@ -436,7 +436,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealIndex: TLabeledEdit
             Left = 195
-            Top = -810
+            Top = -706
             Width = 80
             Height = 18
             Ctl3D = False
@@ -448,7 +448,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBName: TLabeledEdit
             Left = 101
-            Top = -763
+            Top = -659
             Width = 261
             Height = 18
             Ctl3D = False
@@ -460,7 +460,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBLegal: TLabeledEdit
             Left = 101
-            Top = -722
+            Top = -618
             Width = 137
             Height = 18
             Ctl3D = False
@@ -472,7 +472,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leBDate: TLabeledEdit
             Left = 245
-            Top = -722
+            Top = -618
             Width = 119
             Height = 18
             Ctl3D = False
@@ -484,7 +484,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCName: TLabeledEdit
             Left = 101
-            Top = -679
+            Top = -575
             Width = 262
             Height = 18
             Ctl3D = False
@@ -496,7 +496,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCLegal: TLabeledEdit
             Left = 101
-            Top = -638
+            Top = -534
             Width = 137
             Height = 18
             Ctl3D = False
@@ -508,7 +508,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leCDate: TLabeledEdit
             Left = 245
-            Top = -638
+            Top = -534
             Width = 119
             Height = 18
             Ctl3D = False
@@ -520,7 +520,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSName: TLabeledEdit
             Left = 101
-            Top = -595
+            Top = -491
             Width = 262
             Height = 18
             Ctl3D = False
@@ -532,7 +532,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSLegal: TLabeledEdit
             Left = 101
-            Top = -555
+            Top = -451
             Width = 137
             Height = 18
             Ctl3D = False
@@ -544,7 +544,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leSDate: TLabeledEdit
             Left = 245
-            Top = -555
+            Top = -451
             Width = 119
             Height = 18
             Ctl3D = False
@@ -556,7 +556,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlTechParametersBar: TPanel
             Left = 62
-            Top = -510
+            Top = -406
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -564,7 +564,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartPeg: TLabeledEdit
             Left = 34
-            Top = -435
+            Top = -331
             Width = 132
             Height = 18
             Ctl3D = False
@@ -576,7 +576,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leEndPeg: TLabeledEdit
             Left = 176
-            Top = -435
+            Top = -331
             Width = 131
             Height = 18
             Ctl3D = False
@@ -588,7 +588,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLength: TLabeledEdit
             Left = 34
-            Top = -395
+            Top = -291
             Width = 132
             Height = 18
             Ctl3D = False
@@ -600,7 +600,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leLaneCount: TLabeledEdit
             Left = 176
-            Top = -395
+            Top = -291
             Width = 132
             Height = 18
             Ctl3D = False
@@ -612,7 +612,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object cbLoadLevel: TComboBox
             Left = 34
-            Top = -476
+            Top = -372
             Width = 132
             Height = 20
             Ctl3D = False
@@ -629,7 +629,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDealPayBar: TPanel
             Left = 62
-            Top = -349
+            Top = -245
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -637,7 +637,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leContractPrice: TLabeledEdit
             Left = 133
-            Top = -334
+            Top = -230
             Width = 117
             Height = 18
             BiDiMode = bdLeftToRight
@@ -655,7 +655,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leStartedSubsist: TLabeledEdit
             Left = 133
-            Top = -307
+            Top = -203
             Width = 118
             Height = 18
             Ctl3D = False
@@ -669,7 +669,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leMaterialSubsist: TLabeledEdit
             Left = 133
-            Top = -281
+            Top = -177
             Width = 119
             Height = 18
             Ctl3D = False
@@ -683,7 +683,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlSafeBar: TPanel
             Left = 62
-            Top = -245
+            Top = -141
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -691,7 +691,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlUnlockPassword: TPanel
             Left = 40
-            Top = -213
+            Top = -109
             Width = 361
             Height = 85
             BevelOuter = bvNone
@@ -919,7 +919,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leDealType: TLabeledEdit
             Left = 283
-            Top = -810
+            Top = -706
             Width = 80
             Height = 18
             Ctl3D = False
@@ -931,7 +931,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlCalcParametersBar: TPanel
             Left = 62
-            Top = -117
+            Top = -13
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -939,7 +939,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leQuantityDigit: TLabeledEdit
             Left = 100
-            Top = -82
+            Top = 22
             Width = 87
             Height = 18
             EditLabel.Width = 36
@@ -951,7 +951,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object leTotalPriceDigit: TLabeledEdit
             Left = 264
-            Top = -82
+            Top = 22
             Width = 87
             Height = 18
             EditLabel.Width = 36
@@ -963,7 +963,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object udQuantity: TUpDown
             Left = 187
-            Top = -82
+            Top = 22
             Width = 16
             Height = 18
             Associate = leQuantityDigit
@@ -973,7 +973,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object udTotalPrice: TUpDown
             Left = 351
-            Top = -82
+            Top = 22
             Width = 16
             Height = 18
             Associate = leTotalPriceDigit
@@ -982,7 +982,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object gbPM_Digit: TGroupBox
             Left = 52
-            Top = -56
+            Top = 48
             Width = 349
             Height = 49
             Caption = #20215#24046
@@ -1012,7 +1012,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object pnlDateTime: TPanel
             Left = 62
-            Top = 10
+            Top = 114
             Width = 339
             Height = 2
             BevelOuter = bvLowered
@@ -1020,7 +1020,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object dtpBaseline: TDateTimePicker
             Left = 104
-            Top = 23
+            Top = 127
             Width = 105
             Height = 20
             Date = 0.457352881945553200
@@ -1031,7 +1031,7 @@ object ProjectPropertiesForm: TProjectPropertiesForm
           end
           object dtpDeadline: TDateTimePicker
             Left = 104
-            Top = 47
+            Top = 151
             Width = 105
             Height = 20
             Date = 0.457352881945553200

+ 22 - 2
Units/CalcDecimal.pas

@@ -19,6 +19,7 @@ type
     destructor Destroy; override;
 
     function RoundTo(AValue: Double): Double;
+    function StrRoundTo(const AValue: string): string;
 
     procedure ClearLinkViewCols;
     procedure AddLinkViewCol(ACol: TObject);
@@ -65,7 +66,7 @@ type
 implementation
 
 uses
-  ProjectData, ScUtils;
+  ProjectData, ScUtils, SysUtils;
 
 { TDecimal }
 
@@ -138,6 +139,11 @@ begin
   end;
 end;
 
+function TDecimal.StrRoundTo(const AValue: string): string;
+begin
+  Result := FloatToStr(RoundTo(StrToFloatDef(AValue, 0)));
+end;
+
 { TCalcDecimal }
 
 constructor TCalcDecimal.Create;
@@ -278,7 +284,7 @@ procedure TDecimalManager.ResetLinkViewColumns;
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PAL_DeltaPrice'));
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PAL_Total'));
     end;
-    
+
     with TProjectData(FProjectData).ProjectGLData.sdvGather do
     begin
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('CurTotalPrice'));
@@ -286,6 +292,20 @@ procedure TDecimalManager.ResetLinkViewColumns;
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('EndTotalPrice'));
       FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('AddTotalPrice'));
     end;
+
+    with TProjectData(FProjectData).PriceMarginBillsData.sdvDetailGclBills do
+    begin
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_TotalPrice'));
+    end;
+
+    with TProjectData(FProjectData).PriceMarginBillsData.sdvDetailGL do
+    begin
+      FPriceMargin.Quantity.AddLinkViewCol(Columns.FindColumn('Quantity'));
+
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_PreTotalPrice'));
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_CurTotalPrice'));
+      FPriceMargin.TotalPrice.AddLinkViewCol(Columns.FindColumn('PM_EndTotalPrice'));
+    end;
   end;
 
 begin