FUNCTION GET_IT5

PARAMETERS pcsele_criteria,pcwarranty,pcservice_typ,pcrate_flg,pcGodownNo

PRIVATE lcGodownNo
lcGodownNo = ' '
IF PARAMETERS() = 5
	lcGodownNo = pcGodownNo
ENDIF 

IF pcrate_flg = "P"
	IF ! get_it2(pcsele_criteria,pcwarranty,pcservice_typ,PCRATE_FLG,lcGodownNo)
		RETURN .F.
	ENDIF
ELSE
	IF ! get_it1(pcsele_criteria,pcwarranty,pcservice_typ,lcGodownNo)
		RETURN .F.
	ENDIF
ENDIF

IF SEEK(m.cust_no,'LEDGER','ACCOUNT_NO')
	IF ! EMPTY(LEDGER.PRICELIST)
		PRIVATE lcpricelist
		lcpricelist = ledger.pricelist
		DO CASE 
			CASE itemmast.itemtype = 'S'
				DO case
					CASE lcpricelist = '1'
						REPLACE spare_rt WITH itemmast.salerate2
					CASE lcpricelist = '2'
						REPLACE spare_rt WITH itemmast.salerate3
					CASE lcpricelist = '3'
						REPLACE spare_rt WITH itemmast.salerate4
				ENDCASE 
			CASE itemmast.itemtype = 'C'
				DO case
					CASE lcpricelist = '1'
						REPLACE oil_rt WITH itemmast.salerate2
					CASE lcpricelist = '2'
						REPLACE oil_rt WITH itemmast.salerate3
					CASE lcpricelist = '3'
						REPLACE oil_rt WITH itemmast.salerate4
				ENDCASE 
		ENDCASE 
	ENDIF 
ENDIF 
*!*	REPLACE itvat_rate WITH ITEMMAST.st_rt
IF (! EMPTY(m.sparedisc) OR ! EMPTY(m.adisc_rt) OR ! EMPTY(m.oildisc_rt)) AND EMPTY(sd_rt) AND ! EMPTY(item_no)
	DO CASE 
		CASE itemmast.itemtype = 'S'
			REPLACE sd_rt WITH m.sparedisc
*!*					itvat_rate WITH ITEMMAST.st_rt
*!*				REPLACE wotax_rate WITH spare_rt*100/(100+st_rt) 
		CASE itemmast.itemtype = 'A'
			REPLACE sd_rt WITH m.adisc_rt ;
				spare_rt with 0.00
*!*					itvat_rate WITH ITEMMAST.st_rt
*!*					wotax_rate WITH accessoryr*100/(100+st_rt) 			
		CASE itemmast.itemtype = 'C'
			REPLACE sd_rt WITH m.oildisc_rt 
*!*					itvat_rate WITH ITEMMAST.st_rt
*!*					wotax_rate WITH oil_rt*100/(100+st_rt) 						
		CASE itemmast.itemtype = 'L'
			REPLACE labour_rt WITH itemmast.labour_rt ;
				sd_rt WITH m.labourdisc
	ENDCASE 
ENDIF
DO replamt 