private lnresp
lnresp = 1
do alert with '!!! ATTENTION !!!;This option is used to generate Accounting posting for ;Others in sales bill;Are you sure ?',1,'\<No;\<Yes',lnresp
if lnresp = 1
	do cls_menu
	retu
endif


sele salemast
scan for ! empt(other) and empt(othertran)
	private lnother,lcdebit_ac,lccredit_ac,lcdbcr_flg
	lnother = other
	store ' ' to lcdebit_ac,lccredit_ac,lcdbcr_flg
	if lnother > 0
		lcdebit_ac = mclient_ac
		lccredit_ac = m.other_ac
		lcdbcr_flg = 'D'
	else
		lccredit_ac = mclient_ac
		lcdebit_ac = m.other_ac
		lcdbcr_flg = 'C'
	endif
	if ! addtran(m.bill_dt,lcdebit_ac,lccredit_ac,abs(lnother),m.bill_no,'','','',m.othertran,'VS',m.client_no,lcdbcr_flg)
		do err_beep
		do alert with '!!! ERROR !!!;There was problem in storing Financial Info.;Entry rejected'
		unlo in salemast
		retu
	else
		if ! nclitran(m.client_no,lcdbcr_flg,m.other_ac,abs(lnother),m.othertran,'VS',m.bill_no)
			do err_beep
			do alert with '!!! ERROR !!!;There was problem in Adding CLIENT A/C Breakup Info.'
		endif
	endif
endscan


