| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977 |
- {*******************************************************************************
- 单元名称: ScReportsFrm.pas
- 单元说明: 因报表相关单元使用_ScEncrypt编译变量,为了能直接使用SmartCost中的
- 报表相关单元文件,现将本系统中所有编译变量_beEncrypt换成_ScEncrypt
- 作 者: 康彤
- 修 改 人: Chenshilong, 2011-07-13
- *******************************************************************************}
- // chenshilong, 2011-07-13
- unit ScReportsFrm;
- interface
- {$IFDEF _beEncrypt}
- {$DEFINE _ScCanPrint}
- {$ENDIF}
- {$IFDEF _ScBidder}
- {$DEFINE _ScCanPrint}
- {$ENDIF}
- {$IFDEF _ScOnline}
- {$DEFINE _ScCanPrint}
- {$ENDIF}
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, dxBar, ImgList, dxBarExtItems, ExtCtrls, DB, Printers,WinSpool,
- ExTreeView, PrintCom, PrintComXML, PrintComTypeDefUnit, IniFiles, ScProgressFrm,
- ScFileArchiver, Menus, StdCtrls,
- {$IFDEF _beEncrypt}
- ScEncryptUnit,
- {$ENDIF}
- // zy
- ScUtils, ScConsts, ScReportUtils, ADODB, DirectPrintUnit,
- ScWorkListFrm, Grids, DBGrids, ScProjectManager, ScReportDM;
- const
- crMyIdxNext = -25;
- crMyIdxPrevious = -26;
- crMyIdxFirst = -27;
- crMyIdxLast = -28;
-
- type
- // lsm
- ScCompareType = (CompareBills, CompareMaterial, CompareRation);
- TScReportsForm = class(TForm)
- xdcTop: TdxBarDockControl;
- xmReports: TdxBarManager;
- xlbPrint: TdxBarLargeButton;
- ilstLarge: TImageList;
- xlbToExcel: TdxBarLargeButton;
- xlbOnePage: TdxBarLargeButton;
- xlbTwoPage: TdxBarLargeButton;
- xlbFourPage: TdxBarLargeButton;
- xcbPages: TdxBarCombo;
- xlbFirstPage: TdxBarLargeButton;
- xlbPrePage: TdxBarLargeButton;
- xlbNextPage: TdxBarLargeButton;
- xlbLastPage: TdxBarLargeButton;
- xlbSetup: TdxBarLargeButton;
- xlbClose: TdxBarLargeButton;
- xcbBillsItem: TdxBarCombo;
- extvReport: TExTreeView;
- Splitter1: TSplitter;
- ScrollBox1: TScrollBox;
- PreviewBox: TImage;
- PreviewComXML: TPrintComXML;
- xcbStartPage: TdxBarCombo;
- xcbEndPage: TdxBarCombo;
- xcbRptAfterModified: TdxBarButton;
- xlbRealSize: TdxBarLargeButton;
- sdOutputExcel: TSaveDialog;
- xccRptIsModified: TdxBarControlContainerItem;
- pnlRptIsModified: TPanel;
- rbRptBeforeModified: TRadioButton;
- rbRptAfterModified: TRadioButton;
- ilstTree: TImageList;
- xlbToPDF: TdxBarLargeButton;
- dxBarSubItem1: TdxBarSubItem;
- xlbPrintCurPage: TdxBarLargeButton;
- dxBarControlContainerItem1: TdxBarControlContainerItem;
- dxBarControlContainerItem3: TdxBarControlContainerItem;
- PaperSizePanel: TPanel;
- rdbtnA3: TRadioButton;
- rdbtnA4: TRadioButton;
- chkFillZero: TCheckBox;
- PopupMenu1: TPopupMenu;
- popMnuOutputData: TMenuItem;
- cbbPP: TdxBarCombo;
- pnlExcelMode: TPanel;
- chkExcelMode: TCheckBox;
- chkExcel2010: TCheckBox;
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure xlbCloseClick(Sender: TObject);
- procedure FormResize(Sender: TObject);
- procedure FormShow(Sender: TObject);
- procedure xlbPrintClick(Sender: TObject);
- procedure xlbToExcelClick(Sender: TObject);
- procedure xlbOnePageClick(Sender: TObject);
- procedure xlbTwoPageClick(Sender: TObject);
- procedure xlbFourPageClick(Sender: TObject);
- procedure xlbFirstPageClick(Sender: TObject);
- procedure xcbPagesChange(Sender: TObject);
- procedure xlbPrePageClick(Sender: TObject);
- procedure xlbNextPageClick(Sender: TObject);
- procedure xlbLastPageClick(Sender: TObject);
- procedure xlbSetupClick(Sender: TObject);
- procedure PreviewBoxMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure PreviewBoxMouseDownEx(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure FormCreate(Sender: TObject);
- procedure extvReportDblClick(Sender: TObject);
- procedure PreviewComXMLGetDataConnection(var ADOCon: TADOConnection);
- // 汇总项目要换ADOConnection, chenshilong, 2011-07-13
- procedure PreviewComXMLGetGatherProjDataConnection(var ADOCon: TADOConnection);
- procedure xcbStartPageCurChange(Sender: TObject);
- procedure xcbEndPageCurChange(Sender: TObject);
- procedure xcbPagesCurChange(Sender: TObject);
- procedure xlbRealSizeClick(Sender: TObject);
- procedure Splitter1Moved(Sender: TObject);
- procedure PreviewComXMLGetDatasetEvent(DatasetInfo: PDatasetInfoRec;
- var ADataset: TDataSet);
- procedure xcbRptAfterModifiedClick(Sender: TObject);
- procedure FlowDataPrintEvent(var Text: String;
- var FontInfo: TFontRec; FieldID: Integer; ARect: TRect; DC: TCanvas);
- procedure CrossDataPrintEvent(var Text: String;
- var FontInfo: TFontRec; FieldID: Integer; ARect: TRect; DC: TCanvas);
- procedure xmReportsClickItem(Sender: TdxBarManager;
- ClickedItem: TdxBarItem);
- procedure extvReportChanging(Sender: TObject; Node: TExTreeNode;
- var AllowChange: Boolean);
- procedure extvReportChange(Sender: TObject; Node: TExTreeNode);
- procedure PreviewComXMLCrossTabLabelShow(valIDX: Integer; var ExLeft,
- ExRight: Double; var isShow: Boolean; CrsTabShowType: Integer);
- procedure xlbToPDFClick(Sender: TObject);
- procedure xlbPrintCurPageClick(Sender: TObject);
- procedure xdcTopDblClick(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure ReplaceSpecChar(var ShowText : String);
- procedure rdbtnA3Click(Sender: TObject);
- procedure rdbtnA4Click(Sender: TObject);
- procedure PreviewComXMLContentDisplay(var contentFontRec: TFontRec;
- dataType: Integer; isReading : boolean; DrawType : integer; isPrinting : boolean);
- procedure popMnuOutputDataClick(Sender: TObject);
- procedure chkFillZeroClick(Sender: TObject);
- procedure PreviewBoxMouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure PreviewBoxMouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- private
- { Private declarations }
- intPage : integer;
- intGroup : integer;
- intCntPerPage : integer;
- bShowNormal : boolean; //true是普通方式显示,false是强制1:1显示
- ExePath : string;
- //intOldX : integer;
- //intOldY : integer;
- //Tony Kang 2004-09-04----------------------------------------------------
- SpIDX : integer;
- //特殊指标
- //Tony Kang 2004-09-04-end------------------------------------------------
- intTimer : integer;
- {$IFNDEF _KTDebug}
- FProject: TProject;
- FGatherProject: TProject;
- FCurGatherProjRepName: string;
- {$ENDIF}
- strModified : string;
- //lt
- FRefCount: Integer;
- strConfigTxt : string;
- // zy
- FReportManager: TScReportManager;
- FWorkListForm: TScWorkListForm;
- // for mouse move usage
- FCurrentMouseP : TPoint;
- StartMoveRpt : boolean;
- isNarraw : boolean;
- bkContentFontHeight : integer;
- intCurStatus : integer;
- //0: normal, 1: next page, 2: previous page 3: first page, 4: last page
- // Chenshilong
- FHaveTempTabDivideCode: Boolean;
- FHaveTempTab01: Boolean;
- FHaveTempTab08: Boolean;
- FProjectPhase: TProjectPhase;
- FGatherProjectSL: TStringList;
- //lt 2010.3.25
- procedure IncRefCount;
- function IsNotRefCountAbove: Boolean;
- procedure DoWriteReportprogress(APosition: Integer; AMax: Integer = 0);
- procedure ReportPreview;
- procedure setupReport;
- procedure LoadReports;
- function IsEstimate1: Boolean;
- procedure setupPage(pageSize : String);
- procedure setPrinterOrientation();
- {$IFNDEF _KTDebug}
- procedure SetProject(const Value: TProject);
- {$ENDIF}
- procedure startMove(X, Y: Integer);
- procedure moveRpt(X, Y: integer);
- procedure endMove(X, Y: Integer);
- //procedure setDefaultExcelBorder(var Border : TColumnLineRec);
- // zhangyin
- procedure PreviewComXMLProgress(RptName: string; TotalPages: Integer; CurrentPage: Integer);
- public
- { Public declarations }
- ReportName : string;
- PreReportName : string;
- {$IFNDEF _KTDebug}
- property Project: TProject read FProject write SetProject;
- {$ENDIF}
- function GetProjectPhaseByName(AName: string): TProjectPhase;
- property CurGatherProjectReportName: string read FCurGatherProjRepName write FCurGatherProjRepName;
- end;
- var
- ReportsForm: TScReportsForm;
- // lsm
- CompareType: ScCompareType;
- procedure DisplayReports(AProject: TProject);
- //{$R PageRolling.res}
- implementation
- uses ReportAdjusterUnit, CommonMessages, MainForm, ScGatherProjFrm;
- const
- // 审核比较表DataSet
- CompareDataSetID = 1;
- // 审核比较表项目名称DataSet
- CompareNameDataSetID = 2;
- // 总汇总表DataSet
- GatherDataSetID = 3;
- // 总汇总表名称DataSet
- // GatherNameDataSetID = 4;
- // 总工料机汇总表DataSet
- GLJGatherDataSetID = 5;
- // 【03-2】建筑安装工程费审计表(黑龙江)
- HLJ_ComareBillsID = 10;
- // 【01-3】总预算审计表(黑龙江)01-3
- HLJ_ComareRationsID = 11;
- // 审核建设项目信息DataSet
- CompareBuildProjDataID = 100;
- // 汇总建设项目信息DataSet
- GatherBuildProjDataID = 101;
- // 总工料机汇总建设项目信息DataSet
- GLJGatherBuildProjDataID = 102;
- // 【03-2】建筑安装工程费审计表(黑龙江)
- HLJ_ComareBillsProjID = 110;
- // 【01-3】总预算审计表(黑龙江)01-3
- HLJ_ComareRationsProjID = 111;
- // lsm 新增汇总表
- // 汇总建设项目细目直接工程费DWF明细表DataSet
- GatheDWFDataSetID = 6;
- // 汇总DWF建设项目信息DataSet
- GatherDWFBuildProjDataID = 103;
- // 主材权重对比表
- CompareMaterialDataSetID = 7;
- // 主材权重对比项目名称DataSet
- CompareMaterialProjNamesID = 8;
- // 主材权重对比建设项目信息DataSet
- CompareMaterialProjDataID = 104;
- // 主材权重对比材料费、建安费信息DataSet
- CompareMaterialProjFeeID = 105;
- // 工料机权重汇总表DataSet
- GatherGLJPropDataSetID = 9;
- // 工料机权重汇总建设项目信息DataSet
- GatherGLJPropProjDataID = 106;
- // 单价偏差汇总表
- GatherEcoLineDataSetID = 12;
- // 单价偏差汇总项目名称DataSet
- GatherEcoLineProjDataID = 107;
- // 审核比较定额表(标表4-3格式)
- CompareRationDataSetID = 13;
- // 审核比较定额表汇总清单名称DataSet
- CompareRationBillDataID = 108;
- // 指标单价汇总表
- GatherUnitPriceDataSetID = 14;
- // 指标单价汇总项目名称DataSet
- GatherUnitPriceProjDataID = 109;
- // 指标单价汇总表(广东)
- GatherBillsUnitPriceDataSetID = 15;
- // 指标单价汇总(广东)项目名称DataSet
- GatherBillsUnitPriceProjDataID = 120;
- (*// 审核比较定额表(标表4-3格式) ProjNames
- CompareRationProjNamesID = 121;
- // 审核比较定额表(标表4-3格式) ProjData
- CompareRationBillProjDataID = 122; *)
- // 土地项目清单汇总表(广东)
- GatherGroundDataSetID = 16;
- // 土地项目清单汇总表(广东)项目名称DataSet
- GatherGroundProjDataID = 123;
- // 标表1汇总表(广东招预总01-2)
- GatherStandardOneDataSetID = 17;
- // 标表1汇总表(广东招预总01-2)项目名称DataSet
- GatherStandardOneProjDataID = 124;
- // 合同征拆总01表
- GatherGroundChapterDataSetID = 18;
- // 合同征拆总01表项目名称DataSet
- GatherGroundChapterProjDataID = 125;
- // 项目计日工清单汇总表(广东)
- GatherDatallerDataSetID = 19;
- // 项目计日工清单汇总表(广东)项目名称DataSet
- GatherDatallerProjDataID = 126;
- var
- CompareReportCount: Integer = 0;
- GathereReportCount: Integer = 0;
- GLJGatherCount: Integer = 0;
- HLJCompareBillsCount: Integer = 0;
- HLJCompareRationsCount: Integer = 0;
- // lsm
- GatheDWFReportCount: Integer = 0;
- CompareMateCount: Integer = 0;
- GatherGLJPropCount: Integer = 0;
- GatherEcoLineReportCount: Integer = 0;
- CompareRationReportCount: Integer = 0;
- GatherUnitPriceCount: Integer = 0;
- GatherGroundPriceCount: Integer = 0;
- GatherStandardOneCount: Integer = 0;
- GatherGroundChapterCount: Integer = 0;
- GatherDatallerCount: Integer = 0;
- procedure DisplayReports(AProject: TProject);
- begin
- ReportsForm := TScReportsForm.Create(nil);
- ReportsForm.Project := AProject;
- ReportsForm.ShowModal;
- end;
- {$R *.dfm}
- (*
- procedure TScReportsForm.setDefaultExcelBorder(var Border : TColumnLineRec);
- var FileName, ExePath : String;
- L_IniFile : TIniFile;
- begin
- ExePath := ExtractFilePath(Application.ExeName);
- FileName := ExePath + STR_CONFIG_TEXT;
- L_IniFile := TIniFile.Create(FileName);
- Border.LeftThick := 0.5;
- Border.TopThick := 0.5;
- Border.RightThick := 0.5;
- Border.BottomThick := 0.5;
- if (L_IniFile.ReadInteger('页面', '报表边框竖线', 0) = 0) then
- begin
- Border.LeftThick := 0;
- Border.RightThick := 0;
- end;
- L_IniFile.Free;
- end;
- *)
- procedure TScReportsForm.FormClose(Sender: TObject;
- var Action: TCloseAction);
- begin
- Action := caFree;
- end;
- procedure TScReportsForm.xlbCloseClick(Sender: TObject);
- begin
- Close;
- end;
- procedure TScReportsForm.FormResize(Sender: TObject);
- var intMaxHeight, intMaxWidth : integer;
- begin
- if Printer.Printers.Count = 0 then
- begin
- exit;
- end;
- if (bShowNormal) then
- begin
- if PreviewBox.Height <> ScrollBox1.ClientHeight then
- begin
- PreviewBox.Height := ScrollBox1.ClientHeight;
- PreviewBox.Picture.Bitmap.Height := ScrollBox1.ClientHeight;
- end;
- if PreviewBox.Width <> ScrollBox1.ClientWidth then
- begin
- PreviewBox.Width := ScrollBox1.ClientWidth;
- PreviewBox.Picture.Bitmap.Width := ScrollBox1.ClientWidth;
- end;
- end else
- begin
- intMaxHeight := PreviewComXML.PrintHeight + 20;
- if intMaxHeight < ScrollBox1.ClientHeight then
- intMaxHeight := ScrollBox1.ClientHeight;
- intMaxWidth := PreviewComXML.PrintWidth + 20;
- if intMaxWidth < ScrollBox1.ClientWidth then
- intMaxWidth := ScrollBox1.ClientWidth;
- if PreviewBox.Height <> intMaxHeight then
- begin
- PreviewBox.Height := PreviewComXML.PrintHeight + 20;
- PreviewBox.Picture.Bitmap.Height := PreviewBox.Height;
- end;
- if PreviewBox.Width <> intMaxWidth then
- begin
- PreviewBox.Width := PreviewComXML.PrintWidth + 20;
- PreviewBox.Picture.Bitmap.Width := PreviewBox.Width;
- end;
- end;
- ReportPreview;
- end;
- procedure TScReportsForm.ReportPreview;
- begin
- PreviewComXML.FillZero := chkFillZero.Checked;
- if bShowNormal then
- begin //普通显示
- PreviewComXML.PrintPreviewCanvas(-1,intGroup,PreviewBox.Canvas);
- end else
- begin //强制1:1显示
- PreviewComXML.PrintPreviewCanvas(intPage,0,PreviewBox.Canvas);
- end;
- end;
- // zy
- procedure TScReportsForm.LoadReports;
- var
- strVer, sRDir: string;
- begin
- sRDir := 'BillsEditorReports\*';
- FReportManager.LoadFromSRT(ExePath + sRDir + FILEEXT,
- '主版本=招投标版');
- end;
- procedure TScReportsForm.setupReport;
- var i,j,k : integer;
- douJ : double;
- intW : integer;
- FIni : TIniFile;
- strFileName : string;
- ObjList : TList;
- TitleRec : PTitleRec;
- ColumnRec : PColumnRec;
- FlowContentRec : PContentRec;
- CrossContentRec : PCrossContentRec;
- //CrossContentRec : PContentRec;
- SumRec : PSumRec;
- HeadTailRec : PHeadRec;
- ShapeRec : PPicRec;
- PageObj : PPageRec;
- AAR : PActiveAreaRec;
- SER : PShowElementRec;
- procedure setActAreaBorder(intSetType : integer; BorderWidth : double); //0:左右边框; 1: 上下边框; 2:竖线; 3:横线
- var i,k : integer;
- ActAreaRec : PActiveAreaRec;
- PSR : PShowElementRec;
- PTR : PTextRec;
- PCR : PColumnRec;
- begin
- ActAreaRec := nil;
- PreviewComXML.getAllActAreaObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ActAreaRec := ObjList[i];
- case ActAreaRec.ShowType of
- 0..2 :
- begin
- if ActAreaRec.ElementList <> nil then
- begin
- for k := 0 to ActAreaRec.ElementList.Count - 1 do
- begin
- PSR := PShowElementRec(ActAreaRec.ElementList[k]);
- case PSR.ElementType of
- 0..2 : //文本,参数,字段, 表栏
- begin
- PTR := PSR.Data;
- case intSetType of
- 0 : begin //左右边框
- //if PTR.ExArea.ExLeft = 0.0 then
- (*
- if PTR.ExArea.ExLeft = 0.0 then
- begin
- if BorderWidth <> 1.0 then
- PTR.LineInfo.LeftThick := BorderWidth
- else
- PTR.LineInfo.LeftThick := BorderWidth / 2;
- end;
- if PTR.ExArea.ExRight = 100.0 then
- begin
- if BorderWidth <> 1.0 then
- PTR.LineInfo.RightThick := BorderWidth
- else
- PTR.LineInfo.RightThick := BorderWidth / 2;
- end;
- //*)
- if PTR.ExArea.ExLeft = 0.0 then
- begin
- if BorderWidth = 0.0 then
- PTR.LineInfo.LeftThick := BorderWidth
- end;
- if PTR.ExArea.ExRight = 100.0 then
- begin
- if BorderWidth = 0.0 then
- PTR.LineInfo.RightThick := BorderWidth
- end;
- end;
- 1 : begin //上下边框
- //约定中无此项,暂缓
- end;
- 2 : begin //竖线
- (*
- if (PTextRec(PSR.Data).LineInfo.LeftThick >= 0.2) and (BorderWidth >= 0.2) then
- PTextRec(PSR.Data).LineInfo.LeftThick := BorderWidth;
- if (PTextRec(PSR.Data).LineInfo.RightThick >= 0.2) and (BorderWidth >= 0.2) then
- PTextRec(PSR.Data).LineInfo.RightThick := BorderWidth;
- //
- if PTR.ExArea.ExLeft = 0.0 then
- PTR.LineInfo.LeftThick := BorderWidth;
- if PTR.ExArea.ExRight = 100.0 then
- PTR.LineInfo.RightThick := BorderWidth;
- //*)
- end;
- 3 : begin //横线
- if (PTR.LineInfo.TopThick >= 0.2) and (BorderWidth <= 0.2) then
- PTR.LineInfo.TopThick := BorderWidth;
- if (PTR.LineInfo.BottomThick >= 0.2) and (BorderWidth <= 0.2) then
- PTR.LineInfo.BottomThick := BorderWidth;
- end;
- end;
- end;
- 7 : //Column
- begin
- PCR := PSR.Data;
- case intSetType of
- 0 : begin //左右边框
- //if PTR.ExArea.ExLeft = 0.0 then
- if PCR.ExArea.ExLeft = 0.0 then
- begin
- if BorderWidth = 0.0 then
- PCR.LineInfo.LeftThick := BorderWidth
- end;
- if PCR.ExArea.ExRight = 100.0 then
- begin
- if BorderWidth = 0.0 then
- PCR.LineInfo.RightThick := BorderWidth
- end;
- end;
- 1 : begin //上下边框
- //约定中无此项,暂缓
- end;
- 2 : begin //竖线
- (*
- if (PTextRec(PSR.Data).LineInfo.LeftThick >= 0.2) and (BorderWidth >= 0.2) then
- PTextRec(PSR.Data).LineInfo.LeftThick := BorderWidth;
- if (PTextRec(PSR.Data).LineInfo.RightThick >= 0.2) and (BorderWidth >= 0.2) then
- PTextRec(PSR.Data).LineInfo.RightThick := BorderWidth;
- //*)
- if PCR.ExArea.ExLeft = 0.0 then
- PCR.LineInfo.LeftThick := BorderWidth;
- if PCR.ExArea.ExRight = 100.0 then
- PCR.LineInfo.RightThick := BorderWidth;
- end;
- 3 : begin //横线
- if (PCR.LineInfo.TopThick >= 0.2) and (BorderWidth <= 0.2) then
- PCR.LineInfo.TopThick := BorderWidth;
- if (PTR.LineInfo.BottomThick >= 0.2) and (BorderWidth <= 0.2) then
- PCR.LineInfo.BottomThick := BorderWidth;
- end;
- end;
- end;
- end;
- PreviewComXML.setActShowElementObj(PSR);
- //
- end;
- end;
- end;
- end;
- end;
- //
- end;
- begin
- strFileName := extractFilePath(Application.ExeName) + STR_CONFIG_TEXT;
- FIni := TIniFile.Create(strFileName) ;
- ObjList := TList.Create;
- try
- //0. 设置页面大小
- PreviewComXML.setPageSize(FIni.ReadString('纸张','幅面','A4'));
- //1. 设置边距
- PreviewComXML.setEdge(0,'',FIni.ReadInteger('纸张','左边距',0)/10);
- PreviewComXML.setEdge(1,'',FIni.ReadInteger('纸张','右边距',0)/10);
- PreviewComXML.setEdge(2,'',FIni.ReadInteger('纸张','上边距',0)/10);
- PreviewComXML.setEdge(3,'',FIni.ReadInteger('纸张','下边距',0)/10);
- //2. 设置表标题
- TitleRec := PreviewComXML.getTitleByID(1);
- if TitleRec <> nil then
- begin
- TitleRec.FontRec.FontName := FIni.ReadString('页面','表标题_字体','宋体');
- TitleRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表标题_字体大小',18)*4/3) ;
- TitleRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表标题_字体粗',0)*200;
- TitleRec.FontRec.FontItalic := FIni.ReadInteger('页面','表标题_字体斜',0);
- TitleRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表标题_字体下滑线',0);
- PreviewComXML.setTitleObj(TitleRec);
- end;
- //还有行高
- //设置表眉/表脚
- if (FIni.ReadFloat('页面','页眉显示',0) = 1) then
- begin
- //1. 设置页眉显示TITLE
- TitleRec := PreviewComXML.getTitleByID(500); //默认ID为500
- if TitleRec = nil then
- begin
- TitleRec := PreviewComXML.newTitleObj;
- end;
- TitleRec.FontRec.FontName := FIni.ReadString('页面','页眉/页脚_字体','宋体');
- TitleRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','页眉/页脚_字体大小',18)*4/3) ;
- TitleRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','页眉/页脚_字体粗',0)*200;
- TitleRec.FontRec.FontItalic := FIni.ReadInteger('页面','页眉/页脚_字体斜',0);
- TitleRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','页眉/页脚_字体下滑线',0);
- TitleRec.Content := FIni.ReadString('页面','页眉_显示内容','');
- TitleRec.ExArea.ExTop := 1;
- TitleRec.ExArea.ExBottom := 1;
- TitleRec.Align := getAlignByName(FIni.ReadString('页面','页眉_对齐','中'));
- TitleRec.ID := 500;
- PreviewComXML.setTitleObj(TitleRec);
- //2. 设置表眉横线
- if (FIni.ReadFloat('页面','页眉横线',0) = 1) then
- begin
- ShapeRec := PreviewComXML.getShapeByID(500);
- if ShapeRec = nil then
- begin
- ShapeRec := PreviewComXML.newShapeObj(1);
- end;
- ShapeRec.AreaName := '表题';
- ShapeRec.ID := 500;
- ShapeRec.PenWidth := FIni.ReadInteger('页面','页眉/页脚线_线粗',1);
- ShapeRec.ExArea.ExTop := 33.33;
- ShapeRec.ExArea.ExBottom := 33.33;
- PreviewComXML.setShapeObj(ShapeRec);
- end else
- begin
- //删除多余SHAPE对象
- PreviewComXML.getAllShapeObjs(1,ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ID = 500) then
- begin
- PreviewComXML.delShapeObj(ShapeRec);
- end;
- end;
- end;
- //3. 整理TITLE区域
- TitleRec := PreviewComXML.getTitleByID(1);
- if TitleRec <> nil then
- begin
- TitleRec.ExArea.ExTop := 2;
- TitleRec.ExArea.ExBottom := 2;
- PreviewComXML.setTitleObj(TitleRec);
- end;
- PreviewComXML.setNewTitleAreaProperties(1.8,3);
- end else
- begin
- //1. 删除多余TITLE对象
- TitleRec := PreviewComXML.getTitleByID(500); //默认ID为500
- if TitleRec <> nil then
- begin
- PreviewComXML.delTitleObj(TitleRec);
- end;
- //2. 删除多余SHAPE对象
- PreviewComXML.getAllShapeObjs(1,ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ID = 500) then
- begin
- PreviewComXML.delShapeObj(ShapeRec);
- end;
- end;
- //3. 整理TITLE区域
- TitleRec := PreviewComXML.getTitleByID(1);
- if TitleRec <> nil then
- begin
- TitleRec.ExArea.ExTop := 1;
- TitleRec.ExArea.ExBottom := 1;
- PreviewComXML.setTitleObj(TitleRec);
- end;
- PreviewComXML.setNewTitleAreaProperties(1.2,1);
- end;
- k := 0;
- PreviewComXML.getAllTailObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- if (PHeadRec(ObjList[i]).ExArea.ExTop > k) then
- k := Round(PHeadRec(ObjList[i]).ExArea.ExTop);
- end;
- PreviewComXML.getAllPageObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- if (PPageRec(ObjList[i]).ID <> 500) and (PPageRec(ObjList[i]).ExArea.ExTop > k) then
- k := Round(PPageRec(ObjList[i]).ExArea.ExTop);
- end;
- Inc(k);
- if (FIni.ReadFloat('页面','页脚显示',0) = 1) then
- begin
- //1. 设置页脚显示页码
- PageObj := PreviewComXML.getPageByID(500);
- if PageObj = nil then
- begin
- PageObj := PreviewComXML.newPageObj(1);
- end;
- PageObj.FontRec.FontName := FIni.ReadString('页面','页眉/页脚_字体','宋体');
- PageObj.FontRec.FontHeight := Round(FIni.ReadInteger('页面','页眉/页脚_字体大小',18)*4/3) ;
- PageObj.FontRec.FontBold := 400 + FIni.ReadInteger('页面','页眉/页脚_字体粗',0)*200;
- PageObj.FontRec.FontItalic := FIni.ReadInteger('页面','页眉/页脚_字体斜',0);
- PageObj.FontRec.FontUnderLine := FIni.ReadInteger('页面','页眉/页脚_字体下滑线',0);
- PageObj.PageDist := FIni.ReadInteger('页面','页脚_起始页码',1) - 1;
- PageObj.PrefixContent := '第';
- PageObj.SufixContent := '页';
- PageObj.AreaName := '表尾';
- PageObj.AreaType := false;
- PageObj.ExArea.ExTop := k;
- PageObj.ExArea.ExBottom := 1;
- PageObj.Align := getAlignByName(FIni.ReadString('页面','页脚_对齐','中'));
- PageObj.ID := 500;
- PreviewComXML.setPageObj(PageObj);
- //3. 设置表脚横线
- if (FIni.ReadFloat('页面','页脚横线',0) = 1) then
- begin
- ShapeRec := PreviewComXML.getShapeByID(501);
- if ShapeRec = nil then
- begin
- ShapeRec := PreviewComXML.newShapeObj(1);
- end;
- ShapeRec.AreaName := '表尾';
- ShapeRec.ID := 501;
- ShapeRec.PenWidth := FIni.ReadInteger('页面','页眉/页脚线_线粗',1);
- PreviewComXML.setNewHeadTailAreaProperties(1,0.6*k,k);
- ShapeRec.ExArea.ExTop := (k - 1)/k*100;
- ShapeRec.ExArea.ExBottom := ShapeRec.ExArea.ExTop;
- PreviewComXML.setShapeObj(ShapeRec);
- end else
- begin
- //删除多余SHAPE对象
- PreviewComXML.getAllShapeObjs(1,ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ID = 501) then
- begin
- PreviewComXML.delShapeObj(ShapeRec);
- end;
- end;
- Dec(k);
- PageObj := PreviewComXML.getPageByID(500);
- if (k = 0) and (PageObj <> nil) then
- Inc(k);
- PreviewComXML.setNewHeadTailAreaProperties(1,0.6*k,k);
- if k = 0 then
- PreviewComXML.setNewHeadTailAreaProperties(1,0,1);
- end;
- end else
- begin
- //2. 删除多余SHAPE对象
- PreviewComXML.getAllShapeObjs(1,ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ID = 501) then
- begin
- PreviewComXML.delShapeObj(ShapeRec);
- end;
- end;
- //3. 删除多余的页码对象
- PageObj := PreviewComXML.getPageByID(500);
- if PageObj <> nil then
- begin
- PreviewComXML.delPageObj(PageObj);
- end;
- Dec(k);
- PreviewComXML.setNewHeadTailAreaProperties(1,0.6*k,k);
- if k = 0 then
- PreviewComXML.setNewHeadTailAreaProperties(1,0,1);
- end;
- //3. 设置列标题(表栏)
- douJ := FIni.ReadFloat('页面','表格线粗',0);
- PreviewComXML.getAllColumnHeadObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ColumnRec := ObjList[i];
- ColumnRec.FontRec.FontName := FIni.ReadString('页面','列标题_字体','宋体');
- ColumnRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','列标题_字体大小',18)*4/3) ;
- ColumnRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','列标题_字体粗',0)*200;
- ColumnRec.FontRec.FontItalic := FIni.ReadInteger('页面','列标题_字体斜',0);
- ColumnRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','列标题_字体下滑线',0);
- if (douJ > 0.2) then
- begin
- if (ColumnRec.LineInfo.LeftThick > 0.2) then
- ColumnRec.LineInfo.LeftThick := douJ;
- if (ColumnRec.LineInfo.RightThick > 0.2) then
- ColumnRec.LineInfo.RightThick := douJ;
- if (ColumnRec.LineInfo.TopThick > 0.2) then
- ColumnRec.LineInfo.TopThick := douJ;
- if (ColumnRec.LineInfo.BottomThick > 0.2) then
- ColumnRec.LineInfo.BottomThick := douJ;
- end;
- PreviewComXML.setColumnHeadTailObj(0,ColumnRec);
- end;
- PreviewComXML.getAllColumnTailObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- ColumnRec := ObjList[i];
- ColumnRec.FontRec.FontName := FIni.ReadString('页面','列标题_字体','宋体');
- ColumnRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','列标题_字体大小',18)*4/3) ;
- ColumnRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','列标题_字体粗',0)*200;
- ColumnRec.FontRec.FontItalic := FIni.ReadInteger('页面','列标题_字体斜',0);
- ColumnRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','列标题_字体下滑线',0);
- if (douJ > 0.2) then
- begin
- if (ColumnRec.LineInfo.LeftThick > 0.2) then
- ColumnRec.LineInfo.LeftThick := douJ;
- if (ColumnRec.LineInfo.RightThick > 0.2) then
- ColumnRec.LineInfo.RightThick := douJ;
- if (ColumnRec.LineInfo.TopThick > 0.2) then
- ColumnRec.LineInfo.TopThick := douJ;
- if (ColumnRec.LineInfo.BottomThick > 0.2) then
- ColumnRec.LineInfo.BottomThick := douJ;
- end;
- PreviewComXML.setColumnHeadTailObj(1,ColumnRec);
- end;
- PreviewComXML.getAllActAreaObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- AAR := ObjList[i];
- for j := 0 to AAR.ElementList.Count - 1 do
- begin
- SER := AAR.ElementList[j];
- if (SER.ElementType = 7) then
- begin
- ColumnRec := SER.Data;
- ColumnRec.FontRec.FontName := FIni.ReadString('页面','列标题_字体','宋体');
- ColumnRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','列标题_字体大小',18)*4/3) ;
- ColumnRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','列标题_字体粗',0)*200;
- ColumnRec.FontRec.FontItalic := FIni.ReadInteger('页面','列标题_字体斜',0);
- ColumnRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','列标题_字体下滑线',0);
- if (douJ > 0.2) then
- begin
- if (ColumnRec.LineInfo.LeftThick > 0.2) then
- ColumnRec.LineInfo.LeftThick := douJ;
- if (ColumnRec.LineInfo.RightThick > 0.2) then
- ColumnRec.LineInfo.RightThick := douJ;
- if (ColumnRec.LineInfo.TopThick > 0.2) then
- ColumnRec.LineInfo.TopThick := douJ;
- if (ColumnRec.LineInfo.BottomThick > 0.2) then
- ColumnRec.LineInfo.BottomThick := douJ;
- end;
- PreviewComXML.setActShowElementObj(SER);
- end;
- end;
- end;
- //4. 设置表正文
- //{
- PreviewComXML.getAllFlowShowContentObjs(ObjList);
- bkContentFontHeight := Round(FIni.ReadInteger('页面','表正文_字体大小',18)*4/3) ;
- self.isNarraw := (FIni.ReadInteger('页面','内容窄体输出',0) = 1);
- //内容窄体输出
- for i := 0 to ObjList.Count - 1 do
- begin
- FlowContentRec := ObjList[i];
- if not(FlowContentRec.Fixed) then
- begin
- FlowContentRec.FontRec.FontName := FIni.ReadString('页面','表正文_字体','宋体');
- FlowContentRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表正文_字体大小',18)*4/3) ;
- FlowContentRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表正文_字体粗',0)*200;
- FlowContentRec.FontRec.FontItalic := FIni.ReadInteger('页面','表正文_字体斜',0);
- FlowContentRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表正文_字体下滑线',0);
- PreviewComXML.setFlowContentObj(FlowContentRec);
- end;
- end;
- PreviewComXML.getAllBillShowContentObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- FlowContentRec := ObjList[i];
- if not(FlowContentRec.Fixed) then
- begin
- FlowContentRec.FontRec.FontName := FIni.ReadString('页面','表正文_字体','宋体');
- FlowContentRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表正文_字体大小',18)*4/3) ;
- FlowContentRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表正文_字体粗',0)*200;
- FlowContentRec.FontRec.FontItalic := FIni.ReadInteger('页面','表正文_字体斜',0);
- FlowContentRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表正文_字体下滑线',0);
- PreviewComXML.setBillContentObj(FlowContentRec);
- end;
- end;
- PreviewComXML.getAllCrossContentObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- CrossContentRec := ObjList[i];
- if not(CrossContentRec.CrossContent.Fixed) then
- begin
- CrossContentRec.CrossContent.FontRec.FontName := FIni.ReadString('页面','表正文_字体','宋体');
- CrossContentRec.CrossContent.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表正文_字体大小',18)*4/3) ;
- CrossContentRec.CrossContent.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表正文_字体粗',0)*200;
- CrossContentRec.CrossContent.FontRec.FontItalic := FIni.ReadInteger('页面','表正文_字体斜',0);
- CrossContentRec.CrossContent.FontRec.FontUnderLine := FIni.ReadInteger('页面','表正文_字体下滑线',0);
- PreviewComXML.setCrossContentObj(CrossContentRec);
- end;
- end;
- //}
- //5. 设置表合计
- for i := 0 to 2 do
- begin
- PreviewComXML.getAllSumObjs(i,ObjList);
- for j := 0 to ObjList.Count - 1 do
- begin
- SumRec := ObjList[j];
- SumRec.FontRec.FontName := FIni.ReadString('页面','表合计_字体','宋体');
- SumRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表合计_字体大小',18)*4/3) ;
- SumRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表合计_字体粗',0)*200;
- SumRec.FontRec.FontItalic := FIni.ReadInteger('页面','表合计_字体斜',0);
- SumRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表合计_字体下滑线',0);
- PreviewComXML.setSumObj(SumRec);
- end;
- end;
- //6. 设置表眉/脚
- PreviewComXML.getAllHeadObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- HeadTailRec := ObjList[i];
- HeadTailRec.FontRec.FontName := FIni.ReadString('页面','表眉/表脚_字体','宋体');
- HeadTailRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表眉/表脚_字体大小',18)*4/3) ;
- HeadTailRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表眉/表脚_字体粗',0)*200;
- HeadTailRec.FontRec.FontItalic := FIni.ReadInteger('页面','表眉/表脚_字体斜',0);
- HeadTailRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表眉/表脚_字体下滑线',0);
- PreviewComXML.setHeadTailObj(0,HeadTailRec);
- end;
- PreviewComXML.getAllTailObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- HeadTailRec := ObjList[i];
- HeadTailRec.FontRec.FontName := FIni.ReadString('页面','表眉/表脚_字体','宋体');
- HeadTailRec.FontRec.FontHeight := Round(FIni.ReadInteger('页面','表眉/表脚_字体大小',18)*4/3) ;
- HeadTailRec.FontRec.FontBold := 400 + FIni.ReadInteger('页面','表眉/表脚_字体粗',0)*200;
- HeadTailRec.FontRec.FontItalic := FIni.ReadInteger('页面','表眉/表脚_字体斜',0);
- HeadTailRec.FontRec.FontUnderLine := FIni.ReadInteger('页面','表眉/表脚_字体下滑线',0);
- PreviewComXML.setHeadTailObj(1,HeadTailRec);
- end;
- //7. 设置页眉/脚(无显示必要,暂不实现)
- //8. 页眉/页脚线(无显示必要,暂不实现)
- //9. 报表边框横线
- PreviewComXML.getAllShapeObjs(1,ObjList);
- //j := FIni.ReadInteger('页面','报表边框横线',0)*FIni.ReadInteger('页面','边框线粗',0);
- douJ := FIni.ReadInteger('页面','报表边框横线',0)*FIni.ReadFloat('页面','边框线粗',0);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ExArea.ExLeft <> ShapeRec.ExArea.ExRight) then
- begin //这里的判断条件是约定好的
- ShapeRec.PenWidth := Round(douJ);
- if (douJ = 0.0) then
- ShapeRec.PenStyle := integer(psClear)
- else
- ShapeRec.PenStyle := integer(psSolid)
- end;
- PreviewComXML.setShapeObj(ShapeRec);
- end;
- //10. 报表边框竖线
- //j := FIni.ReadInteger('页面','报表边框竖线',0)*FIni.ReadInteger('页面','边框线粗',0);
- douJ := FIni.ReadInteger('页面','报表边框竖线',0)*FIni.ReadFloat('页面','边框线粗',0);
- for i := 0 to ObjList.Count - 1 do
- begin
- ShapeRec := ObjList[i];
- if (ShapeRec.ExArea.ExTop <> ShapeRec.ExArea.ExBottom) and
- ((ShapeRec.ExArea.ExLeft = 0) or (ShapeRec.ExArea.ExLeft = 100)) then
- begin //这里的判断条件是约定好的
- //ShapeRec.PenWidth := j;
- ShapeRec.PenWidth := Round(douJ);
- //if (j = 0) then
- if (douJ = 0.0) then
- ShapeRec.PenStyle := integer(psClear)
- else
- ShapeRec.PenStyle := integer(psSolid)
- end;
- PreviewComXML.setShapeObj(ShapeRec);
- end;
- //11. 报表表格横线
- //{
- PreviewComXML.getAllFlowShowContentObjs(ObjList);
- //j := FIni.ReadInteger('页面','报表表格横线',0)*FIni.ReadInteger('页面','表格线粗',0);
- douJ := FIni.ReadInteger('页面','报表表格横线',0)*FIni.ReadFloat('页面','表格线粗',0);
- for i := 0 to ObjList.Count - 1 do
- begin
- FlowContentRec := ObjList[i];
- //FlowContentRec.LineInfo.TopThick := j;
- //FlowContentRec.LineInfo.BottomThick := j;
- FlowContentRec.LineInfo.TopThick := douJ;
- FlowContentRec.LineInfo.BottomThick := douJ;
- PreviewComXML.setFlowContentObj(FlowContentRec);
- end;
- //}
- PreviewComXML.getAllCrossContentObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- CrossContentRec := ObjList[i];
- //CrossContentRec.CrossContent.LineInfo.TopThick := j;
- //CrossContentRec.CrossContent.LineInfo.BottomThick := j;
- CrossContentRec.CrossContent.LineInfo.TopThick := douJ;
- CrossContentRec.CrossContent.LineInfo.BottomThick := douJ;
- PreviewComXML.setCrossContentObj(CrossContentRec);
- end;
- //12. 报表表格竖线
- //(*
- PreviewComXML.getAllFlowShowContentObjs(ObjList);
- //j := FIni.ReadInteger('页面','报表表格竖线',0)*FIni.ReadInteger('页面','表格线粗',0);
- douJ := FIni.ReadInteger('页面','报表表格竖线',0)*FIni.ReadFloat('页面','表格线粗',0);
- intW := FIni.ReadInteger('页面','报表边框竖线',0);
- for i := 0 to ObjList.Count - 1 do
- begin
- FlowContentRec := ObjList[i];
- //FlowContentRec.LineInfo.LeftThick := j;
- //FlowContentRec.LineInfo.RightThick := j;
- FlowContentRec.LineInfo.LeftThick := douJ;
- FlowContentRec.LineInfo.RightThick := douJ;
- if (i = 0) then
- begin
- if (intW = 0) then
- begin
- FlowContentRec.LineInfo.LeftThick := 0;
- end;
- end;
- if (i = ObjList.Count - 1) then
- begin
- if (intW = 0) then
- begin
- FlowContentRec.LineInfo.RightThick := 0;
- end;
- end;
- PreviewComXML.setFlowContentObj(FlowContentRec);
- end;
- //*)
- PreviewComXML.getAllCrossContentObjs(ObjList);
- for i := 0 to ObjList.Count - 1 do
- begin
- CrossContentRec := ObjList[i];
- //CrossContentRec.CrossContent.LineInfo.LeftThick := j;
- //CrossContentRec.CrossContent.LineInfo.RightThick := j;
- CrossContentRec.CrossContent.LineInfo.LeftThick := douJ;
- CrossContentRec.CrossContent.LineInfo.RightThick := douJ;
- ColumnRec := CrossContentRec.CrossContent.Column;
- //这里还要判断如果没有边框竖线的情况下,表格竖线边缘的线粗也为0
- //前提是所属表栏最右位置位于边缘
- if (intW = 0) and (ColumnRec<>nil) and ((ColumnRec.ExArea.ExRight=100.0) or (ColumnRec.ExArea.ExLeft=0.0)) then
- begin
- case CrossContentRec.CrossType of
- 0 : //交叉行
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- end;
- 1 : //交叉列
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- //(*
- if (CrossContentRec.CrossContent.isSpecialBorder) then
- begin
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.SpecialLineInfo.RightThick := 0;
- end;
- //*)
- end;
- 2 : //显示数据
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- end;
- 3 : //固定LABEL
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- end;
- 4 : //序号
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- end;
- 5 : //横向统计
- begin
- if (CrossContentRec.CrossContent.ExArea.ExLeft = ColumnRec.ExArea.ExLeft ) then
- CrossContentRec.CrossContent.LineInfo.LeftThick := 0;
- if (CrossContentRec.CrossContent.ExArea.ExRight = ColumnRec.ExArea.ExRight ) then
- CrossContentRec.CrossContent.LineInfo.RightThick := 0;
- end;
- end;
- end;
- PreviewComXML.setCrossContentObj(CrossContentRec);
- end;
- //13. 活动区域
- //j := FIni.ReadInteger('页面','报表表格竖线',0)*FIni.ReadInteger('页面','表格线粗',0);
- douJ := FIni.ReadInteger('页面','报表表格竖线',0)*FIni.ReadFloat('页面','表格线粗',0);
- setActAreaBorder(2,douJ);
- //j := FIni.ReadInteger('页面','报表表格横线',0)*FIni.ReadInteger('页面','表格线粗',0);
- douJ := FIni.ReadInteger('页面','报表表格横线',0)*FIni.ReadFloat('页面','表格线粗',0);
- setActAreaBorder(3,douJ);
- //j := FIni.ReadInteger('页面','报表边框竖线',0)*FIni.ReadInteger('页面','边框线粗',0);
- douJ := FIni.ReadInteger('页面','报表边框竖线',0)*FIni.ReadFloat('页面','边框线粗',0);
- setActAreaBorder(0,douJ);
- finally
- FIni.Free;
- ObjList.Free;
- end;
- end;
- procedure TScReportsForm.FormShow(Sender: TObject);
- var wd : integer;
- begin
- LoadReports;
- PreviewComXML.OnReplaceString := ReplaceSpecChar;
- xcbRptAfterModifiedClick(xcbRptAfterModified);
- extvReport.Selected := extvReport.Items.GetFirstNode;
- rdbtnA4Click(rdbtnA4);
- // 取得汇总项目 chenshilong, 2011-07-12
- MainFrm.GetGatherProjects(FGatherProjectSL);
- end;
- procedure TScReportsForm.xlbPrintClick(Sender: TObject);
- var
- i : integer;
- intStartPage , intEndPage : integer;
- Node: TExTreeNode;
- strFile: string;
- begin
- try
- Screen.Cursor := crHourGlass;
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- if extvReport.LeafCheckedCount > 0 then
- begin
- for I := 0 to extvReport.Items.Count - 1 do
- begin
- Node := extvReport.Items[I];
- if (not Node.HasChildren) and (Node.Checked = csChecked) then
- begin
- bIsEstimate1 := IsEstimate1;
- evCrossDataPrintEvent := CrossDataPrintEvent;
- evFlowDataPrintEvent := FlowDataPrintEvent;
- FReportManager.RecordNo := Integer(Node.Data);
- strFile := FReportManager.FieldValue['FileName'];
- //if FileExists(strFile) then
- // directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, False);
- if FileExists(strFile) then
- begin
- directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, False, False, oemNormal,'','', chkExcel2010.Checked);
- end;
- end;
- end;
- extvReport.ClearChecked;
- end
- else
- //打印
- if (TestInt(xcbStartPage.Text)) and (TestInt(xcbEndPage.Text)) then
- begin
- intStartPage := StrToInt(xcbStartPage.Text);
- intEndPage := StrToInt(xcbEndPage.Text);
- if (intStartPage>0) and (intEndPage <= PreviewComXML.TotalPages) then
- begin
- PreviewComXML.PrintMultiPages(intStartPage,intEndPage);
- end;
- end;
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end;
- procedure TScReportsForm.setPrinterOrientation();
- begin
- if (rdbtnA4.Checked) then
- begin
- PreviewComXML.PrintPageSizeIdx := DMPAPER_A4;
- end else if (rdbtnA3.Checked) then
- begin
- PreviewComXML.PrintPageSizeIdx := DMPAPER_A3;
- end;
- //
- end;
- procedure TScReportsForm.xlbToExcelClick(Sender: TObject);
- var
- i, idx, iCount: integer;
- intStartPage, intEndPage, iStart, iEnd: integer;
- strOutput, strTemplate: string;
- Border : TColumnLineRec;
- excelMode : TOutputExcelMode;
- Node: TExTreeNode;
- strFile : string;
- strPath : string;
- strTemp : string;
- isFirst : boolean;
- begin
- //导出到EXCEL
- SetMessageInfoFile(ExtractFilePath(Application.ExeName) + 'Data\' + 'DlgInfo.dat');
- {$IFDEF _ScCanPrint}
- { CommonMessage(pmtHint, [pmbOK],
- '不必再导出到EXCEL中修改了,针对各地业主的不同单价分析表要求,海德纵横smartcost提供报表定制服务,只需以下三步:'#13#10 +
- '传真报表格式到海德→海德服务人员制作报表→客户接收报表模板邮件'#13#10 +
- '只需几分钟,即可完成以往几小时,几天才能完成的报表编辑工作,在激烈的投标竞争中占尽先机!'#13#10 +
- '客服热线:' + LoadServicePhone, True, 'OutToXL');}
- strTemplate := ExtractFilePath(Application.ExeName) + 'Data\basic.xls';
- { strOutput := extvReport.Selected.Text;
- sdOutputExcel.FileName := strOutput;}
- if (chkExcelMode.Checked) then
- begin
- excelMode := oemOneSheet;
- end else
- begin
- excelMode := oemNormal;
- end;
- //set printer direction
- setPrinterOrientation;
-
- if extvReport.LeafCheckedCount > 0 then
- begin
- isFirst := true;
- for I := 0 to extvReport.Items.Count - 1 do
- begin
- Node := extvReport.Items[I];
- if (not Node.HasChildren) and (Node.Checked = csChecked) then
- begin
- bIsEstimate1 := IsEstimate1;
- evCrossDataPrintEvent := CrossDataPrintEvent;
- evFlowDataPrintEvent := FlowDataPrintEvent;
- FReportManager.RecordNo := Integer(Node.Data);
- strFile := FReportManager.FieldValue['FileName'];
- try
- Update;
- Screen.Cursor := crHourGlass;
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- if (FileExists(strFile)) then
- begin
- // CheckTempTabs(Node.Text);
- //ShowFloatProgress(Format('正在导出 %s ,请稍候……', [FReportManager.FieldValue['名称']]),
- // ((I + 1) * 100) div (extvReport.Items.Count) );
- strTemp := ExtractFileName(Node.Text);
- idx := Pos('.', strTemp);
- if (idx > 0) then
- begin
- strTemp := Copy(strTemp, 1, idx - 1);
- end;
- //sdOutputExcel.FileName := strTemp + '.xls';
- sdOutputExcel.FileName := strTemp ;
- if (isFirst) then
- begin
- if (sdOutputExcel.Execute) then
- begin
- isFirst := false;
- strPath := ExtractFilePath(sdOutputExcel.FileName);
- directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, False, True, excelMode,sdOutputExcel.FileName, strTemplate, chkExcel2010.Checked);
- end;
- end else
- begin
- directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, False, True, excelMode, strPath + strTemp + '.xls', strTemplate, chkExcel2010.Checked);
- end;
- end;
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end;
- end;
- extvReport.ClearChecked;
- end else
- begin
- strOutput := extvReport.Selected.Text;
- sdOutputExcel.FileName := strOutput;
- if (TestInt(xcbStartPage.Text)) and (TestInt(xcbEndPage.Text)) then
- begin
- intStartPage := StrToInt(xcbStartPage.Text);
- intEndPage := StrToInt(xcbEndPage.Text);
- if (intStartPage>0) and (intEndPage <= PreviewComXML.TotalPages) then
- begin
- if not sdOutputExcel.Execute then
- Exit;
- if (intEndPage - intStartPage > 30) and (excelMode <> oemOneSheet) then
- begin
- Update;
- Screen.Cursor := crHourGlass;
- try
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- iStart := intStartPage;
- iEnd := 20;
- I := 1;
- iCount := (intEndPage - intStartPage + 1) div 20;
- if (intEndPage - intStartPage + 1) mod 20 > 0 then
- Inc(iCount);
- repeat
- begin
- //ShowFloatProgress(Format('分 %d 个文件导出,正在导出第 %d 个文件,请稍候……', [iCount, I]),
- // (I * 100) div iCount);
- strOutput := sdOutputExcel.FileName + Format('(%d)', [I]);
- FixFileExt(strOutput, '.xls');
- (*
- Border.LeftThick := 0.5;
- Border.TopThick := 0.5;
- Border.RightThick := 0.5;
- Border.BottomThick := 0.5;
- *)
- //OutputExcelMode
- setDefaultExcelBorder(Border);
- if (chkExcel2010.Checked) then
- begin
- PreViewComXML.OutputToExcelRangeXMLEx(PreviewBox.Canvas,iStart,iEnd, strTemplate, strOutput, Border, excelMode);
- end else
- begin
- PreViewComXML.OutputToExcelFile(PreviewBox.Canvas,iStart,iEnd, strTemplate, strOutput, excelMode, Border);
- end;
- //PreViewComXML.OutputToExcelRangeXMLEx(PreviewBox.Canvas,iStart,iEnd, strTemplate, strOutput, Border, excelMode);
- iStart := iStart + 20;
- iEnd := iEnd + 20;
- if iEnd > intEndPage then
- iEnd := intEndPage;
- Inc(I);
- end
- //until iStart >= intEndPage;
- until iStart > intEndPage;
- // PreViewComXML.OutputToExcelRange(PreviewBox.Canvas,intStartPage,intEndPage);
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end
- else
- begin
- Update;
- Screen.Cursor := crHourGlass;
- try
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- strOutput := sdOutputExcel.FileName;
- FixFileExt(strOutput, '.xls');
- (*
- Border.LeftThick := 0.5;
- Border.TopThick := 0.5;
- Border.RightThick := 0.5;
- Border.BottomThick := 0.5;
- *)
- setDefaultExcelBorder(Border);
- if (chkExcel2010.Checked) then
- begin
- PreViewComXML.OutputToExcelRangeXMLEx(PreviewBox.Canvas,intStartPage,intEndPage, strTemplate, strOutput, Border, excelMode);
- end else
- begin
- PreViewComXML.OutputToExcelFile(PreviewBox.Canvas,intStartPage,intEndPage, strTemplate, strOutput, excelMode, Border);
- end;
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end;
- end;
- end;
- end;
- {$ELSE}
- {$IFDEF _KTDebug}
- //My implementation
- //Standard message show dialog.
- //No need to implement this for debug purpose
- {$ELSE}
- CommonMessage(pmtHint, [pmbOK],
- {'不必再导出到EXCEL中修改了,针对各地业主的不同单价分析表要求,纵横smartcost提供报表定制服务,只需以下三步:'#13#10 +
- '传真报表格式到客服中心→服务人员制作报表→客户接收报表模板邮件'#13#10 +
- '只需几分钟,即可完成以往几小时,几天才能完成的报表编辑工作,在激烈的投标竞争中占尽先机!'#13#10 +}
- '对不起,学习版不提供导出功能。'#13#10#13#10 +
- '以下为收费服务项目,请在必要时联系纵横:'#13#10 +
- '针对各地业主的不同单价分析表要求,纵横SmartCost提供报表模板定制服务,只需几分钟,即可完成以往几小时,几天才能完成的报表编辑工作,在激烈的投标竞争中占尽先机!'#13#10#13#10+
- '客服热线:' + LoadServicePhone);
- {$ENDIF}
- {$ENDIF}
- end;
- procedure TScReportsForm.xlbToPDFClick(Sender: TObject);
- var
- i : integer;
- intStartPage , intEndPage : integer;
- Node: TExTreeNode;
- strFile: string;
- begin
- if extvReport.LeafCheckedCount > 0 then
- begin
- try
- Screen.Cursor := crHourGlass;
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- for I := 0 to extvReport.Items.Count - 1 do
- begin
- Node := extvReport.Items[I];
- if (not Node.HasChildren) and (Node.Checked = csChecked) then
- begin
- bIsEstimate1 := IsEstimate1;
- evCrossDataPrintEvent := CrossDataPrintEvent;
- evFlowDataPrintEvent := FlowDataPrintEvent;
- FReportManager.RecordNo := Integer(Node.Data);
- strFile := FReportManager.FieldValue['FileName'];
- if FileExists(strFile) then
- begin
- //ShowFloatProgress(Format('正在导出 %s ,请稍候……', [FReportManager.FieldValue['名称']]),
- // ((I + 1) * 100) div (extvReport.Items.Count) );
- //directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True);
- directPrintReport(PreviewBox.Canvas, strFile, PreviewComXML, True, False, oemNormal,'','', chkExcel2010.Checked);
- end;
- end;
- end;
- //extvReport.ClearChecked;
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end
- else
- //打印
- if (TestInt(xcbStartPage.Text)) and (TestInt(xcbEndPage.Text)) then
- begin
- try
- PreviewComXML.OnProgress := PreviewComXMLProgress;
- Screen.Cursor := crHourGlass;
- intStartPage := StrToInt(xcbStartPage.Text);
- intEndPage := StrToInt(xcbEndPage.Text);
- if (intStartPage>0) and (intEndPage <= PreviewComXML.TotalPages) then
- PreviewComXML.PrintPDF(intStartPage, intEndPage);
- finally
- Screen.Cursor := crDefault;
- PreviewComXML.OnProgress := nil;
- CloseFloatProgress;
- end;
- end;
- end;
- procedure TScReportsForm.xlbOnePageClick(Sender: TObject);
- begin
- PreviewComXML.PreviewRows := 1;
- PreviewComXML.PreviewCols := 1;
- intCntPerPage := 1;
- intGroup := intPage;
- bShowNormal := true; //强制为普通输出模式
- //ReportPreview;
- FormResize(Self);
- end;
- procedure TScReportsForm.xlbTwoPageClick(Sender: TObject);
- begin
- if PreviewComXML.ReportSize.X > PreviewComXML.ReportSize.Y then
- begin
- PreviewComXML.PreviewRows := 2;
- PreviewComXML.PreviewCols := 1;
- end else
- begin
- PreviewComXML.PreviewRows := 1;
- PreviewComXML.PreviewCols := 2;
- end;
- intCntPerPage := 2;
- intGroup := intPage div 2;
- if (intPage mod 2) > 0 then Inc(intGroup);
- bShowNormal := true; //强制为普通输出模式
- //ReportPreview;
- FormResize(Self);
- end;
- procedure TScReportsForm.xlbFourPageClick(Sender: TObject);
- begin
- PreviewComXML.PreviewRows := 2;
- PreviewComXML.PreviewCols := 2;
- intCntPerPage := 4;
- intGroup := intPage div 4;
- if (intPage mod 4) > 0 then Inc(intGroup);
- bShowNormal := true; //强制为普通输出模式
- //ReportPreview;
- FormResize(Self);
- end;
- procedure TScReportsForm.xlbFirstPageClick(Sender: TObject);
- begin
- intPage := 1;
- xcbPages.Text := IntToStr(intPage);
- xcbPagesChange(nil);
- end;
- procedure TScReportsForm.xcbPagesChange(Sender: TObject);
- var intValue : integer;
- begin
- if TestInt(xcbPages.Text) then
- begin
- intValue := StrToInt(xcbPages.Text);
- if (intValue <= PreviewComXML.TotalPages) and (intValue > 0) then
- begin
- intPage := intValue;
- intGroup := intValue div intCntPerPage;
- if (intValue mod intCntPerPage) > 0 then
- Inc(intGroup);
- ReportPreview;
- end;
- end;
- end;
- procedure TScReportsForm.xlbPrePageClick(Sender: TObject);
- begin
- if intPage > 1 then
- begin
- Dec(intPage);
- xcbPages.Text := IntToStr(intPage);
- xcbPagesChange(nil);
- end;
- end;
- procedure TScReportsForm.xlbNextPageClick(Sender: TObject);
- begin
- if intPage < PreviewComXML.TotalPages then
- begin
- Inc(intPage);
- xcbPages.Text := IntToStr(intPage);
- xcbPagesChange(nil);
- end;
- end;
- procedure TScReportsForm.xlbLastPageClick(Sender: TObject);
- begin
- intPage := PreviewComXML.TotalPages;
- xcbPages.Text := IntToStr(intPage);
- xcbPagesChange(nil);
- end;
- procedure TScReportsForm.xlbSetupClick(Sender: TObject);
- var intIdx : integer;
- begin
- //打印机设置
- //{
- if extvReport.Selected = nil then
- begin
- MessageBox(Handle, '请选择报表。', '提示', MB_OK or MB_ICONINFORMATION);
- Exit;
- end;
- try
- Application.CreateForm(TReportAdjuster, ReportAdjuster);
- ReportAdjuster.SetupReportName := ExtractFileName(ReportName);
- ReportAdjuster.Project := Project;
- intIdx := Pos(FILEEXT,ReportAdjuster.SetupReportName);
- if intIdx > 0 then
- begin
- //ReportAdjuster.SetupReportName := Copy(ReportAdjuster.SetupReportName, 1 , intIdx - 1 );
- FReportManager.RecordNo := Integer(extvReport.Selected.Data);
- ReportName := FReportManager.FieldValue['FileName'];
- ReportAdjuster.IsTender := rbRptAfterModified.Checked;
- ReportAdjuster.SetupReportName := ReportName;
- ReportAdjuster.SetupReportNo := FReportManager.RecordNo;
- end;
- ReportAdjuster.ShowModal;
- if ReportAdjuster.ReportChanged then
- begin
- //FormShow(nil);
- extvReportDblClick(nil);
- end else
- if ReportAdjuster.SetupChanged then
- begin
- setupReport;
- ReportPreview;
- end;
- finally
- ReportAdjuster.free;
- end;
- //}
- end;
- procedure TScReportsForm.PreviewBoxMouseDownEx(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- //0: normal, 1: next page, 2: previous page 3: first page, 4: last page
- case intCurStatus of
- 0 : begin
- //
- end;
- 1 : begin
- xlbNextPageClick(nil);
- end;
- 2 : begin
- xlbPrePageClick(nil);
- end;
- 3 : begin
- xlbFirstPageClick(nil);
- end;
- 4 : begin
- xlbLastPageClick(nil);
- end;
- end;
- end;
- procedure TScReportsForm.PreviewBoxMouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var offset, offsetex : integer;
- semiW : integer;
- begin
- offset := 150;
- offsetex := 50;
- semiW := PreviewBox.Width div 2;
- //0: normal, 1: next page, 2: previous page 3: first page, 4: last page
- if (X > (semiW + offset)) then
- begin
- if (X >= PreviewBox.Width - offsetex) then
- begin
- PreviewBox.Cursor := crMyIdxLast;
- intCurStatus := 4;
- end else
- begin
- PreviewBox.Cursor := crMyIdxNext;
- intCurStatus := 1;
- end;
- end else if (X < (semiW - offset)) then
- begin
- if (X <= offsetex) then
- begin
- PreviewBox.Cursor := crMyIdxFirst;
- intCurStatus := 3;
- end else
- begin
- PreviewBox.Cursor := crMyIdxPrevious;
- intCurStatus := 2;
- end;
- end else
- begin
- PreviewBox.Cursor := crDefault;
- intCurStatus := 0;
- //ScReportsForm.Caption := 'X: ' + IntToStr(PreviewBox.Left) + ' Y: ' + IntToStr(PreviewBox.Top);
- end;
- end;
- procedure TScReportsForm.PreviewBoxMouseDown(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- var intVertical, intHorizontal : integer;
- i,j : integer;
- begin
- //intOldX := X;
- //intOldY := Y;
- //if ScaleBtn.Down then
- if (Button = mbLeft) then
- begin
- //根据放大缩小情况来显示
- intVertical := Self.ClientWidth div 2;
- intHorizontal := Self.ClientHeight div 2;
- if (bShowNormal) then
- begin
- bShowNormal := not(bShowNormal);
- xlbRealSize.Down := True;
- case intCntPerPage of
- 2 :
- begin
- if (PreviewComXML.PreviewRows > PreviewComXML.PreviewCols) then
- begin
- if (Y < intHorizontal) then
- intPage := intGroup * 2 - 1
- else
- intPage := intGroup * 2 ;
- end else
- begin
- if (X < intVertical) then
- intPage := intGroup * 2 - 1
- else
- intPage := intGroup * 2 ;
- end;
- end;
- 4 :
- begin
- if (Y < intHorizontal) then
- begin
- if (X < intVertical) then
- intPage := intGroup * 4 - 3
- else
- intPage := intGroup * 4 - 2;
- end else
- begin
- if (X < intVertical) then
- intPage := intGroup * 4 - 1
- else
- intPage := intGroup * 4;
- end;
- end;
- end;
- //FormResize(Self);
- end else
- begin
- case intCntPerPage of
- 1:
- xlbOnePage.Down := True;
- 2:
- xlbTwoPage.Down := True;
- 4:
- xlbFourPage.Down := True;
- end;
- bShowNormal := not(bShowNormal);
- //ReportPreview;
- end;
- FormResize(Self);
- //ReportPreview;
- end else
- begin
- startMove(X, Y);
- end;
- end;
- procedure TScReportsForm.FormCreate(Sender: TObject);
- var
- rst1, rst2 : integer;
- //fp : PChar;
- pn : PAnsiChar;
- begin
- pn := PChar(extractFilePath(Application.ExeName) + 'NextPage.cur');
- rst1 := LoadcursorFromFile(pn);
- if rst1 <> 0 then
- begin
- Screen.Cursors[crMyIdxNext] := rst1;
- end;
- pn := PChar(extractFilePath(Application.ExeName) + 'PreviousPage.cur');
- rst2 := LoadcursorFromFile(pn);
- if rst2 <> 0 then
- begin
- Screen.Cursors[crMyIdxPrevious] := rst2;
- end;
- pn := PChar(extractFilePath(Application.ExeName) + 'LastPage.cur');
- rst1 := LoadcursorFromFile(pn);
- if rst1 <> 0 then
- begin
- Screen.Cursors[crMyIdxLast] := rst1;
- end;
- pn := PChar(extractFilePath(Application.ExeName) + 'FirstPage.cur');
- rst2 := LoadcursorFromFile(pn);
- if rst2 <> 0 then
- begin
- Screen.Cursors[crMyIdxFirst] := rst2;
- end;
- intCurStatus := 0;
- //0: normal, 1: next page, 2: previous page 3: first page, 4: last page
- // zy 2005-05-18 加速读取报表列表速度
- FReportManager := ReportManager;//TScReportManager.Create;
- FWorkListForm := TScWorkListForm.Create(nil);
- bShowNormal := true;
- ExePath := ExtractFilePath(Application.ExeName);
- strModified := '(调价后)';
- //strConfigTxt := '报表打印机设置.INI';
- rbRptBeforeModified.Checked := True;
- isNarraw := false;
- xccRptIsModified.Visible := ivNever;
- pnlRptIsModified.Visible := False;
- {$IFNDEF _ScCanPrint}
- xlbPrint.Enabled := False;
- xlbToPDF.Enabled := False;
- {$ENDIF}
- // xlbToExcel.Enabled := False;
- {$IFDEF _beEncrypt}
- ClearReportFuncList;
- ClearReportOprList;
- {$ENDIF}
- {$IFDEF _ScInternal}
- xlbPrint.Enabled := True;
- xlbToExcel.Enabled := True;
- {$ENDIF}
- extvReport.IsRecurCheck := False;
- FGatherProjectSL := TStringList.Create;
- end;
- function FindEmptyReport(AReportName: string; var AEmptyReportName: string): Boolean;
- var
- strPath, strEmptyReport: string;
- iPos: Integer;
- begin
- strPath := ExtractFilePath(Application.ExeName) + 'BillsEditorReports\EmptyReports\';
- strEmptyReport := ExtractFileNameWithoutExt(AReportName);
- // 如果表名是“xxxx(预算)”,需要先将“(预算)”去掉
- iPos := Pos('(', strEmptyReport);
- if iPos > 0 then
- strEmptyReport := Copy(strEmptyReport, 1, iPos - 1);
- strEmptyReport := strPath + strEmptyReport + '(空表).srt';
- Result := FileExists(strEmptyReport);
- if Result then
- AEmptyReportName := strEmptyReport;
- end;
- procedure TScReportsForm.extvReportDblClick(Sender: TObject);
- var
- CurPoint : TPoint;
- GatherProjFrm: TGatherProjForm;
- P: TPoint;
- function IsGatherProjectReport(AReportName: string): Boolean;
- begin
- Result := False;
- if (Pos('【表2-1】', AReportName) > 0) or (Pos('【表2-2】', AReportName) > 0) then
- Result := True;
- end;
- procedure ExecReport(AIsGthPrjRep: Boolean);
- var i : integer;
- strRptName: string;
- strM : string;
- RptArchiverObj : TReportArchiver;
- MemFile : TMemoryStream;
- OldBrushColor, OldPenColor: TColor;
- isBillingGrp : boolean;
- function NeedReBuild(AIsGthPrjRep: Boolean): Boolean;
- begin
- Result := False;
- if AIsGthPrjRep then
- begin
- Result := True;
- end
- else
- begin
- if (Sender = nil) or (PreReportName <> ReportName) and (FileExists(ReportName)) then
- Result := True;
- end;
- end;
- begin
- if extvReport.Selected = nil then Exit;
- if Integer(extvReport.Selected.Data) = 10000 then Exit;
- FReportManager.RecordNo := Integer(extvReport.Selected.Data);
- ReportName := FReportManager.FieldValue['FileName'];
- isBillingGrp := FReportManager.FieldValue['清单分类'] = '是';
- MemFile := nil;
-
- if not NeedReBuild(AIsGthPrjRep) then Exit;
- Screen.Cursor := crHourGlass;
- {$IFNDEF _KTDebug}
- RptArchiverObj := TReportArchiver.Create;
- RptArchiverObj.FileName := ReportName;
- MemFile := RptArchiverObj.Extract;
- {$ENDIF}
- try
- if MemFile = nil then
- begin
- MemFile := TMemoryStream.Create;
- MemFile.LoadFromFile(ReportName);
- end;
- if PreviewComXML.ReadReportStream(MemFile) then
- begin
- try
- if (FReportManager.FieldValue['格式固化'] <> '是') then
- begin
- setupReport;
- //存盘
- PreviewComXML.SaveToStream(MemFile);
- end;
- PreviewComXML.ReadReportStream(MemFile);
- PreviewComXML.ReadDBData;
- PreviewComXML.AnalyseData;
- PreReportName := ReportName;
- if PreviewComXML.TotalPages > 0 then
- begin
- // zy 暂时以此方法屏蔽所有异常
- try
- intPage := 1;
- intGroup := 1;
- intCntPerPage := 1;
- bShowNormal := false;
- xlbRealSize.Down := True;
- xcbPages.Items.Clear;
- xcbStartPage.Items.Clear;
- xcbEndPage.Items.Clear;
- for i := 1 to PreviewComXML.TotalPages do
- begin
- xcbPages.Items.Add(IntToStr(i));
- end;
- xcbStartPage.Items.Assign(xcbPages.Items);
- xcbEndPage.Items.Assign(xcbPages.Items);
- xcbPages.ItemIndex := 0;
- xcbStartPage.ItemIndex := 0;
- xcbEndPage.ItemIndex := xcbEndPage.Items.Count - 1;
- FormResize(nil); //有刷新
- if isBillingGrp then
- begin
- FWorkListForm.initialize(PreviewComXML);
- FWorkListForm.FormStyle := fsStayOnTop;
- GetCursorPos(CurPoint);
- FWorkListForm.Left := CurPoint.X + 5;
- FWorkListForm.Top := CurPoint.Y + 5;
- FWorkListForm.Show;
- end else
- begin
- FWorkListForm.Hide;
- end;
- except
- Application.MessageBox(PChar('当前报表显示可能存在问题,请与纵横客服中心联系:' + LoadServicePhone + '。'), '注意', MB_OK or MB_ICONINFORMATION);
- OldBrushColor := PreviewBox.Canvas.Brush.Color;
- OldPenColor := PreviewBox.Canvas.Pen.Color;
- try
- PreviewBox.Canvas.Brush.Color := clBtnFace;
- PreviewBox.Canvas.Pen.Color := clBlack;
- PreviewBox.Canvas.Rectangle(PreviewBox.BoundsRect);
- finally
- PreviewBox.Canvas.Brush.Color := OldBrushColor;
- PreviewBox.Canvas.Pen.Color := OldPenColor;
- end;
- end;
- end else
- begin
- // 显示空表
- if FindEmptyReport(ReportName, strRptName) then
- begin
- if MemFile <> nil then
- MemFile.Free;
- RptArchiverObj.Free;
- RptArchiverObj := TReportArchiver.Create;
- RptArchiverObj.FileName := strRptName;
- MemFile := RptArchiverObj.Extract;
- if PreviewComXML.ReadReportStream(MemFile) then
- begin
- setupReport;
- //存盘
- PreviewComXML.SaveToStream(MemFile);
- PreviewComXML.ReadReportStream(MemFile);
- PreviewComXML.ReadDBData;
- PreviewComXML.AnalyseData;
- try
- intPage := 1;
- intGroup := 1;
- intCntPerPage := 1;
- bShowNormal := false;
- xlbRealSize.Down := True;
- xcbPages.Items.Clear;
- xcbStartPage.Items.Clear;
- xcbEndPage.Items.Clear;
- for i := 1 to PreviewComXML.TotalPages do
- begin
- xcbPages.Items.Add(IntToStr(i));
- end;
- xcbStartPage.Items.Assign(xcbPages.Items);
- xcbEndPage.Items.Assign(xcbPages.Items);
- xcbPages.ItemIndex := 0;
- xcbStartPage.ItemIndex := 0;
- xcbEndPage.ItemIndex := xcbEndPage.Items.Count - 1;
- FormResize(nil); //有刷新
- except
- Application.MessageBox(PChar('当前报表显示可能存在问题,请与纵横客服中心联系:' + LoadServicePhone + '。'), '注意', MB_OK or MB_ICONINFORMATION);
- OldBrushColor := PreviewBox.Canvas.Brush.Color;
- OldPenColor := PreviewBox.Canvas.Pen.Color;
- try
- PreviewBox.Canvas.Brush.Color := clBtnFace;
- PreviewBox.Canvas.Pen.Color := clBlack;
- PreviewBox.Canvas.Rectangle(PreviewBox.BoundsRect);
- finally
- PreviewBox.Canvas.Brush.Color := OldBrushColor;
- PreviewBox.Canvas.Pen.Color := OldPenColor;
- end;
- end;
- end;
- end
- else
- begin
- Application.MessageBox('报表无数据,请选择其他报表。','注意',MB_OK or MB_ICONINFORMATION);
- OldBrushColor := PreviewBox.Canvas.Brush.Color;
- OldPenColor := PreviewBox.Canvas.Pen.Color;
- try
- PreviewBox.Canvas.Brush.Color := clBtnFace;
- PreviewBox.Canvas.Pen.Color := clBlack;
- PreviewBox.Canvas.Rectangle(PreviewBox.BoundsRect);
- finally
- PreviewBox.Canvas.Brush.Color := OldBrushColor;
- PreviewBox.Canvas.Pen.Color := OldPenColor;
- end;
- end;
- end;
- finally
- //FIni.Free;
- //ObjList.Free;
- end;
- end;
- finally
- Screen.Cursor := crDefault;
- if MemFile <> nil then
- MemFile.Free;
- {$IFNDEF _KTDebug}
- RptArchiverObj.free;
- {$ENDIF}
- end;
- end;
- begin
- {$IFDEF _beEncrypt}
- ClearReportOprList;
- ClearReportFuncList;
- {$ENDIF}
- // 汇总报表先打开一个小窗口供项目选择 chenshilong, 2011-07-12
- if IsGatherProjectReport(extvReport.Selected.Text) then
- begin
- CurGatherProjectReportName := '';
- GatherProjFrm := TGatherProjForm.Create(nil);
- try
- GetCursorPos(P);
- GatherProjFrm.init(FGatherProjectSL, Self);
- GatherProjFrm.Left := P.X;
- GatherProjFrm.Top := P.Y;
- GatherProjFrm.ShowModal;
- if GatherProjFrm.ModalResult <> mrOK then Exit;
- if CurGatherProjectReportName = '' then Exit;
- FGatherProject := MainFrm.ProjectManager.OpenProjectForReport(CurGatherProjectReportName);
- if not Assigned(FGatherProject) then Exit;
- PreviewComXML.OnGetDataConnection := PreviewComXMLGetGatherProjDataConnection;
- ExecReport(True);
- finally
- PreviewComXML.OnGetDataConnection := PreviewComXMLGetDataConnection;
- GatherProjFrm.Free;
- end;
- end
- else
- begin
- ExecReport(False);
- end;
- end;
- {$IFNDEF _KTDebug}
- procedure TScReportsForm.SetProject(const Value: TProject);
- begin
- FProject := Value;
- FProject.Report.RefreshData;
- end;
- {$ENDIF}
- procedure TScReportsForm.PreviewComXMLGetDataConnection(
- var ADOCon: TADOConnection);
- begin
- ADOCon := FProject.Report.Connection;
- end;
- procedure TScReportsForm.xcbStartPageCurChange(Sender: TObject);
- begin
- xcbStartPage.Text := xcbStartPage.CurText;
- end;
- procedure TScReportsForm.xcbEndPageCurChange(Sender: TObject);
- begin
- xcbEndPage.Text := xcbEndPage.CurText;
- end;
- procedure TScReportsForm.xcbPagesCurChange(Sender: TObject);
- begin
- xcbPages.Text := xcbPages.CurText;
- end;
- // zy
- procedure TScReportsForm.xlbRealSizeClick(Sender: TObject);
- begin
- bShowNormal := False;
- FormResize(Self);
- end;
- function TScReportsForm.GetProjectPhaseByName(AName: string): TProjectPhase;
- var i, iFrom, iTo: Integer;
- begin
- iFrom := Ord(Low(TProjectPhase));
- iTo := Ord(High(TProjectPhase));
- for i := iFrom to iTo do
- begin
- if aryPPStr[TProjectPhase(i)] = AName then
- begin
- Result := TProjectPhase(i);
- Break;
- end
- else Result := ppNull;
- end;
- end;
- procedure TScReportsForm.Splitter1Moved(Sender: TObject);
- begin
- // FormResize(Self);
- end;
- procedure TScReportsForm.PreviewComXMLGetDatasetEvent(
- DatasetInfo: PDatasetInfoRec; var ADataset: TDataSet);
- //var
- // CompareForm: TScReportCompareHLJForm;
- begin
- // {$IFNDEF _KTDebug}
- // {$IFNDEF _ScPersonal}
- // case DataSetInfo.ID of
- // CompareDataSetID, CompareNameDataSetID, CompareBuildProjDataID:
- // begin
- // // lsm
- // CompareType := CompareBills;
- // if FCompareReport = nil then
- // FCompareReport := TScReportCompareForm.Create(Self);
- // if CompareReportCount = 0 then
- // begin
- // // litao
- // FCompareReport.CompositeCompareName(FProjData.BuildProjectName, FProjData.Alias);
- // FCompareReport.CompareAlias := Format('%s\%s', [FProjData.BuildProjectName, FProjData.Alias]);
- // if (FCompareReport.ShowModal <> mrOK) then
- // begin
- //// Exit;
- // end;
- // end;
- // Inc(CompareReportCount);
- // if CompareReportCount >= 3 then
- // CompareReportCount := 0;
- // case DataSetInfo.ID of
- // CompareDataSetID:
- // ADataSet := FCompareReport.DM.cdsCompare;
- // CompareNameDataSetID:
- // ADataSet := FCompareReport.DM.cdsProjNames;
- // CompareBuildProjDataID:
- // ADataSet := FCompareReport.DM.cdsProjData;
- // end;
- // end;
- // GatherDataSetID, GatherBuildProjDataID:
- // begin
- // if FGatherReport = nil then
- // FGatherReport := TScProjGatherDM.Create(nil);
- // if GathereReportCount = 0 then
- // // lsm
- // FGatherReport.GatherProjsForReport(FProjData.BuildProjectName, gtBuildProject);
- // Inc(GathereReportCount);
- // if GathereReportCount >= 2 then
- // GathereReportCount := 0;
- // case DataSetInfo.ID of
- // GatherDataSetID:
- // ADataSet := FGatherReport.cdsProjGatherForReport;
- // GatherBuildProjDataID:
- // ADataSet := FGatherReport.cdsProjData;
- // end;
- // end;
- // GLJGatherDataSetID, GLJGatherBuildProjDataID:
- // begin
- // if FGLJGatherReport = nil then
- // FGLJGatherReport := TScProjGLJGather.Create(Self);
- // {Litao 2010.4.29 02—1表不需要砼}
- // if DatasetInfo.ID = GLJGatherBuildProjDataID then
- // FGLJGatherReport.ReportType := rtTable_02_1;
- //
- // if GLJGatherCount = 0 then
- // FGLJGatherReport.GatherProjs(FProjData.BuildProjectName);
- // Inc(GLJGatherCount);
- // if GLJGatherCount >= 2 then
- // GLJGatherCount := 0;
- // case DatasetInfo.ID of
- // GLJGatherDataSetID:
- // ADataSet := FGLJGatherReport.cdsGLJGather;
- // GLJGatherBuildProjDataID:
- // ADataSet := FGLJGatherReport.cdsProjData;
- // end;
- //
- // {Litao 2010.4.29 还原设置}
- // FGLJGatherReport.ReportType := rtNone;
- // end;
- // HLJ_ComareBillsID, HLJ_ComareBillsProjID:
- // begin
- // if FCompareHLJ = nil then
- // FCompareHLJ := TScProjectCompareHLJDM.Create(Self);
- // CompareForm := TScReportCompareHLJForm.Create(Self);
- // try
- // if HLJCompareBillsCount = 0 then
- // begin
- // CompareForm.Compare := FProjData.FileName;
- // if CompareForm.ShowModal = mrOK then
- // begin
- // FCompareHLJ.CompareBills(CompareForm.Compare, CompareForm.Source);
- // end;
- // end;
- // Inc(HLJCompareBillsCount);
- // if HLJCompareBillsCount >= 2 then
- // HLJCompareBillsCount := 0;
- // case DataSetInfo.ID of
- // HLJ_ComareBillsID:
- // ADataSet := FCompareHLJ.cdsCompareBills;
- // HLJ_ComareBillsProjID:
- // ADataSet := FCompareHLJ.cdsProjData;
- // end;
- // finally
- // FreeAndNil(CompareForm);
- // end;
- // end;
- // HLJ_ComareRationsID, HLJ_ComareRationsProjID:
- // begin
- // if FCompareHLJ = nil then
- // FCompareHLJ := TScProjectCompareHLJDM.Create(Self);
- // CompareForm := TScReportCompareHLJForm.Create(Self);
- // try
- // if HLJCompareBillsCount = 0 then
- // begin
- // CompareForm.Compare := FProjData.FileName;
- // if CompareForm.ShowModal = mrOK then
- // begin
- // FCompareHLJ.CompareRations(CompareForm.Compare, CompareForm.Source);
- // end;
- // end;
- // Inc(HLJCompareBillsCount);
- // if HLJCompareBillsCount >= 2 then
- // HLJCompareBillsCount := 0;
- // case DataSetInfo.ID of
- // HLJ_ComareRationsID:
- // ADataSet := FCompareHLJ.cdsCompareRations;
- // HLJ_ComareRationsProjID:
- // ADataSet := FCompareHLJ.cdsProjData;
- // end;
- // finally
- // FreeAndNil(CompareForm);
- // end;
- // end;
- // // lsm 新增汇总表
- // GatheDWFDataSetID, GatherDWFBuildProjDataID:
- // begin
- // if FGatherDWFReport = nil then
- // FGatherDWFReport := TScProjGatherDM.Create(nil);
- // if GatheDWFReportCount = 0 then
- // FGatherDWFReport.GatherProjsDWFForReport(FProjData.BuildProjectName);
- // Inc(GatheDWFReportCount);
- // if GatheDWFReportCount >= 2 then
- // GatheDWFReportCount := 0;
- // case DataSetInfo.ID of
- // GatheDWFDataSetID:
- // ADataSet := FGatherDWFReport.cdsDWFForReport;
- // GatherDWFBuildProjDataID:
- // ADataSet := FGatherDWFReport.cdsProjDataDWF;
- // end;
- // end;
- // // 主材权重对比表
- // CompareMaterialDataSetID, CompareMaterialProjNamesID, CompareMaterialProjDataID, CompareMaterialProjFeeID:
- // begin
- // CompareType := CompareMaterial;
- // if FCompareMateReport = nil then
- // begin
- // FCompareMateReport := TScReportCompareForm.Create(nil);
- // end;
- // if CompareMateCount = 0 then
- // begin
- // FCompareMateReport.CompositeCompareName(FProjData.BuildProjectName, FProjData.Alias);
- // FCompareMateReport.CompareAlias := Format('%s\%s', [FProjData.BuildProjectName, FProjData.Alias]);
- // if (FCompareMateReport.ShowModal <> mrOK) then
- // begin
- //// Exit;
- // end;
- // end;
- // Inc(CompareMateCount);
- // if CompareMateCount >= 4 then
- // CompareMateCount := 0;
- // case DataSetInfo.ID of
- // CompareMaterialDataSetID:
- // ADataSet := FCompareMateReport.DM.cdsMaterial;
- // CompareMaterialProjNamesID:
- // ADataSet := FCompareMateReport.DM.cdsProjNames;
- // CompareMaterialProjDataID:
- // ADataSet := FCompareMateReport.DM.cdsProjData;
- // CompareMaterialProjFeeID:
- // ADataSet := FCompareMateReport.DM.cdsProjFees;
- // end;
- // end;
- // // 工料机权重汇总表
- // GatherGLJPropDataSetID, GatherGLJPropProjDataID:
- // begin
- // if FGatherGLJPropReport = nil then
- // FGatherGLJPropReport := TScProjGLJGather.Create(Self);
- // if GatherGLJPropCount = 0 then
- // FGatherGLJPropReport.GatherGLJForReport(FProjData.BuildProjectName);
- // Inc(GatherGLJPropCount);
- // if GatherGLJPropCount >= 2 then
- // GatherGLJPropCount := 0;
- // case DatasetInfo.ID of
- // GatherGLJPropDataSetID:
- // ADataSet := FGatherGLJPropReport.cdsGLJForReport;
- // GatherGLJPropProjDataID:
- // ADataSet := FGatherGLJPropReport.cdsProjData;
- // end;
- // end;
- // // 汇总单价偏差
- // GatherEcoLineDataSetID, GatherEcoLineProjDataID:
- // begin
- // if FGatherReport = nil then
- // FGatherReport := TScProjGatherDM.Create(nil);
- // if GatherEcoLineReportCount = 0 then
- // FGatherReport.GatherProjsForReport(FProjData.BuildProjectName, gtWeightPrice);
- // Inc(GatherEcoLineReportCount);
- // if GatherEcoLineReportCount >= 2 then
- // GatherEcoLineReportCount := 0;
- // case DataSetInfo.ID of
- // GatherEcoLineDataSetID:
- // ADataSet := FGatherReport.cdsProjGatherForReport;
- // GatherEcoLineProjDataID:
- // ADataSet := FGatherReport.cdsProjData;
- // end;
- // end;
- // // 汇总指标单价
- // GatherUnitPriceDataSetID, GatherUnitPriceProjDataID:
- // begin
- // if FGatherUnitPriceReport = nil then
- // FGatherUnitPriceReport := TScProjGatherDM.Create(nil);
- // if GatherUnitPriceCount = 0 then
- // FGatherUnitPriceReport.GatherProjsForReport(FProjData.BuildProjectName, gtUnitPrice);
- // Inc(GatherUnitPriceCount);
- // if GatherUnitPriceCount >= 2 then
- // GatherUnitPriceCount := 0;
- // case DataSetInfo.ID of
- // GatherUnitPriceDataSetID:
- // ADataSet := FGatherUnitPriceReport.cdsProjGatherForReport;
- // GatherUnitPriceProjDataID:
- // ADataSet := FGatherUnitPriceReport.cdsProjData;
- // end;
- // end;
- // // 汇总指标单价(广东)
- // GatherBillsUnitPriceDataSetID, GatherBillsUnitPriceProjDataID:
- // begin
- // if FGatherUnitPriceReport = nil then
- // FGatherUnitPriceReport := TScProjGatherDM.Create(nil);
- // if GatherUnitPriceCount = 0 then
- // FGatherUnitPriceReport.GatherProjsForReport(FProjData.BuildProjectName, gtBillsUnitPrice);
- // Inc(GatherUnitPriceCount);
- // if GatherUnitPriceCount >= 2 then
- // GatherUnitPriceCount := 0;
- // case DataSetInfo.ID of
- // GatherBillsUnitPriceDataSetID:
- // ADataSet := FGatherUnitPriceReport.cdsProjGatherForReport;
- // GatherBillsUnitPriceProjDataID:
- // ADataSet := FGatherUnitPriceReport.cdsProjData;
- // end;
- // end;
- // // 审核比较定额表(标表4-3格式)
- // CompareRationDataSetID, CompareRationBillDataID{, CompareRationProjNamesID, CompareRationBillProjDataID}:
- // begin
- // CompareType := CompareRation;
- // if FCompareRationReport = nil then
- // begin
- // FCompareRationReport := TScReportCompareForm.Create(nil);
- // end;
- // if CompareRationReportCount = 0 then
- // begin
- // FCompareRationReport.CompositeCompareName(FProjData.BuildProjectName, FProjData.Alias);
- // FCompareRationReport.CompareAlias := Format('%s\%s', [FProjData.BuildProjectName, FProjData.Alias]);
- // if (FCompareRationReport.ShowModal <> mrOK) then
- // begin
- //// Exit;
- // end;
- // end;
- // Inc(CompareRationReportCount);
- // if CompareRationReportCount >= 2 then
- // CompareRationReportCount := 0;
- // case DataSetInfo.ID of
- // CompareRationDataSetID:
- // ADataSet := FCompareRationReport.DM.cdsRationsData;
- // CompareRationBillDataID:
- // ADataSet := FCompareRationReport.DM.cdsBillsData;
- // end;
- // end;
- //
- // // 汇总土地项目清单(广东)
- // GatherGroundDataSetID, GatherGroundProjDataID:
- // begin
- // if FGatherGroundPriceReport = nil then
- // FGatherGroundPriceReport := TScProjGatherDM.Create(nil);
- // if GatherGroundPriceCount = 0 then
- // FGatherGroundPriceReport.GatherProjsForReport(FProjData.BuildProjectName, gtGroundBills);
- // Inc(GatherGroundPriceCount);
- // if GatherGroundPriceCount >= 2 then
- // GatherGroundPriceCount := 0;
- // case DataSetInfo.ID of
- // GatherGroundDataSetID:
- // ADataSet := FGatherGroundPriceReport.cdsProjGatherForReport;
- // GatherGroundProjDataID:
- // ADataSet := FGatherGroundPriceReport.cdsProjData;
- // end;
- // end;
- //
- // // 汇总标表1(广东)(招预总01-2)
- // GatherStandardOneDataSetID, GatherStandardOneProjDataID:
- // begin
- // if FGatherStandardOneReport = nil then
- // FGatherStandardOneReport := TScProjGatherDM.Create(nil);
- // if GatherStandardOneCount = 0 then
- // FGatherStandardOneReport.GatherProjsStandardOneForReport(FProjData.BuildProjectName);
- // Inc(GatherStandardOneCount);
- // if GatherStandardOneCount >= 2 then
- // GatherStandardOneCount := 0;
- // case DataSetInfo.ID of
- // GatherStandardOneDataSetID:
- // ADataSet := FGatherStandardOneReport.cdsStandardOneForReport;
- // GatherStandardOneProjDataID:
- // ADataSet := FGatherStandardOneReport.cdsProjData;
- // end;
- // end;
- //
- // // 合同征拆总01表
- // GatherGroundChapterDataSetID, GatherGroundChapterProjDataID:
- // begin
- // if FGatherGroundChapterReport = nil then
- // FGatherGroundChapterReport := TScProjGatherDM.Create(nil);
- // if GatherGroundChapterCount = 0 then
- // FGatherGroundChapterReport.GatherProjsForReport(FProjData.BuildProjectName, gtGroundChapter);
- // Inc(GatherGroundChapterCount);
- // if GatherGroundChapterCount >= 2 then
- // GatherGroundChapterCount := 0;
- // case DataSetInfo.ID of
- // GatherGroundChapterDataSetID:
- // ADataSet := FGatherGroundChapterReport.cdsProjGatherForReport;
- // //FGatherGroundChapterReport.cdsProjGatherForReport.savetofile('E:\TEMP\cdsProjGatherForReport.cds');
- // GatherGroundChapterProjDataID:
- // ADataSet := FGatherGroundChapterReport.cdsProjData;
- // end;
- // end;
- //
- // // 计日工汇总 合同总01-2表
- // GatherDatallerDataSetID, GatherDatallerProjDataID:
- // begin
- // if FGatherDatallerReport = nil then
- // FGatherDatallerReport := TScProjGatherDM.Create(nil);
- // if GatherDatallerCount = 0 then
- // FGatherDatallerReport.GatherProjsForReport(FProjData.BuildProjectName, gtDataller);
- // Inc(GatherDatallerCount);
- // if GatherDatallerCount >= 2 then
- // GatherDatallerCount := 0;
- // case DataSetInfo.ID of
- // GatherDatallerDataSetID:
- // ADataSet := FGatherDatallerReport.cdsProjGatherForReport;
- // //FGatherGroundChapterReport.cdsProjGatherForReport.savetofile('E:\TEMP\cdsProjGatherForReport.cds');
- // GatherDatallerProjDataID:
- // ADataSet := FGatherDatallerReport.cdsProjData;
- // end;
- // end;
- //
- // end;
- // {$ENDIF}
- // {$ENDIF}
- end;
- procedure TScReportsForm.DoWriteReportprogress(APosition, AMax: Integer);
- begin
- if AMax > 0 then
- begin
- CreateProgressForm(AMax);
- end
- else if APosition = 0 then
- CloseProgressForm
- else
- RefreshProgressForm(APosition, '正在生成报表,请稍候……');
- end;
- procedure TScReportsForm.IncRefCount;
- begin
- Inc(FRefCount);
- end;
- function TScReportsForm.IsNotRefCountAbove: Boolean;
- begin
- if FRefCount <= 0 then Result := True
- else Result := False;
- end;
- procedure TScReportsForm.xcbRptAfterModifiedClick(Sender: TObject);
- var
- ParentNode, Node: TExTreeNode;
- SubParentNode, tempNode : TExTreeNode;
- strType, strTypeName, strRptName: string;
- strSubType, strSubTypeName : String;
- i : integer;
- ParentList : TList;
- SubParentList : TList;
- function addParent() : TExTreeNode;
- var compNode : TExTreeNode;
- loop : integer;
- begin
- Result := nil;
- ParentNode := nil;
- for loop := 0 to ParentList.Count - 1 do
- begin
- compNode := TExTreeNode(ParentList[loop]);
- if SameText(compNode.Text, strTypeName) then
- begin
- ParentNode := compNode;
- end;
- end;
- if (ParentNode = nil) then
- begin
- if (strType <> '') then
- begin
- ParentNode := extvReport.Items.AddChildObject(nil, strTypeName, Pointer(10000));
- ParentNode.ImageIndex := 0;
- ParentNode.SelectedIndex := 1;
- ParentList.Add(ParentNode);
- end;
- (*
- end else if (strType <> '') and (not SameText(ParentNode.Text, strTypeName)) then
- begin
- ParentNode := extvReport.Items.AddChildObject(nil, strTypeName, Pointer(10000));
- ParentNode.ImageIndex := 0;
- ParentNode.SelectedIndex := 1;
- //*)
- end;
- Result := ParentNode;
- end;
- function addSubParent() : TExTreeNode;
- var compNode : TExTreeNode;
- loop : integer;
- begin
- Result := nil;
- if (ParentNode <> nil) then
- begin
- SubParentNode := nil;
- if (strSubType <> '') then
- begin
- for loop := 0 to SubParentList.Count - 1 do
- begin
- compNode := TExTreeNode(SubParentList[loop]);
- if SameText(compNode.Text, strSubTypeName) then
- begin
- SubParentNode := compNode;
- end;
- end;
- if (SubParentNode = nil) then
- begin
- SubParentNode := extvReport.Items.AddChildObject(ParentNode, strSubTypeName, Pointer(10000));
- SubParentNode.ImageIndex := 0;
- SubParentNode.SelectedIndex := 1;
- end;
- end;
- end else
- begin
- SubParentNode := nil;
- end;
-
- Result := SubParentNode;
- if (Result <> nil) then
- begin
- SubParentList.Add(Result);
- end;
- end;
- begin
- if (extvReport.Selected <> nil) then
- begin
- strRptName := extvReport.Selected.Text;
- extvReport.Selected := nil;
- end;
- LockWindowUpdate(extvReport.Handle);
- try
- ParentNode := nil;
- SubParentNode := nil;
- ParentList := TList.Create;
- SubParentList := TList.Create;
- extvReport.Items.Clear;
- FReportManager.First;
- while not FReportManager.Eof do
- begin
- strType := FReportManager.FieldValue['分类'];
- strTypeName := FReportManager.FieldValue['分类'] + '.' +FReportManager.FieldValue['分类名称'];
- strSubType := FReportManager.FieldValue['子分类'];
- strSubTypeName := FReportManager.FieldValue['子分类'] + '.' +FReportManager.FieldValue['子分类名称'];
- //(*
- ParentNode := addParent();
- SubParentNode := addSubParent();
- //*)
- (*
- if ParentNode = nil then
- begin
- if strType <> '' then
- begin
- ParentNode := extvReport.Items.AddChildObject(nil, strTypeName, Pointer(10000));
- ParentNode.ImageIndex := 0;
- ParentNode.SelectedIndex := 1;
- if (strSubType <> '') then
- begin
- SubParentNode := extvReport.Items.AddChildObject(ParentNode, strSubTypeName, Pointer(10000));
- SubParentNode.ImageIndex := 0;
- SubParentNode.SelectedIndex := 1;
- end;
- end;
- end
- else if strType = '' then
- begin
- ParentNode := nil;
- SubParentNode := nil;
- end
- else if not SameText(ParentNode.Text, strTypeName) then
- begin
- if strType <> '' then
- begin
- ParentNode := extvReport.Items.AddChildObject(nil, strTypeName, Pointer(10000));
- ParentNode.ImageIndex := 0;
- ParentNode.SelectedIndex := 1;
- if (strSubType <> '') then
- begin
- SubParentNode := extvReport.Items.AddChildObject(ParentNode, strSubTypeName, Pointer(10000));
- SubParentNode.ImageIndex := 0;
- SubParentNode.SelectedIndex := 1;
- end else
- begin
- SubParentNode := nil;
- end;
- end;
- end;
- //*)
- tempNode := ParentNode;
- if (ParentNode <> nil) and (SubParentNode <> nil) then
- begin
- tempNode := SubParentNode;
- end;
- Node := extvReport.Items.AddChildObject(tempNode, FReportManager.FieldValue['名称'], Pointer(FReportManager.RecordNo));
- //Node := extvReport.Items.AddChildObject(ParentNode, FReportManager.FieldValue['名称'], Pointer(FReportManager.RecordNo));
- Node.ImageIndex := 2;
- Node.SelectedIndex := 3;
- Node.Checked := csUnchecked;
- if ParentNode <> nil then
- ParentNode.Expanded := True;
- FReportManager.Next;
- end;
- extvReport.AlphaSort;
- finally
- LockWindowUpdate(0);
- ParentList.Free;
- SubParentList.Free;
- end;
- //----------------------------------------------------------------------------
- for i := 0 to extvReport.Items.Count - 1 do
- begin
- if strRptName = extvReport.Items[i].Text then
- begin
- extvReport.Selected := extvReport.Items[i];
- extvReportDblClick(extvReport);
- break;
- end;
- end;
- //备注: 这里前提是调价前与调价后报表的显示名称要一致,否则不会去自动刷新
- //----------------------------------------------------------------------------
- end;
- //Tony Kang 2004-09-04----------------------------------------------------
- procedure TScReportsForm.FlowDataPrintEvent(var Text: String;
- var FontInfo: TFontRec; FieldID: Integer; ARect: TRect; DC: TCanvas);
- begin
- if IsEstimate1 then
- begin
- if ((FieldID = 2) and (Text = '元')) then
- begin
- Inc(SpIDX);
- end else
- if ((FieldID = 4) and (SpIDX > 0) ) then
- begin
- Text := '1.00';
- SpIDX := 0;
- end;
- //备注: 以上代码是一个比较特殊的判断,目的是为了在单位为元条件下(在此报表模板中字段ID为2),
- // 单价(字段ID为4)确定在1.00
- end;
- end;
- procedure TScReportsForm.CrossDataPrintEvent(var Text: String;
- var FontInfo: TFontRec; FieldID: Integer; ARect: TRect; DC: TCanvas);
- begin
- if IsEstimate1 then
- begin
- if ((FieldID = 3) and (Text = '元')) then
- begin
- Inc(SpIDX);
- end else
- if ((FieldID = 5) and (SpIDX > 0) ) then
- begin
- Text := '1.00';
- SpIDX := 0;
- end;
- //备注: 以上代码是一个比较特殊的判断,目的是为了在单位为元条件下(在此报表模板中字段ID为2),
- // 单价(字段ID为4)确定在1.00
- end;
- end;
- //Tony Kang 2004-09-04-end------------------------------------------------
- // begin [ZhangYin] 2004-09-04-----------------------------------------------------
- function TScReportsForm.IsEstimate1: Boolean;
- begin
- Result := false;
- end;
- // end [ZhangYin] 2004-09-04-----------------------------------------------------
- procedure TScReportsForm.xmReportsClickItem(Sender: TdxBarManager;
- ClickedItem: TdxBarItem);
- begin
- {$IFDEF _beEncrypt}
- DelayCheckDog;
- {$ENDIF}
- end;
- procedure TScReportsForm.extvReportChanging(Sender: TObject;
- Node: TExTreeNode; var AllowChange: Boolean);
- begin
- { AllowChange := True;
- if (Node = extvReport.Selected) or (Integer(Node.Data) = 10000) then
- AllowChange := False;}
- end;
- procedure TScReportsForm.extvReportChange(Sender: TObject;
- Node: TExTreeNode);
- begin
- // extvReportDblClick(Sender);
- end;
- procedure TScReportsForm.PreviewComXMLCrossTabLabelShow(valIDX: Integer;
- var ExLeft, ExRight: Double; var isShow: Boolean;
- CrsTabShowType: Integer);
- var field : PFieldRec;
- begin
- if (CrsTabShowType = -1) then exit;
- field := PreviewComXML.getFieldByID(6);
- if (field <> nil) then
- begin
- if (field.DataLen > valIDX) and (valIDX >= 0) then
- begin
- if (field.Value[valIDX] = 1.5) then
- begin
- case CrsTabShowType of
- 1 : begin
- isShow := false;
- end;
- 2 : begin
- ExLeft := 0;
- ExRight := 100;
- end;
- 3 : begin
- //
- end
- else
- begin
- //
- end;
- end;
- end;
- end;
- end;
- end;
- procedure TScReportsForm.xlbPrintCurPageClick(Sender: TObject);
- begin
- //Print current page
- if (TestInt(xcbPages.Text)) then
- begin
- PreviewComXML.Print(StrToInt(xcbPages.Text),1);
- end else
- begin
- Application.MessageBox('请选择正确的报表或页码.','注意');
- end;
- end;
- procedure TScReportsForm.xdcTopDblClick(Sender: TObject);
- begin
- //chkSafePrintMode.Visible := not chkSafePrintMode.Visible;
- end;
- procedure TScReportsForm.FormDestroy(Sender: TObject);
- begin
- FWorkListForm.Free;
-
- // chenshilong, 2011-07-12
- // 清除为预览报表创建打开的汇总项目
- MainFrm.ProjectManager.CloseProjectsForReport;
- // 这个属性能够保证每次点“报表”按钮时,重新读取最新数据
- // MainFrm.ProjectManager.SetReportsFirstGetData;
- FGatherProjectSL.Free;
- end;
- procedure TScReportsForm.ReplaceSpecChar(var ShowText : String);
- begin
- replaceSubString(ShowText, 'à','m3');
- replaceSubString(ShowText, '㎡','m2');
- end;
- procedure TScReportsForm.rdbtnA3Click(Sender: TObject);
- var FIni : TIniFile;
- strFileName : String;
- begin
- strFileName := extractFilePath(Application.ExeName) + STR_CONFIG_TEXT;
- FIni := TIniFile.Create(strFileName) ;
- FIni.WriteString('纸张','幅面','A3');
- FIni.Free;
- PreReportName := '';
- setupPage('A3');
- extvReportDblClick(extvReport);
- end;
- procedure TScReportsForm.rdbtnA4Click(Sender: TObject);
- var FIni : TIniFile;
- strFileName : String;
- begin
- strFileName := extractFilePath(Application.ExeName) + STR_CONFIG_TEXT;
- FIni := TIniFile.Create(strFileName) ;
- FIni.WriteString('纸张','幅面','A4');
- FIni.Free;
- PreReportName := '';
- setupPage('A4');
- extvReportDblClick(extvReport);
- end;
- procedure TScReportsForm.setupPage(pageSize : String);
- var pDevModeInput : PDeviceMode;
- DevHandle : THandle;
- DevSetHandle : THandle;
- StubDevMode: TDeviceMode;
- arr_szDeviceName: array[0..64] of char;
- arr_szDriver : array[0..64] of char;
- arr_szPort : array[0..64] of char;
- begin
- Printer.GetPrinter(arr_szDeviceName,arr_szDriver,arr_szPort,DevHandle);
- try
- //L_IniFile.WriteString('纸张','幅面',PageNameCBox.Text);
- pDevModeInput := PDeviceMode(GlobalLock(DevHandle));
- StrCopy(pDevModeInput.dmFormName,PChar(pageSize));
- //pDevModeInput.dmPaperLength := arr_PaperSize[PageNameCBox.ItemIndex].Y;
- //pDevModeInput.dmPaperWidth := arr_PaperSize[PageNameCBox.ItemIndex].X;
- if (pageSize = 'A4') then
- begin
- pDevModeInput.dmPaperSize := DMPAPER_A4;
- end else if (pageSize = 'A3') then
- begin
- pDevModeInput.dmPaperSize := DMPAPER_A3;
- end;
- //要改变项
- pDevModeInput.dmFields := pDevModeInput.dmFields or DM_FORMNAME;
- //pDevModeInput.dmFields := pDevModeInput.dmFields or DM_PAPERLENGTH;
- //pDevModeInput.dmFields := pDevModeInput.dmFields or DM_PAPERWIDTH;
- pDevModeInput.dmFields := pDevModeInput.dmFields or DM_PAPERSIZE;
- DocumentProperties(0, Printer.Handle, arr_szDeviceName, pDevModeInput^,
- pDevModeInput^, DM_OUT_BUFFER);
- finally
- GlobalUnLock(DevHandle);
- //GlobalFree(DevHandle);
- end;
- end;
- procedure TScReportsForm.PreviewComXMLContentDisplay(
- var contentFontRec: TFontRec; dataType: Integer; isReading : boolean; DrawType : integer; isPrinting : boolean);
- begin
- if (isNarraw) then
- begin
- //(*
- if (isReading) then
- begin
- //bkContentFontHeight := contentFontRec.FontHeight;
- //if (dataType = 5) or (dataType = 4) then
- begin
- contentFontRec.FontName := 'Arial Narrow';
- contentFontRec.FontHeight := bkContentFontHeight * 4 div 3;
- end;
- end else
- begin
- //if ((dataType = 5) or (dataType = 4)) and (contentFontRec.FontName = 'Arial Narrow')
- // and (contentFontRec.FontHeight >= 16) then
- if (DrawType = 3) or (DrawType = 5) then
- begin
- //contentFontRec.FontName := 'Arial Narrow';
- contentFontRec.FontHeight := bkContentFontHeight;
- end else if (isPrinting) then
- begin
- contentFontRec.FontName := 'Arial Narrow';
- //contentFontRec.FontHeight := bkContentFontHeight;
- contentFontRec.FontHeight := bkContentFontHeight * 7 div 6;
- end else
- begin
- contentFontRec.FontHeight := bkContentFontHeight * 4 div 3;
- //contentFontRec.FontHeight := bkContentFontHeight;
- end;
- end;
- //*)
- end;
- end;
- procedure TScReportsForm.popMnuOutputDataClick(Sender: TObject);
- var strFileName : String;
- begin
- //显示报表数据,调试用
- strFileName := extractFilePath(Application.ExeName) + 'data.log';
- end;
- procedure TScReportsForm.startMove(X, Y: Integer);
- begin
- FCurrentMouseP.X := X;
- FCurrentMouseP.Y := Y;
- //FCurrentMouseP.
- StartMoveRpt := true;
- end;
- procedure TScReportsForm.endMove(X, Y: Integer);
- begin
- StartMoveRpt := false;
- end;
- procedure TScReportsForm.moveRpt(X, Y: integer);
- begin
- //
- end;
- procedure TScReportsForm.chkFillZeroClick(Sender: TObject);
- begin
- //PreviewComXML.FillZero := chkFillZero.Checked;
- ReportPreview();
- end;
- procedure TScReportsForm.PreviewComXMLProgress(RptName: string; TotalPages,
- CurrentPage: Integer);
- begin
- //ShowFloatProgress
- ShowFloatProgress(Format('正在处理 %s 第 %d 页,共 %d 页,请稍候…', [RptName, CurrentPage, TotalPages]),
- (CurrentPage * 100) div TotalPages);
- end;
- procedure TScReportsForm.PreviewBoxMouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- //
- end;
- procedure TScReportsForm.PreviewComXMLGetGatherProjDataConnection(
- var ADOCon: TADOConnection);
- begin
- ADOCon := FGatherProject.Report.Connection;
- end;
- end.
|