These code working fine FWH2212, but not work FWH2402 and FWH2404.
- Code: Select all Expand view
LOCAL oReport, oFont[4]
LOCAL nI := 0
LOCAL nRows := 0
LOCAL nSel := 0
cOFFER_NO := AllTrim( FW_UTF8PADCHAR(cOFFER_NO, 10) )
cOFFER_NM := AllTrim( FW_UTF8PADCHAR(cOFFER_NM, 50) )
cOFFER_NO := "%" + cOFFER_NO + "%"
cOFFER_NM := "%" + cOFFER_NM + "%"
DO CASE
CASE nRdo1 == 1
::oDB:cQuery := "SELECT * FROM OfferMsf WHERE OFFER_NO LIKE'"+cOFFER_NO+"'"
::oDB:Refresh()
::oBrw:Refresh()
::oBrw:GoTop()
Dr_SetFocus( ::oBrw )
CASE nRdo1 == 2
::oDB:cQuery := "SELECT * FROM OfferMsf WHERE OFFER_NM LIKE'"+cOFFER_NM+"'"
::oDB:Refresh()
::oBrw:Refresh()
::oBrw:GoTop()
Dr_SetFocus( ::oBrw )
ENDCASE
IF ::oDB:LastRec() == 0
MsgAlert("資料檔中無任何資料,無法列印 !","警告")
RETURN NIL
ENDIF
DEFINE FONT oFont[1] NAME "MingLiU" SIZE 0,12
DEFINE FONT oFont[2] NAME "DFKai-SB" SIZE 0,16 BOLD
DEFINE FONT oFont[3] NAME "MingLiU" SIZE 0,12 BOLD
DEFINE FONT oFont[4] NAME "DFKai-SB" SIZE 0,22 BOLD
DO CASE
CASE nPreView == 1 // 報表先預覽後列印
REPORT oReport ;
TITLE Trim("廠商基本資料報表") ,;
"" ,;
"列印區間:"+ iif ( nRdo1=1, cOFFER_NO, cOFFER_NM ) + space(5) + ;
"列印日期:"+DTOC(DATE())+ REPL(" ",12) + ;
"頁次: "+str(oReport:nPage,3) CENTER ;
HEADER GetRegName() ,;
" " CENTER ;
FONT oFont[1],oFont[2],oFont[3],oFont[4] ;
CAPTION "廠商基本資料報表" ;
PREVIEW
CASE nPreView == 2 // 報表直接從印表機列印
REPORT oReport ;
TITLE Trim("廠商基本資料報表") ,;
"" ,;
"列印區間:"+ iif ( nRdo1=1, cOFFER_NO, cOFFER_NM ) + space(5) + ;
"列印日期:"+DTOC(DATE())+ REPL(" ",12) + ;
"頁次: "+str(oReport:nPage,3) CENTER ;
HEADER GetRegName() ,;
" " CENTER ;
FONT oFont[1],oFont[2],oFont[3],oFont[4] ;
CAPTION "廠商基本資料報表" ;
TO PRINTER
ENDCASE
COLUMN TITLE "廠商編號" DATA ::oDB:OFFER_NO
COLUMN TITLE "廠商簡稱" DATA ::oDB:OFFER_NM2
COLUMN TITLE "統一編號" DATA ::oDB:OFFER_ID
COLUMN TITLE "負責人" DATA ::oDB:BOSS
COLUMN TITLE "聯絡人1" DATA ::oDB:CONTACT1
COLUMN TITLE "電話1" DATA ::oDB:TEL1
COLUMN TITLE "傳真" DATA ::oDB:FAX
COLUMN TITLE "行動電話1" DATA ::oDB:MOBIL1
END REPORT
IF oReport:lCreated
oReport:oHEADER:aFONT[1]:={|| 4 }
oReport:oTITLE:aFONT[1]:={|| 2 }
oReport:oTITLE:aFONT[2]:={|| 1 }
oReport:oTITLE:aFONT[3]:={|| 1 }
oReport:cPageTotal := "分頁小計..."
oReport:cGrandTotal := "總計金額..."
oReport:nTotalLine := RPT_SINGLELINE
oReport:bInit := {|| ::oDB:GoTop() }
oReport:bSkip := {|| ::oDB:Skip() }
ENDIF
FOR nI=1 TO LEN(oReport:aColumns)
oReport:aColumns[nI]:bTitleFont := {|| 3 }
NEXT
ACTIVATE REPORT oReport WHILE !::oDB:EOF() ON STARTGROUP oReport:NewLine()
oFont[1]:End()
oFont[2]:End()
oFont[3]:End()
oFont[4]:End()
RETURN NIL