This code Right here always skips a First page the first page is BLANK then the correct Printing follows please help.
This is a Foxpro 9.0 code the code is for printing draft mode
ps. the printer is EPSON LQ-310 but I tried on other printer same result.
This is a Foxpro 9.0 code the code is for printing draft mode
ps. the printer is EPSON LQ-310 but I tried on other printer same result.
Code:
LOCAL mSpool
mSpool = GETPRINTER()
IF !EMPTY(mSpool)
SET PRINTER TO NAME (mSpool)
SET DEVICE TO PRINTER
SET CONSOLE OFF
SET PRINTER ON
&& SET PRINTER FONT "Courier New",4
*!* SET PRINTER FONT "draft 12cpi"
*!* LOCAL nHandle
*!* nHandle = FOPEN("SAMPLE TEXT.TXT")
*!* IF nHandle > 0
*!* =FSEEK(nHandle,0,0)
*!* DO WHILE !FEOF(nHandle)
*!* @PROW()+1,0 say FGETS(nHandle)
*!* ENDDO
*!* =FCLOSE(nHandle)
*!* ENDIF
&&SET DEVICE TO SCREEN
&&SET PRINTER off
&&SET CONSOLE ON
&&SET PRINTER TO
ENDIF
&&SET PRINTER ON
&&SET PRINTER TO default
LOCAL lcHeading1,lcHeading2, lcHeading3, lcHeading4
lcHeading1 = ALLTRIM(cHead)
lcHeading2 = ALLTRIM(cSysName)
lcHeading3 = 'Statement of Account'
lcHeading4 = 'From : ' + MDY(Thisform.dtxtStartDate.value) + ' To ' + MDY(thisform.dtxtendDate.Value)
LOCAL headerswitch,lineperpage
headerswitch = 1
lineperpage = 0
SELECT TEMPCUS
GO TOP
SET ORDER TO TMP_CUSCD
DO WHILE !EOF() &&1
***Header of Evry Page****
lineperpage = 16
??? CHR(27)+CHR(33)+CHR(16) && reset to default font...
??? CHR(27)+CHR(120)+CHR(0) && draft mode
??? CHR(10)+CHR(27)+CHR(33)+CHR(17)
??? CHR(27)+CHR(33)+CHR(04) && 12 cpi
??? CHR(10) +PADR(lcHeading1,50," ") && + SPACE(38) + 'Run Date: '+ DTOC(DATE())
??? CHR(10) +PADR(lcHeading2,50," ") &&+ SPACE(38) + 'Run Time: '+ TIME()
??? CHR(10) +PADR(lcHeading3,50," ")
??? CHR(10) +PADR(lcHeading4,50," ")
&&? CHR(27)+CHR(33)+CHR(04)
**********************************************
******Header Per Customer & Detailed Per Customer*****
*****NOTE Palehug ayaw helabte ang Spacing kay Maguba ag Report*******
*****----Boy_Turko----------**********
SELECT TEMP
SET ORDER TO TMP_CUSCD
GO TOP
SEEK ALLTRIM(TEMPCUS.TMP_CUSCD)
DO WHILE !EOF() &&2
IF ALLTRIM(TEMPCUS.TMP_CUSCD) = ALLTRIM(TEMP.TMP_CUSCD)
IF headerswitch = 1 &&if1
??? CHR(10)+ SPACE(100)+"Previous Balance "
??? CHR(10)+ SPACE(100) + TRANSFORM(temp->tmp_Pbal,'999,999,999.99')
??? CHR(10)+ SPACE(100)+"OutStanding Balance "
??? CHR(10)+ SPACE(100) + TRANSFORM(TEMP.TMP_sum,'999,999,999.99')
??? CHR(10)+ 'Code ' + PADR(' : '+ TEMP.TMP_CUSCD,50," ")
??? CHR(10)+ 'Name ' +PADR(' : '+ TEMP.TMP_CUSNM,50," ")
??? CHR(10)+ 'Address ' +PADR(' : '+ TEMP.TMP_ADDR1,50," ")
??? CHR(10)+ 'Credit Limit ' +PADR(' : '+ TRANSFORM(TEMP.TMP_CR,'999,999,999.99'),50," ")
??? CHR(10)+ 'Terms ' +PADR(' : '+ TEMP->TMP_PAYTR,50," ")
??? CHR(10)+REPLICATE('=',137)
??? CHR(10)+ 'Date Doc No. Type SI/TDS Amount Credit Adj Debit Adj Partial Payment Balance Floating Age'
??? CHR(10)+REPLICATE('-',137)
headerswitch = 0
ENDIF &&if1
IF lineperpage > 60
lineperpage = 3
EJECT
??? CHR(10)+ 'Date Doc No. Type SI/TDS Amount Credit Adj Debit Adj Partial Payment Balance Floating Age'
??? CHR(10)+REPLICATE('-',137)
??? CHR(10) + DTOC(TEMP.TMP_DATE) + SPACE(1) + PADL(ALLTRIM(TEMP.TMP_DOCNO),10,' ') + SPACE(4) + PADL(ALLTRIM(TEMP.TMP_TYPE),8,' ') + SPACE(4) + ;
TRANSFORM(TEMP.tmp_dbqty,"999,999.99") + SPACE(7) + ;
TRANSFORM(TEMP.tmp_ctqty,"999,999.99") + SPACE(4) +;
TRANSFORM(TEMP.tmp_dtqty,"999,999.99") + SPACE(9) +;
TRANSFORM(TEMP.tmp_crqty,"999,999.99") + SPACE(6) +;
TRANSFORM(TEMP.tmp_bal,"999,999.99") + SPACE(1) +;
TRANSFORM(TEMP.TMP_FLOAT,"999,999.99") + SPACE(3) + IIF(!EMPTY(TEMP.TMP_AGE), ALLTRIM(STR(TEMP.TMP_AGE)) + ' Day(s) ', ' ')
ELSE
??? CHR(10) + DTOC(TEMP.TMP_DATE) + SPACE(1) + PADL(ALLTRIM(TEMP.TMP_DOCNO),10,' ') + SPACE(4) + PADL(ALLTRIM(TEMP.TMP_TYPE),8,' ') + SPACE(4) + ;
TRANSFORM(TEMP.tmp_dbqty,"999,999.99") + SPACE(7) + ;
TRANSFORM(TEMP.tmp_ctqty,"999,999.99") + SPACE(4) +;
TRANSFORM(TEMP.tmp_dtqty,"999,999.99") + SPACE(9) +;
TRANSFORM(TEMP.tmp_crqty,"999,999.99") + SPACE(6) +;
TRANSFORM(TEMP.tmp_bal,"999,999.99") + SPACE(1) +;
TRANSFORM(TEMP.TMP_FLOAT,"999,999.99") + SPACE(3) + IIF(!EMPTY(TEMP.TMP_AGE), ALLTRIM(STR(TEMP.TMP_AGE)) + ' Day(s) ', ' ')
ENDIF
lineperpage = lineperpage + 1
ENDIF
SELECT TEMP
SKIP
ENDDO &&2
*********************************************************
********************************REPORT FOOTER**************************************
IF (lineperpage + 22) > 60
EJECT
??? CHR(10)+REPLICATE('=',137)
??? CHR(10) + '1,000.00 x ____________ = ____________ 50.00 x _____________ = _____________ |'
??? CHR(10) + ' 500.00 x ____________ = ____________ 20.00 x _____________ = _____________ |'
??? CHR(10) + ' 200.00 x ____________ = ____________ 10.00 x _____________ = _____________ |'
??? CHR(10) + ' 100.00 x ____________ = ____________ 5.00 x _____________ = _____________ |'
??? CHR(10) + ' |'
??? CHR(10) + 'Bills Amount : P _____________________________________________________ |'
??? CHR(10) + 'DatedCheck Amount : P _____________________________________________________ |'
??? CHR(10) + 'Coin Amount : P _____________________________________________________ |'
??? CHR(10) + 'Total Amount : P _____________________________________________________ |'
??? CHR(10) + 'PDC Received (Salesman)'
??? CHR(10) + '------------------------------------------------------------------------------------'
??? CHR(10) + ' Due Date Bank Name Check Number Amount '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '------------------------------------------------------------------------------------'
??? CHR(10) + ' TOTAL >>>>>> ______________________'
??? CHR(10)+REPLICATE('-',137)
??? CHR(10) + 'Remarks : '
??? CHR(10)
??? CHR(10)
??? CHR(10)
??? CHR(10)
??? CHR(10) + 'Prepared By: ' + ALLTRIM(_username) + SPACE(25) + 'Noted By: ' + ALLTRIM(cNotedby) + SPACE(25) + 'Receive By:___________________'
??? CHR(10)+REPLICATE('-',137)
ELSE
??? CHR(10)+REPLICATE('=',137)
??? CHR(10) + '1,000.00 x ____________ = ____________ 50.00 x _____________ = _____________ |'
??? CHR(10) + ' 500.00 x ____________ = ____________ 20.00 x _____________ = _____________ |'
??? CHR(10) + ' 200.00 x ____________ = ____________ 10.00 x _____________ = _____________ |'
??? CHR(10) + ' 100.00 x ____________ = ____________ 5.00 x _____________ = _____________ |'
??? CHR(10) + ' |'
??? CHR(10) + 'Bills Amount : P _____________________________________________________ |'
??? CHR(10) + 'DatedCheck Amount : P _____________________________________________________ |'
??? CHR(10) + 'Coin Amount : P _____________________________________________________ |'
??? CHR(10) + 'Total Amount : P _____________________________________________________ |'
??? CHR(10) + 'PDC Received (Salesman)'
??? CHR(10) + '------------------------------------------------------------------------------------'
??? CHR(10) + ' Due Date Bank Name Check Number Amount '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '__________________ __________________ __________________ __________________ '
??? CHR(10) + '------------------------------------------------------------------------------------'
??? CHR(10) + ' TOTAL >>>>>> ______________________'
??? CHR(10)+REPLICATE('-',137)
??? CHR(10) + 'Remarks : '
??? CHR(10)
??? CHR(10)
??? CHR(10)
??? CHR(10)
??? CHR(10) + 'Prepared By: ' + ALLTRIM(_username) + SPACE(25) + 'Noted By: ' + ALLTRIM(cNotedby) + SPACE(25) + 'Receive By:___________________'
??? CHR(10)+REPLICATE('-',137)
ENDIF
********************************END FOOTER******************************************
&&SET PRINTER TO
headerswitch = 1
SELECT TEMPCUS
SKIP
EJECT
ENDDO &&1
&&SET DEVICE TO SCREEN
&&SET PRINTER off
&&SET CONSOLE ON
SELECT TEMP
SET ORDER TO TMP_CUSCD
SET PRINTER TO NAME (mSpool)
&&SET PRINTER TO