FUNCTION PostDate()
local newbal
  newbal = ob + totsal - cr
  vloadif(dpath|"cust_ord.vws")
  order change physical

' write posting date to cust_ord
  if file("sal_pstg.idx")=1
    order change index "sal_pstg.idx"
    data query execute "postdate.dfq"  'index "csh_pstg.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'   replace [Posted] = rel_date
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  end if

' write posting date to variat_n
  if file("ord_pstg.idx")=1
    vloadif(dpath|"dly_varn.vw")
    order change index "ord_pstg.idx"
    data query execute "postdate.dfq"   '  index "csh_pstg.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'   replace [Posted] = rel_date
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  end if

' write posting date to cashrcvd
  vloadif(dpath|"cashrcvd.vws")
  if file("csh_pstg.idx")=1
    order change index "csh_pstg.idx"
    data query execute "postdate.dfq"   '  index "csh_pstg.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'   replace [Posted] = rel_date
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  end if

' write new bal to op_bal.dat
  fopen dpath|"op_bal.dat" as 1
  fwrite 1 from newbal
  fclose 1

' write new bal to stockbal.dat
  fopen dpath|"stockbal.dat" as 1
  fwrite 1 from #total
  fclose 1

END FUNCTION ' PostDate()
