Parcourir la source

Task #1186 根据选项,导出不同格式的Excel

MaiXinRong il y a 9 ans
Parent
commit
0dc53e84cf
6 fichiers modifiés avec 72 ajouts et 11 suppressions
  1. 9 9
      Forms/MainFrm.dfm
  2. 8 2
      Forms/MainFrm.pas
  3. 17 0
      Forms/OptionFrm.dfm
  4. 4 0
      Forms/OptionFrm.pas
  5. 4 0
      Units/ConfigDoc.pas
  6. 30 0
      Units/ExportExcel.pas

+ 9 - 9
Forms/MainFrm.dfm

@@ -20,7 +20,7 @@ object MainForm: TMainForm
   TextHeight = 12
   object jtsProjects: TJimTabSet
     Left = 0
-    Top = 48
+    Top = 49
     Width = 742
     Height = 21
     Align = alTop
@@ -45,7 +45,7 @@ object MainForm: TMainForm
   end
   object dxStatusBar: TdxStatusBar
     Left = 0
-    Top = 484
+    Top = 487
     Width = 742
     Height = 20
     Panels = <
@@ -93,9 +93,9 @@ object MainForm: TMainForm
   end
   object jpsMain: TJimPages
     Left = 0
-    Top = 69
+    Top = 70
     Width = 742
-    Height = 415
+    Height = 417
     ActivePage = jpsMainProjectsManager
     ActivePageIndex = 0
     Align = alClient
@@ -104,7 +104,7 @@ object MainForm: TMainForm
       Left = 0
       Top = 0
       Width = 742
-      Height = 415
+      Height = 417
       TabName = 'ProjectsManager'
       Caption = 'ProjsMgr'
       object pnlUser: TPanel
@@ -202,7 +202,7 @@ object MainForm: TMainForm
       Left = 0
       Top = 0
       Width = 742
-      Height = 415
+      Height = 417
       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 = #23435#20307
+    Font.Name = 'Microsoft YaHei UI'
     Font.Style = []
     Bars = <
       item
@@ -270,7 +270,7 @@ object MainForm: TMainForm
         Caption = #24037#20855#26639
         DockedDockingStyle = dsTop
         DockedLeft = 0
-        DockedTop = 26
+        DockedTop = 27
         DockingStyle = dsTop
         FloatLeft = 484
         FloatTop = 279
@@ -379,7 +379,7 @@ object MainForm: TMainForm
     DockControlHeights = (
       0
       0
-      48
+      49
       0)
     object dxsiFile: TdxBarSubItem
       Caption = #25991#20214'(&F)'

+ 8 - 2
Forms/MainFrm.pas

@@ -715,7 +715,10 @@ begin
   begin
     Exportor := TIDTreeExcelExportor.Create;
     try
-      Exportor.DefineCol(@ciLedger, Length(ciLedger));
+      if SupportManager.ConfigInfo.ExcelWithMis then
+        Exportor.DefineCol(@ciLedgerWithMis, Length(ciLedgerWithMis))
+      else
+        Exportor.DefineCol(@ciLedger, Length(ciLedger));
       Exportor.HasLevelCode := True;
       Exportor.ExportToFile(CurProjectFrame.ProjectData.BillsCompileData.BillsCompileTree, sFileName);
     finally
@@ -799,7 +802,10 @@ begin
   begin
     Exportor := TIDTreeExcelExportor.Create;
     try
-      Exportor.DefineCol(@ciFxBills, Length(ciFxBills));
+      if SupportManager.ConfigInfo.ExcelWithMis then
+        Exportor.DefineCol(@ciFxBillsWithMis, Length(ciFxBillsWithMis))
+      else
+        Exportor.DefineCol(@ciFxBills, Length(ciFxBills));
       Exportor.ExportToFile(CurProjectFrame.ProjectData.BillsCompileData.BillsCompileTree, sFileName);
     finally
       Exportor.Free;

+ 17 - 0
Forms/OptionFrm.dfm

@@ -125,6 +125,23 @@ object OptionForm: TOptionForm
           OnClick = rbLedgerClick
         end
       end
+      object GroupBox1: TGroupBox
+        Left = 11
+        Top = 176
+        Width = 430
+        Height = 49
+        Caption = #23548#20986'Excel'
+        TabOrder = 4
+        object cbExcelWithMis: TCheckBox
+          Left = 11
+          Top = 20
+          Width = 142
+          Height = 17
+          Caption = #21253#21547#38169#28431#22686#20943#25968#37327
+          TabOrder = 0
+          OnClick = cbAutoSaveClick
+        end
+      end
     end
   end
   object btnOk: TButton

+ 4 - 0
Forms/OptionFrm.pas

@@ -24,6 +24,8 @@ type
     rbLedger: TRadioButton;
     rbDeal: TRadioButton;
     rbBoth: TRadioButton;
+    GroupBox1: TGroupBox;
+    cbExcelWithMis: TCheckBox;
     procedure cbAutoSaveClick(Sender: TObject);
     procedure rbLedgerClick(Sender: TObject);
   private
@@ -70,6 +72,7 @@ begin
     SetSaveIntervalEnable(cbAutoSave.Checked);
     cbbSaveIntervall.Text := IntToStr(AutoSaveInterval);
     Self.OverRangeType := OverRangeType;
+    cbExcelWithMis.Checked := ExcelWithMis;
   end;
 end;
 
@@ -80,6 +83,7 @@ begin
     AutoSave := cbAutoSave.Checked;
     AutoSaveInterval := StrToIntDef(cbbSaveIntervall.Text, 15);
     OverRangeType := Self.OverRangeType;
+    ExcelWithMis := cbExcelWithMis.Checked;
   end;
 end;
 

+ 4 - 0
Units/ConfigDoc.pas

@@ -21,6 +21,7 @@ type
     FAutoSave: Boolean;
     FAutoSaveInterval: Integer;
     FOverRangeType: Integer;
+    FExcelWithMis: Boolean;
 
     procedure LoadSectionOfUnitList;
     procedure LoadSectionOfStdFile;
@@ -56,6 +57,7 @@ type
     property AutoSave: Boolean read FAutoSave write FAutoSave;
     property AutoSaveInterval: Integer read FAutoSaveInterval write FAutoSaveInterval;
     property OverRangeType: Integer read FOverRangeType write FOverRangeType;
+    property ExcelWithMis: Boolean read FExcelWithMis write FExcelWithMis;
   end;
 
 implementation
@@ -111,6 +113,7 @@ begin
   FAutoSave := FIniFile.ReadBool('Options', 'AutoSave', True);
   FAutoSaveInterval := FIniFile.ReadInteger('Options', 'AutoSaveInterval', 15);
   FOverRangeType := FIniFile.ReadInteger('Options', 'OverRangeType', 0);
+  FExcelWithMis := FIniFile.ReadBool('Options', 'ExcelWithMis', False);
 end;
 
 procedure TConfigInfo.LoadSectionOfPath;
@@ -149,6 +152,7 @@ begin
   FIniFile.WriteBool('Options', 'AutoSave', FAutoSave);
   FIniFile.WriteInteger('Options', 'AutoSaveInterval', FAutoSaveInterval);
   FIniFile.WriteInteger('Options', 'OverRangeType', FOverRangeType);
+  FIniFile.WriteBool('Options', 'ExcelWithMis', FExcelWithMis);
 end;
 
 procedure TConfigInfo.SaveSectionOfStdFile;

+ 30 - 0
Units/ExportExcel.pas

@@ -96,6 +96,20 @@ const
     (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
   );
 
+  ciLedgerWithMis: array [0..10] of TColInfo =(
+    (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '淃커쌘긍뵀'; Width: 120; HorTextAlign: htaLeft),
+    (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데긍뵀'; Width: 80; HorTextAlign: htaLeft),
+    (FieldName: 'Name'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '츰냔'; Width: 200; HorTextAlign: htaLeft),
+    (FieldName: 'Units'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데貫'; Width: 40; HorTextAlign: htaCenter),
+    (FieldName: 'Price'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데송'; Width: 60; HorTextAlign: htaRight),
+    (FieldName: 'OrgQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '嘉묏暠鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'MisQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'OthQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '페儉댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'TotalPrice'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '쏜띨'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DrawingCode'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '暠뵀'; Width: 100; HorTextAlign: htaLeft),
+    (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
+  );
+
   ciFxBills: array [0..10] of TColInfo =(
     (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '渡炬淃커쌘'; Width: 120; HorTextAlign: htaLeft),
     (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데綾커뵀'; Width: 80; HorTextAlign: htaLeft),
@@ -110,6 +124,22 @@ const
     (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
   );
 
+  ciFxBillsWithMis: array [0..12] of TColInfo =(
+    (FieldName: 'Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '渡炬淃커쌘'; Width: 120; HorTextAlign: htaLeft),
+    (FieldName: 'B_Code'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데綾커뵀'; Width: 80; HorTextAlign: htaLeft),
+    (FieldName: 'Name'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '츰냔'; Width: 200; HorTextAlign: htaLeft),
+    (FieldName: 'Units'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데貫'; Width: 40; HorTextAlign: htaCenter),
+    (FieldName: 'OrgQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '헌데鑒좆'; Width: 902; HorTextAlign: htaRight),
+    (FieldName: 'MisQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'OthQuantity'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '페儉댄짤鑒좆'; Width: 90; HorTextAlign: htaRight),
+    (FieldName: 'DgnQuantity1'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕鑒좆1'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DgnQuantity2'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '�셕鑒좆2'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'Price'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '데송'; Width: 60; HorTextAlign: htaRight),
+    (FieldName: 'TotalPrice'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '북송'; Width: 80; HorTextAlign: htaRight),
+    (FieldName: 'DrawingCode'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '暠뵀'; Width: 100; HorTextAlign: htaLeft),
+    (FieldName: 'MemoStr'; KeyField: ''; LookupKeyField: ''; LookupDataSetIndex: -1; TitleCaption: '구鬧'; Width: 80; HorTextAlign: htaLeft)
+  );
+
 implementation
 
 uses