PRIVATE lcf3_key,lcctrl_P
DO set_menu
CLEA
DEFI WIND estimate FROM 2,1 TO 34,99 CLOS &gcview_clr
SELE estimate
@ 36,1 SAY PADC('F3 More Info. | Ctrl+P Print | Esc Exit',87) &gcvmsg_clr

lcf3_key = ON('KEY','F3')
lcctrl_P = ON('KEY','CTRL+P')

ON KEY LABE ctrl+p DO prinesti WITH estimateno
ON KEY LABE f3 DO esti_item IN auto_lib

BROW FIEL estimateno,estimatedt,vehicle_no :h='Vehicle  No', ;
	spare_amt :h='Spare Amt',labour_amt :h='Labour Amt',oil_amt :h='Oil Amt',TOTAL ;
	WIND estimate ;
	NOAP NODE NOMO ;
	TITL '*** ESTIMATE INFO. ***'

ON KEY LABE f3 &lcf3_key
ON KEY LABE ctrl+p &lcctrl_P
DO cls_menu


PROCEDURE esti_item

PRIVATE lcf3key

IF ALIA() <> 'ESTIMATE'
	MESSAGEBOX("Pressed key has no meaning here ..",'AUTOSOFT',0+16)
	RETU
ENDIF

SELE estibody
SET ORDE TO estimateno
SET ORDE TO item_no IN itemmast
SET RELA TO item_no INTO itemmast ADDI

lcf3key = ON('KEY','F3')
ON KEY LABEL F3 MESSAGEBOX("Pressed key has no meaning here ..",'AUTOSOFT',0+16)

DEFI WIND estibdy FROM 4,2 TO 32,97 CLOS &gcview_clr

BROW FIEL item_no,itemmast.item :25 ,qty,;
	spare_amt = qty*spare_rt :H= 'Spare Amt.' :p= '#####.##',;
	labour_rt :h='Labour Rt',oil_rt :h='Oil Rt' ;
	KEY estimate.estimateno ;
	NOAP NODEL NOMO  wind estibdy ;
	TITLE '*** Info. for Estimate No : ' + estimate.estimateno + ' ***'
	
ON KEY LABEL f3 &lcf3key	
SELE estibody	
SET RELA OFF INTO itemmast
SELE estimate


PROCEDURE prinesti

PARAMETER mestimateno

SELE estibody
IF RECCOUNT() <= 0
	MESSAGEBOX("Pressed key has no meaning here ..","AUTOSOFT",0+16)
	RETURN .F.
ELSE
	private lnesit_rec,lctmp_wind,lcrate_flg
	lctmp_wind = sys(2015)
	lcrate_flg = 'Y'
	lnesit_rec = recn('ESTIMATE')
	WAIT WIND '!!! WAIT !!! Generating Report ...' NOWA

	defi wind (lctmp_wind) from 0,0 to 6,45 pane colo rgb(,,,174,215,255)
	acti wind (lctmp_wind)
	move wind (lctmp_wind) cent
	@ 2,2 say 'Want to Print Rate : ' &gcrepo_clr
	@ 2,28 get lcrate_flg pict 'Y' &gcrepo_clr
	read
	rele wind (lctmp_wind)
	
	SELE estibody
	SET ORDE TO item_no IN itemmast
	SET RELA TO item_no INTO itemmast ADDI
	SELE estimate
	SET ORDE TO client_no IN client
	SET RELA TO client_no INTO client ADDI
	SET ORDE TO estimateno IN estibody
	SET RELA TO estimateno INTO estibody ADDI
	SET SKIP TO estibody
	= get_oprin('ESTIMATE PRINTING')
	_PADVANCE = 'LINEFEED'
	DO prinrepo WITH 'WESTIMATE','ESTIMATE',"estimateno = mestimateno",'',0,.T.
*	REPO FORM estimate FOR estimateno = mestimateno TO (out_file) NOCO
	go (lnesit_rec) in estimate
	_PADVANCE = 'FORMFEED'
	SET SKIP TO
	SET RELA OFF INTO estibody
	SET RELA OFF INTO client
	SELE estibody
	SET RELA OFF INTO itemmast
*	DO out_repo
	SELE estimate
ENDIF
