'ANCL2ORD - Stock ancillaries to order

external   vkeybox() sch scw progress() messbox() vloadif() cpath PrintReport()
external   vunloadif() dpath fentrybox() chkdate() remove() greeting
external   messboxwait()

public     ptstr choice sum_date

global     x ReturnToMenu() repdef p2 p3 p4 p5 p6 p1 Ancls2Order()

MAIN
  single-step off
  screen clear box 1 1 sch scw 0 0 no-border
  repaint off

  file unload all
  p1 = "anclrep2.dfr"        ' p1 = report definition ("ord_stck.dfr")
  p2 = "Ancl's to Order"     ' p2 = title at top of choice popup ("LABEL")
  p3 = 1                     ' 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

  messboxwait(" Program not in use - 22/06/04 ",0,0,1)

'   progress(15,10," Preparing report .... please wait ",0)
'
'   Ancls2Order()

  ReturnToMenu()

END MAIN


FUNCTION Ancls2Order()
  vloadif(dpath|"anclrep1.vw")
  remove("anclbase.*")
  remove(dpath|"anclbase.*")
  data query execute "anclrep1.dfq" Smart4 dpath|"anclbase" fields "[Product_Code|UnitDesc]"
' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
' ³ [PhysicalBalance]<[MaxStock]                                       ³
' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  if cerror
    messboxwait(" No Ancillaries to order ",0,0,1)
    return (0)
  end if
  vloadif(dpath|"anclrep2.vw")
  order sort now dictionary "anclrep2.idx" fields "[Name;Product_Supplier]" ascending
  PrintReport(p1,p2,p3,p4,p5,p6)
END FUNCTION ' Ancls2Order()


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()


