Trial Balance Program

Submitted by Karthikeyan on Mon, 28/09/2009 - 17:13

clear
clear all
set talk off
store space(1) to reply
@3,5 say "Do you continue?" get reply
read
use trial.dbf
store space(20) to p
store 0 to cr, db, sno
do while upper(reply)="Y"
	clear
	@4,10 say [SlNo] get sno
	@6,10 say [Particular] get p
	@8,10 say [Debit] get db
	@10,10 say [Credit] get cr
	read
	append blank
	repl slno with sno
	repl part with p
	repl debit with db
	repl credit with cr
	@18,10 say [Do continue?] get reply
	read
	clear
enddo
	set print on
	set print to trial.out
	@2,30 say "Trial Balance"
	@3,2 say replicate("-",75)
	@4,2 say "S.No."
	@4,13 say "A/c Name"
	@4,28 say "Debit Rs"
	@4,42 say "Credit Rs"
	@5,1 say repl("-",75)

store 0 to cs, ds, sus, l
l = 6
do while .not. eof()
@l,2 say SLNO
@l,7 say part
@l,22 say debit
@l,35 say credit
if l >18
wait ""
@6,0 clear
l = 6
else
 l = l + 1
endif
cs = cs + credit
ds = ds + debit
skip
enddo
if cs > ds
 sus = cs - ds
 @l,7 say "Suspense A/c"
 @l,22 say sus
else
 if ds > cs
 sus = ds - cs
 cs = ds
 @l,7 say "Suspense A/c"
 @l,35 say sus
 endif
endif

@l+1,21 say "---------------"
@l+1,34 say "---------------"
@l+3,21 say "---------------"
@l+3,34 say "---------------"
@l+2,22 say cs
@l+2,35 say cs

set print off
set print to
return