1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101 |
- $PBExportHeader$w_rpt_main.srw
- $PBExportComments$主设计器--窗口
- forward
- global type w_rpt_main from w_rpt_base
- end type
- type mdi_1 from mdiclient within w_rpt_main
- end type
- type cb_hidebackgroud from commandbutton within w_rpt_main
- end type
- type cb_setbackgroud from commandbutton within w_rpt_main
- end type
- type dw3 from datawindow within w_rpt_main
- end type
- type dwx from datawindow within w_rpt_main
- end type
- type dwy from datawindow within w_rpt_main
- end type
- type ddlb_1 from dropdownlistbox within w_rpt_main
- end type
- type ddlb_2 from dropdownlistbox within w_rpt_main
- end type
- type ln_1 from line within w_rpt_main
- end type
- type dwc1 from datawindow within w_rpt_main
- end type
- type st_1 from statictext within w_rpt_main
- end type
- type sle_1 from singlelineedit within w_rpt_main
- end type
- type dw1 from datawindow within w_rpt_main
- end type
- type dwc2 from uo_scolor within w_rpt_main
- end type
- type cbx_lock from checkbox within w_rpt_main
- end type
- end forward
- shared variables
- end variables
- global type w_rpt_main from w_rpt_base
- integer y = 4
- integer width = 3968
- integer height = 2380
- string title = "数据窗口编辑器"
- string menuname = "m_rpt_main"
- windowtype windowtype = mdi!
- long backcolor = 80269524
- event ue_toolbar ( string mybarname, menu mymenu )
- event ue_preview ( )
- event ue_sel_no ( )
- event ue_copy ( )
- event ue_allposition ( string as_direct )
- event ue_save ( )
- event ue_auto ( )
- event ue_sel_yes ( string select_type )
- event ue_datasource ( )
- event ue_deletegroup ( )
- event ue_delobj ( )
- event ue_insertgroup ( )
- event ue_properties ( string tt )
- event ue_outside ( )
- event ue_cc ( integer ai_cc )
- event ue_edit_report ( )
- event ue_upload ( )
- event ue_saveupload ( )
- event ue_beforesave ( )
- event ue_aftersave ( )
- mdi_1 mdi_1
- cb_hidebackgroud cb_hidebackgroud
- cb_setbackgroud cb_setbackgroud
- dw3 dw3
- dwx dwx
- dwy dwy
- ddlb_1 ddlb_1
- ddlb_2 ddlb_2
- ln_1 ln_1
- dwc1 dwc1
- st_1 st_1
- sle_1 sle_1
- dw1 dw1
- dwc2 dwc2
- cbx_lock cbx_lock
- end type
- global w_rpt_main w_rpt_main
- type prototypes
- Function string f_cdw(string s1,string s2,string s3,string s4,string s5,string s6,string s7,string s8,string s9,string s10) Library "cdw.dll" alias for "f_cdw;Ansi"
- Function boolean SetCurrentDirectory(ref string lpPathName) Library "KERNEL32.DLL" Alias for "SetCurrentDirectoryA;Ansi"
- FUNCTION ulong GetCurrentDirectoryA(ulong BufferLen, ref string currentdir) LIBRARY "Kernel32.dll" alias for "GetCurrentDirectoryA;Ansi"
- end prototypes
- type variables
- datawindow id_userdw//前台报表设计时共享的用户dw
- string is_toolbar//当前按下的工具条名称
- string is_point="UP"//鼠标的状态
- string is_dw//创建动态数据窗口的语法
- string is_errors//出错信息字符串
- string is_auto//自动auto或手动mane+自动创建dw字体等
- long is_rid//报表编号
- string is_rname//报表中文名称
- string is_click_object//鼠标点击的对象名
- int ii_x//鼠标按下时的X值
- int ii_y//鼠标按下时的Y值
- int ii_x_max=4544//2272//x最大值
- int ii_y_max=3408//2272//y最大值
- int ii_x_scroll=0//鼠标在dw1向左右卷动的值
- int ii_y_scroll=0//鼠标在dw1向上下卷动的值
- int ii_group//当前分组数
- int ii_bbgs=1//自动设计时所选择的报表格式,1=表格式(标准宽度),2=表格式(压缩宽度),3=自由式
- string is_oexp//表达式的中文名
- string is_o2exp//表达式的英文名
- int ii_x_old//对象移动前的x值
- int ii_y_old//对象移动前的y值
- int iic//所选对象的总数
- int ii_topformove//带区上移时实际移动的距离
- string iso_old//前一对象的名称
- int ii_outside//移出边界方向
- datastore ids//存放dw语法
- string is_type//对象类型
- string is_band='detail'//带区
- string is_modify
- string is_scolor//颜色设置状态
- string is_sparse//压缩列
- datastore idsx//存放属性中英文名称
- robj io[],id[2]//存放所有对象属性的数组
- int iis//对象总数
- string is0[]//对象的属性英文名
- string ist//='01line02text03column04compute05graph06report07bitmap08tableblob09rectangle10button11gb12oval13rr'
- int ii[]//对象的属性数
- int iio//当前对象行
- string iso//当前所选的对象名称
- int ii_save//存盘标识
- decimal ln_bl=2.65295//单位换算比例
- string is_updatetable,is_updatewhere='1',is_updatekeyinplace='no',is_update
- datawindow idwm
- int ii_rowm
- int ii_xc//dwc2记录自定义颜色位置用
- string is_cm//dwc2记录自定义颜色对象用
- string is_path=Space(256)//保存当前路径
- boolean ib_resize_statbar = false
- boolean ib_save_flag
- boolean import_flag
- string ls_pblpath
- string ls_Tag
- m_rpt_main lm_rpt_main
- string ls_comments
- boolean ifreport = false
- ///////////////////////////////////////////////////////////////////
- string ibackgroudname = 'taoda_background_bmp'
- string ifilename = ''
- s_background_rslt s_tran
- end variables
- forward prototypes
- public subroutine wf_setcolor ()
- public function integer wf_topformove ()
- public function string wf_arguments (string s_syntax)
- public subroutine wf_read (string f_label)
- public subroutine wf_resetoid ()
- public subroutine wf_allset (string f_set, string f_new)
- public function string wf_idscreate ()
- public subroutine wf_unit ()
- public function integer wf_afind ()
- public function string wf_object (integer j, integer k)
- public subroutine wf_adelete (integer j)
- public subroutine wf_asort (string fs)
- public subroutine wf_band4 (integer h1, integer h2, integer h3, integer h4, integer f_label)
- public subroutine wf_insertgroup (integer i_h, integer i_b, string s_oexp, string s_o2exp, string s_newpage, string s_resetpagecount, integer f_label)
- public subroutine wf_format (string s_type)
- public subroutine wf_title (integer i_x, integer i_y, string s_fname, integer i_fsize)
- public subroutine wf_page (integer i_x, integer i_y, string s_fname, integer i_fsize)
- public subroutine wf_libexport ()
- public subroutine wf_libimport ()
- public function string wf_ssx (string s1, string s2, string s3, string s4)
- public function integer wf_crosstabc ()
- public subroutine wf_dwinit ()
- public subroutine wf_obj0 ()
- public function string wf_rowindetail (string s1, string s2)
- public subroutine wf_aftermove (integer y1_add, integer ff)
- public function string wf_mysx (string fsx)
- public subroutine wf_wdata ()
- public subroutine wf_alldel ()
- public function long wf_occ (integer icc)
- public subroutine wf_dwimport ()
- public function integer wf_upload (string arg_dwsyn, ref string arg_msg)
- public function integer wf_write ()
- public function string wf_nest_arguments (string s_syntax)
- public function double wf_mm_to_unitsx (string ls_units, double ld_mm)
- public function double wf_mm_to_unitsy (string ls_units, double ld_mm)
- public function double wf_unitsx_to_mm (string ls_units, double ld_unit)
- public function double wf_unitsy_to_mm (string ls_units, double ld_unit)
- end prototypes
- event ue_toolbar;//按下工具条时处理代码
- if is_toolbar=mybarname then//当前按钮已经按下,则弹起
- is_toolbar=''
- else//当前按钮没有按下
- event ue_sel_no()//清除选择
- wf_setcolor()//设置颜色
- is_toolbar=mybarname//设置当前按钮
- end if
- if is_toolbar='' then
- mymenu.Checked=false//弹起按钮
- else
- mymenu.Checked=true//按下按钮
- end if
- if NOT IsValid(m_rpt_main) then
- m_rpt_main = lm_rpt_main
- end if
- if mybarname='taborder' then
- if is_toolbar>'' then
- for i=1 to iis
- if io[i].otype='column' then
- s[1]="create text(band=detail name="+io[i].oname+"_zkl0 text='"+string(long(f_rsx(io[i].others,'tabsequence')))+"' x='"+io[i].ox1+"' y='"+string(long(io[i].oy1) -13)+"' width='24' height='12' font.face='宋体' font.height='12' alignment='0' border='0' color='255' background.color='536870912' background.mode='2')"
- dw1.modify(s[1])
- end if
- next
-
-
-
- m_rpt_main.m_1.enabled=false
- m_rpt_main.m_2.enabled=false
- m_rpt_main.m_dq.enabled=false
- m_rpt_main.m_bk.enabled=false
- m_rpt_main.m_xs.enabled=false
- m_rpt_main.m_4.enabled=false
- m_rpt_main.m_3.m_sep1.enabled=false
- m_rpt_main.m_3.m_dxfz.enabled=false
- m_rpt_main.m_3.m_sql.enabled=false
- else
- for i=1 to iis
- if io[i].otype='column' then
- io[i].oselect=dw1.describe(io[i].oname+'_zkl0.text')
- end if
- next
- wf_asort('select')
- ii_temp=0
- for i=1 to iis
- if io[i].otype='column' then
- if long(io[i].oselect)>0 then
- ii_temp++
- f_wsx(io[i].others,'tabsequence',string(ii_temp*10))
- else
- f_wsx(io[i].others,'tabsequence','')
- end if
- end if
- next
- dw1.modify('destroy zkl0')
- for i=1 to iis
- if io[i].otype='column' then
- dw1.modify('destroy '+io[i].oname+'_zkl0')
- io[i].oselect=''
- end if
- next
-
- m_rpt_main.m_1.enabled=true
- m_rpt_main.m_2.enabled=true
- m_rpt_main.m_dq.enabled=true
- m_rpt_main.m_bk.enabled=true
- m_rpt_main.m_xs.enabled=true
- m_rpt_main.m_4.enabled=true
- m_rpt_main.m_3.m_sep1.enabled=true
- m_rpt_main.m_3.m_dxfz.enabled=true
- m_rpt_main.m_3.m_sql.enabled=true
-
- end if
- end if
- end event
- event ue_preview();//报表预览代码
- IF NOT ib_save_flag AND NOT import_flag THEN
- MessageBox('提示','请先存盘')
- RETURN
- END IF
- s_rpt_print_msg s_print
- wf_resetoid()
- if wf_write() = 0 then return
- IF import_flag THEN
- s_print.isdw = is_dw
- else
- s_print.isdw = ''
- s_print.rpid = istr_rpt.rid
- s_print.tag_text = istr_rpt.billname
- s_print.rpname = is_rname
-
- END IF
- s_print.retr_pram_falg = istr_rpt.retr_pram_falg
- s_print.retr_flag = istr_rpt.retr_flag
- OpenWithParm(w_rpt_preview,s_print)
- end event
- event ue_sel_no;//释放所有选择对象
- for i=1 to iis
- io[i].oselect=''
- next
- iic=0
- end event
- event ue_copy;//对象拷贝事件
- long li_line,li_text,li_edit,li_rectangle,li_bitmap,li_blob,li_report,li_graph,li_button,li_gb,li_oval,li_rr,li_rows,j
- string lso
- for i=1 to iis
- lso=io[i].oname
- choose case io[i].otype
- case 'line'
- li_line=max(li_line,long(mid(lso,7)))
- case 'text'
- li_text=max(li_text,long(mid(lso,6)))
- case 'column','compute'
- li_edit=max(li_edit,long(mid(lso,6)))
- case 'rectangle'
- li_rectangle=max(li_rectangle,long(mid(lso,11)))
- case 'bitmap'
- li_bitmap=max(li_bitmap,long(mid(lso,8)))
- case 'tableblob'
- li_blob=max(li_blob,long(mid(lso,11)))
- case 'report'
- li_report=max(li_report,long(mid(lso,8)))
- case 'graph'
- li_graph=max(li_graph,long(mid(lso,7)))
- case 'button'
- li_button=max(li_button,long(mid(lso,8)))
- case 'groupbox'
- li_gb=max(li_gb,long(mid(lso,10)))
- case 'ellipse'
- li_oval=max(li_oval,long(mid(lso,9)))
- case 'roundrectangle'
- li_rr=max(li_rr,long(mid(lso,16)))
- end choose
- next
- dw1.setredraw(false)
- li_rows=iis
- for j=1 to li_rows
- if io[j].oselect<'1' or io[j].otype='band' then continue
- iis++
- i=iis
- io[i]=io[j]
- io[j].oselect=''
- lso=io[j].oname
-
- io[i].occ=wf_occ(1)+1//对象层次
-
- io[i].oy1=string(long(io[i].oy1)+18)
- io[i].oy2=string(long(io[i].oy2)+18)
- choose case io[i].otype
- case 'line'
- li_line++
- lso=left(lso,6)+string(li_line)
- case 'text'
- li_text++
- lso='text_'+string(li_text)
- case 'column','compute'
- li_edit++
- lso='edit_'+string(li_edit)
- case 'rectangle'
- li_rectangle++
- lso='rectangle_'+string(li_rectangle)
- case 'bitmap'
- li_bitmap++
- lso='bitmap_'+string(li_bitmap)
- case 'tableblob'
- li_blob++
- lso='tableblob_'+string(li_blob)
- case 'report'
- li_report++
- lso='report_'+string(li_report)
- case 'graph'
- li_graph++
- lso='graph_'+string(li_graph)
- case 'button'
- li_button++
- lso='button_'+string(li_button)
- case 'groupbox'
- li_gb++
- lso='groupbox_'+string(li_gb)
- case 'ellipse'
- li_oval++
- lso='ellipse_'+string(li_oval)
- case 'roundrectangle'
- li_rr++
- lso='roundrectangle_'+string(li_rr)
- end choose
- io[i].oname=lso
- wf_object(i,0)
- next
- wf_setcolor()
- dw1.setredraw(true)
- return
- end event
- event ue_allposition;////所选对象上下左右对齐,或者置相同宽度相同高度,参数:as_direct
- int li_left,li_right,li_top,li_buttom,li_width,li_height,li_space
- if iic<=1 then return
- if left(as_direct,5)='space' then//等间距
- if iic<3 then return
- if as_direct='space-x' then//以下12行可以不要,因为有优点也有缺点
- wf_asort('x1')
- else//'space-y'
- wf_asort('y1')
- end if
- ii_temp=2
- for i=1 to iis
- if long(io[i].oselect)>2 then
- ii_temp++
- io[i].oselect=string(ii_temp)
- end if
- next//以上12行可以不要,因为有优点也有缺点
- wf_asort('select')
- end if
- for i=1 to iis
- if io[i].oselect='1' then//寻找click选中的第一个对象
- exit
- end if
- next
- if i>iis then i=1//如果没找到,就选第一条记录
- li_left=min(long(io[i].ox1),long(io[i].ox2))
- li_right=max(long(io[i].ox1),long(io[i].ox2))
- li_top=min(long(io[i].oy1),long(io[i].oy2))
- li_buttom=max(long(io[i].oy1),long(io[i].oy2))
- li_width=li_right - li_left
- li_height=li_buttom - li_top
- if pos(as_direct,'space')=1 then
- for i=1 to iis
- if io[i].oselect='2' then//寻找click选中的第二个对象
- exit
- end if
- next
- if i>iis then i=2//如果没找到,就选第二条记录
- if as_direct='space-x' then
- li_space=long(io[i].ox1) -li_right
- else//'space-y'
- li_space=long(io[i].oy1) -li_buttom
- end if
- end if
- dw1.setredraw(false)
- for i=1 to iis//循环处理所有要对齐的对象
- if io[i].oselect<'1' or io[i].otype='band' then continue
- choose case as_direct
- case 'left'//左对齐
- ii_temp=min(long(io[i].ox1),long(io[i].ox2))
- io[i].ox1=string(long(io[i].ox1)+li_left - ii_temp)
- io[i].ox2=string(long(io[i].ox2)+li_left - ii_temp)
- case 'right'//右对齐
- ii_temp=max(long(io[i].ox1),long(io[i].ox2))
- io[i].ox1=string(long(io[i].ox1)+li_right - ii_temp)
- io[i].ox2=string(long(io[i].ox2)+li_right - ii_temp)
- case 'up'//上对齐
- ii_temp=min(long(io[i].oy1),long(io[i].oy2))
- io[i].oy1=string(long(io[i].oy1)+li_top - ii_temp)
- io[i].oy2=string(long(io[i].oy2)+li_top - ii_temp)
- case 'down'//下对齐
- ii_temp=max(long(io[i].oy1),long(io[i].oy2))
- io[i].oy1=string(long(io[i].oy1)+li_buttom - ii_temp)
- io[i].oy2=string(long(io[i].oy2)+li_buttom - ii_temp)
- case 'width'//等宽
- if li_width>0 then
- if pos(io[i].oname,'line2')<>1 then
- ii_temp=min(long(io[i].ox1),long(io[i].ox2))
- io[i].ox1=string(ii_temp)
- io[i].ox2=string(ii_temp+li_width)
- end if
- end if
- case 'height'//等高
- if li_height>0 then
- if pos(io[i].oname,'line1')<>1 then
- ii_temp=min(long(io[i].oy1),long(io[i].oy2))
- io[i].oy1=string(ii_temp)
- io[i].oy2=string(ii_temp+li_height)
- end if
- end if
- case 'space-x','space-y'//等间距
- if long(io[i].ox2)<long(io[i].ox1) then
- is_temp=io[i].ox2
- io[i].ox2=io[i].ox1
- io[i].ox1=is_temp
- end if
- if long(io[i].oy2)<long(io[i].oy1) then
- is_temp=io[i].oy2
- io[i].oy2=io[i].oy1
- io[i].oy1=is_temp
- end if
- li_width=long(io[i].ox2) -long(io[i].ox1)
- li_height=long(io[i].oy2) -long(io[i].oy1)
- if as_direct='space-x' then//横向等间距
- if io[i].oselect>'1' then
- io[i].ox1=string(li_right+li_space)
- io[i].ox2=string(long(io[i].ox1)+li_width)
- end if
- li_right=long(io[i].ox2)
- else//纵向等间距
- if io[i].oselect>'1' then
- io[i].oy1=string(li_buttom+li_space)
- io[i].oy2=string(long(io[i].oy1)+li_height)
- end if
- li_buttom=long(io[i].oy2)
- end if
- end choose
- wf_object(i,1)
- next
- dw1.setredraw(true)
- return
- end event
- event ue_save;triggerevent('ue_beforesave')
- //语法保存
- wf_resetoid()
- if wf_write() = 0 then return
- Blob lblob
- lblob = Blob(is_dw,EncodingANSI!)
- IF NOT import_flag THEN
- //PB6.5(或PB7.0)+MSSQL2000下需要加上以下两行代码才不会出错,但PB8.0则可以不加
- UPDATE u_report_list Set Rpsyntax = '' Where rpid = :is_rid USING it_report;
- COMMIT USING it_report;
-
- UPDATE u_report_list
- SET flag = 1
- Where rpid = :is_rid USING it_report;
-
- UPDATEBLOB u_report_list
- Set Rpsyntax = :lblob
- Where rpid = :is_rid USING it_report;
- //if it_report.sqlnrows>0 then//PB8.0可以开放以下代码
- IF it_report.SQLCode = 0 THEN
- COMMIT USING it_report;
- ii_save = 0
- MessageBox('提示','保存成功!')
- ib_save_flag = TRUE
- ELSE
- ROLLBACK USING it_report;
- MessageBox('error!','保存失败!'+it_report.SQLErrText)
- END IF
-
- ELSE
- ///直接写入当前PBL
- String ls_error
- IF is_rname > '' THEN
- Long rslt
- IF ls_comments <> '' THEN
- rslt = LibraryImport(ls_pblpath,is_rname,ImportDataWindow!,is_dw,ls_error,ls_comments)
- ELSE
- rslt = LibraryImport(ls_pblpath,is_rname,ImportDataWindow!,is_dw,ls_error)
- END IF
- IF rslt = 1 THEN
- IF IsValid(w_publ_preview) THEN
- Long j
- FOR j = 1 TO w_publ_preview.it_max
- IF w_publ_preview.ls_dw_arr[j] = is_rname THEN
- w_publ_preview.wf_dowithm(22)
- EXIT
- END IF
- NEXT
- END IF
- MessageBox('提示','保存成功!')
- ELSE
- MessageBox('提示','保存失败!')
- END IF
- ELSE
- MessageBox('提示','保存失败!')
- END IF
- END IF
- triggerevent('ue_aftersave')
- RETURN
- end event
- event ue_auto();//自动设计时创建对象事件
- //clen1=字段汉字象素,clen2=字段长度象素
- //dw1=显示对象,dw2=对象内部数据,dw3=dw_rpt_column
- if is_datasource='dw' then
- datastore lds
- lds=create datastore
- lds.dataobject=dw3.dataobject
- dw3.rowscopy(1,dw3.rowcount(),Primary!,lds,1,Primary!)
- end if
- if import_flag then
- goto myband4
- end if
- istr_rpt.auto='auto'
- openwithparm(w_rpt_sql,istr_rpt,this)
- if not isvalid(message.powerobjectparm) then goto myband4
- istr_rpt=message.powerobjectparm
- openwithparm(w_rpt_message,'正在读取数据,请等候......')
- wf_alldel()
- int j,li_max1,li_max2,li_xx,li_nups,k
- int li_ls,li_hs,li_cls,li_chs,li_len1,li_len2,li_len3
- int li_height[4],li_rows,li_tfsize,li_bfsize
- string ls_tfname,ls_bfname
- ii_bbgs=long(istr_rpt.tt)
- ls_tfname=istr_rpt.t1//标题字体
- li_tfsize=long(istr_rpt.t2)//标题字号
- ls_bfname=istr_rpt.t3//内容字体
- li_bfsize =long(istr_rpt.t4)//内容字号
- li_rows=dw3.rowcount()//所选col
- if ii_bbgs<=5 then
- id[1].ox1='0'//processing数据窗口类型
- else
- id[1].ox1=string(ii_bbgs -5)
- end if
- choose case ii_bbgs
- case 10//report
- wf_band4(600,0,0,0,0)
- wf_obj0()
- is_toolbar='report'
- dw1.event clicked(10,10,0,dw1.object.datawindow)
- dw1.event doubleclicked(0,0,0,dw1.object.report_1)
- goto myband4
- case 8//graph
- wf_band4(600,0,0,0,0)
- wf_obj0()
- is_toolbar='graph'
- dw1.event clicked(4,4,0,dw1.object.datawindow)
- if iio>0 then
- io[iio].ox2='900'
- io[iio].oy2='590'
- end if
- io[iio].otext=is_rname
- wf_object(iio,1)
- dw1.event doubleclicked(0,0,0,dw1.object.graph_1)
- goto myband4
- case 9//crosstab
- istr_rpt.tt='crosstab'
- dw1.event doubleclicked(0,0,0,dw1.object.datawindow)
- istr_rpt.tt=''
- goto myband4
- case 1,4,6,5//1=表格式(标准宽度)
- ii_x=0
- if ii_bbgs=1 then
- li_xx=5
- else
- li_xx=2
- end if
- if ii_bbgs=5 then
- li_nups=long(istr_rpt.t5)
- if li_nups<1 then li_nups=1
- id[1].ofweight=string(li_nups)
- else
- li_nups=1
- end if
- for k=1 to li_nups
- ii_x=ii_x+li_xx
- for j=1 to li_rows+1
- if j<=li_rows then
- w_rpt_message.event ue_percent(i*100/li_rows)
- iis++
- i=iis
- is_oexp=dw3.getitemstring(j,'ctag')
- is_o2exp=dw3.getitemstring(j,'cname')
- li_len1=dw3.getitemnumber(j,'clen1')
- li_len2=dw3.getitemnumber(j,'clen2')
- io[i].otype='text'//字段标题
- if ii_bbgs=5 then
- io[i].oname=is_o2exp+'_'+string(k)+'_t'
- else
- io[i].oname=is_o2exp+'_t'
- end if
- io[i].otext=is_oexp
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='536870912'
- io[i].others=io[i].others+'{background.mode=1}'//背景透明
- io[i].ox1=string(ii_x)
- io[i].oy1=string(50+li_bfsize - li_bfsize - 5)
- io[i].ox2=string(long(io[i].ox1)+max(li_len1,li_len2))
- io[i].oy2=string(long(io[i].oy1)+li_bfsize)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- io[i].oalignment='2'
- iis++
- i=iis
- io[i].otype='column'//字段
- io[i].others=io[i].others+'{id='+string(j)+'}'+'{tabsequence='+string(j*10)+'}'
- if ii_bbgs=5 then
- io[i].oname=is_o2exp+'_'+string(k)
- f_wsx(io[i].others,'row_in_detail',string(k))
- else
- io[i].oname=is_o2exp
- end if
- io[i].otext=is_oexp
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].oexpression='edit'
- io[i].ox1=string(ii_x)
- io[i].oy1=string(50+li_bfsize+18)
- io[i].ox2=string(long(io[i].ox1)+max(li_len1,li_len2))
- io[i].oy2=string(long(io[i].oy1)+li_bfsize)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- wf_format(dw3.getitemstring(j,'ctype'))
- end if
- if ii_bbgs=1 then
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line2_'+string(i*2 - 1) // li_rows+1条竖线
- io[i].ocolor='0'
- io[i].ox1=string(ii_x - 3)
- io[i].oy1=string(41)
- io[i].ox2=string(ii_x - 3)
- io[i].oy2=string(50+li_bfsize - 2)
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line2_'+string(i*2)
- io[i].ocolor='0'
- io[i].ox1=string(ii_x - 3)
- io[i].oy1=string(50+li_bfsize+13)
- io[i].ox2=string(ii_x - 3)
- io[i].oy2=string(50+li_bfsize*2+14+8)
- end if
- if j<=li_rows then
- ii_x=ii_x+max(li_len1,li_len2)+li_xx
- if ii_x>ii_x_max then
- li_rows=j
- end if
- end if
- next
- next
-
- if ii_bbgs=1 then
- for j=1 to 3 // 三条横线
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line1_'+string(i*2 - 2+j)
- io[i].ocolor='0'
-
- io[i].ox1=string(2)
- io[i].ox2=string(ii_x - 2)
- choose case j
- case 1
- io[i].oy1=string(41)
- io[i].oy2=string(41)
- case 2
- io[i].oy1=string(50+li_bfsize - 2)
- io[i].oy2=string(50+li_bfsize - 2)
- case 3
- io[i].oy1=string(50+li_bfsize*2+14+8)
- io[i].oy2=string(50+li_bfsize*2+14+8)
- end choose
- next
- end if
-
- wf_title(max((ii_x+4 - len(is_rname)*li_tfsize/2)/2,0),10,ls_tfname,li_tfsize)
- wf_page(min(max((ii_x+4 - 38*li_bfsize/2)/2,0),1000),50+li_bfsize*2+14+10+24+14,ls_bfname,li_bfsize)
- wf_band4(50+li_bfsize,li_bfsize+10,0,50,0)
- case 2 //表格式(压缩宽度)
- ii_x=5
- for j=1 to li_rows+1
- if j<=li_rows then
- w_rpt_message.event ue_percent(i*100/li_rows)
-
- iis++
- i=iis
- is_oexp=dw3.getitemstring(j,'ctag')
- is_o2exp=dw3.getitemstring(j,'cname')
- li_len1=dw3.getitemnumber(j,'clen1')
- li_len2=dw3.getitemnumber(j,'clen2')
- if li_len2 < li_bfsize then li_len2=li_bfsize
- io[i].otype='column'//字段
- io[i].others=io[i].others+'{id='+string(j)+'}'+'{tabsequence='+string(j*10)+'}'
- io[i].oname=is_o2exp//'edit_'+string(i)
- io[i].otext=is_oexp
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].oexpression='edit'
- io[i].ox1=string(ii_x)
- io[i].oy1=string(50+li_bfsize*3+18)
- io[i].ox2=string(long(io[i].ox1)+li_len2)
- io[i].oy2=string(long(io[i].oy1)+li_bfsize)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- wf_format(dw3.getitemstring(j,'ctype'))
-
- iis++
- i=iis
- io[i].otype='text'//字段标题
- io[i].oname=is_o2exp+'_t'//'text_'+string(i)
- io[i].otext=is_oexp
- li_len3=int(li_len2*2/li_bfsize)
- if int(li_len3/2)<>li_len3/2 then li_len3=li_len3 - 1
- if li_len3=0 then li_len3=2
- if li_len1<=li_len2 then
- is_oexp=char(13)+is_oexp
- else
- if li_len1<=2*li_len2 then
- is_oexp=left(is_oexp,li_len3)+char(13)+char(13)+mid(is_oexp,li_len3+1)
- end if
- end if
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='536870912'
- io[i].others=io[i].others+'{background.mode=1}'//背景透明
- io[i].ox1=string(ii_x)
- io[i].oy1=string(50+li_bfsize*3 - li_bfsize*3 - 5)
- io[i].ox2=string(long(io[i].ox1)+li_len2)
- io[i].oy2=string(long(io[i].oy1)+li_bfsize*3)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- io[i].oalignment='2'
- else
- wf_title(max((ii_x+4 - len(is_rname)*li_tfsize/2)/2,0),10,ls_tfname,li_tfsize)
- wf_page(min(max((ii_x+4 - 38*li_bfsize/2)/2,0),1000),50+li_bfsize*3+14+li_bfsize+10+24+14,ls_bfname,li_bfsize)
- end if
-
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line2_'+string(i*2 - 1) // li_rows+1条竖线
- io[i].ocolor='0'
- io[i].ox1=string(ii_x - 3)
- io[i].oy1=string(50+li_bfsize*3 - li_bfsize*3 - 5 - 4)
- io[i].ox2=string(ii_x - 3)
- io[i].oy2=string(50+li_bfsize*3 - 2)
-
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line2_'+string(i*2)
- io[i].ocolor='0'
- io[i].ox1=string(ii_x - 3)
- io[i].oy1=string(50+li_bfsize*3+13)
- io[i].ox2=string(ii_x - 3)
- io[i].oy2=string(50+li_bfsize*3+14+li_bfsize+8)
- if j<=li_rows then
- ii_x=ii_x+li_len2+5
- if ii_x>ii_x_max then
- li_rows=j
- end if
- end if
- next
- for j=1 to 3 // 三条横线
- iis++
- i=iis
- io[i].otype='line'
- io[i].oname='line1_'+string(i*2 - 2+j)
- io[i].ocolor='0'
- io[i].ox1=string(2)
- io[i].ox2=string(ii_x - 2)
- choose case j
- case 1
- io[i].oy1=string(50+li_bfsize*3 - li_bfsize*3 - 5 - 4)
- io[i].oy2=string(50+li_bfsize*3 - li_bfsize*3 - 5 - 4)
- case 2
- io[i].oy1=string(50+li_bfsize*3 - 2)
- io[i].oy2=string(50+li_bfsize*3 - 2)
- case 3
- io[i].oy1=string(50+li_bfsize*3+14+li_bfsize+8)
- io[i].oy2=string(50+li_bfsize*3+14+li_bfsize+8)
- end choose
- next
- wf_band4(50+li_bfsize*3,li_bfsize+10,0,50,0)
- case 3,7 //3=自由式
- for j=1 to li_rows
- li_max1=max(li_max1,dw3.getitemnumber(j,'clen1'))
- li_max2=max(li_max2,dw3.getitemnumber(j,'clen2'))
- next
- if ii_bbgs=7 then
- li_ls=1//Label格式只需要1列
- else
- li_ls=int(800/(li_max1+li_max2+4))//计算列数
- if li_ls=0 then li_ls=1
- end if
- li_hs=Ceiling(li_rows/li_ls)//计算行数
- li_hs=min(li_hs,int(870/(li_bfsize+4)))//(行数*行高)不能超过A4打印的范围约870
- for j=1 to li_rows
- w_rpt_message.event ue_percent(j*100/li_rows)
- li_cls=Ceiling(j/li_hs)
- li_chs=mod(j,li_hs)
- if li_chs=0 then
- li_chs=li_hs
- end if
- iis++
- i=iis
- is_oexp=dw3.getitemstring(j,'ctag')
- is_o2exp=dw3.getitemstring(j,'cname')
- io[i].otype='text'//字段标题
- io[i].oname=is_o2exp+'_t'
- io[i].otext=is_oexp
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='536870912'
- io[i].others=io[i].others+'{background.mode=1}'//背景透明
- io[i].ox1=string((li_max1+li_max2+8)*(li_cls - 1)+4)
- io[i].oy1=string(50+16+(li_chs - 1)*(li_bfsize+4))
- io[i].ox2=string(long(io[i].ox1)+dw3.getitemnumber(j,'clen1'))
- io[i].oy2=string(long(io[i].oy1)+li_bfsize)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- iis++
- i=iis
- io[i].otype='column'//字段
- io[i].others=io[i].others+'{id='+string(j)+'}'+'{tabsequence='+string(j*10)+'}'
- io[i].oname=is_o2exp//'edit_'+string(i)
- io[i].otext=is_oexp
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].oexpression='edit'
- io[i].ox1=string((li_max1+li_max2+8)*(li_cls - 1)+4+li_max1+4)
- io[i].oy1=string(50+16+(li_chs - 1)*(li_bfsize+4))
- io[i].ox2=string(long(io[i].ox1)+dw3.getitemnumber(j,'clen2'))
- io[i].oy2=string(long(io[i].oy1)+li_bfsize)
- io[i].ofname=ls_bfname
- io[i].ofsize=string(li_bfsize)
- wf_format(dw3.getitemstring(j,'ctype'))
- next
- wf_band4(50,li_hs*(li_bfsize+4)+2,0,50,0)
- if ii_bbgs=7 then
- iso='band1'
- iio=wf_afind()
- wf_aftermove(-49,1)
- iso='band4'
- iio=wf_afind()
- wf_aftermove(-50,1)
- f_wsx(id[1].others,'label.width',string(li_max1+li_max2+10))
- f_wsx(id[1].others,'label.height',string(li_hs*(li_bfsize+4)))
- f_wsx(id[1].others,'label.rows','20')
- f_wsx(id[1].others,'label.columns','5')
- f_wsx(id[1].others,'label.rows.spacing','2')
- f_wsx(id[1].others,'label.columns.spacing','2')
- f_wsx(id[1].others,'label.ellipse_height','10')
- f_wsx(id[1].others,'label.ellipse_width','10')
- else
- //添加标题
- wf_title(max(((li_max1+li_max2+8)*li_cls+4 - len(is_rname)*li_tfsize/2)/2,0),10,ls_tfname,li_tfsize)
- //添加页码
- wf_page(min(max(((li_max1+li_max2+8)*li_cls+4 - 38*li_bfsize/2)/2,0),1000),50+li_hs*(li_bfsize+4)+16+24+14,ls_bfname,li_bfsize)
- //添加四个带区
- end if
- end choose
- wf_obj0()
- goto myband4
- return
- myband4:
- if iis=0 then
- wf_band4(50,50,50,50,0)
- wf_obj0()
- end if
- if is_datasource='dw' then
- dw3.reset()
- lds.rowscopy(1,lds.rowcount(),Primary!,dw3,1,Primary!)
- wf_resetoid()
- destroy lds
- end if
- wf_write()//表达式子校验用
- if import_flag then
- wf_dwimport()
- end if
- close(w_rpt_message)
- end event
- event ue_sel_yes;//从菜单中选择对象,参数:select_type
- dw1.setredraw(false)
- iic=0
- for i=1 to iis
- if select_type='all' or (pos(io[i].oname,select_type)=1 and pos(select_type,'line')=1) or (pos(select_type,io[i].otype)>0 and pos(select_type,'line')=0) then
- iic++//全选或找到,选中
- io[i].oselect=string(iic)
- else
- io[i].oselect=''
- end if
- next
- wf_setcolor()//设置颜色,选中为红色。
- dw1.setredraw(true)
- end event
- event ue_datasource();//重新设置数据源事件
- istr_rpt.auto='sql'
- openwithparm(w_rpt_sql,istr_rpt,this)
- if not isvalid(message.powerobjectparm) then return
- istr_rpt=message.powerobjectparm
- wf_resetoid()
- ii_save=1
- wf_write()//表达式子校验用
- end event
- event ue_deletegroup;//删除分组事件
- string ls_obj,ls_group
- int li_group
- open(w_rpt_groupd)
- ls_group=message.StringParm
- if ls_group='' then return
- ls_obj=iso//保护
- //删除组标题区
- wf_asort('y1')
- iso=ls_group
- li_group=long(mid(ls_group,10))
- iio=wf_afind()
- if iio>0 then
- l[1]=0
- for i=iio -1 to 1 step -1//反方向找上一带区
- if io[i].otype='band' then
- l[1]=i
- exit
- end if
- next
- if l[1]>0 then
- l[2]=long(io[i].oy1)
- else
- l[2]=0
- end if
- wf_aftermove(l[2] -long(io[iio].oy1),0)
- wf_adelete(iio)
- end if
- //删除组尾区
- iso=f_replace(ls_group,'_g_h','_g_b')
- iio=wf_afind()
- if iio>0 then
- l[1]=0
- for i=iio -1 to 1 step -1//反方向找上一带区
- if io[i].otype='band' then
- l[1]=i
- exit
- end if
- next
- if l[1]>0 then
- l[2]=long(io[i].oy1)
- else
- l[2]=0
- end if
- wf_aftermove(l[2] -long(io[iio].oy1),0)
- wf_adelete(iio)
- end if
- //对组编号重新排序
- for i=1 to iis
- iso=io[i].oname
- l[1]=long(mid(iso,10))
- if pos(iso,'band_g_')=1 and l[1]>li_group then
- dw1.modify('destroy '+iso)//删除原来分组
- io[i].oname=left(iso,9)+string(l[1] -1)
- io[i].otext=f_replace(io[i].otext,string(l[1])+': ',string(l[1] -1)+': ')
- end if
- next
- for i=1 to iis
- iso=io[i].oname
- l[1]=long(mid(iso,10))
- if pos(iso,'band_g_')=1 and l[1]>=li_group then
- wf_object(i,0)//不能把此循环跟上一循环合并
- end if
- next
- ii_group --
- iso=ls_obj
- iio=wf_afind()
- wf_write()//表达式子校验用
- end event
- event ue_delobj;//删除被选中的全部非带区对象
- dw1.setredraw(false)
- for i=iis to 1 step -1//循环删除所有选中对象
- if io[i].oselect<'1' or io[i].otype='band' then continue
- wf_adelete(i)
- next
- dw1.setredraw(true)
- end event
- event ue_insertgroup;//增加分组代码
- string ls_obj
- ls_obj=iso
- open(w_rpt_groupc)
- s[3]=message.StringParm
- if s[3]='' or s[3]=';;' then return
- l[1]=pos(s[3],';;')
- if l[1]>0 then
- s[1]=left(s[3],l[1] - 1)
- s[2]=mid(s[3],l[1]+2)
- end if
- wf_insertgroup(0,0,s[1],s[2],'no','no',0)//分组头高,分组尾高,中文名,英文名
- iso=ls_obj
- wf_write()//表达式子校验用
- end event
- event ue_properties;choose case iic
- case 1 //选了1个对象
- dwobject ldwo
- dw1.event doubleclicked(0,0,0,ldwo)
- case 0 //选了0个对象,修改datawindow属性
- if tt='crosstab' and istr_rpt.rarguments>'' then//交叉报表数据源带参数情况
- istr_rpt.auto='sql'
- istr_rpt.tt=tt+'_auto'
- openwithparm(w_rpt_sql,istr_rpt,this)
- if isvalid(message.powerobjectparm) then istr_rpt=message.powerobjectparm
- end if
- istr_rpt.tt=tt
- dw1.event doubleclicked(0,0,0,dw1.object.datawindow)
- istr_rpt.tt=''
- case else
- messagebox('信息','请先选择一个对象!')
- end choose
- end event
- event ue_outside;if keydown(KeyLeftButton!) then
- choose case ii_outside
- case 1//右边界
- ii_temp=8
- if ii_x+ii_temp<=ii_x_max then
- dw1.event ScrollHorizontal(ii_x_scroll+ii_temp,2)//触发dw_1的水平滚动事件,下同
- dw1.object.DataWindow.HorizontalScrollPosition=string(ii_x_scroll)
- dw1.event ue_mousemove(ii_x - (ii_x_scroll - ii_temp),ii_y - ii_y_scroll,0,dw1.object.datawindow)//dw_1的鼠标移动事件,用以选择对象,下同.
- end if
- case 2//下边界
- ii_temp=8
- if ii_y+ii_temp<=ii_y_max then
- dw1.event ScrollVertical(ii_y_scroll+ii_temp)
- dw1.object.DataWindow.VerticalScrollPosition=string(ii_y_scroll)
- dw1.event ue_mousemove(ii_x - ii_x_scroll,ii_y - (ii_y_scroll - ii_temp),0,dw1.object.datawindow)
- end if
- case 3//左边界
- ii_temp=-8
- if ii_x_scroll>0 then
- if ii_x_scroll<abs(ii_temp) then ii_temp= - ii_x_scroll
- dw1.event ScrollHorizontal(ii_x_scroll+ii_temp,2)
- dw1.object.DataWindow.HorizontalScrollPosition=string(ii_x_scroll)
- dw1.event ue_mousemove(0,ii_y - ii_y_scroll,0,dw1.object.datawindow)
- else
- dw1.event ue_mousemove(0,ii_y - ii_y_scroll,0,dw1.object.datawindow)
- end if
- case 4//上边界
- ii_temp=-8
- if ii_y_scroll>0 then
- if ii_y_scroll<abs(ii_temp) then ii_temp= - ii_y_scroll
- dw1.event ScrollVertical(ii_y_scroll+ii_temp)
- dw1.object.DataWindow.VerticalScrollPosition=string(ii_y_scroll)
- dw1.event ue_mousemove(ii_x - ii_x_scroll,0,0,dw1.object.datawindow)
- else
- dw1.event ue_mousemove(ii_x - ii_x_scroll,0,0,dw1.object.datawindow)
- end if
- end choose
- end if
- ii_outside=0
- end event
- event ue_cc;dw1.setredraw(false)
- long l1
- l1=wf_occ(1)//最大值
- if ai_cc=1 then//放到最上层
- for i=1 to iis
- if io[i].oselect<'1' or io[i].otype='band' then continue
- dw1.modify('destroy '+io[i].oname)
- wf_object(i,0)//根据对象不同分别生成Modify语句并执行
- l1++
- io[i].occ=l1
- next
- wf_setcolor()
- wf_asort('cc')
- else
- for i=1 to iis
- if io[i].oselect>'0' or io[i].otype='band' then continue
- dw1.modify('destroy '+io[i].oname)
- wf_object(i,0)//根据对象不同分别生成Modify语句并执行
- l1++
- io[i].occ=l1
- next
- wf_setcolor()
- wf_asort('cc')
- end if
- dw1.setredraw(true)
- end event
- event ue_edit_report();IF io[iio].otype = 'report' THEN
- str_rpt s_rpt_parm
-
- s_rpt_parm.auto = "auto"
- s_rpt_parm.transation = sqlca //数据库连接
- s_rpt_parm.oname = io[iio].otext
- s_rpt_parm.otype = istr_rpt.otype
- s_rpt_parm.rcname = io[iio].otext
- s_rpt_parm.retr_pram_falg = -1
- s_rpt_parm.retr_flag = TRUE
- s_rpt_parm.import_flag = TRUE
- s_rpt_parm.pblpath = istr_rpt.pblpath
- window lw_win
- OpenWithParm(lw_win,s_rpt_parm,this.ClassName())
- lw_win.WindowState = Normal!
- END IF
- end event
- event ue_upload(); //语法保存
- wf_resetoid()
- if wf_write() = 0 then return
- String arg_msg
- IF wf_upload(is_dw,arg_msg) = 0 THEN
- MessageBox('错误',arg_msg)
- ELSE
- MessageBox('提示','上传文件成功!')
- END IF
- end event
- event ue_saveupload();triggerevent('ue_beforesave')
- //语法保存
- wf_resetoid()
- if wf_write() = 0 then return
- Blob lblob
- lblob = Blob(is_dw,EncodingANSI!)
- IF NOT import_flag THEN
- //PB6.5(或PB7.0)+MSSQL2000下需要加上以下两行代码才不会出错,但PB8.0则可以不加
- UPDATE u_report_list Set Rpsyntax = '' Where rpid = :is_rid USING it_report;
- COMMIT USING it_report;
-
- UPDATE u_report_list
- SET flag = 1
- Where rpid = :is_rid USING it_report;
-
- UPDATEBLOB u_report_list
- Set Rpsyntax = :lblob
- Where rpid = :is_rid USING it_report;
- //if it_report.sqlnrows>0 then//PB8.0可以开放以下代码
- IF it_report.SQLCode = 0 THEN
- COMMIT USING it_report;
- ii_save = 0
- MessageBox('提示','保存成功!')
- ib_save_flag = TRUE
- ELSE
- ROLLBACK USING it_report;
- MessageBox('error!','保存失败!'+it_report.SQLErrText)
- END IF
-
- ELSE
- ///直接写入当前PBL
- String ls_error
- IF is_rname > '' THEN
- Long rslt
- IF ls_comments <> '' THEN
- rslt = LibraryImport(ls_pblpath,is_rname,ImportDataWindow!,is_dw,ls_error,ls_comments)
- ELSE
- rslt = LibraryImport(ls_pblpath,is_rname,ImportDataWindow!,is_dw,ls_error)
- END IF
- IF rslt = 1 THEN
- IF IsValid(w_publ_preview) THEN
- Long j
- FOR j = 1 TO w_publ_preview.it_max
- IF w_publ_preview.ls_dw_arr[j] = is_rname THEN
- w_publ_preview.wf_dowithm(22)
- EXIT
- END IF
- NEXT
- END IF
-
- String arg_msg
- IF wf_upload(is_dw,arg_msg) = 0 THEN
- MessageBox('错误',arg_msg)
- ELSE
- MessageBox('提示','保存并上传成功!')
- END IF
-
- ELSE
- MessageBox('提示','保存失败!' +ls_error)
- END IF
- ELSE
- MessageBox('提示','保存失败!')
- END IF
- END IF
- triggerevent('ue_aftersave')
- RETURN
- end event
- event ue_beforesave();// 保存之前去除背景
- String ls_type = ''
- Long ll_pos
- String ls_units
- ls_units = dw1.Describe("DataWindow.Units")
- Int rslt = 1
- String arg_msg
- Blob back_data
- FOR i = 1 To iis
- IF io[i].oname = ibackgroudname THEN
- EXIT
- END IF
- NEXT
- IF i <= iis THEN
- s_tran.X = wf_unitsx_to_mm(ls_units, Double(io[i].ox1))
- s_tran.Y = wf_unitsx_to_mm(ls_units, Double(io[i].oy1))
- s_tran.Width = wf_unitsx_to_mm(ls_units, Double(io[i].ox2) - Double(io[i].ox1))
- s_tran.Height = wf_unitsx_to_mm(ls_units, Double(io[i].oy2) - Double(io[i].oy1))
- s_tran.Filename = io[i].otext
-
- IF s_tran.Filename <> ifilename THEN
- IF f_filetoblob(s_tran.Filename, Ref back_data, Ref arg_msg) <> 1 THEN
- rslt = 0
- GOTO ext
- END IF
- END IF
-
- ll_pos = lastpos(s_tran.Filename, '.')
- IF ll_pos > 0 THEN
- ls_type = Mid(s_tran.Filename, ll_pos + 1)
- END IF
-
- UPDATE sys_dwprint_background
- SET back_x = :s_tran.x,
- back_y = :s_tran.y,
- back_width = :s_tran.width,
- back_height = :s_tran.height,
- back_type = :ls_type
- Where dwname = :is_rname;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '保存背景图失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
-
- IF sqlca.SQLNRows = 0 THEN
- INSERT INTO sys_dwprint_background(
- dwname,
- back_x,
- back_y,
- back_width,
- back_height,
- back_type)
- VALUES(
- :is_rname,
- :s_tran.x,
- :s_tran.y,
- :s_tran.width,
- :s_tran.height,
- :ls_type);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '插入背景图失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- COMMIT;
-
- IF s_tran.Filename <> ifilename THEN
- UpdateBlob sys_dwprint_background
- Set back_data = :back_data
- Where dwname = :is_rname;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '保存背景图数据失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
-
- END IF
- ext:
- IF i <= iis THEN
- dw1.SetRedraw(False)
- wf_adelete(i)
- dw1.SetRedraw(True)
- s_tran.ifok = 1
- ELSE
- s_tran.ifok = 0
- END IF
- IF rslt = 1 THEN
- COMMIT;
- ELSE
- ROLLBACK;
- MessageBox('ERROR', arg_msg)
- END IF
- end event
- event ue_aftersave();
- String ls_units
- IF s_tran.ifok = 0 THEN RETURN
- ls_units = dw1.Describe("DataWindow.Units")
- iis++
- iio = iis
- io[iio].oname = ibackgroudname
- io[iio].occ = wf_occ(1)+1
- iic = 1
- io[iio].oselect = '1'
- i = iio
- io[i].otext = s_tran.Filename
- s_tran.X = wf_mm_to_unitsx(ls_units, s_tran.X)
- s_tran.Width = wf_mm_to_unitsx(ls_units, s_tran.Width)
- s_tran.Y = wf_mm_to_unitsy(ls_units, s_tran.Y)
- s_tran.Height = wf_mm_to_unitsy(ls_units, s_tran.Height)
- io[i].ox1 = String(s_tran.X)
- io[i].oy1 = String(s_tran.Y)
- io[i].ox2 = String(Double(io[i].ox1)+s_tran.Width)
- io[i].oy2 = String(Double(io[i].oy1)+s_tran.Height)
- io[i].oborder = '2'
- io[i].otype = 'bitmap'
- io[i].oband = is_band
- wf_object(i,0)
- wf_setcolor()
- This.Trigger Event ue_cc(0)
- end event
- public subroutine wf_setcolor ();dw1.setredraw(false)
- string ls
- for i=1 to iis
- if long(io[i].oselect)>0 then//选择的序号>0
- choose case io[i].otype
- case 'line','rectangle','ellipse','roundrectangle'
- ls=ls+' '+io[i].oname+".pen.color='255'"
- case 'text','column','compute','band','tableblob','report','button','groupbox'
- ls=ls+' '+io[i].oname+".color='255'"
- case 'bitmap','graph'
- ls=ls+' '+io[i].oname+".border='5'"
- end choose
- else
- choose case io[i].otype
- case 'line','rectangle','ellipse','roundrectangle'
- ls=ls+' '+io[i].oname+".pen.color='"+io[i].ocolor+"'"
- case 'text','column','compute','button','groupbox'
- ls=ls+' '+io[i].oname+".color='"+io[i].ocolor+"'"
- case 'tableblob','report','band'
- ls=ls+' '+io[i].oname+".color='0'"
- case 'bitmap','graph'
- ls=ls+' '+io[i].oname+".border='"+io[i].oborder+"'"
- end choose
- end if
- next
- if ls>'' then dw1.modify(ls)
- //messagebox('',ls)
- sle_1.text=''
- sle_1.enabled=false
- sle_1.backcolor=80269524
- if NOT IsValid(m_rpt_main) then
- m_rpt_main = lm_rpt_main
- end if
- m_rpt_main.m_xs.m_left.Checked=false
- m_rpt_main.m_xs.m_center.Checked=false
- m_rpt_main.m_xs.m_right.Checked=false
- m_rpt_main.m_xs.m_ct.Checked=false
- m_rpt_main.m_xs.m_xt.Checked=false
- m_rpt_main.m_xs.m_xhx.Checked=false
- if iic=1 then
- if iio=0 then//在ue_sel_yes和dw1.event ue_lbuttonup中的temp有这种情况
- for i=1 to iis
- if io[i].oselect>'0' then
- iio=i
- exit
- end if
- next
- end if
- if iio=0 then return
- i=iio
- dwc1.object.qjs.background.color=string(long(io[i].ocolor))
- if pos('rectangle,ellipse,roundrectangle',io[i].otype)>0 then
- dwc1.object.bjs.background.color=string(long(io[i].ofname))
- else
- dwc1.object.bjs.background.color=string(long(io[i].obcolor))
- end if
- f_statbar('t2','对象名:'+iso+' 类型:'+io[i].otype)
- if pos('text,column,compute,button,groupbox',io[i].otype)>0 then
- ddlb_1.text=io[i].ofname
- ddlb_2.text=string(round(long(io[i].ofsize)*3/4,0))
- if pos('text,groupbox',io[i].otype)>0 then
- sle_1.text=io[i].otext
- sle_1.enabled=true
- sle_1.backcolor=16777215
- end if
- if long(io[i].ofweight)>400 then m_rpt_main.m_xs.m_ct.Checked=true//weight=700粗体
- if long(io[i].ofitalic)>0 then m_rpt_main.m_xs.m_xt.Checked=true//italic=1斜体
- if long(io[i].ofunderline)>0 then m_rpt_main.m_xs.m_xhx.Checked=true//underline=1下划线
- if pos('text,column,compute',io[i].otype)>0 then
- choose case io[i].oalignment
- case '0'//左
- m_rpt_main.m_xs.m_left.Checked=true
- case '2'//中
- m_rpt_main.m_xs.m_center.Checked=true
- case '1'//右
- m_rpt_main.m_xs.m_right.Checked=true
- end choose
- end if
- end if
- else
- f_statbar('t2','选中对象个数:'+string(iic))
- end if
- dw1.setredraw(true)
- end subroutine
- public function integer wf_topformove ();int li
- ii_temp=-1//0
- for li=1 to iis//背景图可能会跨越三个带区
- if long(io[li].oy2)<long(io[iio].oy1) and pos(',foreground,background,',','+io[li].oband+',')=0 then
- ii_temp=max(ii_temp,long(io[li].oy2))
- end if
- next
- return ii_temp
- end function
- public function string wf_arguments (string s_syntax);long ll1,ll2
- ll1=pos(lower(s_syntax),' arguments=')//PB6.5没有table.arguments属性,PB8.0就有了,不过是只读属性
- if ll1>0 then
- ll2=pos(s_syntax,'))',ll1)
- return mid(s_syntax,ll1+11,ll2 -ll1 -9)
- else
- return ''
- end if
- end function
- public subroutine wf_read (string f_label);string ls_objs,ls_syntax1,ls_syntax2,ls_add
- int j,k,m,n,o,p,q,li_tables
- string ls[],ls1,ls2,ls3
- istr_rpt.rdata=wf_mysx('datawindow.data')//因为wf_unit()有时要ids.create(),这样会丢掉此属性,所以要放在此函数之前
- wf_unit()
- ls_syntax1=ids.describe('DataWindow.Syntax')//改为直接等于is_dw时,分组属性by有时读取不到
- ls_syntax2=lower(ls_syntax1)
- s[1]=f_replace(trim(wf_mysx('datawindow.table.select')),'~~~"','')
- istr_rpt.rsqlselect=s[1]
- if s[1]>'' then//
- f_rpt_cksql(s[1],s[2],s[3],s[4],s[5],s[6])//s[3]=tables
- if pos(s[3],',')+pos(s[3],'=')>0 then
- li_tables=2
- end if
- end if
- is_updatetable=wf_mysx('datawindow.table.UpdateTable')
- is_updatewhere=wf_mysx('datawindow.table.UpdateWhere')
- if is_updatewhere='' then is_updatewhere='1'
- is_updatekeyinplace=wf_mysx('datawindow.table.UpdateKeyinPlace')
- if is_updatekeyinplace='' then is_updatekeyinplace='2'
- istr_rpt.rprocedure=wf_mysx('datawindow.table.procedure')
- istr_rpt.rarguments=wf_arguments(ls_syntax1)//PB6.5没有table.arguments属性,PB8.0就有了,不过是只读属性
- is_sparse=wf_mysx('DataWindow.Sparse')
- ls_objs=ids.describe('datawindow.objects')+'~t'
- id[1].ofweight=ids.describe('DataWindow.rows_per_detail')//此属性要先取,因为后面要用到来判断n-up报表,主要原因是column的row_in_detail属性取不到
- if f_label='all' then
- if ls_objs='~t' then
- wf_band4(50,50,50,50,0)//如果没有任何对象,调用wf_band4增加页表头,细节,页表尾4个带区
- wf_dwinit()
- return
- end if
- wf_band4(0,0,0,0,1)
- for j=1 to 99//读取分组信息,用分解字符串方法
- s[1]=ids.Describe("DataWindow.header."+String(j)+".height")
- IF IsNumber(s[1]) THEN
- s[2]=ids.Describe("DataWindow.trailer."+String(j)+".height")
- l[6]=Pos(ls_syntax2,"by=(",Pos(ls_syntax2,"group(level="+String(j)))
- l[7]=Pos(ls_syntax2, '" ) ',l[6])//by后面以'" ) '结束
- if l[7]=0 then l[7]=Pos(ls_syntax2, '" ) ',l[6])//pb8.02中by后面以'" ) '结束
- s[3]=Mid(ls_syntax1,l[6]+5,l[7] -l[6] - 5)
- s[4]=ids.Describe("DataWindow.header."+String(j)+".pointer")//分组的中文信息放在header.pointer属性中
- if s[4]='?' or pos(s[4],'!')>0 then s[4]=s[3]//?为原来没有pointer属性(PB的正常属性如:Help!)
- l[8]=long(s[1])
- l[9]=long(s[2])
- l[6]=Pos(ls_syntax2,"group(level="+String(j))//以下几行为求newpage
- l[7]=Pos(ls_syntax2,")"+char(13),l[6])
- if pos(mid(ls_syntax2,l[6],l[7] -l[6]),'newpage=yes')>0 then
- s[5]='yes'
- else
- s[5]='no'
- end if
- if pos(mid(ls_syntax2,l[6],l[7] -l[6]),'resetpagecount=yes')>0 then
- s[6]='yes'
- else
- s[6]='no'
- end if
- wf_insertgroup(l[8],l[9],s[4],s[3],s[5],s[6],1)//分组头高,分组尾高,中文名,英文名,newpage属性,
- else
- exit
- end if
- next
- end if
- wf_asort('y1')
- for i=iis to 2 step -1//ls_add={带区=y增加值}
- ls_add=ls_add+'{'+io[i].oband+'='+string(long(io[i -1].oy1)+13)+'}'
- next
- dw3.reset()
- ///20090725 zqh
- string ls_dw,ls_rarguments
- ls_dw = istr_rpt.rsqlselect
- ls_rarguments = istr_rpt.rarguments
-
- //此处替换了参数,如果有子报表,且传入的是该参数时,可能导致传入子报表的参数为NULL,提示出错
- string ss[]
- long ll[]
- ls_rarguments = mid(ls_rarguments,2)
- do while 1=1//重新标记参数
- ll[1]=pos(ls_rarguments,'(')
- ll[2]=pos(ls_rarguments,',',ll[1])
- ll[3]=pos(ls_rarguments,')',ll[1])
- if ll[1]<1 then exit
- ss[1]=trim(mid(ls_rarguments,ll[1]+2,ll[2] -ll[1] -3))
- ss[2]=trim(mid(ls_rarguments,ll[2]+1,ll[3] -ll[2] -1))
- ls_rarguments=mid(ls_rarguments,ll[3]+1)
-
- choose case ss[2]
- case 'date'
- ss[5]=string(today())
- ls_dw=f_replace(ls_dw,':'+ss[1],"'"+ss[5]+"'")
- case 'datetime'
- ss[5]=string(now())
- ls_dw=f_replace(ls_dw,':'+ss[1],"'"+ss[5]+"'")
- case 'time'
- ss[5]=string(time(now()))
- ls_dw=f_replace(ls_dw,':'+ss[1],"'"+ss[5]+"'")
- case 'string','number'
- ss[5]='0'
- ls_dw=f_replace(ls_dw,':'+ss[1],ss[5])
- case else
- ss[5]='0'
- ls_dw=f_replace(ls_dw,':'+ss[1],ss[5])
- end choose
- loop
- //f_rpt_gdw_lwl(ids,dw3,it_report,'','')
- f_rpt_gdw(ls_dw,dw3,it_report,'','')
- ////
- //l[6]=long(ids.describe('DataWindow.Column.Count'))
- //for i=1 to l[6]//为了在下面分解COLUMN直接SETITEM,以便行号跟oid对应
- // s[9]='#'+string(i)
- // s[1]=ids.describe(s[9]+'.coltype')
- // if s[1]='blob' then continue//blob的column应该是放在最后,所以不会影响其他的id
- // dw3.insertrow(0)
- // dw3.object.ctype[i]=s[1]
- // dw3.object.cupdate[i]=ids.describe(s[9]+'.update')
- // dw3.object.cwhereclause[i]=ids.describe(s[9]+'.updatewhereclause')
- // dw3.object.ckey[i]=ids.describe(s[9]+'.key')
- // dw3.object.cidentity[i]=ids.describe(s[9]+'.identity')
- // s[1]=ids.describe(s[9]+'.dbname')
- // dw3.object.cdbname[i]=s[1]
- // s[1]=ids.describe(s[9]+'.name')//此语句对于N-UP取出来的name不理想
- // dw3.object.cname[i]=s[1]
- // dw3.object.cinitial[i]=ids.describe(s[9]+'.initial')
- // dw3.object.cvalidation[i]=wf_mysx(s[9]+'.validation')
- // dw3.object.cvalidationmsg[i]=wf_mysx(s[9]+'.validationmsg')
- // s[1]=wf_mysx(s[9]+'.values')//s[1]值在下面要用到,跟下一行不能合并为一行
- // dw3.object.cvalues[i]=s[1]
- // s[2]=ids.describe(s[9]+'.tag')
- // if left(s[2],1)='"' and right(s[2],1)='"' then
- // s[2]=mid(s[2],2,len(s[2]) -2)//在access数据库下且字段名为英文注释时发现多加双引号"的情况
- // end if
- // if pos(s[2],char(9))>0 then s[2]=left(s[2],pos(s[2],char(9)) -1)
- // if pos('?!',s[2])>0 then
- // if s[1]>'' then
- // if pos(s[1],char(9))>0 then s[1]=left(s[1],pos(s[1],char(9)) -1)
- // s[2]=s[1]
- // else
- // if istr_rpt.datasource='dw' then//前台报表取中文信息
- // s[1]=ids.describe(dw3.object.cname[i]+'_t.text')
- // if pos('?!',s[1])>0 then
- // s[2]=dw3.object.cname[i]
- // else
- // s[2]=s[1]
- // end if
- // else
- // s[2]=dw3.object.cname[i]
- // end if
- // end if
- // end if
- // dw3.object.ctag[i]=s[2]
- //next
- //
- f_atab(ls[],ls_objs+'datawindow~t')
- k=upperbound(ls[])
- for m=1 to k
- iis++
- i=iis
- io[i].occ=i//用于对象层次
-
- is_type=ids.describe(ls[m]+'.type')
- o=long(mid(ist,pos(ist,is_type) -2,2))
- p=ii[2*o -1]+1//type已取
- q=ii[2*o]
-
- ls3=''
- j=1
- io[i].otype=is_type//type已取
-
- for o=p to q
- j++
-
- if j>19 then//为了加快速度
- choose case is_type
- case 'column'
- ii_temp=idsx.object.data[o,2]
- if ii_temp>=41 and ii_temp<=124 then//为了加快速度
- if pos(is0[o],io[i].oexpression+'.')=0 then continue
- end if
- case 'datawindow'
- ii_temp=idsx.object.data[o,2]
- choose case io[i].ox1
- case '1'//grid
- if ii_temp>40 then continue
- case '2'//label
- if ii_temp>20 and ii_temp<51 then continue
- case '4'//crosstab
- if ii_temp>50 then continue
- case else//'0'
- if ii_temp>20 then continue
- end choose
- end choose
- end if
-
- ls1=ids.describe(ls[m]+'.'+is0[o])
- if left(ls1,1)='"' then ls1=mid(ls1,2,len(ls1) -2)//有待检验
- if j=3 and ls1='?' then//band='?',此字段column已经删除
- iis --
- exit
- elseif j>3 and j<19 then//4到18属性在tab处分开
- ii_temp=pos(ls1,char(9))
- if ii_temp>0 then
- ls2=mid(ls1,ii_temp+1)
- ls1=left(ls1,ii_temp -1)
- else
- ls2=''
- end if
- end if
- if pos('?!',ls1)>0 then
- ls1=''
- if id[1].ofweight>'1' and is0[o]='row_in_detail' then//PB中row_in_detail属性取不到
- ls1=wf_rowindetail(ls_syntax2,ls[m])
- end if
- end if
- choose case j//type已取
- case 2
- io[i].oname=ls1
- case 3
- io[i].oband=ls1
- case 4
- io[i].ox1=ls1
- case 5
- io[i].oy1=ls1
- case 6
- io[i].ox2=ls1
- case 7
- io[i].oy2=ls1
- case 8
- io[i].oborder=ls1
- case 9
- io[i].otext=ls1
- case 10
- io[i].ocolor=ls1
- case 11
- io[i].obcolor=ls1
- case 12
- io[i].ofname=ls1
- case 13
- io[i].ofsize=ls1
- case 14
- io[i].ofweight=ls1
- case 15
- io[i].ofitalic=ls1
- case 16
- io[i].ofunderline=ls1
- case 17
- io[i].oalignment=ls1
- case 18
- io[i].oexpression=ls1
- case else//>=19
- ls2=ls1
- end choose
-
- if j>3 and pos('?!',ls2)=0 and ls2>'' then
- ls3=ls3+'{'+is0[o]+'='+ls2+'}'
- end if
- next
- io[i].others=ls3
- if is_type='tableblob' then
- io[i].ocolor=ids.describe('#'+io[i].ofweight+'.dbname')//ocolor='dbname',ofweight='id'
- end if
-
- if is_type='datawindow' then
- if io[i].ox1='4' then//crosstab,在ids没有retrieve()时,crosstab.staticmode取不到属性,crosstab.dynamic则一直取不到属性,只能用分解字符串的办法
- if pos(ls_syntax2,'crosstab.dynamic=yes')+pos(ls_syntax2,'crosstab.dynamic = yes')>0 then//crosstab动态模式
- f_wsx(io[i].others,'crosstab.dynamic','yes')
- else//crosstab静态模式
- l[1]=pos(ls_syntax2,'crosstabdata=')
- l[2]=pos(ls_syntax2,'retrieve=',l[1])//??procedure是否适合
- f_wsx(io[i].others,'crosstabdata',trim(mid(ls_syntax2,l[1],l[2] -l[1])))
- end if
- end if
- continue//避免执行oy1,oy2的加长处理
- elseif is_type<>'line' then
- io[i].ox2=string(long(io[i].ox2)+long(io[i].ox1))//x2
- io[i].oy2=string(long(io[i].oy2)+long(io[i].oy1))//y2
- elseif pos(ls[m],'line2')=1 then//竖线反修正
- if io[i].oy1='-1' then io[i].oy1='0'//wf_write中io[i].oy1='-1'
- if io[i].oband='header' then io[i].oy2=string(long(io[i].oy2) -1)//wf_write中io[i].oy2=string(long(io[i].oy2)+1
- end if
- ii_temp=long(f_rsx(ls_add,io[i].oband))
- if ii_temp>0 then
- io[i].oy1=string(long(io[i].oy1)+ii_temp)
- io[i].oy2=string(long(io[i].oy2)+ii_temp)
- end if
- next
- id[1]=io[iis]//datawindow属性
- io[iis]=id[2]//清空最后一行
- iis --
-
- end subroutine
- public subroutine wf_resetoid ();for i=1 to iis//对type,oid重新设置
- if pos('column,compute',io[i].otype)>0 then
- if io[i].otype='column' then
- s[1]=io[i].oname
- else
- if f_rsx(io[i].others,'id')>'' then//本来是字段,但重新设置数据源不小心删除后,如果重新加上,则用是否有id号来判断
- s[1]=io[i].oname//这种情况io[i].oexpression='edit','checkbox'等
- else
- s[1]=io[i].oexpression
- end if
- end if
- l[1]=dw3.find("cname='"+f_replace(s[1],"'","~~~'")+"'",1,999)
- if l[1]>0 then
- io[i].otype='column'
- f_wsx(io[i].others,'id',string(l[1]))
- else
- io[i].otype='compute'
- end if
- end if
- next
- end subroutine
- public subroutine wf_allset (string f_set, string f_new);//所选对象设置字体,字号等,参数:f_set
- dw1.setredraw(false)
- for i=1 to iis//循环处理所有对象
- if io[i].oselect<'1' then continue
- if pos(f_set,'color')>0 then//color or bcolor
- if pos('text,column,compute,button,line,rectangle,groupbox,ellipse,roundrectangle',io[i].otype)=0 then continue
- elseif pos(f_set,'border')>0 then
- if pos('text,column,compute,graph,bitmap,groupbox',io[i].otype)=0 then continue
- elseif pos(f_set,'align')>0 then
- if pos('text,column,compute',io[i].otype)=0 then continue
- else//fname,fsize,weight,italic,underline
- if pos('text,column,compute,button,roundrectangle,groupbox',io[i].otype)=0 then continue
- end if
- choose case f_set
- case 'fname'//字体
- io[i].ofname=f_new
- case 'fsize'//字号
- io[i].ofsize=string(round(long(f_new)*4/3,0))
- case 'align'//居左中右
- io[i].oalignment=f_new
- case 'border'//边框
- io[i].oborder=f_new
- case 'color'//前景色
- io[i].ocolor=f_new
- case 'bcolor'//背景色
- if pos('rectangle,ellipse,roundrectangle',io[i].otype)>0 then
- io[i].ofname=f_new//brush.color
- else
- io[i].obcolor=f_new
- end if
- case 'weight'//粗体
- io[i].ofweight=f_new
- case 'italic'//斜体
- io[i].ofitalic=f_new
- case 'underline'//下划线
- io[i].ofunderline=f_new
- end choose
- wf_object(i,1)
- next
- dw1.setredraw(true)
- return
- end subroutine
- public function string wf_idscreate ();string ls_error
- //event ue_dw2_sort()
- //wf_write()
- //ids.create(is_dw,ls_error)
- //ids.settransobject(it_report)
- return ls_error
- end function
- public subroutine wf_unit ();string ls[],sx[],ls1,ls2,ls3,ls4,ls5,ls6//暂时先用以下方法处理,如果发现有问题,最好不要采用先MODIFY的方法
- long j,k,m,n,o,p,q,ll
- q=long(ids.describe('datawindow.units'))//0=Pb单位,1=象素单位,3=0.1毫米
- if q=1 then return
- f_atab(ls[],ids.describe('datawindow.bands')+'~t')
- p=upperbound(ls[])
- f_atab(ls[],ids.describe('datawindow.bands')+'~t'+ids.describe('datawindow.objects')+'~tdatawindow~t')
- k=upperbound(ls[])
- for j=1 to k
- is_type=ids.describe(ls[j]+'.type')
- m=0
- choose case is_type
- case 'line'
- m=5
- sx[1]='x1'
- sx[2]='y1'
- sx[3]='x2'
- sx[4]='y2'
- sx[5]='pen.width'
- case 'rectangle','ellipse','roundrectangle'
- m=5
- sx[1]='x'
- sx[2]='y'
- sx[3]='width'
- sx[4]='height'
- sx[5]='pen.width'
- case 'text','column','compute','bitmap','graph','tableblob','report','button','groupbox'
- m=4
- sx[1]='x'
- sx[2]='y'
- sx[3]='width'
- sx[4]='height'
- case else
- if j<=p then//'band'
- m=1
- sx[1]='height'
- elseif j=k then//'datawindow'
- m=4
- sx[1]='print.margin.left'
- sx[2]='print.margin.right'
- sx[3]='print.margin.top'
- sx[4]='print.margin.bottom'
- if ids.describe('datawindow.processing')='2' then
- m=10
- sx[5]='label.width'
- sx[6]='label.height'
- sx[7]='label.rows.spacing'
- sx[8]='label.columns.spacing'
- sx[9]='label.ellipse_height'
- sx[10]='label.ellipse_width'
- end if
- else
- continue
- end if
- end choose
- for n=1 to m
- if j<=p then//'band'
- ls5='datawindow.'+ls[j]+'.'+sx[n]
- else
- ls5=ls[j]+'.'+sx[n]
- end if
- ls1=ids.describe(ls5)
- o=pos(ls1,'~t')
- if o>0 then
- ls2=left(ls1,o -1)
- ls3=mid(ls1,o+1)
- else
- ls2=ls1
- ls3=''
- end if
- if ls2='?' then continue
- choose case q
- case 0//PB
- if pos(',x,x1,x2,width,print.margin.left,print.margin.right,',','+sx[n]+',')>0 then
- ll=UnitsToPixels(long(ls2),xUnitsToPixels!)
- else
- ll=UnitsToPixels(long(ls2),yUnitsToPixels!)
- end if
- case 2//1/1000英寸
- ll=int(long(ls2)*2.54/(ln_bl*10))
- case 3//0.1毫米
- ll=int(long(ls2)/(ln_bl*10))
- end choose
- ls4=string(ll,'0')
- if ls3>'' then ls4=ls4+'~t'+ls3
- if j<=p then//'band'
- if ls[j]='background' then
- continue
- else
- ls5='datawindow.'+ls[j]+'.'+sx[n]+"="+ls4
- end if
- else
- ls5=ls[j]+'.'+sx[n]+"='"+ls4+"'"
- end if
- ls6=ls6+' '+ls5
- // ls1=ids.modify(ls5)//对于crosstab,单个column就modify会出现没有修改到的情况,所有对象一起modify反而没有问题
- next
- next
- ids.modify(ls6)//对于crosstab,单个column就modify会出现没有修改到的情况,所有对象一起modify反而没有问题
- is_dw=ids.describe('DataWindow.Syntax')
- is_dw=f_replace(is_dw,'units='+string(q),'units=1')
- ids.create(is_dw)
- ids.settransobject(it_report)
- end subroutine
- public function integer wf_afind ();int li
- for li=1 to iis
- if io[li].oname=iso then
- return li
- end if
- next
- return 0
- end function
- public function string wf_object (integer j, integer k);iso=io[j].oname
- string ls1,ls2
- choose case io[j].otype
- case 'line'
- if k=0 then
- ls2="x1= '"+io[j].ox1+"' y1='"+io[j].oy1+"' x2='" +io[j].ox2+ "' y2='"+io[j].oy2+"'"
- ls2="create line(band=detail "+ls2+" name="+io[j].oname+" pen.style='"+io[j].oborder+"' pen.width='"+io[j].otext+"' pen.color='"+io[j].ocolor+"' background.mode='2' background.color='"+io[j].obcolor+"')"
- else
- ls2=iso+".x1= '"+io[j].ox1+"' "+iso+".y1='"+io[j].oy1+"' "+iso+".x2='" +io[j].ox2+ "' "+iso+".y2='"+io[j].oy2+"' "
- ls2=ls2+iso+".pen.style='"+io[j].oborder+"' "+iso+".pen.width='"+io[j].otext+"' "+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- case 'text'
- ls1=f_replace(io[j].otext,"'","~~~'")
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='"+io[j].ofname+"' font.height='"+io[j].ofsize+"' "+wf_ssx('',"font.weight","'",io[j].ofweight)+wf_ssx('',"font.italic","'",io[j].ofitalic)+wf_ssx('',"font.underline","'",io[j].ofunderline)+" alignment='"+io[j].oalignment+"'"
- ls2="create text(band=detail "+ls2+" border='2' name="+io[j].oname+" color='"+io[j].ocolor+"' background.color='"+io[j].obcolor+"' background.mode='2')"//background.mode不要删除,否则obcolor='536870912'时间变黑
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".font.face='"+io[j].ofname+"' "+iso+".font.height='"+io[j].ofsize+"' "+wf_ssx(iso,"font.weight","'",io[j].ofweight)+wf_ssx(iso,"font.italic","'",io[j].ofitalic)+wf_ssx(iso,"font.underline","'",io[j].ofunderline)+iso+".alignment='"+io[j].oalignment+"' "
- ls2=ls2+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- case 'groupbox'//类似text,比text少alignment,多border属性
- ls1=f_replace(io[j].otext,"'","~~~'")
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='"+io[j].ofname+"' font.height='"+io[j].ofsize+"' "+wf_ssx('',"font.weight","'",io[j].ofweight)+wf_ssx('',"font.italic","'",io[j].ofitalic)+wf_ssx('',"font.underline","'",io[j].ofunderline)//+" alignment='"+io[j].oalignment+"'"
- ls2="create groupbox(band=detail "+ls2+" border='"+io[j].oborder+"' name="+io[j].oname+" color='"+io[j].ocolor+"' background.color='"+io[j].obcolor+"' background.mode='2')"//background.mode不要删除,否则obcolor='536870912'时间变黑
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".font.face='"+io[j].ofname+"' "+iso+".font.height='"+io[j].ofsize+"' "+wf_ssx(iso,"font.weight","'",io[j].ofweight)+wf_ssx(iso,"font.italic","'",io[j].ofitalic)+wf_ssx(iso,"font.underline","'",io[j].ofunderline)+iso+".border='"+io[j].oborder+"' "
- ls2=ls2+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- case 'column'
- if io[j].otext='' then io[j].otext=io[j].oname
- choose case io[j].oexpression
- case 'edit','editmask'
- ls1=f_replace(io[j].otext,"'","~~~'")
- case 'dddw','ddlb'
- ls1=f_replace(io[j].otext,"'","~~~'")+' ▼'
- case 'checkbox'
- ls1=f_rsx(io[j].others,'checkbox.text')
- if f_rsx(io[j].others,'checkbox.lefttext')='yes' then
- ls1=ls1+"口"
- else
- ls1="口"+ls1
- end if
- case 'radiobuttons'
- int li
- s[4]=f_rsx(io[j].others,'id')
- s[3]=dw3.getitemstring(long(s[4]),'cvalues')
- if s[3]>'' then
- if right(s[3],1)<>'/' then s[3]=s[3]+'/'
- do while true
- li=pos(s[3],char(9))
- if li=0 then exit
- s[1]=left(s[3],li -1)
- s[3]=mid(s[3],li+1)
- li=pos(s[3],'/')
- s[3]=mid(s[3],li+1)
- if f_rsx(io[j].others,'radiobuttons.lefttext')='yes' then
- ls1=ls1+' '+s[1]+' o'
- else
- ls1=ls1+' o '+s[1]
- end if
- loop
- end if
- end choose
-
- if id[1].ofweight>'1' then//N-UP
- ls2=f_rsx(io[j].others,'row_in_detail')
- if ls2>'' then ls1=ls1+'_'+ls2
- end if
-
- if istr_rpt.text='0' then ls1=f_replace(ls1,io[j].otext,io[j].oname)//字段名不进行翻译
-
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='"+io[j].ofname+"' font.height='"+io[j].ofsize+"' "+wf_ssx('',"font.weight","'",io[j].ofweight)+wf_ssx('',"font.italic","'",io[j].ofitalic)+wf_ssx('',"font.underline","'",io[j].ofunderline)+" alignment='"+io[j].oalignment+"'"
- ls2="create text(band=detail "+ls2+" border='5' name="+io[j].oname+" color='"+io[j].ocolor+"' background.color='"+io[j].obcolor+"' background.mode='2')"//background.mode不要删除,否则obcolor='536870912'时间变黑
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".font.face='"+io[j].ofname+"' "+iso+".font.height='"+io[j].ofsize+"' "+wf_ssx(iso,"font.weight","'",io[j].ofweight)+wf_ssx(iso,"font.italic","'",io[j].ofitalic)+wf_ssx(iso,"font.underline","'",io[j].ofunderline)+iso+".alignment='"+io[j].oalignment+"' "
- ls2=ls2+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- case 'compute'
- if io[j].otext='' then io[j].otext=io[j].oexpression
- ls1=f_replace(io[j].otext,"'","~~~'")
-
- if istr_rpt.text='0' then ls1=f_replace(ls1,io[j].otext,io[j].oexpression)//字段名不进行翻译
-
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='"+io[j].ofname+"' font.height='"+io[j].ofsize+"' "+wf_ssx('',"font.weight","'",io[j].ofweight)+wf_ssx('',"font.italic","'",io[j].ofitalic)+wf_ssx('',"font.underline","'",io[j].ofunderline)+" alignment='"+io[j].oalignment+"'"
- ls2="create text(band=detail "+ls2+" border='5' name="+io[j].oname+" color='"+io[j].ocolor+"' background.color='"+io[j].obcolor+"' background.mode='2')"//background.mode不要删除,否则obcolor='536870912'时间变黑
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".font.face='"+io[j].ofname+"' "+iso+".font.height='"+io[j].ofsize+"' "+wf_ssx(iso,"font.weight","'",io[j].ofweight)+wf_ssx(iso,"font.italic","'",io[j].ofitalic)+wf_ssx(iso,"font.underline","'",io[j].ofunderline)+iso+".alignment='"+io[j].oalignment+"' "
- ls2=ls2+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- case 'band'
- ls1=f_replace(io[j].otext,"'","~~~'")
- if pos(io[j].oname,'band_g_h_')=1 then
- ls1="▲组标题区"+mid(io[j].oname,10)+': '+ls1
- elseif pos(io[j].oname,'band_g_b_')=1 then
- ls1="▲组尾区"+mid(io[j].oname,10)+': '+ls1
- end if
-
- if istr_rpt.text='0' and pos(io[j].oname,'band_g_')=1 then ls1=f_replace(ls1,io[j].otext,io[j].ofsize)//字段名不进行翻译
-
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+string(long(io[j].oy1)+1)+"' width='"+string(ii_x_max)+"' height='12' font.face='宋体' font.height='12'"
- ls2="create text(band=detail "+ls2+" border='2' color='0' name="+io[j].oname+" background.color='80269524' background.mode='2')"
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+string(long(io[j].oy1)+1)+"' "
- end if
- ii_save=1
- case 'report','tableblob'
- ls1=f_replace(io[j].otext,"'","~~~'")
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='宋体' font.height='12'"
- ls2="create text(band=detail "+ls2+" border='2' color='0' name="+io[j].oname+" background.color='16777215' background.mode='2')"
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "
- end if
- ii_save=1
- case 'button'
- ls1=f_replace(io[j].otext,"'","~~~'")
- if k=0 then
- ls2="text='"+ls1+"' x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' font.face='"+io[j].ofname+"' font.height='"+io[j].ofsize+"' "+wf_ssx('',"font.weight","'",io[j].ofweight)+wf_ssx('',"font.italic","'",io[j].ofitalic)+wf_ssx('',"font.underline","'",io[j].ofunderline)+" alignment='2'"
- ls2="create text(band=detail "+ls2+" border='6' name="+io[j].oname+" color='"+io[j].ocolor+"' background.color='"+io[j].obcolor+"' background.mode='2')"//background.mode不要删除,否则obcolor='536870912'时间变黑
- else
- ls2=iso+".text='"+ls1+"' "+iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".font.face='"+io[j].ofname+"' "+iso+".font.height='"+io[j].ofsize+"' "+wf_ssx(iso,"font.weight","'",io[j].ofweight)+wf_ssx(iso,"font.italic","'",io[j].ofitalic)+wf_ssx(iso,"font.underline","'",io[j].ofunderline)
- ls2=ls2+iso+".background.color='"+io[j].obcolor+"'"
- end if
- ii_save=1
- //在PB6.5下,create button会跟dw1.event other有冲突,但在PB8.02下则不会出现非法出错.
- case 'graph'
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"'"
- ls2="create graph(band=detail graphtype='"+io[j].ofname+"' "+ls2+" name="+io[j].oname+" border='"+io[j].oborder+"' perspective='2' rotation='-20' color='0' backcolor='16777215' shadecolor='8355711' range=0 overlappercent='0' spacing='100' elevation='20' depth='100' category='zkl0' values='count(zkl0 for graph)' title='"+io[j].otext+"' category.label='"+io[j].ofweight+"' values.label='"+io[j].ofunderline+"' title.dispattr.alignment='2' title.dispattr.font.weight='700' series.labeldispattr.alignment='2' category.labeldispattr.alignment='2' values.labeldispattr.alignment='2' values.labeldispattr.font.escapement='900' values.labeldispattr.font.height='12' title.dispattr.backcolor='553648127' legend.dispattr.backcolor='536870912' series.dispattr.backcolor='536870912' series.labeldispattr.backcolor='536870912' category.dispattr.backcolor='536870912' category.labeldispattr.backcolor='536870912' values.dispattr.backcolor='536870912' values.labeldispattr.backcolor='536870912')"
- // ls2=ls2+" title.dispattr.backcolor='553648127' title.dispattr.autosize='1' title.dispattr.font.charset='0' title.dispattr.font.escapement='0' title.dispattr.font.face='Arial' title.dispattr.font.family='2' title.dispattr.font.height='0' title.dispattr.font.italic='0' title.dispattr.font.orientation='0' title.dispattr.font.pitch='2' title.dispattr.font.strikethrough='0' title.dispattr.font.underline='0' title.dispattr.format='[General]' title.dispattr.textcolor='0' title.dispattr.displayexpression='title' legend='4' legend.dispattr.backcolor='536870912' legend.dispattr.alignment='0' legend.dispattr.autosize='1' legend.dispattr.font.charset='0' legend.dispattr.font.escapement='0' legend.dispattr.font.face='Arial' legend.dispattr.font.family='2' legend.dispattr.font.height='0' legend.dispattr.font.italic='0' legend.dispattr.font.orientation='0' legend.dispattr.font.pitch='2' legend.dispattr.font.strikethrough='0' legend.dispattr.font.underline='0' legend.dispattr.font.weight='400' legend.dispattr.format='[General]' legend.dispattr.textcolor='0' legend.dispattr.displayexpression='series' series.autoscale='1' series.displayeverynlabels='0' series.droplines='0' series.frame='1' series.label='Series' series.majordivisions='0' series.majorgridline='0' series.majortic='3' series.maximumvalue='0' series.minimumvalue='0' series.minordivisions='0' series.minorgridline='0' series.minortic='1' series.originline='0' series.primaryline='1' series.roundto='0' series.roundtounit='0' series.scaletype='1' series.scalevalue='1' series.secondaryline='0' series.shadebackedge='0' series.dispattr.backcolor='536870912' series.dispattr.alignment='0' series.dispattr.autosize='1' series.dispattr.font.charset='0' series.dispattr.font.escapement='0' series.dispattr.font.face='Arial' series.dispattr.font.family='2' series.dispattr.font.height='0' series.dispattr.font.italic='0' series.dispattr.font.orientation='0' series.dispattr.font.pitch='2' series.dispattr.font.strikethrough='0' series.dispattr.font.underline='0' series.dispattr.font.weight='400' series.dispattr.format='[General]' series.dispattr.textcolor='0' series.dispattr.displayexpression='series' series.labeldispattr.backcolor='536870912' series.labeldispattr.autosize='0' series.labeldispattr.font.charset='0' series.labeldispattr.font.escapement='0' series.labeldispattr.font.face='Arial' series.labeldispattr.font.family='2' series.labeldispattr.font.height='-8' series.labeldispattr.font.italic='0' series.labeldispattr.font.orientation='0' series.labeldispattr.font.pitch='2' series.labeldispattr.font.strikethrough='0' series.labeldispattr.font.underline='0' series.labeldispattr.font.weight='1000' series.labeldispattr.format='[General]' series.labeldispattr.textcolor='0' series.labeldispattr.displayexpression='seriesaxislabel' series.sort='1' category.autoscale='1' category.displayeverynlabels='0' category.droplines='0' category.frame='1' category.majordivisions='0' category.majorgridline='0' category.majortic='3' category.maximumvalue='0' category.minimumvalue='0' category.minordivisions='0' category.minorgridline='0' category.minortic='1' category.originline='0' category.primaryline='1' category.roundto='0' category.roundtounit='0' category.scaletype='1' category.scalevalue='1' category.secondaryline='0' category.shadebackedge='1' category.dispattr.backcolor='536870912' category.dispattr.alignment='2' category.dispattr.autosize='1' category.dispattr.font.charset='0' category.dispattr.font.escapement='0' category.dispattr.font.face='Arial' category.dispattr.font.family='2' category.dispattr.font.height='0' category.dispattr.font.italic='0' category.dispattr.font.orientation='0' category.dispattr.font.pitch='2' category.dispattr.font.strikethrough='0' category.dispattr.font.underline='0' category.dispattr.font.weight='400' category.dispattr.format='[General]' category.dispattr.textcolor='0' category.dispattr.displayexpression='category' category.labeldispattr.backcolor='536870912' category.labeldispattr.autosize='0' category.labeldispattr.font.charset='0' category.labeldispattr.font.escapement='0' category.labeldispattr.font.face='Arial' category.labeldispattr.font.family='2' category.labeldispattr.font.height='-8' category.labeldispattr.font.italic='0' category.labeldispattr.font.orientation='0' category.labeldispattr.font.pitch='2' category.labeldispattr.font.strikethrough='0' category.labeldispattr.font.underline='0' category.labeldispattr.font.weight='1000' category.labeldispattr.format='[General]' category.labeldispattr.textcolor='0' category.labeldispattr.displayexpression='categoryaxislabel' category.sort='1' values.autoscale='1' values.displayeverynlabels='0' values.droplines='0' values.frame='1' values.majordivisions='0' values.majorgridline='0' values.majortic='3' values.maximumvalue='250' values.minimumvalue='0' values.minordivisions='0' values.minorgridline='0' values.minortic='1' values.originline='1' values.primaryline='1' values.roundto='0' values.roundtounit='0' values.scaletype='1' values.scalevalue='1' values.secondaryline='0' values.shadebackedge='0' values.dispattr.backcolor='536870912' values.dispattr.alignment='1' values.dispattr.autosize='1' values.dispattr.font.charset='0' values.dispattr.font.escapement='0' values.dispattr.font.face='Arial' values.dispattr.font.family='2' values.dispattr.font.height='0' values.dispattr.font.italic='0' values.dispattr.font.orientation='0' values.dispattr.font.pitch='2' values.dispattr.font.strikethrough='0' values.dispattr.font.underline='0' values.dispattr.font.weight='400' values.dispattr.format='[General]' values.dispattr.textcolor='0' values.dispattr.displayexpression='value' values.labeldispattr.backcolor='536870912' values.labeldispattr.font.charset='0' values.labeldispattr.font.face='Arial' values.labeldispattr.autosize='0' values.labeldispattr.font.family='2' values.labeldispattr.font.italic='0' values.labeldispattr.font.orientation='900' values.labeldispattr.font.pitch='2' values.labeldispattr.font.strikethrough='0' values.labeldispattr.font.underline='0' values.labeldispattr.font.weight='1000' values.labeldispattr.format='[General]' values.labeldispattr.textcolor='0' values.labeldispattr.displayexpression='valuesaxislabel'"
- else
- ls2=iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "
- ls2=ls2+iso+".graphtype='"+io[j].ofname+"' "+iso+".title='"+io[j].otext+"' "+iso+".category.label='"+io[j].ofweight+"' "+iso+".values.label='"+io[j].ofunderline+"'"
- end if
- ii_save=1
- case 'rectangle','ellipse'
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"'"
- ls2="create "+io[j].otype+"(band=detail "+ls2+" name="+io[j].oname+" brush.hatch='6' brush.color='"+io[j].ofname+"' pen.style='"+io[j].oborder+"' pen.width='"+io[j].otext+"' pen.color='"+io[j].ocolor+"' background.mode='2' background.color='"+io[j].obcolor+"')"
- else
- ls2=iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".brush.color='"+io[j].ofname+"' "+iso+".pen.style='"+io[j].oborder+"' "+iso+".pen.width='"+io[j].otext+"' "+iso+".background.color='"+io[j].obcolor+"' "
- end if
- ii_save=1
- case 'roundrectangle'//类似rectangle
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"'"
- ls2="create roundrectangle(band=detail "+ls2+" name="+io[j].oname+" ellipseheight='9' ellipsewidth='10' brush.hatch='6' brush.color='"+io[j].ofname+"' pen.style='"+io[j].oborder+"' pen.width='"+io[j].otext+"' pen.color='"+io[j].ocolor+"' background.mode='2' background.color='"+io[j].obcolor+"')"
- else
- ls2=iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "+iso+".brush.color='"+io[j].ofname+"' "+iso+".pen.style='"+io[j].oborder+"' "+iso+".pen.width='"+io[j].otext+"' "+iso+".background.color='"+io[j].obcolor+"' "
- end if
- ii_save=1
- case 'bitmap'//ok
- if pos('background,foreground',io[j].oband)>0 then
- is_temp=io[j].oband//底图很大时需要这样处理
- else
- is_temp='detail'
- end if
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='"+io[j].oy1+"' width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' height='"+string(long(io[j].oy2)-long(io[j].oy1))+"'"
- ls2="create bitmap(band="+is_temp+" filename='"+io[j].otext+"' "+ls2+" name="+io[j].oname+" border='"+io[j].oborder+"')"
- else
- ls2=iso+".x='"+io[j].ox1+"' "+iso+".y='"+io[j].oy1+"' "+iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"' "
- ls2=ls2+iso+".filename='"+io[j].otext+"' "
- end if
- ii_save=1
- case 'sep1' //垂直分割
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='-2' height='"+string(ii_y_max)+"' width='0'"
- ls2="create rectangle(band=detail "+ls2+" name=sep1 brush.hatch='7' brush.color='0' pen.style='2' pen.width='1' pen.color='255' background.mode='2' background.color='0')"
- else
- ls2=iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"'"
- end if
- case 'temp' //没有对象的空地方
- if k=0 then
- ls2="x='"+io[j].ox1+"' y='"+io[j].oy1+"' height='0' width='0'"
- ls2="create rectangle(band=detail "+ls2+" name=temp brush.hatch='7' brush.color='12632256' pen.style='0' pen.width='1' pen.color='255' background.mode='2' background.color='0')"
- else
- ls2=iso+".width='"+string(long(io[j].ox2)-long(io[j].ox1))+"' "+iso+".height='"+string(long(io[j].oy2)-long(io[j].oy1))+"'"
- end if
- case 'datawindow'
- if k=0 then
- ls2=''
- else
- ls2="datawindow.color="+io[j].oband
- ii_save=1
- end if
- case else
- ls2=''
- end choose
- dw1.modify(ls2)
- return ls2
- end function
- public subroutine wf_adelete (integer j);int li,lj
- if j=0 then return
- dw1.modify('destroy '+io[j].oname)
- li=min(iis+2,upperbound(io))
- for lj=j to li -1
- io[lj]=io[lj+1]
- next
- iis --
- io[lj]=id[2]//清空最后一行
- ii_save=1
- end subroutine
- public subroutine wf_asort (string fs);long j,k,t
- robj loi[1]
- k=iis
- choose case fs
- case 'y1'
- do while k>0
- k=k/2
- For i=k To iis -1
- For j=(i -k+1) To 1 Step -1
- If long(io[j].oy1)<=long(io[j+k].oy1) Then Exit
- loi[1]=io[j]
- io[j]=io[j+k]
- io[j+k]=loi[1]
- j=j -k +1
- next
- next
- loop
- case 'x1'
- do while k>0
- k=k/2
- For i=k To iis -1
- For j=(i -k+1) To 1 Step -1
- If long(io[j].ox1)<=long(io[j+k].ox1) Then Exit
- loi[1]=io[j]
- io[j]=io[j+k]
- io[j+k]=loi[1]
- j=j -k +1
- next
- next
- loop
- case 'select'
- do while k>0
- k=k/2
- For i=k To iis -1
- For j=(i -k+1) To 1 Step -1
- If long(io[j].oselect)<=long(io[j+k].oselect) Then Exit
- loi[1]=io[j]
- io[j]=io[j+k]
- io[j+k]=loi[1]
- j=j -k +1
- next
- next
- loop
- case 'cc'
- do while k>0
- k=k/2
- For i=k To iis -1
- For j=(i -k+1) To 1 Step -1
- If io[j].occ<=io[j+k].occ Then Exit
- if io[j].otype='band' then continue
- loi[1]=io[j]
- io[j]=io[j+k]
- io[j+k]=loi[1]
- j=j -k +1
- next
- next
- loop
- end choose
- end subroutine
- public subroutine wf_band4 (integer h1, integer h2, integer h3, integer h4, integer f_label);long j,k,m,n
- string ls[]
- if f_label=1 then
- f_atab(ls[],ids.describe('datawindow.bands')+'~t')
- k=upperbound(ls[])
- for j=1 to k
- if pos(ls[j],'header.')+pos(ls[j],'trailer.')+pos(ls[j],'background')>0 then continue
- iis++
- i=iis
- io[i].otype='band'
- io[i].ox1='0'
- io[i].oband=ls[j]
- m=long(ids.Describe('DataWindow.'+io[i].oband+'.height'))
- if n>0 then
- m=m+n+14
- else
- m=m+1
- end if
- io[i].oy1=string(m)
- n=m
- choose case left(ls[j],6)
- case 'header'
- io[i].otext="▲页表头"+mid(ls[j],7)
- io[i].oname='band1'+mid(ls[j],8,len(ls[j]) -8)
- case 'detail'
- io[i].otext="▲细节"
- io[i].oname='band2'
- io[i].oborder=ids.Describe('DataWindow.'+io[i].oband+'.height.autosize')
- case 'summar'//'summary'
- io[i].otext="▲总计区"
- io[i].oname='band3'
- case 'footer'
- io[i].otext="▲页表尾"
- io[i].oname='band4'
- end choose
- io[i].ox2=string(ii_x_max)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].ocolor=ids.Describe('DataWindow.'+io[i].oband+'.color')
- next
- else
- for j=1 to 4
- iis++
- i=iis
- io[i].otype='band'
- io[i].oname='band'+string(j)
- io[i].ox1='0'
- choose case j
- case 1
- io[i].oy1=string(h1)
- io[i].otext="▲页表头"
- io[i].oband='header'
- case 2
- io[i].oy1=string(long(io[i -1].oy1)+h2+14)
- io[i].otext="▲细节"
- io[i].oband='detail'
- io[i].oborder='no'
- case 3
- io[i].oy1=string(long(io[i -1].oy1)+h3+14)
- io[i].otext="▲总计区"
- io[i].oband='summary'
- case 4
- io[i].oy1=string(long(io[i -1].oy1)+h4+14)
- io[i].otext="▲页表尾"
- io[i].oband='footer'
- end choose
- io[i].ox2=string(ii_x_max)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].ocolor='536870912'
- next
- end if
- end subroutine
- public subroutine wf_insertgroup (integer i_h, integer i_b, string s_oexp, string s_o2exp, string s_newpage, string s_resetpagecount, integer f_label);ii_group++
- if ii_group=1 then
- iso='band1'
- else
- iso='band_g_h_'+string(ii_group - 1)
- end if
- iio=wf_afind()//找到iso
- if iio=0 then//band11=herder[1],band12=herder[2]
- for i=iis to 1 step -1
- if io[i].otype='band' and pos(io[i].oname,'band1')=1 then
- iio=i
- exit
- end if
- next
- end if
- i=iio
- wf_aftermove(i_h+14,0)//带区移动14
- iis++
- i=iis
- io[i].otype='band'
- io[i].oname='band_g_h_'+string(ii_group)
- io[i].oband='header.'+string(ii_group)
- io[i].ox1='0'
- io[i].oy1=string(long(io[iio].oy1)+i_h+14)
- io[i].ox2=string(ii_x_max)
- io[i].oy2=string(long(io[i].oy1)+12)
- if f_label=1 then
- io[i].ocolor=ids.Describe("DataWindow.header."+String(ii_group)+".color")
- else
- io[i].ocolor='536870912'
- end if
- io[i].obcolor=s_newpage
- io[i].ofname=s_resetpagecount
- io[i].otext=s_oexp
- io[i].ofsize=s_o2exp
- if f_label=0 then
- wf_object(i,0)
- end if
- iso='band2'
- iio=wf_afind()//找到iso
- i=iio
- wf_aftermove(i_b+14,0)
- iis++
- i=iis
- io[i].otype='band'
- io[i].oname='band_g_b_'+string(ii_group)
- io[i].oband='trailer.'+string(ii_group)
- io[i].ox1='0'
- io[i].oy1=string(long(io[iio].oy1)+i_b+14)
- io[i].ox2=string(ii_x_max)
- io[i].oy2=string(long(io[i].oy1)+12)
- if f_label=1 then
- io[i].ocolor=ids.Describe("DataWindow.trailer."+String(ii_group)+".color")
- else
- io[i].ocolor='536870912'
- end if
- io[i].obcolor=s_newpage
- io[i].ofname=s_resetpagecount
- io[i].otext=s_oexp
- io[i].ofsize=s_o2exp
- if f_label=0 then
- wf_object(i,0)
- end if
- end subroutine
- public subroutine wf_format (string s_type);int li_pos1,li_pos2
- string ls_format
- if pos('decimal,number,long,',left(s_type,7))>0 then
- li_pos1=pos(s_type,'(')
- li_pos2=pos(s_type,')')
- if li_pos2 - li_pos1>1 then
- ls_format='#,##0.'+left('000000000000',long(mid(s_type,li_pos1+1,li_pos2 - li_pos1 - 1)))
- if right(ls_format,1)='.' then
- ls_format=left(ls_format,len(ls_format) - 1)
- end if
- else
- ls_format='#,##0'
- end if
- io[i].oalignment='1'
- else
- if pos(s_type,'date')=1 then
- ls_format='yyyy/mm/dd'
- elseif pos(s_type,'time')=1 then
- ls_format='hh:mm:ss'
- else
- ls_format=''
- end if
- io[i].oalignment='0'
- end if
- io[i].others=io[i].others+'{format='+ls_format+'}'
- end subroutine
- public subroutine wf_title (integer i_x, integer i_y, string s_fname, integer i_fsize);if is_rname='' then return
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname='text_tile'
- io[i].otext=is_rname
- io[i].ofname=s_fname
- io[i].ofsize=string(i_fsize)
- io[i].oalignment='2'
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- if ii_bbgs=6 then//grid
- io[i].oband='foreground'
- io[i].ox1='0'
- io[i].oy1='0'
- io[i].ox2=string(max(ii_x -2,len(is_rname)*i_fsize/2))
- io[i].oy2='38'
- io[i].oborder='2'
- else
- io[i].ox1=string(i_x)
- io[i].oy1=string(i_y)
- io[i].ox2=string(long(io[i].ox1)+len(is_rname)*i_fsize/2)
- io[i].oy2=string(long(io[i].oy1)+i_fsize)
- io[i].oborder='0'
- end if
- end subroutine
- public subroutine wf_page (integer i_x, integer i_y, string s_fname, integer i_fsize);iis++
- i=iis
- io[i].otype='compute'
- io[i].oname='edit_page'
- io[i].ox1=string(i_x)
- io[i].oy1=string(i_y)
- io[i].ox2=string(long(io[i].ox1)+38*i_fsize/2)
- io[i].oy2=string(long(io[i].oy1)+i_fsize)
- io[i].ofname=s_fname
- io[i].ofsize=string(i_fsize)
- io[i].oalignment='2'
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- //io[i].otext='"第"+第几页()+"页/共"+总页数()+"页 "+转换成字符串(系统日期(),"yyyy/mm/dd hh:mm:ss")'
- //io[i].oexpression='"第"+PAGE()+"页/共"+PAGECOUNT()+"页 "+STRING(TODAY(),"yyyy/mm/dd hh:mm:ss")'
- io[i].otext="'第'+第几页()+'页/共'+总页数()+'页 '+转换成字符串(系统日期(),'yyyy/mm/dd hh:mm:ss')"
- io[i].oexpression="'第'+PAGE()+'页/共'+PAGECOUNT()+'页 '+STRING(TODAY(),'yyyy/mm/dd hh:mm:ss')"
- end subroutine
- public subroutine wf_libexport ();
- if wf_write() = 0 then return
- i=iio
- iio=iis+1
- io[iio].otype='libexport'
- openwithparm(w_rpt_edit,istr_rpt,THIS)
- io[iio]=id[2]//清空最后一行
- iio=i
- end subroutine
- public subroutine wf_libimport ();i=iio
- iio=iis+1
- io[iio].otype='libimport'
- openwithparm(w_rpt_edit,istr_rpt,THIS)
- if io[iio].oname>'' then
- ids.dataobject=io[iio].oname
- ids.settransobject(it_report)
- io[iio]=id[2]//清空最后一行
- wf_alldel()
- wf_read('all')
- wf_obj0()
- dw1.modify("datawindow.color="+id[1].oband)
- if isvalid(idwm) then
- if f_myget(idwm,ii_rowm,'rdname')='' then
- idwm.setitem(ii_rowm,'rdname',ids.dataobject)
- end if
- end if
- else
- io[iio]=id[2]//清空最后一行
- iio=i
- end if
- end subroutine
- public function string wf_ssx (string s1, string s2, string s3, string s4);string ls
- if s4>'' then
- if s1>'' then ls=s1+'.'
- ls=ls+s2+'='+s3+s4+s3+' '
- end if
- return ls
- end function
- public function integer wf_crosstabc ();long j,k,m,n,o,ll,p
- string lx1,lx2,ls_crossmode,ls_data,ls[]
- datawindow ldw
- ls_crossmode=w_rpt_edit.is_crossmode
- if ls_crossmode<>'yes' then
- ls_data=w_rpt_edit.is_data
- f_atab(ls[],ls_data+'~t')
- p=upperbound(ls[])//p>=1
- else
- p=1
- end if
- io[iio]=id[2]//清空最后一行
- wf_alldel()
- dw3.reset()
- ii_rows=1+w_rpt_edit.dw2.rowcount()
- if w_rpt_edit.dw4.rowcount()>1 then
- ii_rows=ii_rows+1//header[]总数=columns+1+if(rows>1,1,0)
- end if
- for i=1 to ii_rows+3//带区总数=header[]总数+3
- iis++
- i=iis
- io[i].otype='band'
- io[i].ox1='0'
- if i=1 then
- m=24
- else
- m=18
- end if
- if n>0 then
- m=m+n+14
- else
- m=m+1
- end if
- io[i].oy1=string(m)
- n=m
- if i<=ii_rows then
- io[i].otext="▲页表头["+string(i)+']'
- io[i].oname='band1'+string(i)
- io[i].oband="header["+string(i)+']'
- elseif i=ii_rows+1 then
- io[i].otext="▲细节"
- io[i].oname='band2'
- io[i].oband="detail"
- io[i].oborder='no'//ids.Describe('DataWindow.'+io[i].oband+'.height.autosize')
- elseif i=ii_rows+2 then
- io[i].otext="▲总计区"
- io[i].oname='band3'
- io[i].oband="summary"
- elseif i=ii_rows+3 then
- io[i].otext="▲页表尾"
- io[i].oname='band4'
- io[i].oband="footer"
- end if
- io[i].ox2=string(ii_x_max)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].ocolor='536870912'
- next
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname='text_title'
- io[i].oband='foreground'
- io[i].ox1='0'
- io[i].oy1='0'
- io[i].ox2='780'
- io[i].oy2='26'
- io[i].otext=istr_rpt.rcname
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='24'
- io[i].oalignment='2'
- m=2
- //设置columns及上下标识,列数=rows field+values field
- ldw=w_rpt_edit.dw3//rows field
- n=ldw.rowcount()
- ldw.RowsCopy(1,n,primary!,dw3,dw3.RowCount()+1,primary!)
- for j=1 to n//添加column
- ll=6*max(ldw.getitemnumber(j,'clen1'),ldw.getitemnumber(j,'clen2'))
- iis++
- i=iis
- io[i].otype='column'
- io[i].oname=ldw.getitemstring(j,'ckey')//=cname
- io[i].oband='detail'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext=ldw.getitemstring(j,'cupdate')//=ctag
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='0'
- io[i].oexpression='edit'
- o++
- io[i].others='{id='+string(o)+'}'
- wf_format(dw3.getitemstring(o,'ctype'))
- iis++//添加column_t
- i=iis
- io[i].otype='text'
- io[i].oname=ldw.getitemstring(j,'ckey')+'_t'//=cname
- io[i].oband="header["+string(ii_rows)+']'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows -1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext=ldw.getitemstring(j,'cupdate')//=ctag
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='2'
- if j=1 then//添加'总计'
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname=ldw.getitemstring(j,'ckey')+'_h'//=cname
- io[i].oband="summary"
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows+1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext='总计'//=ctag
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='2'
- end if
- m=long(io[i].ox2)+2
- next
- //设置columns及上下标识,列数=rows field+values field
- //ldw=w_rpt_edit.dw4//values field
- //n=ldw.rowcount()
- for k=1 to p
- ldw=w_rpt_edit.dw4//values field
- n=ldw.rowcount()
- for j=1 to n
- if k=1 then
- ldw.setitem(j,'cname',ldw.getitemstring(j,'ckey'))
- ldw.setitem(j,'ctag',ldw.getitemstring(j,'cupdate'))
- else
- ldw.setitem(j,'cname',ldw.getitemstring(j,'ckey')+'_'+string(k -1))
- ldw.setitem(j,'ctag',ldw.getitemstring(j,'cupdate')+'_'+string(k -1))
- end if
- ldw.setitem(j,'cdbname',ldw.getitemstring(j,'cname'))
- next
- ldw.RowsCopy(1,n,primary!,dw3,dw3.RowCount()+1,primary!)
- for j=1 to n//添加column
- ll=6*12
- iis++
- i=iis
- io[i].otype='column'
- io[i].oname=ldw.getitemstring(j,'cname')
- io[i].oband='detail'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext=ldw.getitemstring(j,'ctag')
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='1'
- io[i].oexpression='edit'
- o++
- io[i].others='{id='+string(o)+'}'
- dw3.setitem(o,'ctype','number')
- wf_format('number')
- if n>1 then//添加values_t
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname=ldw.getitemstring(j,'cname')+'_t'
- io[i].oband="header["+string(ii_rows)+']'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows -1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext=ldw.getitemstring(j,'ctag')
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='2'
- end if
- iis++//添加sum(values)
- i=iis
- io[i].otype='compute'
- io[i].oname=ldw.getitemstring(j,'cname')+'_s'
- io[i].oband="summary"
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows+1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext='求和('+ldw.getitemstring(j,'ctag')+')'
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='1'
- io[i].oexpression='sum('+ldw.getitemstring(j,'cname')+')'
- wf_format('number')
- m=long(io[i].ox2)+2
- if j=1 then lx1=io[i].ox1
- if j=n then lx2=io[i].ox2
- next
-
- ldw=w_rpt_edit.dw2//columns
- n=ldw.rowcount()
- for j=1 to n//添加@column
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname=ldw.getitemstring(j,'cname')+'_m'+string(k)
- io[i].oband="header["+string(j+1)+']'
- io[i].ox1=lx1
- io[i].oy1=string(long(io[j].oy1)+17)
- io[i].ox2=lx2
- io[i].oy2=string(long(io[i].oy1)+12)
- if ls_crossmode='yes' then
- io[i].otext='@'+ldw.getitemstring(j,'cname')
- else
- io[i].otext=ls[k]
- end if
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='2'
- next
- next
- m=long(lx2)+2//设置合计
- ldw=w_rpt_edit.dw4//values
- n=ldw.rowcount()
- for j=1 to n//添加column
- ll=6*12
- iis++
- i=iis
- io[i].otype='compute'
- io[i].oname=ldw.getitemstring(j,'ckey')+'_c'//=cname
- io[i].oband='detail'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='1'
- io[i].oexpression='crosstabsum('+string(j)+')'
- io[i].otext=io[i].oexpression
- wf_format('number')
- iis++
- i=iis
- io[i].otype='compute'
- io[i].oname=ldw.getitemstring(j,'ckey')+'_cs'//=cname
- io[i].oband='summary'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[ii_rows+1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='1'
- io[i].oexpression='sum('+ldw.getitemstring(j,'ckey')+'_c)'
- io[i].otext='求和('+ldw.getitemstring(j,'ckey')+'_c)'
- iis++
- i=iis
- io[i].otype='text'
- io[i].oname=ldw.getitemstring(j,'ckey')+'_ct'//=cname
- io[i].oband='header[2]'
- io[i].ox1=string(m)
- io[i].oy1=string(long(io[1].oy1)+17)
- io[i].ox2=string(m+ll)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='2'
- io[i].otext=ldw.getitemstring(j,'cupdate')+'合计'
- m=long(io[i].ox2)+2
- next
- k=dw3.rowcount()
- for j=1 to k
- // dw3.setitem(j,'cname',dw3.getitemstring(j,'ckey'))
- // dw3.setitem(j,'ctag',dw3.getitemstring(j,'cupdate'))
- dw3.setitem(j,'ckey','')
- dw3.setitem(j,'cupdate','')
- next
- for i=1 to iis
- wf_object(i,0)//根据对象不同分别生成Modify语句并执行
- next
- iio=iis+1//最后把iio设回iis+1
- return 0
- end function
- public subroutine wf_dwinit ();id[1].otype='datawindow'
- id[1].oband='16777215'//color
- id[1].ox1='0'//processing数据窗口类型
- id[1].ofweight='1'//rows_per_detail
- id[1].ofitalic='1'//units
- end subroutine
- public subroutine wf_obj0 ();dw1.setredraw(false)
- for i=1 to iis
- wf_object(i,0)//根据对象不同分别生成Modify语句并执行
- next
- dw1.setredraw(true)
- end subroutine
- public function string wf_rowindetail (string s1, string s2);string ls[],lc
- long l1,l2,l3,j
- ls[1]=mid(s1,pos(s1,'band=') -10)
- l1=pos(ls[1],'name='+s2)
- if l1>0 then
- l2=pos(ls[1],'~n',l1)//后一个换行符
- for j=l1 to 1 step -1
- if mid(ls[1],j,1)='~n' then//前一个换行符
- l3=j
- exit
- end if
- next
- ls[2]=mid(ls[1],l3,l2 -l3)
- l2=pos(ls[2],'row_in_detail=')
- if l2>0 then
- l3=pos(ls[2],' ',l2+14)
- lc=trim(mid(ls[2],l2+14,l3 -l2 -14))
- end if
- end if
- return lc
- end function
- public subroutine wf_aftermove (integer y1_add, integer ff);int li,ly1
- ly1=long(io[iio].oy1)
- for li=1 to iis
- if long(io[li].oy1)<ly1 or (li=iio and ff=0) then continue
- io[li].oy1=string(long(io[li].oy1)+y1_add)
- io[li].oy2=string(long(io[li].oy2)+y1_add)
- wf_object(li,1)
- next
- end subroutine
- public function string wf_mysx (string fsx);string ls
- ls=ids.describe(fsx)
- //if left(ls,1)='"' then ls=mid(ls,2,len(ls)-2)
- //ls=f_replace(ls,'~~~"','"')
- if pos('!?',ls)>0 then ls=''
- return ls
- end function
- public subroutine wf_wdata ();String ls1,ls2,ls3,ls4,ls
- Long l1,l2,l3,j
- ls1 = istr_rpt.rdata
- IF ls1 = '' THEN RETURN
- l3 = dw3.RowCount()
- IF l3 = 0 THEN RETURN
- datastore lds
- is_temp = f_rpt_sdw(dw3)
- IF is_temp = '' THEN RETURN
- lds = CREATE datastore
- lds.Create(is_temp)
- lds.ImportString(ls1)
- ls1 = ''
- l1 = lds.RowCount()
- FOR i = 1 TO l1
- FOR j = 1 TO l3
- is_temp = Left(dw3.Object.ctype[j],5)
- CHOOSE CASE is_temp
- CASE 'char(','varch'
- ls = lds.GetItemString(i,j)
- IF IsNull(ls) THEN
- ls1 = ls1+'null '
- ELSE
- ls = f_replace(ls,'~~','~~~~')
- ls1 = ls1+'"'+f_replace(ls,'"','~~~"')+'",'
- END IF
- CASE 'date'
- ls = String(lds.GetItemDate(i,j),'yyyy-mm-dd')
- IF IsNull(ls) OR ls = '' THEN
- ls1 = ls1+'null '
- ELSE
- ls1 = ls1+String(Date(ls),'yyyy-mm-dd')+','
- END IF
- CASE 'datet' //datetime
- ls = String(lds.GetItemDateTime(i,j),'yyyy-mm-dd hh:mm:ss')
- IF IsNull(ls) OR ls = '' THEN
- ls1 = ls1+'null '
- ELSE
- l2 = Pos(ls,' ')
- IF l2 > 0 THEN
- ls3 = Left(ls,l2 -1)
- ls4 = Mid(ls,l2+1)
- ELSE
- ls3 = ls
- ls4 = ''
- END IF
- ls1 = ls1+String(DateTime(Date(ls3),Time(ls4)),'yyyy-mm-dd hh:mm:ss')+','
- END IF
- CASE 'time'
- ls = String(lds.GetItemTime(i,j),'hh:mm:ss:ffff')
- IF IsNull(ls) OR ls = '' THEN
- ls1 = ls1+'null '
- ELSE
- ls1 = ls1+ls+','
- END IF
- CASE 'long','ulong','numbe','decim'
- ls = String(lds.GetItemNumber(i,j))
- IF IsNull(ls) THEN
- ls1 = ls1+'null '
- ELSE
- ls1 = ls1+' '+ls+','
- END IF
- END CHOOSE
- NEXT
- ls1 = ls1+'~n'
- NEXT
- ls1 = 'data('+ls1+')~n'
- l2 = Pos(is_dw,'band=')
- IF l2 = 0 THEN RETURN
- FOR l1 = l2 TO 1 STEP -1
- ls2 = Mid(is_dw,l1,1)
- IF ls2 = '~n' THEN
- ls3 = Left(is_dw,l1)
- ls4 = Mid(is_dw,l1)
- is_dw = ls3+ls1+ls4
- EXIT
- END IF
- NEXT
- DESTROY lds
- RETURN
- end subroutine
- public subroutine wf_alldel ();for i=iis to 1 step -1//循环删除所有选中对象
- wf_adelete(i)
- next
- ii_group=0
- end subroutine
- public function long wf_occ (integer icc);long ll,lr
- for ll=1 to iis
- if ll=1 then
- lr=io[ll].occ
- else
- if icc=1 then
- lr=max(lr,io[ll].occ)
- else
- lr=min(lr,io[ll].occ)
- end if
- end if
- next
- return lr
- end function
- public subroutine wf_dwimport ();i=iio
- iio=iis+1
- io[iio].oname = istr_rpt.oname
- io[iio].otype = istr_rpt.otype
- if io[iio].oname>'' then
- ids.dataobject=io[iio].oname
- ids.settransobject(it_report)
- io[iio]=id[2]//清空最后一行
- wf_alldel()
- wf_read('all')
- wf_obj0()
- dw1.modify("datawindow.color="+id[1].oband)
- if isvalid(idwm) then
- if f_myget(idwm,ii_rowm,'rdname')='' then
- idwm.setitem(ii_rowm,'rdname',ids.dataobject)
- end if
- end if
- else
- io[iio]=id[2]//清空最后一行
- iio=i
- end if
- end subroutine
- public function integer wf_upload (string arg_dwsyn, ref string arg_msg);
- Long rslt = 1 ,cnt = 0
- String ls_pblname
- Blob lb_dwsyn
- IF ls_pblpath <> '' THEN
- ls_pblname = Replace(ls_pblpath,1,Len(sys_cur_path),'')
- END IF
- IF ifreport THEN
- UPDATE u_report_user
- SET uploadtime = getdate()
- Where dwname = :is_rname;
- IF sqlca.SQLCode = 0 THEN
- lb_dwsyn = Blob(arg_dwsyn,EncodingANSI!)
- UPDATEBLOB u_report_user
- Set filedata = :lb_dwsyn
- Where dwname = :is_rname;
- IF sqlca.SQLCode = -1 THEN
- arg_msg = '上传报表语法信息失败' + sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ELSEIF sqlca.SQLCode = -1 THEN
- arg_msg = '更新报表上传时间失败' + sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ELSE
- UPDATE sys_autoudpb
- SET buildtime = getdate(),
- uploadtime = getdate(),
- pblname = :ls_pblname,
- comments = :ls_comments
- Where Filename = :is_rname;
- IF sqlca.SQLCode = 0 THEN
- IF sqlca.SQLNRows = 0 THEN
- INSERT INTO sys_autoudpb
- ( filename,
- buildtime,
- uploadtime,
- pblname,
- comments)
- VALUES ( :is_rname,
- getdate(),
- getdate(),
- :ls_pblname,
- :ls_comments) ;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '插入数据窗口列表失败' + sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- END IF
- COMMIT;
- lb_dwsyn = Blob(arg_dwsyn,EncodingANSI!)
- UPDATEBLOB sys_autoudpb
- Set filedata = :lb_dwsyn
- Where Filename = :is_rname;
- IF sqlca.SQLCode = -1 THEN
- arg_msg = '上传数据窗口语法信息失败' + sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- ELSEIF sqlca.SQLCode = -1 THEN
- arg_msg = '更新数据窗口修改日期失败' + sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSE
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer wf_write ();long ll[9],j,li_cols,o,p,q,m,n
- string ls_group[],ls_modify,ls_sql,ls_cols,ls_obj,ls_groups,ls_editstyle,ls_dw,ls_crosstab
- string lscc[]//对象分层次用
- int licc
- SetCurrentDirectory(is_path)//恢复当前目录,如果改变了当前目录(如选择图片文件时),则f_cdw()可能找不到
- ls_obj=iso
- wf_asort('y1')
- is_temp='footer'
- for i=iis to 1 step -1
- if io[i].otype='band' then
- choose case left(io[i].oname,8)
- case 'band_g_h'
- is_temp='header.'+mid(io[i].oname,10)
- case 'band_g_b'
- is_temp='trailer.'+mid(io[i].oname,10)
- case else//'band1','band2','band3','band4'
- is_temp=io[i].oband
- end choose
- end if
- if io[i].oband<>is_temp and pos('background,foreground',io[i].oband)=0 then
- io[i].oband=is_temp//设置此对象的带区
- end if
- next
- is_dw=''
- li_cols=dw3.rowcount()
- for i=1 to li_cols
- ls_cols=ls_cols+char(13)+"column=(type="+dw3.object.ctype[i]
- if dw3.object.cupdate[i]='yes' then ls_cols=ls_cols+" update=yes"
- if dw3.object.cwhereclause[i]='yes' then ls_cols=ls_cols+" updatewhereclause=yes"
- if dw3.object.ckey[i]='yes' then ls_cols=ls_cols+" key=yes"
- if dw3.object.cidentity[i]='yes' then ls_cols=ls_cols+" identity=yes"
- s[1]=dw3.object.cvalidation[i]
- if s[1]>'' then
- ls_cols=ls_cols+" validation='"+f_replace(s[1],"'","~~~'")+"'"
- end if
- s[1]=dw3.object.cvalidationmsg[i]
- if s[1]>'' then
- ls_cols=ls_cols+" validationmsg='"+f_replace(s[1],"'","~~~'")+"'"
- end if
- ls_cols=ls_cols+" name="+dw3.object.cname[i]
- ls_cols=ls_cols+' dbname="'+dw3.object.cdbname[i]+'"'
- ls_cols=ls_cols+' initial="'+dw3.object.cinitial[i]+'"'
- for j=1 to iis
- if io[j].otype='column' then
- if pos(io[j].others,'{id='+string(i)+'}')>0 then exit
- end if
- next
- if j>iis then//当column对象删除之后
- ls_cols=ls_cols+' values="'+dw3.object.ctag[i]+'~t/"'//字段的中文名暂时放在column.values最安全,当column对象删除之后,还可以取出来
- else
- is_temp=dw3.object.cvalues[i]
- if is_temp>'' then ls_cols=ls_cols+' values="'+is_temp+'"'
- end if
- ls_cols=ls_cols+')'
- next
- if id[1].ox1='5' then//composite
- ls_cols=ls_cols+" unbound='yes' "
- end if
- io[iis+1]=id[1]//加上dw一行
- for i=1 to iis+1
- iso=io[i].oname
- is_type=io[i].otype
- if is_type='band' then//band1,band2,band3,band4,band_g
- ll[6]=long(mid(iso,5,1))
- if ll[6]>0 then//band1,band2,band3,band4
- ll[ll[6]]=long(io[i].oy1) -ll[5] -1//
- if ll[6]=2 then
- is_temp='height.autosize='+io[i].oborder//只有detail有此属性
- else
- is_temp=''
- end if
- is_dw=is_dw+io[i].oband+"(height="+string(ll[ll[6]])+" "+is_temp+" color='"+io[i].ocolor+"')"
- else//band_g_h_,band_g_b_
- ll[6]=long(mid(iso,10))
- if pos(iso,'band_g_h')=1 then//分组的中文信息is_oexp放在header.pointer属性中
- ls_group[ll[6]]=char(13)+"group(level="+string(ll[6])+" header.height="+string(long(io[i].oy1) -ll[5] -1)+" header.pointer='"+io[i].otext+"' header.color='"+io[i].ocolor+"' newpage="+io[i].obcolor+" resetpagecount="+io[i].ofname
- elseif pos(iso,'band_g_b')=1 then
- ls_group[ll[6]]=ls_group[ll[6]]+" trailer.height="+string(long(io[i].oy1) -ll[5] -1)+" trailer.color='"+io[i].ocolor+"' by=('"+io[i].ofsize+"')"+")"
- ls_groups=ls_group[ll[6]]+ls_groups
- end if
- end if
- if iso<>'band4' then//此条件可以在页尾区下面存放不显示的对象
- ll[5]=long(io[i].oy1)+13
- end if
- else
- is_temp=''
- if is_type='datawindow' then
- s[1]=io[i].ox1
- s[2]=io[i].oy1
- s[3]=io[i].ox2
- s[4]=io[i].oy2
- else
- if pos('background,foreground',io[i].oband)>0 then
- ll[6]=0
- else
- ll[6]=ll[5]
- end if
- s[1]=string(long(io[i].ox1))
- s[2]=string(long(io[i].oy1) -ll[6])
- if is_type='line' then//
- s[3]=string(long(io[i].ox2))
- s[4]=string(long(io[i].oy2) -ll[6])
- if pos(io[i].oname,'line2')=1 then//竖线修正
- if s[2]='0' then
- s[2]='-1'
- elseif io[i].oband='header' then
- s[4]=string(long(io[i].oy2) -ll[6]+1)
- end if
- end if
- elseif is_type<>'line' then//
- s[3]=string(long(io[i].ox2) -long(io[i].ox1))
- s[4]=string(long(io[i].oy2) -long(io[i].oy1))
- end if
- end if
- o=long(mid(ist,pos(ist,is_type) -2,2))
- p=ii[2*o -1]
- q=ii[2*o]
-
- s[9]=io[i].others
- j=0
- for o=p to q
- j++
- choose case j
- case 1
- is_temp=' '+io[i].otype+'('
- continue
- case 2
- s[5]=io[i].oname
- case 3
- s[5]=io[i].oband
- case 4
- s[5]=s[1]
- case 5
- s[5]=s[2]
- case 6
- s[5]=s[3]
- case 7
- s[5]=s[4]
- case 8
- s[5]=io[i].oborder
- case 9
- s[5]=io[i].otext
- case 10
- s[5]=io[i].ocolor
- case 11
- s[5]=io[i].obcolor
- case 12
- s[5]=io[i].ofname
- case 13
- s[5]=io[i].ofsize
- case 14
- s[5]=io[i].ofweight
- case 15
- s[5]=io[i].ofitalic
- case 16
- s[5]=io[i].ofunderline
- case 17
- s[5]=io[i].oalignment
- case 18
- s[5]=io[i].oexpression
- end choose
-
- s[7]='{'+is0[o]+'='
- s[8]='}'
- n=pos(s[9],s[7])
- if n>0 then
- m=pos(s[9],s[8],n)
- s[6]=mid(s[9],n+len(s[7]),m -n -len(s[7]))
- else
- s[6]=''
- end if
- if j<19 then
- if s[6]>'' and pos('?!',s[6])=0 then s[5]=s[5]+char(9)+s[6]
- else
- s[5]=s[6]
- end if
-
- if s[5]='' and is0[o]='background.mode' then s[5]='2'//background.mode在crosstab风格的dw中一定要有值
- if pos('?!',s[5])>0 or (s[5]='' and pos(',text,checkbox.text,',is0[o])=0) then continue
-
- s[5]=f_replace(s[5],"'","~~~'")
- choose case is_type
- case 'column'
- if is0[o]='edit.style' then
- ls_editstyle=s[5]+'.'
- continue
- elseif pos(is0[o],'edit.')+pos(is0[o],'checkbox.')+pos(is0[o],'dddw.')+pos(is0[o],'ddlb.')+pos(is0[o],'editmask.')+pos(is0[o],'radiobuttons.')=1 then
- if pos(is0[o],ls_editstyle)=0 then continue
- end if
- case 'tableblob'
- if is0[o]='dbname' then
- li_cols++
- is_temp=is_temp+' id='+string(li_cols)
- ls_cols=ls_cols+char(13)+' column=(type=blob name='+io[i].oname+' dbname="'+io[i].ocolor+'")'
- continue
- elseif is0[o]='id' then
- continue
- end if
- case 'datawindow'
- ii_temp=idsx.object.data[o,2]
- choose case io[i].ox1
- case '1'//grid
- if ii_temp>40 then continue
- case '2'//label
- if ii_temp>20 and ii_temp<50 then continue
- case '4'//crosstab
- if ii_temp>50 then continue
- if pos(is0[o],'crosstab')=1 then
- choose case is0[o]
- case 'crosstab.dynamic'
- case 'crosstabdata'
- if f_rsx(id[1].others,'crosstab.dynamic')<>'yes' then
- ls_cols=ls_cols+f_rsx(id[1].others,'crosstabdata')
- end if
- continue
- case else
- s[6]=idsx.object.data[o,5]
- ls_crosstab=f_cdw('$1',ls_crosstab,is0[o],s[6],s[5],'','','','','')
- continue
- end choose
- end if
- case else//'0'
- if ii_temp>20 then continue
- end choose
- end choose
-
- s[6]=idsx.object.data[o,5]
- is_temp=is_temp+' '+is0[o]+"="+s[6]+s[5]+s[6]
- next
- is_temp=is_temp+')'
- if is_type='datawindow' then
- is_temp=f_replace(is_temp,'row.resize=0','')//有row.resize=0会出错,但row.resize=1没有问题
- ls_dw="release 11.5;"+is_temp
- else
- if is_type='column' then//为了处理PB本身的小BUG,即editmask.useformat=yes在'DataWindow.Syntax'会丢掉此属性
- if pos(is_temp,'editmask.useformat=yes')>0 then
- is_temp=f_replace(is_temp,"editmask.mask='","editmask.mask='editmask.useformat=yes")
- end if
- end if
- licc++
- lscc[licc]=string(io[i].occ)
- lscc[licc]=lscc[licc]+space(8 -len(lscc[licc]))+is_temp
- end if
- end if
- next
- //////////////////////以下代码处理对象层次
- long k
- string lscc2
- k=licc
- do while k>0
- k=k/2
- For i=k To licc -1
- For j=(i -k+1) To 1 Step -1
- If long(left(lscc[j],8))<=long(left(lscc[j+k],8)) Then Exit
- lscc2=lscc[j]
- lscc[j]=lscc[j+k]
- lscc[j+k]=lscc2
- j=j -k +1
- next
- next
- loop
- for i=1 to licc
- ls_modify=ls_modify+char(13)+mid(lscc[i],9)
- next
- //////////////////////////
- is_dw=ls_dw+is_dw
- if ls_crosstab>'' then ls_modify=ls_modify+char(13)+ls_crosstab+')'
- is_update=''
- if is_updatetable>'' then is_update=is_update+" update='"+is_updatetable+"'"
- if is_updatewhere>'' then is_update=is_update+" updatewhere="+is_updatewhere
- if is_updatekeyinplace>'' then is_update=is_update+" updatekeyinplace="+is_updatekeyinplace
- is_dw=f_cdw(is_dw,ls_modify,ls_cols,istr_rpt.rsqlselect,is_update,istr_rpt.rprocedure,istr_rpt.rarguments,ls_groups,is_sparse,'"')
- string ls_msg
- if ids.create(is_dw,ls_msg) = -1 then
- messagebox('错误','编辑格式,表达式内容错误或为空')
- return 0
- end if
-
- is_dw=ids.describe('DataWindow.Syntax')//此两句不要删除,否则预览有时会出现非法错误.
- wf_wdata()
-
- is_dw=f_replace(is_dw,'editmask.mask="editmask.useformat=yes','editmask.useformat=yes editmask.mask="')//为了处理PB本身的小BUG,即editmask.useformat=yes在'DataWindow.Syntax'会丢掉此属性
- io[iis+1]=id[2]//清空最后一行
- iso=ls_obj
- iio=wf_afind()
- if iio>0 then is_type=io[iio].otype
- return 1
- end function
- public function string wf_nest_arguments (string s_syntax);long ll1,ll2
- ll1=pos(lower(s_syntax),' nest_arguments=')//PB6.5没有table.arguments属性,PB8.0就有了,不过是只读属性
- if ll1>0 then
- ll2=pos(s_syntax,'))',ll1)
- return mid(s_syntax,ll1+11,ll2 -ll1 -9)
- else
- return ''
- end if
- end function
- public function double wf_mm_to_unitsx (string ls_units, double ld_mm);double ld_rslt
- IF ls_units = '0' THEN
- ld_rslt = ld_mm * 17.27827217278272172782721727827217278272172782721727827217
- ELSEIF ls_units = '1' THEN
- ld_rslt = ld_mm * 3.77962203779622037796220377962203779622037796220377962203
- ELSEIF ls_units = '2' THEN
- ld_rslt = ld_mm * 0.0393700787401575
- ELSEIF ls_units = '3' THEN
- ld_rslt = ld_mm / 10
- ELSE
- ld_rslt = ld_mm * 17.27827217278272172782721727827217278272172782721727827217
- END IF
- return ld_rslt
- end function
- public function double wf_mm_to_unitsy (string ls_units, double ld_mm);double ld_rslt
- IF ls_units = '0' THEN
- ld_rslt = ld_mm * 15.1184881511848815118488151184881511848815118488151184881511848815
- ELSEIF ls_units = '1' THEN
- ld_rslt = ld_mm * 3.77962203779622037796220377962203779622037796220377962203
- ELSEIF ls_units = '2' THEN
- ld_rslt = ld_mm * 0.0393700787401575
- ELSEIF ls_units = '3' THEN
- ld_rslt = ld_mm / 10
- ELSE
- ld_rslt = ld_mm * 15.1184881511848815118488151184881511848815118488151184881511848815
- END IF
- return ld_rslt
- end function
- public function double wf_unitsx_to_mm (string ls_units, double ld_unit);double ld_rslt
- IF ls_units = '0' THEN
- ld_rslt = ld_unit / 17.27827217278272172782721727827217278272172782721727827217
- ELSEIF ls_units = '1' THEN
- ld_rslt = ld_unit / 3.77962203779622037796220377962203779622037796220377962203
- ELSEIF ls_units = '2' THEN
- ld_rslt = ld_unit / 0.0393700787401575
- ELSEIF ls_units = '3' THEN
- ld_rslt = ld_unit * 10
- ELSE
- ld_rslt = ld_unit / 17.27827217278272172782721727827217278272172782721727827217
- END IF
- return ld_rslt
- end function
- public function double wf_unitsy_to_mm (string ls_units, double ld_unit);double ld_rslt
- IF ls_units = '0' THEN
- ld_rslt = ld_unit / 15.1184881511848815118488151184881511848815118488151184881511848815
- ELSEIF ls_units = '1' THEN
- ld_rslt = ld_unit / 3.77962203779622037796220377962203779622037796220377962203
- ELSEIF ls_units = '2' THEN
- ld_rslt = ld_unit / 0.0393700787401575
- ELSEIF ls_units = '3' THEN
- ld_rslt = ld_unit * 10
- ELSE
- ld_rslt = ld_unit / 15.1184881511848815118488151184881511848815118488151184881511848815
- END IF
- return ld_rslt
- end function
- on w_rpt_main.create
- int iCurrent
- call super::create
- if this.MenuName = "m_rpt_main" then this.MenuID = create m_rpt_main
- this.mdi_1=create mdi_1
- this.cb_hidebackgroud=create cb_hidebackgroud
- this.cb_setbackgroud=create cb_setbackgroud
- this.dw3=create dw3
- this.dwx=create dwx
- this.dwy=create dwy
- this.ddlb_1=create ddlb_1
- this.ddlb_2=create ddlb_2
- this.ln_1=create ln_1
- this.dwc1=create dwc1
- this.st_1=create st_1
- this.sle_1=create sle_1
- this.dw1=create dw1
- this.dwc2=create dwc2
- this.cbx_lock=create cbx_lock
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.mdi_1
- this.Control[iCurrent+2]=this.cb_hidebackgroud
- this.Control[iCurrent+3]=this.cb_setbackgroud
- this.Control[iCurrent+4]=this.dw3
- this.Control[iCurrent+5]=this.dwx
- this.Control[iCurrent+6]=this.dwy
- this.Control[iCurrent+7]=this.ddlb_1
- this.Control[iCurrent+8]=this.ddlb_2
- this.Control[iCurrent+9]=this.ln_1
- this.Control[iCurrent+10]=this.dwc1
- this.Control[iCurrent+11]=this.st_1
- this.Control[iCurrent+12]=this.sle_1
- this.Control[iCurrent+13]=this.dw1
- this.Control[iCurrent+14]=this.dwc2
- this.Control[iCurrent+15]=this.cbx_lock
- end on
- on w_rpt_main.destroy
- call super::destroy
- if IsValid(MenuID) then destroy(MenuID)
- destroy(this.mdi_1)
- destroy(this.cb_hidebackgroud)
- destroy(this.cb_setbackgroud)
- destroy(this.dw3)
- destroy(this.dwx)
- destroy(this.dwy)
- destroy(this.ddlb_1)
- destroy(this.ddlb_2)
- destroy(this.ln_1)
- destroy(this.dwc1)
- destroy(this.st_1)
- destroy(this.sle_1)
- destroy(this.dw1)
- destroy(this.dwc2)
- destroy(this.cbx_lock)
- end on
- event open;call super::open;lm_rpt_main = m_rpt_main
- is_rid = istr_rpt.rid //报表编号
- is_rname = istr_rpt.rcname//报表名称
- id_userdw = istr_rpt.userdw//前台报表设计时共享的用户数据dw
- is_auto = istr_rpt.auto
- is_datasource = istr_rpt.DataSource //区分后台、前台,前台='dw'
- it_report = istr_rpt.transation//数据库连接
- ib_save_flag = istr_rpt.save_flag
- import_flag = istr_rpt.import_flag
- ls_pblpath = istr_rpt.pblpath
- ifreport = istr_rpt.ifreport
- //取格式
- if f_get_dwcomment(istr_rpt.pblpath,istr_rpt.oname,ls_comments,is_errors) = 0 then
- messagebox('错误',is_errors, StopSign!, OK! )
- return
- end if
- ids = CREATE datastore
- idsx = CREATE datastore
- idsx.DataObject = 'dw_rpt_cysx65'
- ii_rows = idsx.RowCount()
- is_type = ''
- ii_temp = 0
- FOR i = 1 TO ii_rows
- is0[i] = idsx.Object.Data[i,3]
- IF is_type <> idsx.Object.Data[i,1] THEN
- is_type = idsx.Object.Data[i,1]
- ii_temp++
- ist = ist+String(ii_temp,'00')+is_type
- ii[ii_temp*2 -1] = i
- IF ii_temp > 1 THEN
- ii[ii_temp*2 -2] = i -1
- END IF
- END IF
- NEXT
- ii[ii_temp*2] = ii_rows
- IF is_auto = 'auto' THEN //自动
- IF is_datasource = 'dw' THEN//前台报表
- ids.Create(id_userdw.Describe('DataWindow.Syntax'))
- ids.SetTransObject(it_report)
- wf_read('all')
- ELSE
- wf_dwinit()
- END IF
- POST EVENT ue_auto()
- ELSE
- Blob lblob
- SELECTBLOB Rpsyntax INTO :lblob FROM u_report_list Where rpid = :is_rid USING it_report;
- IF it_report.SQLCode = 0 THEN
- is_dw = String(lblob, EncodingANSI!)
- IF IsNull(is_dw) THEN
- wf_band4(50,50,50,50,0)
- wf_dwinit()
- ELSE
- ids.Create(is_dw,is_errors)
- ids.SetTransObject(it_report)
- wf_read('all')
- END IF
- END IF
- END IF
- //创建动态数据窗口dw1及所有对象
- s[1] = "release 6;datawindow(units=1 processing=0 color="+id[1].oband+") detail(height="+String(ii_y_max)+" color='536870912') table(column=(type=long name=zkl0 dbname='zkl0')) text(band=detail visible='0' text='' x='"+String(ii_x_max)+"' y='1' height='1' width='1')"
- dw1.Create(s[1],is_errors)
- dw1.InsertRow(0)
- wf_obj0() //根据对象不同分别生成Modify语句并执行
- m_rpt_main.m_1.m_line1.ToolbarItemName = 'line1.bmp' //横线
- m_rpt_main.m_1.m_line2.ToolbarItemName = 'line2.bmp'//竖线
- m_rpt_main.m_1.m_edit.ToolbarItemName = 'field.bmp'//表达式
- Title = Title+'('+is_rname+')'
- f_getfont(ddlb_1)
- //Open(w_rpt_statbar)
- ib_resize_statbar = true
- f_statbar('t1',' 龙嘉自定义报表设计器')
- f_statbar('t2','选中对象个数:0')
- dw1.SetFocus()
- IF is_auto <> 'auto' THEN
- ii_save = 0
- END IF
- GetCurrentDirectoryA(256,is_path) //读取当前目录
-
- end event
- event closequery;
- IF import_flag THEN
- Close(w_rpt_statbar)
- ELSE
-
- IF ii_save > 0 THEN
- CHOOSE CASE MessageBox('提示信息','数据已修改,是否存盘?',QUESTION!,YESNOCANCEL!,1)
- CASE 1
- EVENT ue_save()
- CASE 3
- RETURN 1
- END CHOOSE
- END IF
-
- DESTROY ids
- DESTROY idsx
-
- Close(w_rpt_statbar)
- END IF
- end event
- event resize;dwy.Height = (newheight -dwy.Y )
- dwx.Width = newwidth -dwx.X
- dw1.Resize(newwidth -dw1.X ,(newheight -dw1.Y))
- st_1.Width = newwidth
- ln_1.EndX = newwidth
- //if isvalid(w_rpt_statbar) then w_rpt_statbar.event resize(0,0,0)
- end event
- event activate;dw1.setfocus()
- toolbarvisible=true
-
- end event
- event key;call super::key;IF KeyDown(KeyControl!) AND KeyDown(KeyS!) THEN
- THIS.TriggerEvent('ue_save')
- ELSEIF KeyDown( KeyEscape!) THEN
- Close(THIS)
- END IF
- end event
- event close;call super::close;IF ifilename <> '' THEN
- FileDelete(ifilename)
- END IF
- end event
- type mdi_1 from mdiclient within w_rpt_main
- long BackColor=268435456
- end type
- type cb_hidebackgroud from commandbutton within w_rpt_main
- integer x = 3104
- integer y = 100
- integer width = 274
- integer height = 92
- integer taborder = 70
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- boolean enabled = false
- string text = "隐藏背景"
- end type
- event clicked;dw1.SetRedraw(False)
- string ls_visible
- ls_visible = dw1.Describe(ibackgroudname+".visible")
- if ls_visible = '0' then
- dw1.Modify(ibackgroudname+".visible='1'")
- this.Text = '隐藏背景'
- elseif ls_visible = '1' then
- dw1.Modify(ibackgroudname+".visible='0'")
- this.Text = '显示背景'
- cbx_lock.Checked = true
- cb_setbackgroud.Enabled = Not cbx_lock.checked
- end if
- dw1.SetRedraw(True)
- end event
- type cb_setbackgroud from commandbutton within w_rpt_main
- integer x = 2834
- integer y = 100
- integer width = 274
- integer height = 92
- integer taborder = 70
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "套打背景"
- end type
- event clicked;Long cnt
- String ls_filepath, ls_type
- Blob back_data
- String arg_msg
- String ls_units
- ls_units = dw1.Describe("DataWindow.Units")
- FOR i = 1 To iis
- IF io[i].oname = ibackgroudname THEN
- EXIT
- END IF
- NEXT
- IF i <= iis THEN // 已插入背景
-
- s_tran.X = wf_unitsx_to_mm(ls_units, Double(io[i].ox1))
- s_tran.Y = wf_unitsx_to_mm(ls_units, Double(io[i].oy1))
- s_tran.Width = wf_unitsx_to_mm(ls_units, Double(io[i].ox2) - Double(io[i].ox1))
- s_tran.Height = wf_unitsx_to_mm(ls_units, Double(io[i].oy2) - Double(io[i].oy1))
- s_tran.Filename = io[i].otext
-
- OpenWithParm(w_taoda_backgroud_setting, s_tran)
- s_tran = Message.PowerObjectParm
- IF s_tran.ifok = 0 THEN RETURN
-
- io[i].otext = s_tran.Filename
-
- s_tran.X = wf_mm_to_unitsx(ls_units, s_tran.X)
- s_tran.Width = wf_mm_to_unitsx(ls_units, s_tran.Width)
- s_tran.Y = wf_mm_to_unitsy(ls_units, s_tran.Y)
- s_tran.Height = wf_mm_to_unitsy(ls_units, s_tran.Height)
-
- io[i].ox1 = String(s_tran.X)
- io[i].oy1 = String(s_tran.Y)
- io[i].ox2 = String(Double(io[i].ox1)+s_tran.Width)
- io[i].oy2 = String(Double(io[i].oy1)+s_tran.Height)
-
- wf_object(i,1)
-
- ELSE
-
- // DONE: 获取当前DW的套打图片与坐标
- SELECT count(0)
- INTO :cnt
- FROM sys_dwprint_background
- Where dwname = :is_rname;
- IF sqlca.SQLCode <> 0 THEN cnt = 0
- IF cnt > 0 THEN
- SELECT back_x, back_y, back_width, back_height, newid(), back_type
- INTO :s_tran.x, :s_tran.y, :s_tran.width, :s_tran.height, :ls_filepath, :ls_type
- FROM sys_dwprint_background
- Where dwname = :is_rname;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('ERROR', '查询背景图坐标失败,' + sqlca.SQLErrText)
- RETURN
- END IF
-
- IF ifilename = '' THEN // 文件未下载过
- SelectBlob back_data
- Into :back_data
- From sys_dwprint_background
- Where dwname = :is_rname;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('ERROR', '查询背景图内容失败,' + sqlca.SQLErrText)
- RETURN
- END IF
- ls_filepath = sys_cur_path + ins_fjtemppath + "\" + ls_filepath + "." + ls_type
- IF Not IsNull(back_data) THEN
- IF f_blobtofile(ls_filepath, back_data, Ref arg_msg) <> 1 THEN
- MessageBox('ERROR', '保存背景图失败,' + arg_msg)
- RETURN
- END IF
- ifilename = ls_filepath
- s_tran.Filename = ifilename
- ELSE
- s_tran.Filename = ''
- END IF
- ELSE // 图片已经下载过
- s_tran.Filename = ifilename
- END IF
- ELSE
- s_tran.X = 0
- s_tran.Y = 4
- s_tran.Width = 230
- s_tran.Height = 127
- s_tran.Filename = '快递套打.jpg'
- END IF
-
- OpenWithParm(w_taoda_backgroud_setting, s_tran)
- s_tran = Message.PowerObjectParm
- IF s_tran.ifok = 0 THEN RETURN
-
- iis++
- iio = iis
- io[iio].oname = ibackgroudname
- io[iio].occ = wf_occ(1)+1
- iic = 1
- io[iio].oselect = '1'
-
- i = iio
- io[i].otext = s_tran.Filename
-
- s_tran.X = wf_mm_to_unitsx(ls_units, s_tran.X)
- s_tran.Width = wf_mm_to_unitsx(ls_units, s_tran.Width)
- s_tran.Y = wf_mm_to_unitsy(ls_units, s_tran.Y)
- s_tran.Height = wf_mm_to_unitsy(ls_units, s_tran.Height)
-
- io[i].ox1 = String(s_tran.X)
- io[i].oy1 = String(s_tran.Y)
- io[i].ox2 = String(double(io[i].ox1)+s_tran.Width)
- io[i].oy2 = String(double(io[i].oy1)+s_tran.Height)
- io[i].oborder = '2'
- io[i].otype = 'bitmap'
- io[i].oband = is_band
- wf_object(i,0)
- wf_setcolor()
-
- Parent.Trigger Event ue_cc(0)
-
- cb_hidebackgroud.Enabled = True
- cbx_lock.Enabled = True
- END IF
- end event
- type dw3 from datawindow within w_rpt_main
- boolean visible = false
- integer x = 475
- integer y = 40
- integer width = 2757
- integer height = 492
- integer taborder = 70
- boolean bringtotop = true
- string dataobject = "dw_rpt_column"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean resizable = true
- boolean hsplitscroll = true
- boolean livescroll = true
- end type
- type dwx from datawindow within w_rpt_main
- event ue_mousemove pbm_dwnmousemove
- string tag = "PB预览的标尺不准"
- integer x = 64
- integer y = 200
- integer width = 1737
- integer height = 68
- boolean bringtotop = true
- string dataobject = "dw_xruler"
- boolean border = false
- end type
- event ue_mousemove;//鼠标移动到dw1之外时触发事件
- //功能:拖动鼠标超过边界时自动移动,好像在Excel软件中拖动鼠标一样。
- ii_outside=4
- parent.postevent('ue_outside')
- end event
- event constructor;insertrow(0)
- end event
- type dwy from datawindow within w_rpt_main
- event ue_mousemove pbm_dwnmousemove
- string tag = "PB预览的标尺不准"
- integer y = 260
- integer width = 69
- integer height = 1060
- boolean bringtotop = true
- string dataobject = "dw_yruler"
- boolean border = false
- end type
- event ue_mousemove;//鼠标移动到dw1之外时触发事件//左边界
- //功能:拖动鼠标超过边界时自动移动,好像在Excel软件中拖动鼠标一样。
- ii_outside=3
- parent.postevent('ue_outside')
- end event
- event constructor;insertrow(0)
- end event
- type ddlb_1 from dropdownlistbox within w_rpt_main
- integer x = 896
- integer y = 104
- integer width = 782
- integer height = 804
- integer taborder = 50
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long backcolor = 16777215
- string text = "宋体"
- boolean vscrollbar = true
- borderstyle borderstyle = stylelowered!
- end type
- event selectionchanged;wf_allset('fname',text)
- end event
- type ddlb_2 from dropdownlistbox within w_rpt_main
- integer x = 1682
- integer y = 104
- integer width = 192
- integer height = 804
- integer taborder = 60
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long backcolor = 16777215
- string text = "9"
- boolean allowedit = true
- boolean sorted = false
- boolean vscrollbar = true
- string item[] = {"8","9","10","11","12","14","16","18","20","22","24","26","28","36","48","72"}
- borderstyle borderstyle = stylelowered!
- end type
- event selectionchanged;wf_allset('fsize',text)
- end event
- event modified;wf_allset('fsize',text)
- end event
- type ln_1 from line within w_rpt_main
- long linecolor = 16777215
- integer linethickness = 4
- integer beginy = 196
- integer endx = 3419
- integer endy = 196
- end type
- type dwc1 from datawindow within w_rpt_main
- event ue_mousemove pbm_dwnmousemove
- integer x = 1902
- integer y = 100
- integer width = 919
- integer height = 88
- integer taborder = 30
- boolean bringtotop = true
- string dataobject = "dw_rpt_color1"
- boolean border = false
- boolean livescroll = true
- end type
- event ue_mousemove;if not isvalid(dwo) then return
- choose case dwo.name
- case 'qjst','t','qjs'
- if object.qjst.border='0' then
- object.t.border='6'
- object.qjst.border='6'
- else
- end if
- case 'bjst','b','bjs'
- if object.bjst.border='0' then
- object.b.border='6'
- object.bjst.border='6'
- else
- end if
- case else
- if is_scolor<>'qjst' then
- object.t.border='0'
- object.qjst.border='0'
- end if
- if is_scolor<>'bjst' then
- object.bjst.border='0'
- object.b.border='0'
- end if
- end choose
- end event
- event clicked;if not isvalid(dwo) then return
- choose case dwo.name
- case 'qjst'//↓前景色
- if is_scolor<>'qjst' then
- object.bjst.border='0'
- object.b.border='0'
- object.qjst.border='5'
- dwc2.x=1902
- s[1]=object.qjs.background.color
- is_scolor='qjst'
- dwc2.uf_scolor(s[1])
- else
- dwc2.event ue_close()
- end if
- case 'qjs','t'//前景色
- wf_allset('color',object.qjs.background.color)
- object.t.border='5'
- case 'bjs','b'//前景色
- wf_allset('bcolor',object.bjs.background.color)
- object.b.border='5'
- case 'bjst'//↓背景色
- if is_scolor<>'bjst' then
- object.qjst.border='0'
- object.t.border='0'
- object.bjst.border='5'
- dwc2.x=2358
- s[1]=object.bjs.background.color
- is_scolor='bjst'
- dwc2.uf_scolor(s[1])
- else
- dwc2.event ue_close()
- end if
- end choose
- end event
- type st_1 from statictext within w_rpt_main
- integer y = 96
- integer width = 3794
- integer height = 100
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 80269524
- long backcolor = 80269524
- boolean border = true
- borderstyle borderstyle = styleraised!
- boolean focusrectangle = false
- end type
- type sle_1 from singlelineedit within w_rpt_main
- integer x = 9
- integer y = 104
- integer width = 878
- integer height = 80
- integer taborder = 40
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long backcolor = 16777215
- boolean enabled = false
- borderstyle borderstyle = stylelowered!
- end type
- event modified;io[iio].otext=text
- wf_object(iio,1)
- end event
- type dw1 from datawindow within w_rpt_main
- event ue_lbuttonup pbm_dwnlbuttonup
- event ue_key pbm_dwnkey
- event ue_mousemove pbm_dwnmousemove
- string tag = "lse"
- integer x = 64
- integer y = 264
- integer width = 1733
- integer height = 1052
- integer taborder = 10
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean border = false
- boolean livescroll = true
- end type
- event ue_lbuttonup;//左鼠标弹起时触发事件
- Long ll_x1,ll_y1,ll_x2,ll_y2,j,ll_width,ll_width_min = 99999
- xpos = xpos+ii_x_scroll
- ypos = ypos+ii_y_scroll
- IF is_toolbar = '' THEN
- IF iio > 0 THEN
- CHOOSE CASE io[iio].otype
- CASE 'line'
- is_point = 'mouseup'
- CASE 'band','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- is_point = 'lbuttonup'
- CASE 'temp'
- is_point = 'lbuttonup'
- ll_x1 = Min(Long(io[iio].ox1),Long(io[iio].ox2))
- ll_y1 = Min(Long(io[iio].oy1),Long(io[iio].oy2))
- ll_x2 = Max(Long(io[iio].ox1),Long(io[iio].ox2))
- ll_y2 = Max(Long(io[iio].oy1),Long(io[iio].oy2))
- FOR i = 1 To iis
- IF cbx_lock.Checked And io[i].otype = 'bitmap' And io[i].oname = ibackgroudname THEN CONTINUE
- If (ll_x1 > Long(io[i].ox1) And ll_x1 > Long(io[i].ox2)) Or (ll_x2 < Long(io[i].ox1) And ll_x2 < Long(io[i].ox2)) &
- Or (ll_y1 > Long(io[i].oy1) And ll_y1 > Long(io[i].oy2)) Or (ll_y2 < Long(io[i].oy1) And ll_y2 < Long(io[i].oy2)) THEN
- ELSE
- IF io[i].oselect < '1' And io[i].otype <> 'band' THEN
- iic++
- io[i].oselect = String(iic)
- END IF
- END IF
- NEXT
- Modify('destroy temp')
- iio = 0
- iso = ''
- wf_setcolor()
- END CHOOSE
- END IF
- ELSE
- IF iio = iis+2 THEN //sep1
- SetRedraw(False)
- is_point = 'lbuttonup'
- ll_x1 = Long(io[iio].ox1)
- ll_width = Long(io[iio].ox2) -Long(io[iio].ox1)
- FOR i = 1 To iis //中间穿过的对象
- IF Long(io[i].ox1) < ll_x1 And Long(io[i].ox2) >= ll_x1 And io[i].otype <> 'band' THEN
- ll_width_min = Min(ll_width_min,Abs(Long(io[i].ox2) -Long(io[i].ox1)))
- END IF
- NEXT
- IF ll_width_min > -ll_width And ll_width_min < 99999 THEN
- FOR i = 1 To iis
- IF Long(io[i].ox1) < ll_x1 And Long(io[i].ox2) >= ll_x1 THEN //中间穿过的对象
- io[i].ox2 = String(Long(io[i].ox2)+ll_width)
- ELSEIF Long(io[i].ox1) >= ll_x1 THEN // 右边的对象
- io[i].ox1 = String(Long(io[i].ox1)+ll_width)
- io[i].ox2 = String(Long(io[i].ox2)+ll_width)
- END IF
- wf_object(i,1)
- NEXT
- END IF
- Modify('destroy sep1')
- SetRedraw(True)
- iso = ''
- iio = 0
- END IF
- END IF
- RETURN
- end event
- event ue_key;//键盘操作触发事件
- if key=Keyleftarrow! or key=Keyrightarrow! or key=Keyuparrow! or key=Keydownarrow! or key=Keydelete! then
- SetRedraw(false)
- if iic=1 and left(iso,4)='band' then //带区选择
- choose case key
- case Keyuparrow!
- if long(io[iio].oy1) - 1>ii_topformove+1 then
- wf_aftermove(-1,1)
- wf_object(iio,1)
- end if
- case Keydownarrow!
- wf_aftermove(1,1)
- wf_object(iio,1)
- end choose
- else
-
- for i=1 to iis
- if io[i].oselect>'0' then
- choose case keyflags
- case 1 // shift
- choose case key
- case Keyleftarrow!
- choose case io[i].otype
- case 'line'
- choose case left(io[i].oname,5)
- case 'line1','line3'
- io[i].ox2=string(long(io[i].ox2) - 1)
- wf_object(i,1)
- end choose
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].ox2=string(long(io[i].ox2) - 1)
- wf_object(i,1)
- end choose
- case Keyrightarrow!
- choose case io[i].otype
- case 'line'
- choose case left(io[i].oname,5)
- case 'line1','line3'
- io[i].ox2=string(long(io[i].ox2)+1)
- wf_object(i,1)
- end choose
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].ox2=string(long(io[i].ox2)+1)
- wf_object(i,1)
- end choose
- case Keyuparrow!
- choose case io[i].otype
- case 'line'
- choose case left(io[i].oname,5)
- case 'line2','line3'
- io[i].oy2=string(long(io[i].oy2) - 1)
- wf_object(i,1)
- end choose
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].oy2=string(long(io[i].oy2) - 1)
- wf_object(i,1)
- end choose
- case Keydownarrow!
- choose case io[i].otype
- case 'line'
- choose case left(io[i].oname,5)
- case 'line2','line3'
- io[i].oy2=string(long(io[i].oy2)+1)
- wf_object(i,1)
- end choose
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].oy2=string(long(io[i].oy2)+1)
- wf_object(i,1)
- end choose
- end choose
- case 2
- case 3
- case else // no shift
- choose case key
- case Keyleftarrow!
- choose case io[i].otype
- case 'line','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].ox1=string(long(io[i].ox1) - 1)
- io[i].ox2=string(long(io[i].ox2) - 1)
- wf_object(i,1)
- end choose
- case Keyrightarrow!
- choose case io[i].otype
- case 'line','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].ox1=string(long(io[i].ox1)+1)
- io[i].ox2=string(long(io[i].ox2)+1)
- wf_object(i,1)
- end choose
- case Keyuparrow!
- choose case io[i].otype
- case 'line','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].oy1=string(long(io[i].oy1) - 1)
- io[i].oy2=string(long(io[i].oy2) - 1)
- wf_object(i,1)
- case 'band'
- io[i].oy1=string(long(io[i].oy1) - 1)
- io[i].oy2=string(long(io[i].oy2) - 1)
- wf_object(i,1)
- end choose
- case Keydownarrow!
- choose case io[i].otype
- case 'line','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].oy1=string(long(io[i].oy1)+1)
- io[i].oy2=string(long(io[i].oy2)+1)
- wf_object(i,1)
- case 'band'
- io[i].oy1=string(long(io[i].oy1)+1)
- io[i].oy2=string(long(io[i].oy2)+1)
- wf_object(i,1)
- end choose
- end choose
- end choose
- end if
- next
- end if
- if key=Keydelete! then // 对象删除
- parent.event ue_delobj()
- end if
- if iso='sep1' and keydown(KeyLeftButton!) then
- choose case key
- case Keyleftarrow!
- io[iio].ox2=string(long(io[iio].ox2) - 1)
- wf_object(iio,1)
- ii_x=ii_x - 1
- case Keyrightarrow!
- io[iio].ox2=string(long(io[iio].ox2)+1)
- wf_object(iio,1)
- ii_x=ii_x+1
- end choose
- end if
- SetRedraw(true)
- end if
- return 1
- end event
- event ue_mousemove;xpos=xpos+ii_x_scroll
- ypos=ypos+ii_y_scroll
- if (xpos=ii_x_old and ypos=ii_y_old) or ((KeyDown(Keyshift!) or KeyDown(KeyControl!)) and iso<>'temp') then
- else
- dwx.modify("l_x.x1='"+string(xpos)+"' l_x.x2='"+string(xpos)+"'")
- dwy.modify("l_y.y1='"+string(ypos)+"' l_y.y2='"+string(ypos)+"'")
- f_statbar('t3','X:'+string(int(xpos*ln_bl)*0.01)+'cm'+mid(space(7),len(string(int(xpos*ln_bl)*0.01)))+'Y:'+string(int(ypos*ln_bl)*0.01)+'cm')
- SetRedraw(false)
- if iic>1 then //多重选择
- if is_point='move' and keydown(KeyLeftButton!) then
- for i=1 to iis
- // if (ypos - ii_y)<0 then
- // iio=i
- // else
- // iio=iis - i+1
- // end if
- // is_label=dw2.getitemstring(iio,'oselect')
- if io[i].oselect>'0' then
- choose case io[i].otype
- case 'line','text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- case 'band'
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- end choose
- wf_object(i,1)
- end if
- next
- ii_x=xpos
- ii_y=ypos
- elseif iio=iis+1 then//iso='temp'
- if keydown(KeyLeftButton!) then
- io[iio].ox2=string(xpos)
- io[iio].oy2=string(ypos)
- modify("temp.width='"+string(long(io[iio].ox2) -long(io[iio].ox1))+"'")
- modify("temp.height='"+string(long(io[iio].oy2) -long(io[iio].oy1))+"'")
- ii_x=xpos
- ii_y=ypos
- else
- event ue_lbuttonup(xpos,ypos,row,dwo)
- end if
- end if
- elseif iio>0 then //单个对象选择
- i=iio
- choose case io[i].otype
- case 'line'
- choose case is_point
- case "mouseup"
- choose case left(io[i].oname,5)
- case 'line1'
- if (xpos>=long(io[i].ox1) and xpos<=long(io[i].ox1)+2 and ypos>=long(io[i].oy1) - 2 and ypos<=long(io[i].oy1)+2) or &
- (xpos>=long(io[i].ox2) - 2 and xpos<=long(io[i].ox2) and ypos>=long(io[i].oy2) - 2 and ypos<=long(io[i].oy2)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- case 'line2'
- if (xpos>=long(io[i].ox1) - 2 and xpos<=long(io[i].ox1)+2 and ypos>=long(io[i].oy1) and ypos<=long(io[i].oy1)+2) or &
- (xpos>=long(io[i].ox2) - 2 and xpos<=long(io[i].ox2)+2 and ypos>=long(io[i].oy2) - 2 and ypos<=long(io[i].oy2)) then
- modify(io[i].oname+".pointer='cross!'")
- if isvalid(dwo) then
- if dwo.name<>'datawindow' then //对于短竖线,光标需要特殊处理
- iso_old=dwo.name
- dwo.pointer='cross!'
- is_click_object='y'
- modify(iso_old+".pointer='cross!'")
- end if
- end if
- else
- modify(io[i].oname+".pointer='arrow!'")
- if iso_old>'' then
- modify(iso_old+".pointer='arrow!'")
- end if
- is_click_object='n'
- end if
- case else//'line3'
- if (xpos>=long(io[i].ox1) - 2 and xpos<=long(io[i].ox1)+2 and ypos>=long(io[i].oy1) - 2 and ypos<=long(io[i].oy1)+2) or &
- (xpos>=long(io[i].ox2) - 2 and xpos<=long(io[i].ox2)+2 and ypos>=long(io[i].oy2) - 2 and ypos<=long(io[i].oy2)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- end choose
- case "point1"
- choose case left(io[i].oname,5)
- case 'line1'
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- if (ypos>=long(io[i].oy1) - 2 and ypos<=long(io[i].oy1)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- case 'line2'
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- if (xpos>=long(io[i].ox1) - 2 and xpos<=long(io[i].ox1)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- case else//'line3'
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- end choose
- ii_x=xpos
- ii_y=ypos
- case "point2"
- choose case left(io[i].oname,5)
- case 'line1'
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- if (ypos>=long(io[i].oy2) - 2 and ypos<=long(io[i].oy2)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- case 'line2'
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- if (xpos>=long(io[i].ox2) - 2 and xpos<=long(io[i].ox2)+2) then
- modify(io[i].oname+".pointer='cross!'")
- else
- modify(io[i].oname+".pointer='arrow!'")
- end if
- case else//'line3'
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- end choose
- ii_x=xpos
- ii_y=ypos
- case "move"
- if keydown(KeyLeftButton!) then
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- ii_x=xpos
- ii_y=ypos
- end if
- end choose
- if keydown(KeyLeftButton!) then
- wf_object(i,1)
- end if
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- choose case is_point
- case 'move'
- if keydown(KeyLeftButton!) then
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- end if
- case 'upline'
- if long(io[i].oy2) - long(io[i].oy1) - ypos+ii_y>=2 then
- io[i].oy1=string(long(io[i].oy1)+ypos - ii_y)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- end if
- case 'downline'
- if long(io[i].oy2) - long(io[i].oy1)+ypos - ii_y>=2 then
- io[i].oy2=string(long(io[i].oy2)+ypos - ii_y)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- end if
- case 'leftline'
- if long(io[i].ox2) - long(io[i].ox1) - xpos+ii_x>=2 then
- io[i].ox1=string(long(io[i].ox1)+xpos - ii_x)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- end if
- case 'rightline'
- if long(io[i].ox2) - long(io[i].ox1)+xpos - ii_x>=2 then
- io[i].ox2=string(long(io[i].ox2)+xpos - ii_x)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- end if
- case 'lbuttonup'
- is_point='mouseup'
- case 'mouseup'
- if (xpos>=long(io[i].ox1) and xpos<=long(io[i].ox1)+2 and ypos>=long(io[i].oy1) and ypos<=long(io[i].oy2)) or &
- (xpos>=long(io[i].ox2) - 2 and xpos<=long(io[i].ox2) and ypos>=long(io[i].oy1) and ypos<=long(io[i].oy2)) then
- if pos(describe(io[i].oname+".pointer"),'sizewe!')=0 then
- modify(io[i].oname+".pointer='sizewe!'")
- end if
- elseif (xpos>=long(io[i].ox1) and xpos<=long(io[i].ox2) and ypos>=long(io[i].oy1) and ypos<=long(io[i].oy1)+2 ) or &
- (xpos>=long(io[i].ox1) and xpos<=long(io[i].ox2) and ypos>=long(io[i].oy2) - 2 and ypos<=long(io[i].oy2)) then
- if pos(describe(io[i].oname+".pointer"),'sizens!')=0 then
- modify(io[i].oname+".pointer='sizens!'")
- end if
- else
- if pos(describe(io[i].oname+".pointer"),'arrow!')=0 then
- modify(io[i].oname+".pointer='arrow!'")
- end if
- end if
- end choose
- case 'band'
- if is_point='move' then
- if keydown(KeyLeftButton!) then
- if long(io[i].oy1)+ypos - ii_y>ii_topformove+2 then
- wf_aftermove(ypos - ii_y,1)
- else
- wf_aftermove(ii_topformove+2 - long(io[i].oy1),1)
- end if
- ii_x=xpos
- ii_y=ypos
- end if
- end if
- case 'temp'
- if keydown(KeyLeftButton!) then
- io[i].ox2=string(xpos)
- io[i].oy2=string(ypos)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- else
- event ue_lbuttonup(xpos,ypos,row,dwo)
- end if
- case 'sep1'
- if keydown(KeyLeftButton!) then
- io[i].ox2=string(xpos)
- wf_object(i,1)
- ii_x=xpos
- ii_y=ypos
- else
- event ue_lbuttonup(xpos,ypos,row,dwo)
- end if
- end choose
- end if
-
- SetRedraw(true)
- ii_x_old=xpos
- ii_y_old=ypos
- end if
- return
- end event
- event doubleclicked;if is_toolbar>'' then return
- //if ii_save>0 then wf_write()//为了计算字段直接引用前一个计算字段名,但可能会有点影响速度
- //wf_write()//为了计算字段直接引用前一个计算字段名,但可能会有点影响速度
- if pos(dwo.name,ibackgroudname) = 1 AND cbx_lock.checked then return
- if iic=0 then//没有选择任何对象
- iio=iis+1
- io[iio]=id[1]
- openwithparm(w_rpt_edit,istr_rpt,parent)
- id[1]=io[iio]
- io[iio]=id[2]//清空最后一行
- iio=0
- else
- openwithparm(w_rpt_edit,istr_rpt,parent)
- if pos(io[iio].oname,'band_g_')=1 then//分组表达式
- iso=io[iio].oname
- if pos(iso,'band_g_h')=1 then
- iso=f_replace(iso,'band_g_h_','band_g_b_')
- else
- iso=f_replace(iso,'band_g_b_','band_g_h_')
- end if
- i=wf_afind()
- io[i].obcolor=io[iio].obcolor//newpage
- io[i].ofname=io[iio].ofname//resetpagecount
- io[i].otext=io[iio].otext//text
- io[i].ofsize=io[iio].ofsize//group by
- wf_object(i,1)
- iso=io[iio].oname
- end if
- end if
- is_point='mouseup'
- end event
- event scrollvertical;ii_y_scroll=scrollpos
- dwy.event ScrollVertical(ii_y_scroll)
- dwy.object.DataWindow.VerticalScrollPosition=string(ii_y_scroll)
- return 0
- end event
- event scrollhorizontal;ii_x_scroll=scrollpos
- dwx.event ScrollHorizontal(ii_x_scroll,1)
- dwx.object.DataWindow.HorizontalScrollPosition=string(ii_x_scroll)
- return 0
- end event
- event clicked;dwc2.event ue_close()
- xpos=xpos+ii_x_scroll
- ypos=ypos+ii_y_scroll
- ii_x=xpos
- ii_y=ypos
- if not isvalid(dwo) then return
- if is_toolbar='' then
- if keydown(KeyShift!) or keydown(keyControl!) then//按下ctrl,选择多个对象
- iso=dwo.name
- if pos(iso,ibackgroudname) = 1 AND cbx_lock.checked then iso = 'datawindow'
- iio=wf_afind()
- if iio>0 then
- if io[iio].oselect<'1' then
- iic++
- io[iio].oselect=string(iic)
- else
- for i=1 to iis
- if long(io[i].oselect)>long(io[iio].oselect) then
- io[i].oselect=string(long(io[i].oselect) -1)
- end if
- next
- iic --
- io[iio].oselect=''
- end if
- elseif iso='datawindow' then
- goto mytemp
- end if
- is_point='select'
- else //只按下CLICK,没按下ctrl
- if iic>1 then //已选了多个对象
- iso=dwo.name
- if pos(iso,ibackgroudname) = 1 AND cbx_lock.checked then iso = 'datawindow'
- iio=wf_afind()
- if iio>0 then
- if io[iio].oselect>'0' then
- is_point='move'
- else
- is_point='changeto_one'
- parent.event ue_sel_no()
- iic=1
- io[iio].oselect='1'
- end if
- else
- is_point='changeto_one'
- parent.event ue_sel_no()
- if iso='datawindow' then
- wf_setcolor()
- goto mytemp
- end if
- end if
- else //只选了单个对象
- if is_click_object<>'y' then
- iso=dwo.name
- if pos(iso,ibackgroudname) = 1 AND cbx_lock.checked then iso = 'datawindow'
- end if
- iio=wf_afind()
- if iio>0 then
- if iic>0 then
- parent.event ue_sel_no()
- end if
- iic=1
- io[iio].oselect='1'
- if io[iio].otype='band' then
- ii_topformove=wf_topformove()
- end if
- elseif iso='datawindow' then
- if iic>0 then
- parent.event ue_sel_no()
- wf_setcolor()
- end if
- goto mytemp
- end if
- is_type=io[iio].otype
- choose case io[iio].otype
- case 'line'
- choose case left(iso,5)
- case 'line1'
- if (xpos>=long(io[iio].ox1) and xpos<=long(io[iio].ox1)+2 and ypos>=long(io[iio].oy1) - 2 and ypos<=long(io[iio].oy1)+2) then
- is_point='point1'
- elseif (xpos>=long(io[iio].ox2) - 2 and xpos<=long(io[iio].ox2) and ypos>=long(io[iio].oy2) - 2 and ypos<=long(io[iio].oy2)+2) then
- is_point='point2'
- else
- is_point='move'
- end if
- case 'line2'
- if (xpos>=long(io[iio].ox1) - 2 and xpos<=long(io[iio].ox1)+2 and ypos>=long(io[iio].oy1) and ypos<=long(io[iio].oy1)+2) then
- is_point='point1'
- elseif (xpos>=long(io[iio].ox2) - 2 and xpos<=long(io[iio].ox2)+2 and ypos>=long(io[iio].oy2) - 2 and ypos<=long(io[iio].oy2)) then
- is_point='point2'
- else
- is_point='move'
- end if
- case else//'line3'
- if (xpos>=long(io[iio].ox1) - 2 and xpos<=long(io[iio].ox1)+2 and ypos>=long(io[iio].oy1) - 2 and ypos<=long(io[iio].oy1)+2) then
- is_point='point1'
- elseif (xpos>=long(io[iio].ox2) - 2 and xpos<=long(io[iio].ox2)+2 and ypos>=long(io[iio].oy2) - 2 and ypos<=long(io[iio].oy2)+2) then
- is_point='point2'
- else
- is_point='move'
- end if
- end choose
- case 'text','column','compute','rectangle','bitmap','graph','tableblob','report','button','groupbox','ellipse','roundrectangle'
- if (xpos>=long(io[iio].ox1) and xpos<=long(io[iio].ox1)+2 and ypos>=long(io[iio].oy1) and ypos<=long(io[iio].oy2)) then
- is_point='leftline'
- elseif (xpos>=long(io[iio].ox2) - 2 and xpos<=long(io[iio].ox2) and ypos>=long(io[iio].oy1) and ypos<=long(io[iio].oy2)) then
- is_point='rightline'
- elseif (xpos>=long(io[iio].ox1) and xpos<=long(io[iio].ox2) and ypos>=long(io[iio].oy1) and ypos<=long(io[iio].oy1)+2 ) then
- is_point='upline'
- elseif (xpos>=long(io[iio].ox1) and xpos<=long(io[iio].ox2) and ypos>=long(io[iio].oy2) - 2 and ypos<=long(io[iio].oy2)) then
- is_point='downline'
- else
- is_point='move'
- end if
- case 'band'
- is_point='move'
- case else
- parent.event ue_sel_no()
- end choose
- end if
- end if
- wf_setcolor()
- else//第一次创建对象
- if is_toolbar='sep1' then
- iio=iis+2
- elseif is_toolbar='taborder' then
- iso=dwo.name
- if right(iso,5)='_zkl0' then
- dw1.setitem(1,1,long(dwo.text))
- if dw1.describe('zkl0.x')='?' then
- s[1]="create column(band=detail name=zkl0 id=1 x='"+dwo.x+"' y='"+dwo.y+"' tabsequence=1 edit.limit=0 edit.case=any edit.autoselect=yes width='24' height='12' font.face='宋体' font.height='12' alignment='1' border='0' color='16777215' background.color='255')"
- else
- s[1]="zkl0.x='"+dwo.x+"' zkl0.y='"+dwo.y+"')"
- end if
- dw1.modify(s[1])
- dw1.setcolumn(1)
- dw1.setredraw(true)
- end if
- return
- else
- ii_temp=0//求最大对象名
- for i=1 to iis
- if pos(io[i].oname,is_toolbar)>0 then
- ii_temp=max(ii_temp,long(mid(io[i].oname,len(is_toolbar)+2)))
- end if
- next
- iis++
- iio=iis
- io[iio].oname=is_toolbar+'_'+string(ii_temp+1)
- io[iio].occ=wf_occ(1)+1
- iic=1
- io[iio].oselect='1'
- end if
- i=iio
- io[i].ox1=string(xpos)
- io[i].oy1=string(ypos)
- choose case is_toolbar
- case 'line1','line2','line3'
- choose case is_toolbar
- case 'line1'
- io[i].ox2=string(xpos+50)
- io[i].oy2=string(ypos)
- case 'line2'
- io[i].ox2=string(xpos)
- io[i].oy2=string(ypos+50)
- case 'line3'
- io[i].ox2=string(xpos+30)
- io[i].oy2=string(ypos+30)
- end choose
- io[i].oborder='0'
- io[i].otext='1'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].otype='line'
- case 'text'
- io[i].ox2=string(long(io[i].ox1)+40)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext=f_replace(io[i].oname,is_toolbar+'_',"文本")
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='536870912'//'16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='0'
- io[i].otype=is_toolbar
- case 'groupbox'
- io[i].ox2=string(long(io[i].ox1)+80)
- io[i].oy2=string(long(io[i].oy1)+40)
- io[i].otext=f_replace(io[i].oname,is_toolbar+'_',"分组框")
- io[i].oborder='5'
- io[i].ocolor='0'
- io[i].obcolor='536870912'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='0'
- io[i].otype=is_toolbar
- case 'button'
- io[i].ox2=string(long(io[i].ox1)+56)
- io[i].oy2=string(long(io[i].oy1)+16)
- io[i].otext=f_replace(io[i].oname,is_toolbar+'_',"按钮")
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='80269524'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].otype='button'
- case 'compute'
- io[i].ox2=string(long(io[i].ox1)+56)
- io[i].oy2=string(long(io[i].oy1)+12)
- io[i].otext="'"+f_replace(io[i].oname,is_toolbar+'_','表达式')+"'"
- io[i].oborder='0'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='宋体'
- io[i].ofsize='12'
- io[i].oalignment='0'
- io[i].oexpression=io[i].otext
- io[i].otype='compute'
- case 'rectangle','roundrectangle','ellipse'
- io[i].ox2=string(long(io[i].ox1)+40)
- io[i].oy2=string(long(io[i].oy1)+20)
- io[i].oborder='0'
- io[i].otext='1'
- io[i].ocolor='0'
- io[i].obcolor='16777215'
- io[i].ofname='16777215'//brush.color
- io[i].ofsize='6'//brush.hatch
- if is_toolbar='roundrectangle' then
- io[i].ofweight='10'
- io[i].ofitalic='10'
- end if
- io[i].otype=is_toolbar
- case 'sep1' //垂直分割
- io[i].ox1=string(xpos)
- io[i].oname='sep1'
- io[i].otype='sep1'
- case 'bitmap'
- STRING FileType
- FileType += "JPG(*.JPG),*.JPG,"
- FileType += "位图文件(*.bmp),*.bmp,"
- FileType += "GIF文件(*.GIF),*.GIF"
-
- if GetFileOpenName("Select File",io[i].otext,is_temp,"all",FileType)=1 then
- // if GetFileOpenName("Select File",io[i].otext,is_temp,"bmp","Bitmap Files(*.BMP),*.bmp")=1 then
- io[i].ox2=string(long(io[i].ox1)+40)
- io[i].oy2=string(long(io[i].oy1)+40)
- io[i].oborder='2'
- else
- iis --
- iio=0
- iic=0
- return
- end if
- io[i].otype='bitmap'
- case 'tableblob'
- io[i].ox2=string(long(io[i].ox1)+80)
- io[i].oy2=string(long(io[i].oy1)+40)
- io[i].oborder='0'
- io[i].otext=io[i].oname
- io[i].ofname=io[i].oname
- io[i].ofsize='PBrush'
- io[i].otype='tableblob'
- case 'report'
- io[i].ox2=string(long(io[i].ox1)+400)
- io[i].oy2=string(long(io[i].oy1)+40)
- io[i].oborder='0'
- io[i].otext=io[i].oname
- io[i].otype='report'
- io[i].obcolor='yes'//height.autosize
- case 'graph'
- io[i].ox2=string(long(io[i].ox1)+240)
- io[i].oy2=string(long(io[i].oy1)+160)
- io[i].oborder='0'
- io[i].otext=f_replace(io[i].oname,is_toolbar+'_','统计图')//gtitle
- io[i].ocolor='0'//color
- io[i].obcolor='16777215'//backcolor
- io[i].ofname='7'//graphtype
- io[i].ofsize=''//gfl
- io[i].ofweight='分类轴'//gtfl
- io[i].ofitalic=''//gvalue
- io[i].ofunderline='数据轴'//gtvalue
- io[i].otype='graph'
- io[i].others="{title.dispattr.backcolor=553648127}{legend.dispattr.backcolor=536870912}{series.dispattr.backcolor=536870912}{series.labeldispattr.backcolor=536870912}{category.dispattr.backcolor=536870912}{category.labeldispattr.backcolor=536870912}{values.dispattr.backcolor=536870912}{values.labeldispattr.backcolor=536870912}{title.dispattr.alignment=2}{title.dispattr.font.weight=700}{series.labeldispattr.alignment=2}{category.labeldispattr.alignment=2}{values.labeldispattr.alignment=2}{values.labeldispattr.font.escapement=900}{values.labeldispattr.font.height=12}"
- end choose
- wf_object(i,0)
- wf_setcolor()
- choose case is_toolbar
- case 'line1'
- parent.event ue_toolbar('line1',m_rpt_main.m_1.m_line1)
- case 'line2'
- parent.event ue_toolbar('line2',m_rpt_main.m_1.m_line2)
- case 'line3'
- parent.event ue_toolbar('line3',m_rpt_main.m_1.m_line3)
- case 'text'
- parent.event ue_toolbar('text',m_rpt_main.m_1.m_text)
- case 'compute'
- parent.event ue_toolbar('compute',m_rpt_main.m_1.m_edit)
- case 'rectangle'
- parent.event ue_toolbar('rectangle',m_rpt_main.m_1.m_rect)
- case 'bitmap'
- parent.event ue_toolbar('bitmap',m_rpt_main.m_1.m_pict)
- case 'tableblob'
- parent.event ue_toolbar('tableblob',m_rpt_main.m_1.m_blob)
- case 'report'
- parent.event ue_toolbar('report',m_rpt_main.m_1.m_rpt)
- case 'graph'
- parent.event ue_toolbar('graph',m_rpt_main.m_1.m_graph)
- case 'button'
- parent.event ue_toolbar('button',m_rpt_main.m_1.m_button)
- case 'groupbox'
- parent.event ue_toolbar('groupbox',m_rpt_main.m_1.m_groupbox)
- case 'ellipse'
- parent.event ue_toolbar('ellipse',m_rpt_main.m_1.m_ellipse)
- case 'roundrectangle'
- parent.event ue_toolbar('roundrectangle',m_rpt_main.m_1.m_roundrectangle)
- end choose
- if is_toolbar<>'sep1' then is_toolbar=''
- end if
- return
- mytemp:
- iso='temp'
- iio=iis+1
- io[iio].otype='temp'
- io[iio].oname='temp'
- io[iio].ox1=string(xpos)
- io[iio].oy1=string(ypos)
- io[iio].ox2=io[iio].ox1
- io[iio].oy2=io[iio].oy1
- wf_object(iio,0)
- return
- end event
- event rbuttondown;//右鼠标按下时触发事件
- EVENT Clicked(xpos,ypos,row,dwo)
- IF io[iio].otype = 'report' THEN
- m_rpt_pop_report m_pop1
- m_pop1 = CREATE m_rpt_pop_report
- IF id[1].ox1 <> '4' OR iic > 0 THEN //<>crosstab
- m_pop1.m_popup.m_cross.Visible = FALSE
- END IF
- m_rpt_pop_report.m_popup.PopMenu(PARENT.PointerX(),PARENT.PointerY())
- ELSE
- m_rpt_pop m_pop
- m_pop = CREATE m_rpt_pop
- IF id[1].ox1 <> '4' OR iic > 0 THEN //<>crosstab
- m_pop.m_popup.m_cross.Visible = FALSE
- END IF
- m_rpt_pop.m_popup.PopMenu(PARENT.PointerX(),PARENT.PointerY())
- END IF
- EVENT ue_lbuttonup(xpos,ypos,row,dwo)
- end event
- event other;if (iso='temp' or is_point='move') and ii_outside=0 then//iso='temp'表示选择多个对象,is_point='move'表示正在拖动对象,ii_outside=0表示上次触发的ue_outside事件已经结束
- if PointerX()>width -68 then//右边界
- ii_outside=1
- parent.postevent('ue_outside')//只能用postevent
- elseif PointerY()>height -68 then//下边界
- ii_outside=2
- parent.postevent('ue_outside')
- end if
- end if
- end event
- event editchanged;if right(iso,5)='_zkl0' then//taborder
- dw1.modify(iso+".text='"+data+"'")
- ii_save=1
- end if
- end event
- type dwc2 from uo_scolor within w_rpt_main
- boolean visible = false
- integer x = 1911
- integer y = 100
- integer taborder = 20
- boolean bringtotop = true
- end type
- event ue_close;call super::ue_close;choose case is_scolor
- case 'bjst'
- dwc1.object.bjs.background.color=is_color
- wf_allset('bcolor',is_color)
- case 'qjst'
- dwc1.object.qjs.background.color=is_color
- wf_allset('color',is_color)
- end choose
- dwc1.object.qjst.border='0'
- dwc1.object.bjst.border='0'
- dwc1.object.t.border='0'
- dwc1.object.b.border='0'
- is_scolor=''
- end event
- type cbx_lock from checkbox within w_rpt_main
- integer x = 3397
- integer y = 116
- integer width = 315
- integer height = 60
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long backcolor = 80269524
- boolean enabled = false
- string text = "锁定背景"
- end type
- event clicked;cb_setbackgroud.Enabled = Not This.checked
- end event
|