FUNCTION GET_IT4

PARAMETERS pcsele_criteria,pcwarranty,pcservice_typ,pcGodownNo

PRIVATE lcGodownNo
lcGodownNo = ' '
IF PARAMETERS() = 4
	lcGodownNo = pcGodownNo
ENDIF 
IF ! get_it1(pcsele_criteria,pcwarranty,pcservice_typ,lcGodownNo)
	RETURN .F.
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 
				IF gcvat_flg = 'Y'
					REPLACE itvat_rate WITH ITEMMAST.st_rt 
				ELSE 
					REPLACE itvat_rate WITH 00.00
				ENDIF 
				IF gcaddivatflg = "Y"	
					REPLACE itavat_rt with ITEMMAST.ADDIVATRT	
				ELSE
					REPLACE itavat_rt with 00.00
				ENDIF 
		CASE itemmast.itemtype = 'A'
			REPLACE sd_rt WITH m.adisc_rt ;
				spare_rt with 0.00
				IF gcvat_flg = 'Y'
					REPLACE itvat_rate WITH ITEMMAST.st_rt 
				ELSE
					REPLACE itvat_rate WITH 00.00				
				ENDIF 
				IF gcaddivatflg = "Y"	
					REPLACE itavat_rt with ITEMMAST.ADDIVATRT
				ELSE
					REPLACE itavat_rt with 00.00
				ENDIF 
		CASE itemmast.itemtype = 'C'
			REPLACE sd_rt WITH m.oildisc_rt 
				IF gcvat_flg = 'Y'
					REPLACE itvat_rate WITH ITEMMAST.st_rt 
				ELSE
					REPLACE itvat_rate WITH 00.00				
				ENDIF 
				IF gcaddivatflg = "Y"	
					REPLACE itavat_rt with ITEMMAST.ADDIVATRT	
				ELSE
					REPLACE itavat_rt with 00.00
				ENDIF 
		CASE itemmast.itemtype = 'L'
			REPLACE labour_rt WITH itemmast.labour_rt ;
				sd_rt WITH m.labourdisc
	ENDCASE 
ENDIF
DO replamt