Browse Source

其他台账,小数位数问题

MaiXinRong 8 years ago
parent
commit
3ef232e793

+ 13 - 2
DataModules/OtherMeasureOnceDm.pas

@@ -3,6 +3,7 @@ unit OtherMeasureOnceDm;
 interface
 
 uses
+  CalcDecimal,
   SysUtils, Classes, sdDB, sdProvider, ADODB;
 
 type
@@ -20,13 +21,16 @@ type
 
     function GetNewID: Integer;
     function GetNewSerialNo: Integer;
+    function GetDecimal: TCalcDecimal;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
 
     procedure Open(AConnection: TADOConnection);
     procedure Close;
-    procedure Save;    
+    procedure Save;
+    
+    property Decimal: TCalcDecimal read GetDecimal;
   end;
 
 implementation
@@ -132,7 +136,9 @@ begin
     begin
       DataSetErrorMessage(Allow, '编号、名称不可同时为空,请先填写编号或名称,再填写其他信息。');
       sddOnce.Remove(AValue.Owner);
-    end;
+    end
+    else if Pos('TotalPrice', AColumn.FieldName) > 0 then
+      Text := FloatToStr(Decimal.TotalPrice.RoundTo(StrToFloatDef(Text, 0)));
   end;
 end;
 
@@ -152,4 +158,9 @@ begin
     GetDisplayText;
 end;
 
+function TOtherMeasureOnceData.GetDecimal: TCalcDecimal;
+begin
+  Result := TProjectData(FProjectData).ProjProperties.DecimalManager.Common;
+end;
+
 end.

+ 11 - 1
DataModules/OtherMeasurePhaseDm.pas

@@ -3,6 +3,7 @@ unit OtherMeasurePhaseDm;
 interface
 
 uses
+  CalcDecimal,
   SysUtils, Classes, sdDB, sdProvider, ADODB, OMPhaseRecord;
 
 type
@@ -35,6 +36,7 @@ type
     procedure BeforeBatchOperation;
     procedure AfterBatchOperation;
     procedure SetFilterDeletedRec(const Value: Boolean);
+    function GetDecimal: TCalcDecimal;
   public
     constructor Create(AProjectData: TObject);
     destructor Destroy; override;
@@ -44,6 +46,7 @@ type
 
     procedure LoadCurStageData;
 
+    property Decimal: TCalcDecimal read GetDecimal;
     property FilterDeletedRec: Boolean read FFilterDeletedRec write SetFilterDeletedRec;
   end;
 
@@ -265,7 +268,9 @@ begin
     begin
       DataSetErrorMessage(Allow, '编号、名称不可同时为空,请先填写编号或名称,再填写其他信息。');
       sddPhase.Remove(AValue.Owner);
-    end;
+    end
+    else if Pos('TotalPrice', AColumn.FieldName) > 0 then
+      Text := FloatToStr(Decimal.TotalPrice.RoundTo(StrToFloatDef(Text, 0)));
   end;
 end;
 
@@ -318,4 +323,9 @@ begin
     GetDisplayText;
 end;
 
+function TOtherMeasurePhaseData.GetDecimal: TCalcDecimal;
+begin
+  Result := TProjectData(FProjectData).ProjProperties.DecimalManager.Common;
+end;
+
 end.

+ 2 - 0
Forms/ProjectPropertiesFrm.pas

@@ -568,6 +568,8 @@ begin
     FProjProperties.QuantityDigit := udQuantity.Position;
     FProjProperties.TotalPriceDigit := udTotalPrice.Position;
     FProjectData.ResetFloatDigitView;
+    FProjProperties.DecimalManager.Common.Quantity.Digit := udQuantity.Position;
+    FProjProperties.DecimalManager.Common.TotalPrice.Digit := udTotalPrice.Position;    
     FProjProperties.DecimalManager.PriceMargin.Quantity.Digit := udQuantity.Position;
     FProjProperties.DecimalManager.PriceMargin.TotalPrice.Digit := udTotalPrice.Position;
   end;