*** Program to Replace SalesTax Amount at the time of Vehicle Sales Bill for Dealer


FUNCTION replst


** If Sales Tax is to be calculated on Rate Only

REPLACE salemast.st_amt WITH ROUND(salemast.rate*salemast.st_rt/(100+salemast.st_rt + (salemast.st_rt*salemast.st_sc/100) ),2) ;
	salemast.st_sc_amt WITH ROUND(salemast.st_amt*salemast.st_sc/100,2)

** If Sales Tax is to be calculated on Rate + Other
*!*	REPLACE salemast.st_amt WITH ROUND((salemast.rate + salemast.other)*salemast.st_rt/(100+salemast.st_rt + (salemast.st_rt*salemast.st_sc/100)),2) ;
*!*		salemast.st_sc_amt WITH ROUND(salemast.st_amt*salemast.st_sc/100,2)


** If Sales Tax is to be calculated on Rate + Other - SchemeDiscount
*!*	REPLACE salemast.st_amt WITH ROUND((salemast.rate + salemast.other - saleamst.disc_rs)*salemast.st_rt/(100+salemast.st_rt + (salemast.st_rt*salemast.st_sc/100)),2) ;
*!*		salemast.st_sc_amt WITH ROUND(salemast.st_amt*salemast.st_sc/100,2)


** If Sales Tax is to be calculated on Rate - SchemeDiscount
*!*	REPLACE salemast.st_amt WITH ROUND((salemast.rate - saleamst.disc_rs)*salemast.st_rt/(100+salemast.st_rt + (salemast.st_rt*salemast.st_sc/100)),2) ;
*!*		salemast.st_sc_amt WITH ROUND(salemast.st_amt*salemast.st_sc/100,2)


** In old Screens
*!*	m.st_amt = ROUN(m.rate*m.st_rt/(100 + m.st_rt + m.st_rt*m.st_sc/100 ),2)
*!*	m.st_sc_amt = roun(m.st_amt*m.st_sc/100,2)

*!*	m.basic_amt = m.rate - m.st_amt - m.st_sc_amt
*!*	if m.basic_amt + m.st_amt + m.st_sc_amt > m.rate
*!*		m.basic_amt = m.basic_amt + (m.basic_amt + m.st_amt + m.st_sc_amt - m.rate)
*!*	else
*!*		m.basic_amt = m.basic_amt + (m.rate - m.basic_amt - m.st_amt - m.st_sc_amt)
*!*	endif

REPLACE salemast.basic_amt WITH salemast.rate - salemast.st_amt - salemast.st_sc_amt
IF salemast.basic_amt + salemast.st_amt + salemast.st_sc_amt > salemast.rate
	REPLACE salemast.basic_amt with salemast.basic_amt + (salemast.basic_amt + salemast.st_amt + salemast.st_sc_amt - salemast.rate)
ELSE 
	REPLACE salemast.basic_amt with salemast.basic_amt + (salemast.rate - salemast.basic_amt - salemast.st_amt - salemast.st_sc_amt)
ENDIF 
