'PDNOTINV - orders paid but not invoiced

external  vloadif() dpath sch scw messboxwait() navrecs() fgp bgp cpath
external  PrintReport() Background() progress()

public    ptval ptstr dsa jobnr

global    x p1 p2 p3 p4 p5 p6 ChooseOrder() ReturnToMenu()


MAIN
single-step off
  Background()
  file unload all
'   redimension custdet[11,2]
  p2 = ""               ' p2 = title at top of choice popup ("LABEL")
'   p3 = 3                ' p3 = printer to be used (1=HPIII_QC; 2=GEN_EPSN etc)
  p4 = 1                ' p4 = printer port to use (1,2 etc - network set to use 2=LASER; 3=LABEL)
  p5 = 1                ' p5 = choose VIEW/PRINT 1=PRINT; 2=VIEW; 3=CHOOSE
  p6 = 1                ' p6 = nr of copies

  x = ChooseOrder()

  ReturnToMenu()
END MAIN


FUNCTION ChooseOrder()
  progress(15,10," Searching for uninvoiced orders ",0)
  vloadif(dpath|"pdnotinv.vw")
  data query execute "pdnotinv.dfq" index "x.idx"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
'   [Inv_Nr]=blank
'   and
'   [Invoice_Total]>.01
'   and
'   [SalesAnalysis]<>"X"
'   and
'   [Balance_Due]<.01
'   and
'   not (deleted)
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  if cerror
    messboxwait(" No fully paid orders awaiting invoicing ",0,0,1)
    return (-1)
  end if
  order sort now dictionary "pdnotinv.idx" fields "[Job_Nr]" ascending
  p3 = 1                               'message "Printing to LJ3"
  p1 = "pdnotinv.dfr"
  PrintReport(p1,p2,p3,p4,p5,p6)
END FUNCTION ' ChooseOrder()


FUNCTION ReturnToMenu()
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off
  file unload all
  transfer cpath|"pm_menu.psl" in-memory
END FUNCTION ' ReturnToMenu()
