uo_print_preview.sru 22 KB

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