瀏覽代碼

project manage, format display by Digit

MaiXinRong 7 年之前
父節點
當前提交
4febf36adb
共有 4 個文件被更改,包括 66 次插入4 次删除
  1. 8 1
      DataModules/ProjectManagerDm.dfm
  2. 51 1
      DataModules/ProjectManagerDm.pas
  3. 4 1
      Units/DataBaseTables.pas
  4. 3 1
      Units/ProjectData.pas

+ 8 - 1
DataModules/ProjectManagerDm.dfm

@@ -99,7 +99,14 @@ object ProjectManagerData: TProjectManagerData
       65636973696F6E02000453697A6502000001044E616D6506065765624B657909
       65636973696F6E02000453697A6502000001044E616D6506065765624B657909
       4669656C644E616D6506065765624B6579084461746154797065020108446174
       4669656C644E616D6506065765624B6579084461746154797065020108446174
       6153697A6503FF000549734B6579080F4E65656450726F636573734E616D6509
       6153697A6503FF000549734B6579080F4E65656450726F636573734E616D6509
-      09507265636973696F6E02000453697A6502000000}
+      09507265636973696F6E02000453697A6502000001044E616D65060B436F6D6D
+      6F6E4469676974094669656C644E616D65060B436F6D6D6F6E44696769740844
+      617461547970650203084461746153697A6502040549734B6579080F4E656564
+      50726F636573734E616D650909507265636973696F6E02000453697A65020000
+      01044E616D65060C4465616C5061794469676974094669656C644E616D65060C
+      4465616C50617944696769740844617461547970650203084461746153697A65
+      02040549734B6579080F4E65656450726F636573734E616D6509095072656369
+      73696F6E02000453697A6502000000}
   end
   end
   object sdvProjectsInfo: TsdDataView
   object sdvProjectsInfo: TsdDataView
     Active = False
     Active = False

+ 51 - 1
DataModules/ProjectManagerDm.pas

@@ -331,13 +331,63 @@ procedure TProjectManagerData.sdvProjectsInfoGetText(var Text: String;
     end;
     end;
   end;
   end;
 
 
+  function GetFormatString(ADigitValue: TsdValue): string;
+  begin
+    if not ADigitValue.IsNull then
+    begin
+      case ADigitValue.AsInteger of
+        0: Result := '0';
+        1: Result := '0.#';
+        2: Result := '0.##';
+        3: Result := '0.###';
+        4: Result := '0.####';
+        5: Result := '0.#####';
+        6: Result := '0.######';
+        7: Result := '0.#######';
+        8: Result := '0.########';
+        9: Result := '0.#########';
+      else
+        Result := '0.##########';
+      end;
+    end
+    else
+      Result := '';
+  end;
+
+  function FormatCommonTotalPrice(ATotalPrice: Double): string;
+  var
+    sFormat: string;
+  begin
+    Result := Text;
+    sFormat := GetFormatString(ARecord.ValueByName('CommonDigit'));
+    if sFormat <> '' then
+      Result := FormatFloat(sFormat, ATotalPrice);
+  end;
+
+  function FormatDealPayTotalPrice(ATotalPrice: Double): string;
+  var
+    sFormat: string;
+  begin
+    Result := Text;
+    sFormat := GetFormatString(ARecord.ValueByName('DealPayDigit'));
+    if sFormat <> '' then
+      Result := FormatFloat(sFormat, ATotalPrice);
+  end;
+
 begin
 begin
   if not Assigned(ARecord) then Exit;
   if not Assigned(ARecord) then Exit;
   if SameText(AColumn.FieldName, 'AuditStatus') then
   if SameText(AColumn.FieldName, 'AuditStatus') then
     if ARecord.ValueByName('Type').AsInteger = 1 then
     if ARecord.ValueByName('Type').AsInteger = 1 then
       Text := NumToAuditStatus(AValue.AsInteger)
       Text := NumToAuditStatus(AValue.AsInteger)
     else
     else
-      Text := '';
+      Text := ''
+  else if DisplayText then
+  begin
+    if Pos('TotalPrice', AColumn.FieldName) > 0 then
+      Text := FormatCommonTotalPrice(AValue.AsFloat)
+    else if SameText('PhasePay', AColumn.FieldName) then
+      Text := FormatDealPayTotalPrice(AValue.AsFloat);
+  end;
 end;
 end;
 
 
 procedure TProjectManagerData.DeleteAllTenderFiles(ANode: TsdIDTreeNode);
 procedure TProjectManagerData.DeleteAllTenderFiles(ANode: TsdIDTreeNode);

+ 4 - 1
Units/DataBaseTables.pas

@@ -28,7 +28,7 @@ const
   {ProjectManagerData}
   {ProjectManagerData}
   {项目管理}
   {项目管理}
   SProjectsInfo = 'ProjectsInfo';
   SProjectsInfo = 'ProjectsInfo';
-  tdProjectsInfo: array [0..24] of TScFieldDef =(
+  tdProjectsInfo: array [0..26] of TScFieldDef =(
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: True; ForceUpdate: False),
     (FieldName: 'ParentID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'ParentID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'NextSiblingID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'NextSiblingID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: True; PrimaryKey: False; ForceUpdate: False),
@@ -58,6 +58,9 @@ const
     (FieldName: 'FileName'; FieldType: ftString; Size: 100; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'FileName'; FieldType: ftString; Size: 100; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     // 创建日期
     // 创建日期
     (FieldName: 'CreateDate'; FieldType: ftString; Size: 20; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'CreateDate'; FieldType: ftString; Size: 20; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    // 金额小数
+    (FieldName: 'CommonDigit'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
+    (FieldName: 'DealPayDigit'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
 
 
     // 关联网络用的ID。标段和文件夹都有
     // 关联网络用的ID。标段和文件夹都有
     (FieldName: 'WebID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),
     (FieldName: 'WebID'; FieldType: ftInteger; Size: 0; Precision: 0; NotNull: False; PrimaryKey: False; ForceUpdate: False),

+ 3 - 1
Units/ProjectData.pas

@@ -266,7 +266,7 @@ implementation
 uses UtilMethods, Globals, ProjectCommands, sdIDTree, StageDm,
 uses UtilMethods, Globals, ProjectCommands, sdIDTree, StageDm,
   ZJJLDm, PHPWebDm, XMLDoc, XMLIntf, ConstUnit, PasswordInputFrm,
   ZJJLDm, PHPWebDm, XMLDoc, XMLIntf, ConstUnit, PasswordInputFrm,
   mProgressProFrm, mDataRecord, ConditionalDefines, DbTreeImport,
   mProgressProFrm, mDataRecord, ConditionalDefines, DbTreeImport,
-  StrUtils, sdProvider;
+  StrUtils, sdProvider, CalcDecimal;
 
 
 { TProjectData }
 { TProjectData }
 
 
@@ -529,6 +529,8 @@ begin
   InfoRec.ValueByName('PhasePay').AsFloat := PhaseRec.ValueByName('PhasePay').AsFloat;
   InfoRec.ValueByName('PhasePay').AsFloat := PhaseRec.ValueByName('PhasePay').AsFloat;
   InfoRec.ValueByName('PhaseCount').AsInteger := FProjProperties.PhaseCount;
   InfoRec.ValueByName('PhaseCount').AsInteger := FProjProperties.PhaseCount;
   InfoRec.ValueByName('AuditStatus').AsInteger := FProjProperties.AuditStatus;
   InfoRec.ValueByName('AuditStatus').AsInteger := FProjProperties.AuditStatus;
+  InfoRec.ValueByName('CommonDigit').AsInteger := FProjProperties.DecimalManager.Common.TotalPrice.Digit;
+  InfoRec.ValueByName('DealPayDigit').AsInteger := FProjProperties.DecimalManager.DealPay.TotalPrice.Digit;
   ProjectManager.Save;
   ProjectManager.Save;
 end;
 end;