uo_rpt_print_preview.sru 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. $PBExportHeader$uo_rpt_print_preview.sru
  2. forward
  3. global type uo_rpt_print_preview from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_rpt_print_preview from nonvisualobject autoinstantiate
  7. end type
  8. type prototypes
  9. function boolean IsWindowsNT() library "PrintCtrl.dll"
  10. SUBROUTINE About() library "PrintCtrl.dll"
  11. function boolean GetDefaultPrinter(ref string PrinterName, int BufferLen) library "PrintCtrl.dll" alias for "GetDefaultPrinter;Ansi"
  12. function boolean GetPrinterPort(ref string PrinterName, ref string Port, int PortLen, ref string Driver, int DriverLen) library "PrintCtrl.dll" alias for "GetPrinterPort;Ansi"
  13. function boolean GetPrinterList(ref string PrinterList, ref long bufferLen) library "PrintCtrl.dll" alias for "GetPrinterList;Ansi"
  14. function boolean GetPrinterStatus(ref string Printer, ref long status) library "PrintCtrl.dll" alias for "GetPrinterStatus;Ansi"
  15. function boolean GetPaperList(ref string Printer, ref string PaperList, ref long bufferLen) library "PrintCtrl.dll" alias for "GetPaperList;Ansi"
  16. function boolean SetPrinterDefault(ref string Printer) library "PrintCtrl.dll" alias for "SetPrinterDefault;Ansi"
  17. function boolean AddCustomPaper( ref string Printer, ref string PaperName, long pwidth, long pheight, long left, long right, long top, long bottom) library "PrintCtrl.dll" alias for "AddCustomPaper;Ansi"
  18. function boolean DeleteCustomPaper(ref string Printer, ref string PaperName) library "PrintCtrl.dll" alias for "DeleteCustomPaper;Ansi"
  19. function boolean SetUserDefinePaper(ref string Printer, ref long pWidth, ref long pHeight) library "PrintCtrl.dll" alias for "SetUserDefinePaper;Ansi"
  20. function boolean GetUserDefinePaperMinMax(ref string Printer, ref long minWidth, ref long minHeight, ref long maxWidth, ref long maxHeight) library "PrintCtrl.dll" alias for "GetUserDefinePaperMinMax;Ansi"
  21. function boolean GetDefaultPaper(ref string Printer, ref string PaperName, ref int nOrientation) library "PrintCtrl.dll" alias for "GetDefaultPaper;Ansi"
  22. function boolean SetDefaultPaper(ref string Printer, ref string PaperName, int nOrientation) library "PrintCtrl.dll" alias for "SetDefaultPaper;Ansi"
  23. function boolean GetDefaultPaper(ref string Printer, ref string PaperName,ref long nPapserSize, ref long nOrientation) library "PrintCtrl.dll" alias for "GetDefaultPaper;Ansi"
  24. function boolean GetPaperName(ref string Printer, ref string PaperName, int PaperSize) library "PrintCtrl.dll" alias for "GetPaperName;Ansi"
  25. function boolean GetPaperSize(ref string Printer, ref string PaperName, ref int PaperSize) library "PrintCtrl.dll" alias for "GetPaperSize;Ansi"
  26. function boolean GetBinNameList(ref string Printer, ref string BinNameList) library "PrintCtrl.dll" alias for "GetBinNameList;Ansi"
  27. function boolean GetBin(ref string Printer, ref string BinName, ref int Bin) library "PrintCtrl.dll" alias for "GetBin;Ansi"
  28. function boolean GetBinName(ref string Printer, ref string BinName, int Bin) library "PrintCtrl.dll" alias for "GetBinName;Ansi"
  29. end prototypes
  30. type variables
  31. S_rpt_print_MSG FACT_PRINT_MSG
  32. string dwdataobject
  33. DataWindowChild ins_dwcld
  34. s_childreportxwidth s_xwidth
  35. dwobject dwod
  36. long retrieveid=0,secondretrieveid=0,scid=0
  37. uo_printer_setting lnv_printer
  38. String ins_printerlist [ ]
  39. int p_printerlist =0
  40. string dw_default_printer ='',default_printer =''
  41. string default_printer_info=''
  42. LONG Print_row
  43. string default_dwname,default_dname
  44. datastore ds_print
  45. string rpt_inifilename = 'longjoeERP_rpt.ini'
  46. long reportid
  47. end variables
  48. forward prototypes
  49. public subroutine uof_initprinterinfo ()
  50. public function integer uof_trycreate_sys_dwnsyntax (ref string arg_msg)
  51. public function integer uof_print_begin (ref string arg_msg)
  52. public function integer uof_defdataobject (ref string arg_msg)
  53. public function integer uof_dwcreate (string arg_dwname, string arg_formatname, ref string arg_msg)
  54. public function integer ds_retrieve ()
  55. public function integer uof_read_subdwpos (string arg_dwname, string arg_dname, ref s_childreportxwidth s_subdwwidth, ref string arg_msg)
  56. public subroutine uof_subdwpos_blobtostru (blob arg_blob, ref s_childreportxwidth arg_s_xwidth)
  57. public function integer uof_mdfmxreport (s_childreportxwidth s_xw)
  58. public function integer uof_mdfx (s_childreportxwidth s_xw, integer pt)
  59. public subroutine ds_print ()
  60. public subroutine uof_nullrow (long arg_rowcnt, long arg_pagerow, ref long arg_nullrow)
  61. end prototypes
  62. public subroutine uof_initprinterinfo ();// 取PB缺省打印机
  63. String printerName
  64. Boolean rt_1
  65. printerName = Space(255)
  66. rt_1 = GetDefaultPrinter(REF printerName, 255)
  67. IF rt_1 THEN
  68. default_printer = Trim(printerName)
  69. ELSE
  70. default_printer = ''
  71. END IF
  72. //取PB缺省打印机设置字符串
  73. default_printer_info = ProfileString ( "win.ini", "windows", "device", "" )
  74. end subroutine
  75. public function integer uof_trycreate_sys_dwnsyntax (ref string arg_msg);//wf_trycreate_sys_dwnsyntax
  76. long rslt=1
  77. long cnt
  78. string createsql_string,t_str
  79. createsql_string="CREATE TABLE sys_dwnSyntax ( dwname char (50) NOT NULL,dname char (50) NOT NULL,default_flag tinyint not null default (0),dwSyntaxB image not NULL DEFAULT (''),subdwSyntaxB image not NULL DEFAULT ('')) "+&
  80. " ~n ALTER TABLE sys_dwnSyntax WITH NOCHECK ADD CONSTRAINT PK_sys_dwnSyntax PRIMARY KEY CLUSTERED (dwname,dname)"
  81. t_str="select count(*) from sys_dwnSyntax"
  82. Execute immediate :t_str;
  83. if sqlca.sqlcode=0 then //已经存在该表
  84. rslt=1
  85. goto ext
  86. end if
  87. Execute immediate :createsql_string ;
  88. if sqlca.sqlcode<>0 then
  89. arg_msg='建立表sys_dwnSyntax失败>>'+sqlca.sqlerrtext
  90. rollback ;
  91. rslt=0
  92. goto ext
  93. end if
  94. commit ;
  95. ext:
  96. return rslt
  97. return 0
  98. end function
  99. public function integer uof_print_begin (ref string arg_msg);int rslt=1
  100. string ls_dw
  101. Blob lblob
  102. //------------------初始化打印机
  103. uof_initprinterinfo()
  104. retrieveid=fact_print_msg.retr_pramnmb
  105. scid=fact_print_msg.retr_scid
  106. reportid = fact_print_msg.rpid
  107. //********************
  108. //获取DW数据
  109. SELECTBLOB Rpsyntax INTO :lblob FROM u_report_list Where rpid = :reportid USING sqlca;
  110. IF sqlca.SQLCode = 0 THEN
  111. ls_dw = String(lblob)
  112. END IF
  113. ds_print.Create(ls_dw,arg_msg)
  114. IF arg_msg > '' THEN
  115. rslt = 0
  116. goto ext
  117. END IF
  118. ds_print.SetTransObject(SQLCA)
  119. dw_default_printer = f_ProfileString (sys_empid,string(reportid), "dw_default_printer ", "" )
  120. IF dw_default_printer = '' THEN
  121. dw_default_printer = default_printer
  122. END IF
  123. string ls_parm
  124. ls_parm = string(reportid) + '_' + dw_default_printer
  125. //------------------读默认行数
  126. fact_print_msg.printrow=long(f_ProfileString (sys_empid,ds_print.dataobject, "printrow", '10'))
  127. IF NOT ISNULL(fact_print_msg.ini_GROUP) THEN
  128. ds_print.OBJECT.DataWindow.PRINT.MARGIN.TOP=INTEGER(f_ProfileString (sys_empid,ls_parm, "MARGIN_TOP", "30"))
  129. ds_print.OBJECT.DataWindow.PRINT.MARGIN.LEFT=INTEGER(f_ProfileString (sys_empid,ls_parm, "MARGIN_LEFT", "30" ))
  130. ds_print.OBJECT.DataWindow.PRINT.MARGIN.bottom=INTEGER(f_ProfileString (sys_empid,ls_parm, "MARGIN_BOTTOM", "30"))
  131. ds_print.OBJECT.DataWindow.PRINT.MARGIN.right=INTEGER(f_ProfileString (sys_empid,ls_parm, "MARGIN_RIGHT", "30" ))
  132. ds_print.OBJECT.DataWindow.PRINT.PAPER.SIZE=INTEGER(f_ProfileString (sys_empid,ls_parm, "PAPER_SIZE", "9" ))
  133. ds_print.OBJECT.DataWindow.PRINT.ORIENTATION=INTEGER(f_ProfileString (sys_empid,ls_parm, "ORIENTATION", "0" ))
  134. END IF
  135. fact_print_msg.printrow=INTEGER(f_ProfileString (sys_empid,ls_parm, "printrow", '8'))
  136. //--------------------------------------------建表
  137. //if uof_trycreate_sys_dwnsyntax(arg_msg)=0 then
  138. // rslt=0
  139. // goto ext
  140. //end if
  141. //
  142. //if uof_defdataobject(arg_msg)=0 then
  143. // rslt=0
  144. // goto ext
  145. //end if
  146. Ds_Retrieve()
  147. //if uof_read_subdwpos(default_dwname,default_dname,s_xwidth,arg_msg)=0 then
  148. // rslt=0
  149. // goto ext
  150. //else
  151. // uof_mdfmxreport(s_xwidth)
  152. //end if
  153. ext:
  154. return rslt
  155. end function
  156. public function integer uof_defdataobject (ref string arg_msg);int rslt=1
  157. long ls_count
  158. blob sqlblob
  159. select count(*) into :ls_count from sys_dwnSyntax where dwname=:fact_print_msg.obj_dwname and default_flag=1 ;
  160. if sqlca.sqlcode=-1 then
  161. arg_msg='查询单据格式失败'+sqlca.sqlerrtext
  162. rslt=0
  163. goto ext
  164. end if
  165. if ls_count=1 then
  166. select dwname,dname into :default_dwname,:default_dname from sys_dwnSyntax where dwname=:fact_print_msg.obj_dwname and default_flag=1 ;
  167. if sqlca.sqlcode=-1 then
  168. arg_msg='查询单据格式失败'+sqlca.sqlerrtext
  169. rslt=0
  170. goto ext
  171. end if
  172. if uof_dwcreate(default_dwname,default_dname,arg_msg)=0 then
  173. arg_msg='打开单据格式失败!原因:'+arg_msg
  174. rslt=0
  175. goto ext
  176. end if
  177. ds_print.settransobject(sqlca)
  178. end if
  179. ext:
  180. return rslt
  181. end function
  182. public function integer uof_dwcreate (string arg_dwname, string arg_formatname, ref string arg_msg);blob dwSyntax
  183. int rslt=1
  184. selectblob dwSyntaxB into :dwSyntax from sys_dwnSyntax where dwname=:arg_dwname and dname=:arg_formatname;
  185. if sqlca.sqlcode=-1 then
  186. arg_msg='查询单据格式失败,原因:'+sqlca.sqlerrtext
  187. rslt=0
  188. goto ext
  189. end if
  190. if ds_print.create(string(dwSyntax),arg_msg)<>1 then
  191. rslt=0
  192. goto ext
  193. end if
  194. ext:
  195. return rslt
  196. end function
  197. public function integer ds_retrieve ();//ds_retrieve
  198. CHOOSE CASE fact_print_msg.retr_pram_falg
  199. CASE 0 //SHARE DATAWINDOW
  200. DATAWINDOW LS_DW
  201. LS_DW = fact_print_msg.SHARE_DW
  202. LS_DW.ShareData(ds_print)
  203. CASE 1 //ONE STRING PRAM
  204. ds_print.Retrieve(fact_print_msg.retr_pramstr)
  205. CASE 2 //ONE NUMBER PRAM
  206. ds_print.Retrieve(fact_print_msg.retr_pramnmb)
  207. retrieveid = fact_print_msg.retr_pramnmb
  208. CASE 3 //ONE DATE PRAM
  209. ds_print.Retrieve(fact_print_msg.retr_pramfd)
  210. CASE 4 //TWO DATE PRAM
  211. ds_print.Retrieve(fact_print_msg.retr_pramfd,fact_print_msg.retr_pramed)
  212. CASE 5 //TWO NUMBER PRAM
  213. ds_print.Retrieve(fact_print_msg.retr_pramnmb,fact_print_msg.b_long)
  214. CASE 11 //scid string
  215. ds_print.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramstr)
  216. CASE 12 //scid long
  217. ds_print.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb)
  218. CASE 13 //scid long and TWO NUMBER PRAM
  219. ds_print.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb,fact_print_msg.b_long)
  220. CASE 14 //TWO DATETIME PRAM
  221. ds_print.Retrieve(fact_print_msg.retr_pramfdt,fact_print_msg.retr_pramedt)
  222. CASE 15 //scid long and TWO NUMBER PRAM and null_row
  223. uof_nullrow(fact_print_msg.rowcnt,fact_print_msg.printrow,fact_print_msg.nullrow)
  224. ds_print.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb,fact_print_msg.printrow,fact_print_msg.nullrow)
  225. CASE 16
  226. ds_print.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb,fact_print_msg.printrow)
  227. CASE ELSE
  228. ds_print.Retrieve()
  229. END CHOOSE
  230. IF fact_print_msg.retr_pram_falg <> 0 THEN
  231. ds_print.SetFilter(fact_print_msg.FILTER_STRING)
  232. ds_print.Filter()
  233. END IF
  234. RETURN 0
  235. end function
  236. public function integer uof_read_subdwpos (string arg_dwname, string arg_dname, ref s_childreportxwidth s_subdwwidth, ref string arg_msg);//uof_read_subdwpos(arg_dwname,arg_dname,arg_msg)
  237. blob ls_subdwSyntaxB
  238. int rslt=1
  239. selectblob subdwSyntaxB into :ls_subdwSyntaxB from sys_dwnSyntax where dwname=:arg_dwname and dname=:arg_dname;
  240. if sqlca.sqlcode=-1 then
  241. arg_msg='读取单据明细表格式失败!'+sqlca.sqlerrtext
  242. rslt=0
  243. goto ext
  244. end if
  245. if len(ls_subdwSyntaxB)>0 then
  246. dwod=ds_print.object.mxreport
  247. uof_subdwpos_blobtostru(ls_subdwSyntaxB,s_subdwwidth)
  248. end if
  249. ext:
  250. return rslt
  251. end function
  252. public subroutine uof_subdwpos_blobtostru (blob arg_blob, ref s_childreportxwidth arg_s_xwidth);//uof_subdwpos_blobtostru(arg_blob,arg_s_xwidth)
  253. string subdwpos_str,clm_str,cmp_str,clm_strx,clm_strwidth,cmplp_x,cmplp_width
  254. long clm_p,cmplp,i
  255. subdwpos_str=string(arg_blob)
  256. clm_str=mid(subdwpos_str,1,pos(subdwpos_str,'cmplp:') - 1)
  257. cmp_str=mid(subdwpos_str,pos(subdwpos_str,'cmplp:'))
  258. clm_strx=mid(clm_str,pos(clm_str,'x:')+2,pos(clm_str,';width:') - pos(clm_str,'x:') - 1 ) //x_str
  259. clm_strwidth=mid(clm_str,pos(clm_str,'width:') + 6) //width_str
  260. cmplp_x=mid(cmp_str,pos(cmp_str,'x:')+2,pos(cmp_str,';width:') - pos(cmp_str,'x:') - 1 )
  261. cmplp_width=mid(cmp_str,pos(cmp_str,'width:') + 6) //cmplpwidth_str
  262. clm_p=long(mid(clm_str,3,pos(clm_str,';') - 3)) //P
  263. cmplp=long(mid(cmp_str,7,pos(cmp_str,';') - 7)) //cmplp
  264. arg_s_xwidth.p=clm_p
  265. arg_s_xwidth.cmplp=cmplp
  266. //messagebox('all',subdwpos_str)
  267. //MEssagebox('clm_str',clm_str)
  268. //MEssagebox('cmp_str',cmp_str)
  269. //
  270. //MEssagebox('clm_p',clm_p)
  271. //MEssagebox('cmplp',cmplp)
  272. //
  273. //MEssagebox('clm_strx',clm_strx)
  274. //MEssagebox('clm_strwidth',clm_strwidth)
  275. long xmx
  276. string xstr
  277. xmx=0
  278. xstr=''
  279. for i =1 to len(clm_strx) //x
  280. if mid(clm_strx,i,1)<>',' and mid(clm_strx,i,1)<>';' then
  281. xstr=xstr+mid(clm_strx,i,1)
  282. else
  283. xmx++
  284. arg_s_xwidth.x[xmx]=long(xstr)
  285. xstr=''
  286. end if
  287. next
  288. xmx=0
  289. xstr=''
  290. for i =1 to len(clm_strwidth) //width
  291. if mid(clm_strwidth,i,1)<>',' and mid(clm_strwidth,i,1)<>';' then
  292. xstr=xstr+mid(clm_strwidth,i,1)
  293. else
  294. xmx++
  295. arg_s_xwidth.width[xmx]=long(xstr)
  296. xstr=''
  297. end if
  298. next
  299. xmx=0
  300. xstr=''
  301. for i =1 to len(cmplp_x) //cmplp_x
  302. if mid(cmplp_x,i,1)<>',' and mid(cmplp_x,i,1)<>';' then
  303. xstr=xstr+mid(cmplp_x,i,1)
  304. else
  305. xmx++
  306. arg_s_xwidth.cmplx[xmx]=long(xstr)
  307. xstr=''
  308. end if
  309. next
  310. xmx=0
  311. xstr=''
  312. for i =1 to len(cmplp_width) //cmplp_width
  313. if mid(cmplp_width,i,1)<>',' and mid(cmplp_width,i,1)<>';' then
  314. xstr=xstr+mid(cmplp_width,i,1)
  315. else
  316. xmx++
  317. arg_s_xwidth.cmplwidth[xmx]=long(xstr)
  318. xstr=''
  319. end if
  320. next
  321. //messagebox('','sdfsdf')
  322. end subroutine
  323. public function integer uof_mdfmxreport (s_childreportxwidth s_xw);//uof_mdfmxreport(s_childreportxwidth)
  324. if s_xw.p=0 then
  325. return 0
  326. end if
  327. if mod(s_xw.cmplp,2)=1 then
  328. if s_xw.cmplx[1]>0 then dwod.object.cmpl1.width=s_xw.cmplwidth[1]
  329. end if
  330. if s_xw.cmplp=2 or s_xw.cmplp=3 then
  331. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.width= s_xw.cmplwidth[2]
  332. end if
  333. if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then
  334. if s_xw.cmplp=6 or s_xw.cmplp=7 then
  335. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.width= s_xw.cmplwidth[2] //yyx0609
  336. end if
  337. if s_xw.cmplx[3]>0 then dwod.object.cmpl3.width= s_xw.cmplwidth[3]
  338. end if
  339. if s_xw.x[1]>0 then dwod.object.#1.width=s_xw.width[1]
  340. if s_xw.p<2 then goto mdfx
  341. if s_xw.x[2]>0 then dwod.object.#2.width=s_xw.width[2]
  342. if s_xw.p<3 then goto mdfx
  343. if s_xw.x[3]>0 then dwod.object.#3.width=s_xw.width[3]
  344. if s_xw.p<4 then goto mdfx
  345. if s_xw.x[4]>0 then dwod.object.#4.width=s_xw.width[4]
  346. if s_xw.p<5 then goto mdfx
  347. if s_xw.x[5]>0 then dwod.object.#5.width=s_xw.width[5]
  348. if s_xw.p<6 then goto mdfx
  349. if s_xw.x[6]>0 then dwod.object.#6.width=s_xw.width[6]
  350. if s_xw.p<7 then goto mdfx
  351. if s_xw.x[7]>0 then dwod.object.#7.width=s_xw.width[7]
  352. if s_xw.p<8 then goto mdfx
  353. if s_xw.x[8]>0 then dwod.object.#8.width=s_xw.width[8]
  354. if s_xw.p<9 then goto mdfx
  355. if s_xw.x[9]>0 then dwod.object.#9.width=s_xw.width[9]
  356. if s_xw.p<10 then goto mdfx
  357. if s_xw.x[10]>0 then dwod.object.#10.width=s_xw.width[10]
  358. if s_xw.p<11 then goto mdfx
  359. if s_xw.x[11]>0 then dwod.object.#11.width=s_xw.width[11]
  360. if s_xw.p<12 then goto mdfx
  361. if s_xw.x[12]>0 then dwod.object.#12.width=s_xw.width[12]
  362. if s_xw.p<13 then goto mdfx
  363. if s_xw.x[13]>0 then dwod.object.#13.width=s_xw.width[13]
  364. if s_xw.p<14 then goto mdfx
  365. if s_xw.x[14]>0 then dwod.object.#14.width=s_xw.width[14]
  366. if s_xw.p<15 then goto mdfx
  367. if s_xw.x[15]>0 then dwod.object.#15.width=s_xw.width[15]
  368. if s_xw.p<16 then goto mdfx
  369. if s_xw.x[16]>0 then dwod.object.#16.width=s_xw.width[16]
  370. if s_xw.p<17 then goto mdfx
  371. if s_xw.x[17]>0 then dwod.object.#17.width=s_xw.width[17]
  372. if s_xw.p<18 then goto mdfx
  373. if s_xw.x[18]>0 then dwod.object.#18.width=s_xw.width[18]
  374. if s_xw.p<19 then goto mdfx
  375. if s_xw.x[19]>0 then dwod.object.#19.width=s_xw.width[19]
  376. if s_xw.p<20 then goto mdfx
  377. if s_xw.x[20]>0 then dwod.object.#20.width=s_xw.width[20]
  378. if s_xw.p<21 then goto mdfx
  379. if s_xw.x[21]>0 then dwod.object.#21.width=s_xw.width[21]
  380. if s_xw.p<22 then goto mdfx
  381. if s_xw.x[22]>0 then dwod.object.#22.width=s_xw.width[22]
  382. if s_xw.p<23 then goto mdfx
  383. if s_xw.x[23]>0 then dwod.object.#23.width=s_xw.width[23]
  384. if s_xw.p<24 then goto mdfx
  385. if s_xw.x[24]>0 then dwod.object.#24.width=s_xw.width[24]
  386. if s_xw.p<25 then goto mdfx
  387. if s_xw.x[25]>0 then dwod.object.#25.width=s_xw.width[25]
  388. if s_xw.p<26 then goto mdfx
  389. if s_xw.x[26]>0 then dwod.object.#26.width=s_xw.width[26]
  390. if s_xw.p<27 then goto mdfx
  391. if s_xw.x[27]>0 then dwod.object.#27.width=s_xw.width[27]
  392. if s_xw.p<28 then goto mdfx
  393. if s_xw.x[28]>0 then dwod.object.#28.width=s_xw.width[28]
  394. if s_xw.p<29 then goto mdfx
  395. if s_xw.x[29]>0 then dwod.object.#29.width=s_xw.width[29]
  396. mdfx:
  397. if mod(s_xw.cmplp,2)=1 then
  398. if s_xw.cmplx[1]>0 then dwod.object.cmpl1.x= s_xw.cmplx[1] - 9
  399. end if
  400. if s_xw.cmplp=2 or s_xw.cmplp=3 then
  401. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9
  402. end if
  403. if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then
  404. if s_xw.cmplp=6 or s_xw.cmplp=7 then
  405. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9 //yyx0609
  406. end if
  407. if s_xw.cmplx[3]>0 then dwod.object.cmpl3.x= s_xw.cmplx[3] - 9
  408. end if
  409. long obp,bp,bi,bj,bk
  410. obp=0
  411. for bi=1 to s_xw.p
  412. bp=50000
  413. bk=0
  414. for bj=1 to s_xw.p
  415. if s_xw.x[bj]<bp and s_xw.x[bj]>obp and s_xw.x[bj]>0 then
  416. bp=s_xw.x[bj]
  417. bk=bj
  418. end if
  419. next
  420. if mod(s_xw.cmplp,2)=1 then
  421. if s_xw.cmplx[1]<bp and s_xw.cmplx[1]>obp and s_xw.cmplx[1]>0 then
  422. bp=s_xw.cmplx[1]
  423. bk=0
  424. bi = bi -1
  425. dwod.object.cmpl1.x= s_xw.cmplx[1] - 9
  426. end if
  427. end if
  428. uof_mdfx(s_xw,bk)
  429. obp=bp
  430. next
  431. if mod(s_xw.cmplp,2)=1 then
  432. if s_xw.cmplx[1]>0 then dwod.object.cmpl1.x= s_xw.cmplx[1] - 9
  433. end if
  434. if s_xw.cmplp=2 or s_xw.cmplp=3 then
  435. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9
  436. end if
  437. if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then
  438. if s_xw.cmplp=6 or s_xw.cmplp=7 then
  439. if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9 //yyx0609
  440. end if
  441. if s_xw.cmplx[3]>0 then dwod.object.cmpl3.x= s_xw.cmplx[3] - 9
  442. end if
  443. return 0
  444. end function
  445. public function integer uof_mdfx (s_childreportxwidth s_xw, integer pt);//uof_mdfx(s_childreportxwidth,int)
  446. if s_xw.p=0 or pt=0 then
  447. return 0
  448. end if
  449. CHOOSE CASE pt
  450. CASE 1
  451. if s_xw.p>=1 and s_xw.x[1]>0 then dwod.object.#1.x=s_xw.x[1] - 9
  452. CASE 2
  453. if s_xw.p>=2 and s_xw.x[2]>0 then dwod.object.#2.x=s_xw.x[2] - 9
  454. CASE 3
  455. if s_xw.p>=3 and s_xw.x[3]>0 then dwod.object.#3.x=s_xw.x[3] - 9
  456. CASE 4
  457. if s_xw.p>=4 and s_xw.x[4]>0 then dwod.object.#4.x=s_xw.x[4] - 9
  458. CASE 5
  459. if s_xw.p>=5 and s_xw.x[5]>0 then dwod.object.#5.x=s_xw.x[5] - 9
  460. CASE 6
  461. if s_xw.p>=6 and s_xw.x[6]>0 then dwod.object.#6.x=s_xw.x[6] - 9
  462. CASE 7
  463. if s_xw.p>=7 and s_xw.x[7]>0 then dwod.object.#7.x=s_xw.x[7] - 9
  464. CASE 8
  465. if s_xw.p>=8 and s_xw.x[8]>0 then dwod.object.#8.x=s_xw.x[8] - 9
  466. CASE 9
  467. if s_xw.p>=9 and s_xw.x[9]>0 then dwod.object.#9.x=s_xw.x[9] - 9
  468. CASE 10
  469. if s_xw.p>=10 and s_xw.x[10]>0 then dwod.object.#10.x=s_xw.x[10] - 9
  470. CASE 11
  471. if s_xw.p>=11 and s_xw.x[11]>0 then dwod.object.#11.x=s_xw.x[11] - 9
  472. CASE 12
  473. if s_xw.p>=12 and s_xw.x[12]>0 then dwod.object.#12.x=s_xw.x[12] - 9
  474. CASE 13
  475. if s_xw.p>=13 and s_xw.x[13]>0 then dwod.object.#13.x=s_xw.x[13] - 9
  476. CASE 14
  477. if s_xw.p>=14 and s_xw.x[14]>0 then dwod.object.#14.x=s_xw.x[14] - 9
  478. CASE 15
  479. if s_xw.p>=15 and s_xw.x[15]>0 then dwod.object.#15.x=s_xw.x[15] - 9
  480. CASE 16
  481. if s_xw.p>=16 and s_xw.x[16]>0 then dwod.object.#16.x=s_xw.x[16] - 9
  482. CASE 17
  483. if s_xw.p>=17 and s_xw.x[17]>0 then dwod.object.#17.x=s_xw.x[17] - 9
  484. CASE 18
  485. if s_xw.p>=18 and s_xw.x[18]>0 then dwod.object.#18.x=s_xw.x[18] - 9
  486. CASE 19
  487. if s_xw.p>=19 and s_xw.x[19]>0 then dwod.object.#19.x=s_xw.x[19] - 9
  488. CASE 20
  489. if s_xw.p>=20 and s_xw.x[20]>0 then dwod.object.#20.x=s_xw.x[20] - 9
  490. CASE 21
  491. if s_xw.p>=21 and s_xw.x[21]>0 then dwod.object.#21.x=s_xw.x[21] - 9
  492. CASE 22
  493. if s_xw.p>=22 and s_xw.x[22]>0 then dwod.object.#22.x=s_xw.x[22] - 9
  494. CASE 23
  495. if s_xw.p>=23 and s_xw.x[23]>0 then dwod.object.#23.x=s_xw.x[23] - 9
  496. CASE 24
  497. if s_xw.p>=24 and s_xw.x[24]>0 then dwod.object.#24.x=s_xw.x[24] - 9
  498. CASE 25
  499. if s_xw.p>=25 and s_xw.x[25]>0 then dwod.object.#25.x=s_xw.x[25] - 9
  500. CASE 26
  501. if s_xw.p>=26 and s_xw.x[26]>0 then dwod.object.#26.x=s_xw.x[26] - 9
  502. CASE 27
  503. if s_xw.p>=27 and s_xw.x[27]>0 then dwod.object.#27.x=s_xw.x[27] - 9
  504. CASE 28
  505. if s_xw.p>=28 and s_xw.x[28]>0 then dwod.object.#28.x=s_xw.x[28] - 9
  506. CASE 29
  507. if s_xw.p>=29 and s_xw.x[29]>0 then dwod.object.#29.x=s_xw.x[29] - 9
  508. END CHOOSE
  509. return 0
  510. end function
  511. public subroutine ds_print ();lnv_printer.of_SetDefault ( dw_default_printer )
  512. ds_print.print()
  513. end subroutine
  514. public subroutine uof_nullrow (long arg_rowcnt, long arg_pagerow, ref long arg_nullrow);//====================================================================
  515. // Function: uof_nullrow()
  516. //--------------------------------------------------------------------
  517. // Description:返回加空行数
  518. //--------------------------------------------------------------------
  519. // Arguments:
  520. // value long arg_rowcnt
  521. // value long arg_pagerow
  522. // reference long arg_nullrow
  523. //--------------------------------------------------------------------
  524. // Returns: (none)
  525. //--------------------------------------------------------------------
  526. // Author: yyx Date: 2004.09.13
  527. //--------------------------------------------------------------------
  528. // Modify History:
  529. //
  530. //====================================================================
  531. long pagecnt,tal_rowcnt
  532. pagecnt = long(arg_rowcnt / arg_pagerow)
  533. tal_rowcnt = arg_rowcnt + pagecnt + 1
  534. if mod(tal_rowcnt,arg_pagerow)<>0 then
  535. arg_nullrow = arg_pagerow - mod(tal_rowcnt,arg_pagerow)
  536. else
  537. arg_nullrow = 0
  538. end if
  539. end subroutine
  540. on uo_rpt_print_preview.create
  541. call super::create
  542. TriggerEvent( this, "constructor" )
  543. end on
  544. on uo_rpt_print_preview.destroy
  545. TriggerEvent( this, "destructor" )
  546. call super::destroy
  547. end on
  548. event constructor;ds_print = create datastore
  549. end event