$PBExportHeader$w_rpt_preview.srw forward global type w_rpt_preview from w_rpt_publ_base end type type st_1 from statictext within w_rpt_preview end type type ddlb_printerlist from dropdownlistbox within w_rpt_preview end type type cb_mdfmxrp from commandbutton within w_rpt_preview end type type cb_direcprint from uo_imflatbutton within w_rpt_preview end type type ln_bar from line within w_rpt_preview end type type ln_bar2 from line within w_rpt_preview end type type r_bar from rectangle within w_rpt_preview end type type cb_3 from uo_imflatbutton within w_rpt_preview end type type cb_refresh from uo_imflatbutton within w_rpt_preview end type type cb_indirectprint from uo_imflatbutton within w_rpt_preview end type type st_2 from statictext within w_rpt_preview end type type st_3 from statictext within w_rpt_preview end type type st_4 from statictext within w_rpt_preview end type type st_5 from statictext within w_rpt_preview end type type em_1 from editmask within w_rpt_preview end type type em_2 from editmask within w_rpt_preview end type type cbx_1 from checkbox within w_rpt_preview end type type dw_1 from u_rpt_dw_rbtnfilter within w_rpt_preview end type type ln_1 from line within w_rpt_preview end type type ln_2 from line within w_rpt_preview end type end forward global type w_rpt_preview from w_rpt_publ_base integer x = 9 integer y = 24 integer width = 3529 integer height = 2000 string title = "龙嘉数据打印预览窗口" boolean minbox = false windowtype windowtype = response! windowstate windowstate = maximized! event ue_filter ( ) event ue_sentdataout ( ) event ue_setprintpage_value ( ) event ue_spp ( ) event ue_snp ( ) event ue_retrieve_dw ( ) st_1 st_1 ddlb_printerlist ddlb_printerlist cb_mdfmxrp cb_mdfmxrp cb_direcprint cb_direcprint ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar cb_3 cb_3 cb_refresh cb_refresh cb_indirectprint cb_indirectprint st_2 st_2 st_3 st_3 st_4 st_4 st_5 st_5 em_1 em_1 em_2 em_2 cbx_1 cbx_1 dw_1 dw_1 ln_1 ln_1 ln_2 ln_2 end type global w_rpt_preview w_rpt_preview type prototypes //function boolean IsWindowsNT() library "PrintCtrl.dll" //SUBROUTINE About() library "PrintCtrl.dll" //function boolean GetDefaultPrinter(ref string PrinterName, int BufferLen) library "PrintCtrl.dll" //function boolean GetPrinterPort(ref string PrinterName, ref string Port, int PortLen, ref string Driver, int DriverLen) library "PrintCtrl.dll" //function boolean GetPrinterList(ref string PrinterList, ref long bufferLen) library "PrintCtrl.dll" //function boolean GetPrinterStatus(ref string Printer, ref long status) library "PrintCtrl.dll" //function boolean GetPaperList(ref string Printer, ref string PaperList, ref long bufferLen) library "PrintCtrl.dll" //function boolean SetPrinterDefault(ref string Printer) library "PrintCtrl.dll" //function boolean AddCustomPaper( ref string Printer, ref string PaperName, long pwidth, long pheight, long left, long right, long top, long bottom) library "PrintCtrl.dll" //function boolean DeleteCustomPaper(ref string Printer, ref string PaperName) library "PrintCtrl.dll" //function boolean SetUserDefinePaper(ref string Printer, ref long pWidth, ref long pHeight) library "PrintCtrl.dll" //function boolean GetUserDefinePaperMinMax(ref string Printer, ref long minWidth, ref long minHeight, ref long maxWidth, ref long maxHeight) library "PrintCtrl.dll" //function boolean GetDefaultPaper(ref string Printer, ref string PaperName, ref int nOrientation) library "PrintCtrl.dll" //function boolean SetDefaultPaper(ref string Printer, ref string PaperName, int nOrientation) library "PrintCtrl.dll" //function boolean GetDefaultPaper(ref string Printer, ref string PaperName,ref long nPapserSize, ref long nOrientation) library "PrintCtrl.dll" //function boolean GetPaperName(ref string Printer, ref string PaperName, int PaperSize) library "PrintCtrl.dll" //function boolean GetPaperSize(ref string Printer, ref string PaperName, ref int PaperSize) library "PrintCtrl.dll" //function boolean GetBinNameList(ref string Printer, ref string BinNameList) library "PrintCtrl.dll" //function boolean GetBin(ref string Printer, ref string BinName, ref int Bin) library "PrintCtrl.dll" //function boolean GetBinName(ref string Printer, ref string BinName, int Bin) library "PrintCtrl.dll" end prototypes type variables s_rpt_print_msg fact_print_msg string dwdataobject datawindowchild ins_dwcld s_childreportxwidth s_xwidth dwobject dwod long retrieveid=0,secondretrieveid=0,scid=0 uo_rpt_printer_setting lnv_printer string ins_printerlist [ ] int p_printerlist =0 string dw_default_printer ='',default_printer ='' string default_printer_info='' long print_row string default_dwname,default_dname int rslt_printnum = 0 string rpt_inifilename = 'longjoeERP_rpt.ini' long reportid,printrow end variables forward prototypes public function integer dw_retrieve () public function integer wf_mdfmxreport (s_childreportxwidth s_xw) public function integer wf_mdfx (s_childreportxwidth s_xw, integer pt) public function integer wf_initprinterinfo () public function integer wf_setdefaultprinter () public function integer wf_write_childdw_pos (string arg_childdw_name, s_childreportxwidth arg_s_xwidth) public function integer wf_read_childdw_pos (string arg_childdw_name, ref s_childreportxwidth arg_s_xwidth) public subroutine wf_readini_begin () public function integer wf_trycreate_sys_dwnsyntax (ref string arg_msg) public function integer wf_dwcreate (string arg_dwname, string arg_formatname, ref string arg_errmsg) public subroutine wf_defdataobject () public subroutine wf_subdwpos_strutoblob (s_childreportxwidth arg_s_xwidth, ref blob subdwpos) public subroutine wf_subdwpos_blobtostru (blob arg_blob, ref s_childreportxwidth arg_s_xwidth) public function integer wf_read_subdwpos (string arg_dwname, string arg_dname, ref s_childreportxwidth s_subdwwidth, ref string arg_msg) public subroutine wf_nullrow (long arg_rowcnt, long arg_pagerow, ref long arg_nullrow) public subroutine wf_check_ini () public subroutine wf_setprofile () public subroutine wf_retrdw_dt () public function integer wf_face_change () end prototypes event ue_filter();OPENWITHPARM(w_filter_query,dw_1) STRING LS_EXPR LS_EXPR=Message.StringParm if len(LS_EXPR)>2 and trim(LS_EXPR)='' then return dw_1.setfilter(LS_EXPR) dw_1.SetRedraw (false) dw_1.filter() dw_1.SetRedraw (TRUE) end event event ue_sentdataout;OPENWITHPARM(w_rpt_sentdataout,dw_1) end event event ue_setprintpage_value();s_rpt_print_value s_print s_print.obj_dw = DW_1 s_print.dft_printername = ddlb_printerlist.Text s_print.printrow = printrow s_print.print_msg = fact_print_msg OpenWithParm(w_rpt_printpage_value,s_print) s_rpt_print_msg S_INSCUST S_INSCUST = Message.PowerObjectParm IF S_INSCUST.retr_flag = TRUE THEN f_retrieve_dw(dw_1,S_INSCUST) else wf_retrdw_dt() END IF fact_print_msg = S_INSCUST end event event ue_spp();dw_1.ScrollPriorPage() end event event ue_snp();dw_1.ScrollNextPage() end event event ue_retrieve_dw();IF fact_print_msg.retr_flag THEN dw_1.Retrieve(scid,retrieveid,printrow) END IF end event public function integer dw_retrieve ();//dw_retrieve CHOOSE CASE fact_print_msg.retr_pram_falg CASE 0 //SHARE DATAWINDOW DATAWINDOW LS_DW LS_DW = fact_print_msg.SHARE_DW LS_DW.ShareData(DW_1) CASE 1 //ONE STRING PRAM DW_1.Retrieve(fact_print_msg.retr_pramstr) CASE 2 //ONE NUMBER PRAM DW_1.Retrieve(fact_print_msg.retr_pramnmb) retrieveid = fact_print_msg.retr_pramnmb CASE 3 //ONE DATE PRAM DW_1.Retrieve(fact_print_msg.retr_pramfd) CASE 4 //TWO DATE PRAM DW_1.Retrieve(fact_print_msg.retr_pramfd,fact_print_msg.retr_pramed) CASE 5 //TWO NUMBER PRAM DW_1.Retrieve(fact_print_msg.retr_pramnmb,fact_print_msg.b_long) CASE 6 //TWO DATETIME PRAM DW_1.Retrieve(fact_print_msg.retr_pramfdt,fact_print_msg.retr_pramedt) CASE 11 //scid string DW_1.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramstr) CASE 12 //scid long DW_1.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb) CASE 13 //scid long and TWO NUMBER PRAM DW_1.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb,fact_print_msg.b_long) CASE 14 //ONE NUMBER PRAM and ONE STRING PRAM DW_1.Retrieve(fact_print_msg.retr_pramnmb,fact_print_msg.retr_pramstr) CASE 15 //scid long and TWO NUMBER PRAM and null_row wf_nullrow(fact_print_msg.rowcnt,fact_print_msg.printrow,fact_print_msg.nullrow) DW_1.Retrieve(fact_print_msg.retr_scid,fact_print_msg.retr_pramnmb,fact_print_msg.printrow,fact_print_msg.nullrow) CASE ELSE DW_1.Retrieve() END CHOOSE IF fact_print_msg.retr_pram_falg <> 0 THEN DW_1.SetFilter(fact_print_msg.FILTER_STRING) DW_1.Filter() END IF //dw_1.object.title.text=sys_message_report_title //messagebox('',sys_message_report_title) RETURN 0 end function public function integer wf_mdfmxreport (s_childreportxwidth s_xw);//wf_mdfmxreport(s_childreportxwidth) if s_xw.p=0 then return 0 end if if mod(s_xw.cmplp,2)=1 then if s_xw.cmplx[1]>0 then dwod.object.cmpl1.width=s_xw.cmplwidth[1] end if if s_xw.cmplp=2 or s_xw.cmplp=3 then if s_xw.cmplx[2]>0 then dwod.object.cmpl2.width= s_xw.cmplwidth[2] end if if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then if s_xw.cmplx[3]>0 then dwod.object.cmpl3.width= s_xw.cmplwidth[3] end if if s_xw.x[1]>0 then dwod.object.#1.width=s_xw.width[1] if s_xw.p<2 then goto mdfx if s_xw.x[2]>0 then dwod.object.#2.width=s_xw.width[2] if s_xw.p<3 then goto mdfx if s_xw.x[3]>0 then dwod.object.#3.width=s_xw.width[3] if s_xw.p<4 then goto mdfx if s_xw.x[4]>0 then dwod.object.#4.width=s_xw.width[4] if s_xw.p<5 then goto mdfx if s_xw.x[5]>0 then dwod.object.#5.width=s_xw.width[5] if s_xw.p<6 then goto mdfx if s_xw.x[6]>0 then dwod.object.#6.width=s_xw.width[6] if s_xw.p<7 then goto mdfx if s_xw.x[7]>0 then dwod.object.#7.width=s_xw.width[7] if s_xw.p<8 then goto mdfx if s_xw.x[8]>0 then dwod.object.#8.width=s_xw.width[8] if s_xw.p<9 then goto mdfx if s_xw.x[9]>0 then dwod.object.#9.width=s_xw.width[9] if s_xw.p<10 then goto mdfx if s_xw.x[10]>0 then dwod.object.#10.width=s_xw.width[10] if s_xw.p<11 then goto mdfx if s_xw.x[11]>0 then dwod.object.#11.width=s_xw.width[11] if s_xw.p<12 then goto mdfx if s_xw.x[12]>0 then dwod.object.#12.width=s_xw.width[12] if s_xw.p<13 then goto mdfx if s_xw.x[13]>0 then dwod.object.#13.width=s_xw.width[13] if s_xw.p<14 then goto mdfx if s_xw.x[14]>0 then dwod.object.#14.width=s_xw.width[14] if s_xw.p<15 then goto mdfx if s_xw.x[15]>0 then dwod.object.#15.width=s_xw.width[15] if s_xw.p<16 then goto mdfx if s_xw.x[16]>0 then dwod.object.#16.width=s_xw.width[16] if s_xw.p<17 then goto mdfx if s_xw.x[17]>0 then dwod.object.#17.width=s_xw.width[17] if s_xw.p<18 then goto mdfx if s_xw.x[18]>0 then dwod.object.#18.width=s_xw.width[18] if s_xw.p<19 then goto mdfx if s_xw.x[19]>0 then dwod.object.#19.width=s_xw.width[19] if s_xw.p<20 then goto mdfx if s_xw.x[20]>0 then dwod.object.#20.width=s_xw.width[20] if s_xw.p<21 then goto mdfx if s_xw.x[21]>0 then dwod.object.#21.width=s_xw.width[21] if s_xw.p<22 then goto mdfx if s_xw.x[22]>0 then dwod.object.#22.width=s_xw.width[22] if s_xw.p<23 then goto mdfx if s_xw.x[23]>0 then dwod.object.#23.width=s_xw.width[23] if s_xw.p<24 then goto mdfx if s_xw.x[24]>0 then dwod.object.#24.width=s_xw.width[24] if s_xw.p<25 then goto mdfx if s_xw.x[25]>0 then dwod.object.#25.width=s_xw.width[25] if s_xw.p<26 then goto mdfx if s_xw.x[26]>0 then dwod.object.#26.width=s_xw.width[26] if s_xw.p<27 then goto mdfx if s_xw.x[27]>0 then dwod.object.#27.width=s_xw.width[27] if s_xw.p<28 then goto mdfx if s_xw.x[28]>0 then dwod.object.#28.width=s_xw.width[28] if s_xw.p<29 then goto mdfx if s_xw.x[29]>0 then dwod.object.#29.width=s_xw.width[29] mdfx: if mod(s_xw.cmplp,2)=1 then if s_xw.cmplx[1]>0 then dwod.object.cmpl1.x= s_xw.cmplx[1] - 9 end if if s_xw.cmplp=2 or s_xw.cmplp=3 then if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9 end if if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then if s_xw.cmplx[3]>0 then dwod.object.cmpl3.x= s_xw.cmplx[3] - 9 end if long obp,bp,bi,bj,bk obp=0 for bi=1 to s_xw.p bp=50000 bk=0 for bj=1 to s_xw.p if s_xw.x[bj]obp and s_xw.x[bj]>0 then bp=s_xw.x[bj] bk=bj end if next if mod(s_xw.cmplp,2)=1 then if s_xw.cmplx[1]obp and s_xw.cmplx[1]>0 then bp=s_xw.cmplx[1] bk=0 bi = bi -1 dwod.object.cmpl1.x= s_xw.cmplx[1] - 9 end if end if wf_mdfx(s_xw,bk) obp=bp next if mod(s_xw.cmplp,2)=1 then if s_xw.cmplx[1]>0 then dwod.object.cmpl1.x= s_xw.cmplx[1] - 9 end if if s_xw.cmplp=2 or s_xw.cmplp=3 then if s_xw.cmplx[2]>0 then dwod.object.cmpl2.x= s_xw.cmplx[2] - 9 end if if s_xw.cmplp=4 or s_xw.cmplp=6 or s_xw.cmplp=7 then if s_xw.cmplx[3]>0 then dwod.object.cmpl3.x= s_xw.cmplx[3] - 9 end if //if s_xw.x[1]>0 then dwod.object.#1.x=s_xw.x[1] - 1 //if s_xw.p<2 then goto ext //if s_xw.x[2]>0 then dwod.object.#2.x=s_xw.x[2] - 1 //if s_xw.p<3 then goto ext //if s_xw.x[3]>0 then dwod.object.#3.x=s_xw.x[3] - 1 //if s_xw.p<4 then goto ext //if s_xw.x[4]>0 then dwod.object.#4.x=s_xw.x[4] - 1 //if s_xw.p<5 then goto ext //if s_xw.x[5]>0 then dwod.object.#5.x=s_xw.x[5] - 1 //if s_xw.p<6 then goto ext //if s_xw.x[6]>0 then dwod.object.#6.x=s_xw.x[6] - 1 //if s_xw.p<7 then goto ext //if s_xw.x[7]>0 then dwod.object.#7.x=s_xw.x[7] - 1 //if s_xw.p<8 then goto ext //if s_xw.x[8]>0 then dwod.object.#8.x=s_xw.x[8] - 1 //if s_xw.p<9 then goto ext //if s_xw.x[9]>0 then dwod.object.#9.x=s_xw.x[9] - 1 //if s_xw.p<10 then goto ext //if s_xw.x[10]>0 then dwod.object.#10.x=s_xw.x[10] - 1 //if s_xw.p<11 then goto ext //if s_xw.x[11]>0 then dwod.object.#11.x=s_xw.x[11] - 1 //if s_xw.p<12 then goto ext //if s_xw.x[12]>0 then dwod.object.#12.x=s_xw.x[12] - 1 //if s_xw.p<13 then goto ext //if s_xw.x[13]>0 then dwod.object.#13.x=s_xw.x[13] - 1 //if s_xw.p<14 then goto ext //if s_xw.x[14]>0 then dwod.object.#14.x=s_xw.x[14] - 1 //if s_xw.p<15 then goto ext //if s_xw.x[15]>0 then dwod.object.#15.x=s_xw.x[15] - 1 //if s_xw.p<16 then goto ext //if s_xw.x[16]>0 then dwod.object.#16.x=s_xw.x[16] - 1 //if s_xw.p<17 then goto ext //if s_xw.x[17]>0 then dwod.object.#17.x=s_xw.x[17] - 1 //if s_xw.p<18 then goto ext //if s_xw.x[18]>0 then dwod.object.#18.x=s_xw.x[18] - 1 //if s_xw.p<19 then goto ext //if s_xw.x[19]>0 then dwod.object.#19.x=s_xw.x[19] - 1 //if s_xw.p<20 then goto ext //if s_xw.x[20]>0 then dwod.object.#20.x=s_xw.x[20] - 1 //if s_xw.p<21 then goto ext //if s_xw.x[21]>0 then dwod.object.#21.x=s_xw.x[21] - 1 //if s_xw.p<22 then goto ext //if s_xw.x[22]>0 then dwod.object.#22.x=s_xw.x[22] - 1 //if s_xw.p<23 then goto ext //if s_xw.x[23]>0 then dwod.object.#23.x=s_xw.x[23] - 1 //if s_xw.p<24 then goto ext //if s_xw.x[24]>0 then dwod.object.#24.x=s_xw.x[24] - 1 //if s_xw.p<25 then goto ext //if s_xw.x[25]>0 then dwod.object.#25.x=s_xw.x[25] - 1 //if s_xw.p<26 then goto ext //if s_xw.x[26]>0 then dwod.object.#26.x=s_xw.x[26] - 1 //if s_xw.p<27 then goto ext //if s_xw.x[27]>0 then dwod.object.#27.x=s_xw.x[27] - 1 //if s_xw.p<28 then goto ext //if s_xw.x[28]>0 then dwod.object.#28.x=s_xw.x[28] - 1 //if s_xw.p<29 then goto ext //if s_xw.x[29]>0 then dwod.object.#29.x=s_xw.x[29] - 1 // //ext: return 0 end function public function integer wf_mdfx (s_childreportxwidth s_xw, integer pt);//wf_mdfx(s_childreportxwidth,int) if s_xw.p=0 or pt=0 then return 0 end if CHOOSE CASE pt CASE 1 if s_xw.p>=1 and s_xw.x[1]>0 then dwod.object.#1.x=s_xw.x[1] - 9 CASE 2 if s_xw.p>=2 and s_xw.x[2]>0 then dwod.object.#2.x=s_xw.x[2] - 9 CASE 3 if s_xw.p>=3 and s_xw.x[3]>0 then dwod.object.#3.x=s_xw.x[3] - 9 CASE 4 if s_xw.p>=4 and s_xw.x[4]>0 then dwod.object.#4.x=s_xw.x[4] - 9 CASE 5 if s_xw.p>=5 and s_xw.x[5]>0 then dwod.object.#5.x=s_xw.x[5] - 9 CASE 6 if s_xw.p>=6 and s_xw.x[6]>0 then dwod.object.#6.x=s_xw.x[6] - 9 CASE 7 if s_xw.p>=7 and s_xw.x[7]>0 then dwod.object.#7.x=s_xw.x[7] - 9 CASE 8 if s_xw.p>=8 and s_xw.x[8]>0 then dwod.object.#8.x=s_xw.x[8] - 9 CASE 9 if s_xw.p>=9 and s_xw.x[9]>0 then dwod.object.#9.x=s_xw.x[9] - 9 CASE 10 if s_xw.p>=10 and s_xw.x[10]>0 then dwod.object.#10.x=s_xw.x[10] - 9 CASE 11 if s_xw.p>=11 and s_xw.x[11]>0 then dwod.object.#11.x=s_xw.x[11] - 9 CASE 12 if s_xw.p>=12 and s_xw.x[12]>0 then dwod.object.#12.x=s_xw.x[12] - 9 CASE 13 if s_xw.p>=13 and s_xw.x[13]>0 then dwod.object.#13.x=s_xw.x[13] - 9 CASE 14 if s_xw.p>=14 and s_xw.x[14]>0 then dwod.object.#14.x=s_xw.x[14] - 9 CASE 15 if s_xw.p>=15 and s_xw.x[15]>0 then dwod.object.#15.x=s_xw.x[15] - 9 CASE 16 if s_xw.p>=16 and s_xw.x[16]>0 then dwod.object.#16.x=s_xw.x[16] - 9 CASE 17 if s_xw.p>=17 and s_xw.x[17]>0 then dwod.object.#17.x=s_xw.x[17] - 9 CASE 18 if s_xw.p>=18 and s_xw.x[18]>0 then dwod.object.#18.x=s_xw.x[18] - 9 CASE 19 if s_xw.p>=19 and s_xw.x[19]>0 then dwod.object.#19.x=s_xw.x[19] - 9 CASE 20 if s_xw.p>=20 and s_xw.x[20]>0 then dwod.object.#20.x=s_xw.x[20] - 9 CASE 21 if s_xw.p>=21 and s_xw.x[21]>0 then dwod.object.#21.x=s_xw.x[21] - 9 CASE 22 if s_xw.p>=22 and s_xw.x[22]>0 then dwod.object.#22.x=s_xw.x[22] - 9 CASE 23 if s_xw.p>=23 and s_xw.x[23]>0 then dwod.object.#23.x=s_xw.x[23] - 9 CASE 24 if s_xw.p>=24 and s_xw.x[24]>0 then dwod.object.#24.x=s_xw.x[24] - 9 CASE 25 if s_xw.p>=25 and s_xw.x[25]>0 then dwod.object.#25.x=s_xw.x[25] - 9 CASE 26 if s_xw.p>=26 and s_xw.x[26]>0 then dwod.object.#26.x=s_xw.x[26] - 9 CASE 27 if s_xw.p>=27 and s_xw.x[27]>0 then dwod.object.#27.x=s_xw.x[27] - 9 CASE 28 if s_xw.p>=28 and s_xw.x[28]>0 then dwod.object.#28.x=s_xw.x[28] - 9 CASE 29 if s_xw.p>=29 and s_xw.x[29]>0 then dwod.object.#29.x=s_xw.x[29] - 9 END CHOOSE return 0 end function public function integer wf_initprinterinfo ();///////////////////////读取打印机信息 //// 用uo取打印机列表 //int ls_ii //p_printerlist = lnv_printer.of_GetPrinterList ( ins_printerlist ) // //for ls_ii=1 to p_printerlist // ddlb_printerlist.additem(ins_printerlist[ls_ii]) //next ////用dll取打印机列表 //String printerlist = Space(512) //Long bufferlen = 512 //Boolean rt //ddlb_printerlist.Reset() //Long p1,p2 //p1 = 1 //p2 = 0 //rt = GetPrinterList(REF printerlist, REF bufferlen) //IF rt THEN // p2 = Pos(printerlist,"~t",p1) // DO WHILE p2 > 0 // ddlb_printerlist.AddItem(Mid(printerlist,p1,p2 - p1)) // p1 = p2+1 // p2 = Pos(printerlist,"~t",p1) // LOOP //END IF //用pb取打印机列表 String ls_left, ls_prntrs,ls_printername Long ll_pos_n,ll_pos_t ddlb_printerlist.Reset() ls_prntrs = PrintGetPrinters() DO WHILE Len(Trim(ls_prntrs)) > 0 ll_pos_n = Pos (ls_prntrs, "~n" ) IF ll_pos_n > 0 THEN ls_left = Left (ls_prntrs, ll_pos_n - 1) ll_pos_t = Pos (ls_left, "~t" ) ls_printername = Left (ls_left, ll_pos_t - 1) ddlb_printerlist.AddItem(ls_printername) ls_prntrs = Mid (ls_prntrs, ll_pos_n + 1) ELSE ll_pos_t = Pos (ls_prntrs, "~t" ) ls_printername = Left (ls_prntrs, ll_pos_t - 1) ddlb_printerlist.AddItem(ls_printername) ls_prntrs = '' END IF LOOP // 取PB缺省打印机 default_printer = lnv_printer.of_GetPBPrinter ( ) //// 取dll缺省打印机 //String printerName //Boolean rt_1 //printerName = Space(255) //rt_1 = GetDefaultPrinter(REF printerName, 255) //IF rt_1 THEN // default_printer = Trim(printerName) //ELSE // default_printer = '' //END IF //取PB缺省打印机设置字符串 default_printer_info=ProfileString ( "win.ini", "windows", "device", "" ) return 0 end function public function integer wf_setdefaultprinter ();///wf_setdefaultprinter if default_printer_info='' or pos(default_printer_info,',')=0 then return 0 f_SetProfileString (sys_empid,'windows', "device", default_printer_info) return 1 end function public function integer wf_write_childdw_pos (string arg_childdw_name, s_childreportxwidth arg_s_xwidth);//wf_write_childdw_pos(string arg_childdw_name,s_childreportxwidth arg_s_xwidth) // long ls_clmxp,ls_clm_cmplxp long i,j //列数 ls_clmxp=arg_s_xwidth.p if ls_clmxp > 0 then for i=1 to ls_clmxp f_SetProfileString (sys_empid,arg_childdw_name, string(i)+".x",string(arg_s_xwidth.x[i])) f_SetProfileString (sys_empid,arg_childdw_name, string(i)+".width",string(arg_s_xwidth.width[i])) next end if //计算列数量 ls_clm_cmplxp=arg_s_xwidth.cmplp choose case ls_clm_cmplxp case 1 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".x",string(arg_s_xwidth.cmplx[1])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".width",string(arg_s_xwidth.cmplwidth[1])) case 2 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".x",string(arg_s_xwidth.cmplx[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".width",string(arg_s_xwidth.cmplwidth[2])) case 3 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".x",string(arg_s_xwidth.cmplx[1])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".width",string(arg_s_xwidth.cmplwidth[1])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".x",string(arg_s_xwidth.cmplx[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".width",string(arg_s_xwidth.cmplwidth[2])) case 4 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".x",string(arg_s_xwidth.cmplx[4])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".width",string(arg_s_xwidth.cmplwidth[4])) case 5 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".x",string(arg_s_xwidth.cmplx[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".width",string(arg_s_xwidth.cmplwidth[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(3)+".x",string(arg_s_xwidth.cmplx[3])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(3)+".width",string(arg_s_xwidth.cmplwidth[3])) case 6 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".x",string(arg_s_xwidth.cmplx[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".width",string(arg_s_xwidth.cmplwidth[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".x",string(arg_s_xwidth.cmplx[3])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".width",string(arg_s_xwidth.cmplwidth[3])) case 7 f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".x",string(arg_s_xwidth.cmplx[1])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(1)+".width",string(arg_s_xwidth.cmplwidth[1])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".x",string(arg_s_xwidth.cmplx[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(2)+".width",string(arg_s_xwidth.cmplwidth[2])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".x",string(arg_s_xwidth.cmplx[3])) f_SetProfileString (sys_empid,arg_childdw_name, "cmpl"+string(4)+".width",string(arg_s_xwidth.cmplwidth[3])) end choose return 1 end function public function integer wf_read_childdw_pos (string arg_childdw_name, ref s_childreportxwidth arg_s_xwidth);//f_read_childdw_pos(string arg_childdw_name,s_childreportxwidth arg_s_xwidth) // int ls_i,ls_clmno int rslt=1 datastore obj_dw obj_dw =create datastore obj_dw.dataobject=arg_childdw_name obj_dw.settransobject(sqlca) ls_clmno=integer(obj_dw.Describe('DataWindow.Column.Count')) if ls_clmno=0 then rslt=0 goto ext end if for ls_i=1 to ls_clmno long column_xpos,column_width column_xpos=long(f_ProfileString (sys_empid,arg_childdw_name, string(ls_i)+".x",'-1')) column_width=long(f_ProfileString (sys_empid,arg_childdw_name, string(ls_i)+".width",'-1')) if column_xpos = -1 or column_width = -1 then rslt=0 goto ext end if arg_s_xwidth.width[ls_i]=column_width arg_s_xwidth.x[ls_i]=column_xpos next arg_s_xwidth.p=ls_clmno if obj_dw.Describe('cmpl1.name')='cmpl1' then arg_s_xwidth.cmplwidth[1]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl1.width",'-1')) arg_s_xwidth.cmplx[1]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl1.x",'-1')) if arg_s_xwidth.cmplx[1] = -1 or arg_s_xwidth.cmplwidth[1] = -1 then rslt=0 goto ext end if arg_s_xwidth.cmplp=1 end if if obj_dw.Describe('cmpl2.name')='cmpl2' then arg_s_xwidth.cmplwidth[2]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl2.width",'-1')) arg_s_xwidth.cmplx[2]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl2.x",'-1')) if arg_s_xwidth.cmplx[2] = -1 or arg_s_xwidth.cmplwidth[2] = -1 then rslt=0 goto ext end if arg_s_xwidth.cmplp=arg_s_xwidth.cmplp+2 end if if obj_dw.Describe('cmpl3.name')='cmpl3' then arg_s_xwidth.cmplwidth[3]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl3.width",'-1')) arg_s_xwidth.cmplx[3]=long(f_ProfileString (sys_empid,arg_childdw_name, "cmpl3.x",'-1')) if arg_s_xwidth.cmplx[3] = -1 or arg_s_xwidth.cmplwidth[3] = -1 then rslt=0 goto ext end if arg_s_xwidth.cmplp=arg_s_xwidth.cmplp+4 end if ext: return rslt end function public subroutine wf_readini_begin ();dwod=dw_1.object.mxreport s_mdfxwidth_tran s_mdfxw_tran s_mdfxw_tran.retrieveid=retrieveid //if em_1.enabled then // secondretrieveid=long(em_1.text) //end if s_mdfxw_tran.secondretrieveid=secondretrieveid s_mdfxw_tran.dataobject=dwod.dataobject if wf_read_childdw_pos(dwod.dataobject,s_xwidth)=0 then return end if wf_mdfmxreport(s_xwidth) end subroutine public function integer wf_trycreate_sys_dwnsyntax (ref string arg_msg);//wf_trycreate_sys_dwnsyntax long rslt=1 long cnt string createsql_string,t_str 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 ('')) "+& " ~n ALTER TABLE sys_dwnSyntax WITH NOCHECK ADD CONSTRAINT PK_sys_dwnSyntax PRIMARY KEY CLUSTERED (dwname,dname)" t_str="select count(*) from sys_dwnSyntax" Execute immediate :t_str; if sqlca.sqlcode=0 then //已经存在该表 rslt=1 goto ext end if Execute immediate :createsql_string ; if sqlca.sqlcode<>0 then arg_msg='建立表sys_dwnSyntax失败>>'+sqlca.sqlerrtext rollback ; rslt=0 goto ext end if commit ; ext: return rslt return 0 end function public function integer wf_dwcreate (string arg_dwname, string arg_formatname, ref string arg_errmsg);blob dwSyntax int rslt=1 selectblob dwSyntaxB into :dwSyntax from sys_dwnSyntax where dwname=:arg_dwname and dname=:arg_formatname; if sqlca.sqlcode=-1 then Messagebox('系统提示','查询单据格式失败,原因:'+sqlca.sqlerrtext) rslt=0 goto ext end if //Messagebox('string(dwSyntax)',string(dwSyntax)) if dw_1.create(string(dwSyntax),arg_errmsg)<>1 then Messagebox('系统提示',arg_errmsg) goto ext end if dw_1.object.DataWindow.Print.Preview = 'yes' dw_1.Object.DataWindow.Print.Duplex = 2 dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" ext: return rslt end function public subroutine wf_defdataobject ();String errmsg Long ls_count,rslt = 1 Blob sqlblob SELECT count(*) INTO :ls_count FROM sys_dwnSyntax Where dwname = :fact_print_msg.obj_dwname AND default_flag = 1 ; IF sqlca.SQLCode = -1 THEN MessageBox('系统提示','查询单据格式失败'+sqlca.SQLErrText) RETURN END IF IF ls_count = 1 THEN SELECT dwname,dname INTO :default_dwname,:default_dname FROM sys_dwnSyntax Where dwname = :fact_print_msg.obj_dwname AND default_flag = 1 ; IF sqlca.SQLCode = -1 THEN MessageBox('系统提示','查询单据格式失败'+sqlca.SQLErrText) RETURN END IF IF wf_dwcreate(default_dwname,default_dname,errmsg) = 0 THEN MessageBox('系统提示','打开单据格式失败!原因:'+errmsg) RETURN END IF dw_1.SetTransObject(sqlca) ELSEIF ls_count = 0 THEN END IF end subroutine public subroutine wf_subdwpos_strutoblob (s_childreportxwidth arg_s_xwidth, ref blob subdwpos);long ls_clmxp,ls_cmplxp long i,j string x_str,width_str,clmxp_str,cmpx_str,cmpwidth_str,cmp_str,subdwstr //列数 ls_clmxp=arg_s_xwidth.p if ls_clmxp > 0 then for i=1 to ls_clmxp x_str=x_str+string(arg_s_xwidth.x[i])+',' width_str=width_str+string(arg_s_xwidth.width[i])+',' next x_str=left(x_str,len(x_str) - 1)+';' width_str=left(width_str,len(width_str) - 1)+';' clmxp_str='P:'+string(ls_clmxp)+';x:'+x_str+'width:'+width_str end if //Messagebox('clmxp_str',clmxp_str) ls_cmplxp=arg_s_xwidth.cmplp if ls_cmplxp>0 then for i= 1 to upperbound(arg_s_xwidth.cmplx) cmpwidth_str=cmpwidth_str+string(arg_s_xwidth.cmplwidth[i])+',' cmpx_str=cmpx_str+string(arg_s_xwidth.cmplx[i])+',' next cmpx_str=left(cmpx_str,len(cmpx_str) - 1)+';' cmpwidth_str=left(cmpwidth_str,len(cmpwidth_str) - 1)+';' cmp_str='cmplp:'+string(ls_cmplxp)+';x:'+cmpx_str+'width:'+cmpwidth_str end if //Messagebox('cmp_str',cmp_str) //Messagebox('',clmxp_str+cmp_str) subdwpos=blob(clmxp_str+cmp_str,EncodingANSI!) //s_subdwxwidth end subroutine public subroutine wf_subdwpos_blobtostru (blob arg_blob, ref s_childreportxwidth arg_s_xwidth);//wf_subdwpos_blobtostru(arg_blob,arg_s_xwidth) string subdwpos_str,clm_str,cmp_str,clm_strx,clm_strwidth,cmplp_x,cmplp_width long clm_p,cmplp,i subdwpos_str=string(arg_blob) if pos(subdwpos_str,'cmplp:') > 0 then clm_str=mid(subdwpos_str,1,pos(subdwpos_str,'cmplp:') - 1) else clm_str=mid(subdwpos_str,1) end if cmp_str=mid(subdwpos_str,pos(subdwpos_str,'cmplp:')) clm_strx=mid(clm_str,pos(clm_str,'x:')+2,pos(clm_str,';width:') - pos(clm_str,'x:') - 1 ) //x_str clm_strwidth=mid(clm_str,pos(clm_str,'width:') + 6) //width_str cmplp_x=mid(cmp_str,pos(cmp_str,'x:')+2,pos(cmp_str,';width:') - pos(cmp_str,'x:') - 1 ) cmplp_width=mid(cmp_str,pos(cmp_str,'width:') + 6) //cmplpwidth_str clm_p=long(mid(clm_str,3,pos(clm_str,';') - 3)) //P cmplp=long(mid(cmp_str,7,pos(cmp_str,';') - 7)) //cmplp arg_s_xwidth.p=clm_p arg_s_xwidth.cmplp=cmplp //messagebox('all',subdwpos_str) //MEssagebox('clm_str',clm_str) //MEssagebox('cmp_str',cmp_str) // //MEssagebox('clm_p',clm_p) //MEssagebox('cmplp',cmplp) // //MEssagebox('clm_strx',clm_strx) //MEssagebox('clm_strwidth',clm_strwidth) long xmx string xstr xmx=0 xstr='' for i =1 to len(clm_strx) //x if mid(clm_strx,i,1)<>',' and mid(clm_strx,i,1)<>';' then xstr=xstr+mid(clm_strx,i,1) else xmx++ arg_s_xwidth.x[xmx]=long(xstr) xstr='' end if next xmx=0 xstr='' for i =1 to len(clm_strwidth) //width if mid(clm_strwidth,i,1)<>',' and mid(clm_strwidth,i,1)<>';' then xstr=xstr+mid(clm_strwidth,i,1) else xmx++ arg_s_xwidth.width[xmx]=long(xstr) xstr='' end if next xmx=0 xstr='' for i =1 to len(cmplp_x) //cmplp_x if mid(cmplp_x,i,1)<>',' and mid(cmplp_x,i,1)<>';' then xstr=xstr+mid(cmplp_x,i,1) else xmx++ arg_s_xwidth.cmplx[xmx]=long(xstr) xstr='' end if next xmx=0 xstr='' for i =1 to len(cmplp_width) //cmplp_width if mid(cmplp_width,i,1)<>',' and mid(cmplp_width,i,1)<>';' then xstr=xstr+mid(cmplp_width,i,1) else xmx++ arg_s_xwidth.cmplwidth[xmx]=long(xstr) xstr='' end if next //messagebox('','sdfsdf') end subroutine public function integer wf_read_subdwpos (string arg_dwname, string arg_dname, ref s_childreportxwidth s_subdwwidth, ref string arg_msg);//wf_read_subdwpos(arg_dwname,arg_dname,arg_msg) blob ls_subdwSyntaxB int rslt=1 selectblob subdwSyntaxB into :ls_subdwSyntaxB from sys_dwnSyntax where dwname=:arg_dwname and dname=:arg_dname; if sqlca.sqlcode=-1 then arg_msg='读取单据明细表格式失败!'+sqlca.sqlerrtext rslt=0 goto ext end if if len(ls_subdwSyntaxB)>0 then dwod=dw_1.object.mxreport wf_subdwpos_blobtostru(ls_subdwSyntaxB,s_subdwwidth) //wf_mdfmxreport(s_subdwwidth) end if ext: return rslt end function public subroutine wf_nullrow (long arg_rowcnt, long arg_pagerow, ref long arg_nullrow);//==================================================================== // Function: wf_nullrow() //-------------------------------------------------------------------- // Description:返回加空行数 //-------------------------------------------------------------------- // Arguments: // value long arg_rowcnt // value long arg_pagerow // reference long arg_nullrow //-------------------------------------------------------------------- // Returns: (none) //-------------------------------------------------------------------- // Author: yyx Date: 2004.09.13 //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long pagecnt,tal_rowcnt pagecnt = Long(arg_rowcnt / arg_pagerow) tal_rowcnt = arg_rowcnt + pagecnt + 1 IF Mod(tal_rowcnt,arg_pagerow) <> 0 THEN arg_nullrow = arg_pagerow - Mod(tal_rowcnt,arg_pagerow) ELSE arg_nullrow = 0 END IF end subroutine public subroutine wf_check_ini ();//读取配置 Int li_file_handle IF NOT FileExists(rpt_inifilename) THEN li_file_handle = FileOpen(rpt_inifilename ,StreamMode!, Write!, LockWrite!, Append!) IF li_file_handle <> -1 AND NOT IsNull(li_file_handle) THEN FileClose(li_file_handle) END IF END IF end subroutine public subroutine wf_setprofile ();string ls_parm ls_parm = string(reportid) + '_' + ddlb_printerlist.Text if isnull(fact_print_msg.ini_group) then return f_SetProfileString (sys_empid,ls_parm, "margin_top", string(dw_1.object.datawindow.print.margin.top)) f_SetProfileString (sys_empid,ls_parm, "margin_left", string(dw_1.object.datawindow.print.margin.left)) f_SetProfileString (sys_empid,ls_parm, "margin_bottom", string(dw_1.object.datawindow.print.margin.bottom)) f_SetProfileString (sys_empid,ls_parm, "margin_right", string(dw_1.object.datawindow.print.margin.right)) f_SetProfileString (sys_empid,ls_parm, "paper_size", string(dw_1.object.datawindow.print.paper.size) ) f_SetProfileString (sys_empid,ls_parm, "orientation", string(dw_1.object.datawindow.print.orientation)) f_SetProfileString(sys_empid,string(reportid), "dw_default_printer ", dw_default_printer ) f_SetProfileString (sys_empid,ls_parm, "printrow", string(fact_print_msg.printrow)) rslt_printnum++ if fact_print_msg.obj_dwname = 'dw_rp_order_ml_lsx' or fact_print_msg.obj_dwname = 'dw_rp_order_ml_lsx_mg' then else cb_exit.triggerevent(clicked!) end if end subroutine public subroutine wf_retrdw_dt (); datetime firstdate,enddate firstdate = DateTime(Date(EM_1.Text),Time(0)) enddate = DateTime(Date(EM_2.Text),Time('23:59:59')) dw_1.Retrieve(firstdate,enddate) end subroutine public function integer wf_face_change ();IF fact_print_msg.retr_flag = FALSE THEN st_4.Visible = TRUE st_5.Visible = TRUE EM_1.Visible = TRUE EM_2.Visible = TRUE cbx_1.Visible = TRUE dw_1.Object.datawindow.Print.Preview = 'no' dw_1.Object.datawindow.Print.Preview.rulers = "no" ELSE st_4.Visible = FALSE st_5.Visible = FALSE EM_1.Visible = FALSE EM_2.Visible = FALSE cbx_1.Visible = FALSE dw_1.Object.datawindow.Print.Preview = 'yes' dw_1.Object.datawindow.Print.duplex = 2 dw_1.Object.datawindow.Print.Preview.rulers = "yes" END IF RETURN 1 end function on w_rpt_preview.create int iCurrent call super::create this.st_1=create st_1 this.ddlb_printerlist=create ddlb_printerlist this.cb_mdfmxrp=create cb_mdfmxrp this.cb_direcprint=create cb_direcprint this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar this.cb_3=create cb_3 this.cb_refresh=create cb_refresh this.cb_indirectprint=create cb_indirectprint this.st_2=create st_2 this.st_3=create st_3 this.st_4=create st_4 this.st_5=create st_5 this.em_1=create em_1 this.em_2=create em_2 this.cbx_1=create cbx_1 this.dw_1=create dw_1 this.ln_1=create ln_1 this.ln_2=create ln_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_1 this.Control[iCurrent+2]=this.ddlb_printerlist this.Control[iCurrent+3]=this.cb_mdfmxrp this.Control[iCurrent+4]=this.cb_direcprint this.Control[iCurrent+5]=this.ln_bar this.Control[iCurrent+6]=this.ln_bar2 this.Control[iCurrent+7]=this.r_bar this.Control[iCurrent+8]=this.cb_3 this.Control[iCurrent+9]=this.cb_refresh this.Control[iCurrent+10]=this.cb_indirectprint this.Control[iCurrent+11]=this.st_2 this.Control[iCurrent+12]=this.st_3 this.Control[iCurrent+13]=this.st_4 this.Control[iCurrent+14]=this.st_5 this.Control[iCurrent+15]=this.em_1 this.Control[iCurrent+16]=this.em_2 this.Control[iCurrent+17]=this.cbx_1 this.Control[iCurrent+18]=this.dw_1 this.Control[iCurrent+19]=this.ln_1 this.Control[iCurrent+20]=this.ln_2 end on on w_rpt_preview.destroy call super::destroy destroy(this.st_1) destroy(this.ddlb_printerlist) destroy(this.cb_mdfmxrp) destroy(this.cb_direcprint) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) destroy(this.cb_3) destroy(this.cb_refresh) destroy(this.cb_indirectprint) destroy(this.st_2) destroy(this.st_3) destroy(this.st_4) destroy(this.st_5) destroy(this.em_1) destroy(this.em_2) destroy(this.cbx_1) destroy(this.dw_1) destroy(this.ln_1) destroy(this.ln_2) end on event open;call super::open;String ls_parm Blob lblob String errmsg String ls_dw EM_1.Text = String(Today(),'yyyy-mm')+'-01' EM_2.Text = String(Today(),'YYYY-MM-DD') //初始化打印机 wf_initprinterinfo() /////////////////////// fact_print_msg = Message.PowerObjectParm retrieveid = fact_print_msg.retr_pramnmb scid = fact_print_msg.retr_scid reportid = fact_print_msg.rpid st_1.Text = fact_print_msg.tag_text st_3.Text = fact_print_msg.rpname IF fact_print_msg.isdw <> '' THEN ls_dw = fact_print_msg.isdw ELSE //获取DW数据 SELECTBLOB Rpsyntax INTO :lblob FROM u_report_list Where rpid = :reportid USING sqlca; IF sqlca.SQLCode = 0 THEN ls_dw = String(lblob) END IF END IF dw_1.Create(ls_dw,errmsg) IF errmsg > '' THEN POST MessageBox("出错信息","创建数据窗口时出错:"+errmsg) RETURN END IF //检查配置文件 wf_check_ini() dw_default_printer = f_ProfileString (sys_empid,String(reportid), "dw_default_printer ", "" ) IF dw_default_printer = '' THEN ddlb_printerlist.Text = default_printer ELSE ddlb_printerlist.Text = dw_default_printer END IF ls_parm = String(reportid) + '_' + ddlb_printerlist.Text printrow = Long(f_ProfileString (sys_empid,ls_parm, "printrow", '10')) fact_print_msg.printrow = printrow dw_1.SetTransObject(sqlca) wf_face_change() /////////自定义单据格式相关 IF fact_print_msg.retr_flag = TRUE AND fact_print_msg.retr_pram_falg <> -1 THEN f_retrieve_dw(dw_1,fact_print_msg) ELSEIF fact_print_msg.retr_flag = FALSE THEN wf_retrdw_dt() END IF dw_1.SetRedraw(FALSE) dw_1.Object.datawindow.Print.margin.Top = Integer(f_ProfileString (sys_empid,ls_parm, "margin_top", "30")) dw_1.Object.datawindow.Print.margin.Left = Integer(f_ProfileString (sys_empid,ls_parm, "margin_left", "20" )) dw_1.Object.datawindow.Print.margin.bottom = Integer(f_ProfileString (sys_empid,ls_parm, "margin_bottom", "30")) dw_1.Object.datawindow.Print.margin.Right = Integer(f_ProfileString (sys_empid,ls_parm, "margin_right", "20" )) dw_1.Object.datawindow.Print.paper.size = Integer(f_ProfileString (sys_empid,ls_parm, "paper_size", "9" )) IF fact_print_msg.retr_flag = TRUE THEN dw_1.Object.datawindow.Print.orientation = Integer(f_ProfileString (sys_empid,ls_parm, "orientation", "0" )) ELSE dw_1.Object.datawindow.Print.orientation = Integer(f_ProfileString (sys_empid,ls_parm, "orientation", "1" )) END IF dw_1.SetRedraw(TRUE) end event event resize;dw_1.setredraw(false) ln_bar.endx = this.width ln_bar2.endx = this.width ln_1.endx = this.width ln_2.endx = this.width r_bar.width = this.width DW_1.WIDTH=THIS.WIDTH - DW_1.X - 35 DW_1.HEIGHT=THIS.HEIGHT - DW_1.Y - 200 dw_1.setredraw(true) end event event close;call super::close;closewithreturn(this,rslt_printnum) end event type cb_exit from w_rpt_publ_base`cb_exit within w_rpt_preview integer x = 850 integer width = 151 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type st_1 from statictext within w_rpt_preview integer x = 1216 integer y = 56 integer width = 754 integer height = 60 integer textsize = -9 integer weight = 700 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 67108864 string text = "标题" boolean focusrectangle = false end type event constructor;this.backcolor = 14215660 end event type ddlb_printerlist from dropdownlistbox within w_rpt_preview integer x = 370 integer y = 184 integer width = 1312 integer height = 1380 integer taborder = 110 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = true boolean vscrollbar = true borderstyle borderstyle = stylelowered! end type event selectionchanged;String ls_parm ls_parm = string(reportid) + '_' + ddlb_printerlist.Text dw_1.SetRedraw(FALSE) dw_1.Object.datawindow.Print.margin.Top = Integer(f_ProfileString (sys_empid,ls_parm, "margin_top", "30")) dw_1.Object.datawindow.Print.margin.Left = Integer(f_ProfileString (sys_empid,ls_parm, "margin_left", "30" )) dw_1.Object.datawindow.Print.margin.bottom = Integer(f_ProfileString (sys_empid,ls_parm, "margin_bottom", "30")) dw_1.Object.datawindow.Print.margin.Right = Integer(f_ProfileString (sys_empid,ls_parm, "margin_right", "30" )) dw_1.Object.datawindow.Print.paper.size = Integer(f_ProfileString (sys_empid,ls_parm, "paper_size", "9" )) dw_1.Object.datawindow.Print.orientation = Integer(f_ProfileString (sys_empid,ls_parm, "orientation", "0" )) dw_1.SetRedraw(TRUE) end event type cb_mdfmxrp from commandbutton within w_rpt_preview boolean visible = false integer x = 261 integer y = 496 integer width = 379 integer height = 92 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "明细网格调整" end type event clicked;dwod=dw_1.object.mxreport s_mdfxwidth_tran s_mdfxw_tran s_mdfxw_tran.retrievetype = fact_print_msg.retr_pram_falg s_mdfxw_tran.retrieveid=retrieveid ///////////yyx0821 //if em_1.enabled then // secondretrieveid=long(em_1.text) //else // secondretrieveid = sys_scid //end if /////////// s_mdfxw_tran.secondretrieveid=secondretrieveid s_mdfxw_tran.retrievestr=fact_print_msg.retr_pramstr s_mdfxw_tran.dataobject=dwod.dataobject openwithparm(w_publ_preview_mdfcrptxwidth,s_mdfxw_tran) s_xwidth=message.powerobjectparm //write ini //wf_write_childdw_pos(s_mdfxw_tran.dataobject,s_xwidth) // wf_mdfmxreport(s_xwidth) end event type cb_direcprint from uo_imflatbutton within w_rpt_preview integer x = 302 integer width = 274 integer height = 164 integer taborder = 120 boolean bringtotop = true string text = "直接打印" boolean default = true string normalpicname = "print.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;//if cbx_select_page.checked then // dw_default_printer = ddlb_printerlist.text // lnv_printer.of_setdefault ( dw_default_printer ) // openwithparm(w_sys_printpagesetting,dw_1) // wf_setdefaultprinter() //else dw_default_printer = ddlb_printerlist.text lnv_printer.of_setdefault ( dw_default_printer ) dw_1.print() wf_setdefaultprinter() //end if wf_setprofile() end event type ln_bar from line within w_rpt_preview long linecolor = 268435456 integer linethickness = 4 integer beginy = 168 integer endx = 3406 integer endy = 168 end type type ln_bar2 from line within w_rpt_preview long linecolor = 16777215 integer linethickness = 4 integer beginy = 172 integer endx = 3406 integer endy = 172 end type type r_bar from rectangle within w_rpt_preview long linecolor = 16777215 long fillcolor = 1073741824 integer x = 2747 integer width = 73 integer height = 172 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar2.beginy - 5 end event type cb_3 from uo_imflatbutton within w_rpt_preview integer x = 151 integer width = 151 integer height = 164 integer taborder = 110 string text = "功能" string normalpicname = "setting.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked; m_Dfc_Control_PopupMenu dmPopupMenu String menustr IF fact_print_msg.retr_flag OR cbx_1.Checked THEN menustr = menustr + "Text=页面设置~tEvent=ue_setprintpage_value" + "|" END IF menustr = menustr + "Text=数据发送~tEvent=ue_sentdataout" menustr = menustr + "|" + "Text=-" menustr = menustr + "|" + "Text=上一页~tEvent=ue_spp" menustr = menustr + "|" + "Text=下一页~tEvent=ue_snp" IF Len(Trim(menustr)) <> 0 THEN dmPopupMenu = CREATE m_Dfc_Control_PopupMenu dmPopupMenu.mf_BuildMenu(THIS, menustr) dmPopupMenu.mf_PopMenu() DESTROY dmPopupMenu END IF end event type cb_refresh from uo_imflatbutton within w_rpt_preview integer width = 151 integer height = 164 integer taborder = 110 string text = "重查" string normalpicname = "refresh.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked; IF fact_print_msg.retr_flag = TRUE THEN f_retrieve_dw(dw_1,fact_print_msg) ELSE wf_retrdw_dt() END IF end event type cb_indirectprint from uo_imflatbutton within w_rpt_preview integer x = 576 integer width = 274 integer height = 164 integer taborder = 130 boolean bringtotop = true string text = "选页打印" string normalpicname = "print.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;//if cbx_select_page.checked then dw_default_printer = ddlb_printerlist.text lnv_printer.of_setdefault ( dw_default_printer ) openwithparm(w_sys_printpagesetting,dw_1) wf_setdefaultprinter() //else // dw_default_printer = ddlb_printerlist.text // lnv_printer.of_setdefault ( dw_default_printer ) // dw_1.print() // wf_setdefaultprinter() //end if wf_setprofile() end event type st_2 from statictext within w_rpt_preview integer x = 37 integer y = 196 integer width = 320 integer height = 64 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "打印机列表:" boolean focusrectangle = false end type type st_3 from statictext within w_rpt_preview integer x = 2085 integer y = 56 integer width = 754 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 700 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 67108864 boolean focusrectangle = false end type event constructor;this.backcolor = 14215660 end event type st_4 from statictext within w_rpt_preview integer x = 2258 integer y = 196 integer width = 229 integer height = 64 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "日期从:" alignment alignment = right! boolean focusrectangle = false end type type st_5 from statictext within w_rpt_preview integer x = 2917 integer y = 196 integer width = 101 integer height = 64 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "到" boolean focusrectangle = false end type type em_1 from editmask within w_rpt_preview integer x = 2496 integer y = 184 integer width = 402 integer height = 84 integer taborder = 120 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "none" borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datetimemask! string mask = "yyyy-mm-dd" boolean spin = true end type event rbuttondown;s_calender_arg s_calender s_calender.PointerX = THIS.PointerX() s_calender.PointerY = THIS.PointerY() s_calender.X = THIS.X s_calender.Y = THIS.Y OpenWithParm(w_calendar,s_calender) THIS.Text = String(id_date_selected) end event type em_2 from editmask within w_rpt_preview integer x = 2981 integer y = 184 integer width = 402 integer height = 84 integer taborder = 130 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "none" borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datetimemask! string mask = "yyyy-mm-dd" boolean spin = true end type event rbuttondown;s_calender_arg s_calender s_calender.PointerX = THIS.PointerX() s_calender.PointerY = THIS.PointerY() s_calender.X = THIS.X s_calender.Y = THIS.Y OpenWithParm(w_calendar,s_calender) THIS.Text = String(id_date_selected) end event type cbx_1 from checkbox within w_rpt_preview integer x = 1957 integer y = 192 integer width = 279 integer height = 64 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "预览" end type event clicked;IF THIS.Checked THEN dw_1.Object.datawindow.Print.Preview = 'yes' dw_1.Object.datawindow.Print.duplex = 2 dw_1.Object.datawindow.Print.Preview.rulers = "yes" ELSE dw_1.Object.datawindow.Print.Preview = 'no' dw_1.Object.datawindow.Print.Preview.rulers = "no" END IF end event type dw_1 from u_rpt_dw_rbtnfilter within w_rpt_preview integer y = 288 integer width = 3401 integer height = 1508 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_rpt_print" boolean hscrollbar = true boolean vscrollbar = true boolean rbutton_filter_use = true boolean titleclick_sort_use = true end type event doubleclicked;call super::doubleclicked;if dwo.type='datawindow' then return s_preview_dwoprp_tran S_SREU S_SREU.yn=0 S_SREU.x=integer(dwo.x) S_SREU.y=integer(dwo.y) S_SREU.width=integer(dwo.width) S_SREU.height=integer(dwo.height) S_SREU.dwotype=dwo.type S_SREU.dwoname=DWO.NAME if LOWER(LEFT(dwo.type,4))='text' then S_SREU.dwotext=dwo.TEXT else S_SREU.dwotext='' end if openwithparm(w_rpt_preview_setdwoprp,S_SREU) S_SREU=Message.PowerObjectParm if S_SREU.yn=1 then dwo.x=S_SREU.x dwo.y=S_SREU.y dwo.width=S_SREU.width dwo.height=S_SREU.height if LOWER(LEFT(dwo.type,4))='text' then THIS.Modify(dwo.name+'.text="'+S_SREU.dwotext+'"') // dwo.TEXT=S_SREU.dwotext end if end if end event type ln_1 from line within w_rpt_preview long linecolor = 268435456 integer linethickness = 4 integer beginy = 276 integer endx = 3406 integer endy = 276 end type type ln_2 from line within w_rpt_preview long linecolor = 16777215 integer linethickness = 4 integer beginy = 280 integer endx = 3406 integer endy = 280 end type