Browse Source

Merge branch 'master' of http://192.168.1.12:3000/maixinrong/measure

MaiXinRong 8 years ago
parent
commit
5433f73a4a

+ 2 - 2
Dprs/Pro/Measure_Cloud.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=3
 MinorVer=1
 Release=6
-Build=2136
+Build=2140
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=936
 [Version Info Keys]
 CompanyName=珠海纵横创新软件有限公司
 FileDescription=纵横结算决算计量一体化云版
-FileVersion=3.1.6.2136
+FileVersion=3.1.6.2140
 InternalName=
 LegalCopyright=版权所有(C)珠海纵横创新软件有限公司2003-2016
 LegalTrademarks=Measure

+ 6 - 0
Dprs/Pro/Measure_Cloud.dpr

@@ -5,6 +5,7 @@ program Measure_Cloud;
 uses
   Windows,
   ShareMem,
+  HttpApp,
   Forms,
   Controls,
   MainFrm in '..\..\Forms\MainFrm.pas' {MainForm},
@@ -247,16 +248,21 @@ begin
 
       {$IFDEF _mLoginNoPW}
       sName := PHPWeb.GetNameFromURLProtocol(ParamStr(1));
+
+         
       if sName = '' then         // 表示手工运行的
       begin
         Application.MessageBox('请从 项目管理信息平台 打开软件。', '系统提示', MB_OK + MB_ICONINFORMATION);
         Application.Terminate;
       end
       else
+
       begin
         // For Test only!
 //        Application.MessageBox(PChar(ParamStr(1) + #10#13 + sName), '系统提示', MB_OK + MB_ICONINFORMATION);
 //        Application.Terminate;
+        if sName[1]= '%' then
+           sName:=UTF8Decode(HttpDecode(sName));
 
         case PHPWeb.Login(sName, '', 2, sInfo, sURL) of
           ltLoginFail:

BIN
Dprs/Pro/Measure_Cloud.res


+ 12 - 12
Forms/MainFrm.dfm

@@ -21,7 +21,7 @@ object MainForm: TMainForm
   object jtsProjects: TJimTabSet
     Left = 0
     Top = 49
-    Width = 742
+    Width = 734
     Height = 21
     Align = alTop
     BackgroundColor = clGradientInactiveCaption
@@ -45,8 +45,8 @@ object MainForm: TMainForm
   end
   object dxStatusBar: TdxStatusBar
     Left = 0
-    Top = 487
-    Width = 742
+    Top = 480
+    Width = 734
     Height = 20
     Panels = <
       item
@@ -78,12 +78,12 @@ object MainForm: TMainForm
     object dxStatusBarContainer2: TdxStatusBarContainerControl
       Left = 604
       Top = 2
-      Width = 136
+      Width = 128
       Height = 16
       object ProgressBar: TProgressBar
         Left = 0
         Top = 0
-        Width = 136
+        Width = 128
         Height = 16
         Align = alClient
         Max = 200
@@ -94,8 +94,8 @@ object MainForm: TMainForm
   object jpsMain: TJimPages
     Left = 0
     Top = 70
-    Width = 742
-    Height = 417
+    Width = 734
+    Height = 410
     ActivePage = jpsMainProjectsManager
     ActivePageIndex = 0
     Align = alClient
@@ -103,8 +103,8 @@ object MainForm: TMainForm
     object jpsMainProjectsManager: TJimPage
       Left = 0
       Top = 0
-      Width = 742
-      Height = 417
+      Width = 734
+      Height = 410
       TabName = 'ProjectsManager'
       Caption = 'ProjsMgr'
       object pnlUser: TPanel
@@ -201,8 +201,8 @@ object MainForm: TMainForm
     object jpsMainProjects: TJimPage
       Left = 0
       Top = 0
-      Width = 742
-      Height = 417
+      Width = 734
+      Height = 410
       TabName = 'Projects'
       Caption = 'Projects'
       object jpsProjects: TJimPages
@@ -220,7 +220,7 @@ object MainForm: TMainForm
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Height = -12
-    Font.Name = 'Microsoft YaHei UI'
+    Font.Name = #24494#36719#38597#40657
     Font.Style = []
     Bars = <
       item

+ 1 - 1
Forms/ReportsFrm.dfm

@@ -216,7 +216,7 @@ object ReportsForm: TReportsForm
     Font.Charset = DEFAULT_CHARSET
     Font.Color = clWindowText
     Font.Height = -12
-    Font.Name = 'Microsoft YaHei UI'
+    Font.Name = #24494#36719#38597#40657
     Font.Style = []
     Bars = <
       item

+ 2 - 2
Forms/ReportsFrm.pas

@@ -327,9 +327,9 @@ end;
 procedure TReportsForm.PreviewReportCurPage;
 begin
   if FbNormal then
-    PreviewComXML.PrintPreviewCanvas(-1, PrecededCount, PreviewBox.Canvas)
+    PreviewComXML.PrintPreviewCanvas(-1, PrecededCount, PreviewBox.Canvas, True)
   else //Ç¿ÖÆ1:1ÏÔʾ
-    PreviewComXML.PrintPreviewCanvas(CurPage, 0, PreviewBox.Canvas);
+    PreviewComXML.PrintPreviewCanvas(CurPage, 0, PreviewBox.Canvas, True);
 end;
 
 procedure TReportsForm.ResizePreviewBox;

+ 2 - 2
Units/CalcDecimal.pas

@@ -76,7 +76,7 @@ type
 implementation
 
 uses
-  ProjectData, ScUtils, SysUtils;
+  ProjectData, UtilMethods, SysUtils;
 
 { TDecimal }
 
@@ -147,7 +147,7 @@ begin
   if Assigned(RelaDecimal) then
     Result := FRelaDecimal.RoundTo(AValue)
   else
-    Result := ScRoundTo(AValue, -Digit);
+    Result := CommonRoundTo(AValue, -Digit);
 end;
 
 procedure TDecimal.SetDigit(const Value: Integer);

+ 64 - 13
Units/UtilMethods.pas

@@ -7,14 +7,15 @@ uses
   sdDB, VCLZip, VCLUnZip, Dialogs, Forms, ShlObj, Classes, StrUtils, Math, ADODB,
   IdGlobal;
 
-type
+type 
+  TRoundMode = (rmNearest, rmUp, rmDown);
   TBookmarkRefreshEvent = procedure (AExpandFrame: Boolean) of object;
 
   {RoundTo}
   function QuantityRoundTo(AValue: Double): Double;
   function PriceRoundTo(AValue: Double): Double;
   function TotalPriceRoundTo(AValue: Double): Double;
-  function CommonRoundTo(AValue: Double; ADigit: Integer): Double;
+  function CommonRoundTo(AValue: Double; ADigit: Integer; RoundMode: TRoundMode = rmNearest): Double;
 
   {Interface Control}
   procedure AlignControl(AControl, AParent: TWinControl; AAlign: TAlign);
@@ -117,40 +118,90 @@ type
 implementation
 
 uses
-  SysUtils, dxBar, MainFrm, ConstUnit, Globals, StdCtrls, ShellAPI,
-  ScUtils;
+  SysUtils, dxBar, MainFrm, ConstUnit, Globals, StdCtrls, ShellAPI;
 
 var
   SysProgressDisabled: Boolean;
 
 {RoundTo}
+function InnerRoundTo(const AValue: Extended; const ADigit: Integer; RoundMode: TRoundMode): Extended;
+var
+  LFactor, Offset: Extended;
+  HFactor: Integer;
+begin
+  LFactor := IntPower(10, ADigit);
+  HFactor := Trunc(IntPower(10, abs(ADigit)));
+  Result := AValue;
+  case RoundMode of
+    rmNearest:
+    begin
+      if AValue >= 0 then
+        Offset := 0.5
+      else
+        Offset := -0.5;
+      Result := Trunc((AValue * HFactor) + Offset) * LFactor;
+    end;
+    rmUP:
+    begin
+      if Frac(AValue / LFactor) > 0 then
+        Result := Trunc(AValue * HFactor + 1) * LFactor
+      else
+        Result := Trunc(AValue * HFactor) * LFactor;
+    end;
+    rmDown:
+    begin
+      Result := Trunc(AValue * HFactor) * LFactor;
+    end;
+  end;
+end;
+
 function QuantityRoundTo(AValue: Double): Double;
 begin
   if Assigned(OpenProjectManager.CurProjectData) then
-    Result := ScRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.QuantityDigit)
+    Result := CommonRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.QuantityDigit)
   else
-    Result := ScRoundTo(AValue, iQuantityDigit);
+    Result := CommonRoundTo(AValue, iQuantityDigit);
 end;
 
 function PriceRoundTo(AValue: Double): Double;
 begin
   if Assigned(OpenProjectManager.CurProjectData) then
-    Result := ScRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.PriceDigit)
+    Result := CommonRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.PriceDigit)
   else
-    Result := ScRoundTo(AValue, iPriceDigit);
+    Result := CommonRoundTo(AValue, iPriceDigit);
 end;
 
 function TotalPriceRoundTo(AValue: Double): Double;
 begin
   if Assigned(OpenProjectManager.CurProjectData) then
-    Result := ScRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.TotalPriceDigit)
+    Result := CommonRoundTo(AValue, -OpenProjectManager.CurProjectData.ProjProperties.TotalPriceDigit)
   else
-    Result := ScRoundTo(AValue, iTotalPriceDigit);
+    Result := CommonRoundTo(AValue, iTotalPriceDigit);
 end;
 
-function CommonRoundTo(AValue: Double; ADigit: Integer): Double;
-begin
-  Result := ScRoundTo(AValue, ADigit);
+function CommonRoundTo(AValue: Double; ADigit: Integer; RoundMode: TRoundMode = rmNearest): Double;
+var
+  X: Double;
+  P: Pointer;
+  I: Integer;
+  Buf: array [0..7] of Byte;
+begin
+  P := @AValue;
+  CopyMemory(@Buf[0], P, SizeOf(AValue));
+  // 进位处理,从后往前,如果当前byte为$FF,则往前一byte进1
+  // 注意到尾数开始的位置停止
+  // 这里说的前后是二进制串,实际存储前后相反
+  for I := 0 to 6 do
+    if (I < 6) and (Buf[I] = $FF) then
+      Buf[I] := 0
+    else
+    begin
+      Buf[I] := Buf[I] + 1;
+      Break;
+    end;
+  P := @X;
+  CopyMemory(P, @Buf[0], SizeOf(X));
+  Result := InnerRoundTo(X, ADigit, RoundMode);
 end;
 
 {Interface Control}