' test

external fentrybox() chkdate() messbox() dsa popuplist() vloadif() dpath tone()
external check_2000()

public  #holdate ptstr
global x $nextbnkhol holdes

MAIN
' x=fixed(filesum([Net_Invoice]),2)
' message "total:"&str(x)
' x=filesum([Released])
' message "Order Total is:"&str(x)
' x=filesum([Paid])
' message "Order Total is:"&str(x)

x=filesum([Cost],[Itemtype]="A")
message "stockancl total is:"&str(x)
x=filesum([Cost],[Itemtype]="B")
message "bespcarp total is:"&str(x)
x=filesum([Cost],[Itemtype]="C")
message "stockcarp total is:"&str(x)
x=filesum([Cost],[Itemtype]="F")
message "fitting total is:"&str(x)
x=filesum([Cost],[Itemtype]="J")
message "bespancl total is:"&str(x)
x=filesum([Cost],[Itemtype]="O")
message "bespsndry total is:"&str(x)
x=filesum([Cost],[Itemtype]="S")
message "STCKTILES total is:"&str(x)
x=filesum([Cost],[Itemtype]="T")
message "besptiles total is:"&str(x)
x=filesum([Cost],[Itemtype]="V")
message "stckvnyl total is:"&str(x)
x=filesum([Cost],[Itemtype]="W")
message "bespvinyl total is:"&str(x)
x=filesum([Cost])
message "TOTAL is:"&str(x)
STOP
' x=filesum([Amount_Received],[Branch]="R" and [Abbrv_M]="P")
' message "raynes total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="R" and [Abbrv_M]="O")
' message "raynes total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="S")
' message "sheen total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="H")
' message "ho total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="P")
' message "putney total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="T")
' message "trade total is:"&str(x)
' x=filesum([Amount_Received],[Branch]="F")
' message "fulham total is:"&str(x)
' x=filesum([Amount_Received],[Branch]=blank)
' message "Non-contract total is:"&str(x)

x=filesum([Amount_Received],[Abbrv_M]="C" OR [Abbrv_M]="D")
message "CASH is:"&str(x)


x=filesum([Amount_Received],[Abbrv_M]="P")
message "PDQ is:"&str(x)
x=filesum([Amount_Received],[Abbrv_M]="O")
message "O is:"&str(x)
' x=filesum([Amount_Received],[Method_Of_Payment]="Other")
' message "other is:"&str(x)
STOP
x=filesum([Invoice_Cost],[Item_Type]="J")
message "F is:"&str(x)
message "J is:"&str(x)
x=filesum([Invoice_Cost],[Item_Type]="T")
message "T is:"&str(x)
x=filesum([Invoice_Cost],[Item_Type]="W")
message "W is:"&str(x)
x=filesum([Invoice_Total],left([Job_Nr],1)="T")
message "Trade is:"&str(x)
x=filesum([Invoice_Total],left([Job_Nr],1)="W")
message "Whouse is:"&str(x)


INCHAR
x=check_2000(today)
message "x is:"&str(x)
'example calls:
'check_2000("01.01.00")   returns   01.01.2000
'check(36612)             returns   28.03.2000   ' if sent as number
'check("36612")           returns   28.03.2000   ' if sent as text


inchar
  vloadif(dpath|"bnkhols1.vw")
  $nextbnkhol = date2(filemax([Dates]))
message "$nextbnkhol) is:"&str($nextbnkhol)
  while true
    while true			
      x = fentrybox(" Enter date of holiday ",10,"##\/##\/####",$nextbnkhol)
      if x = 0
        #holdate = ptstr
        if chkdate(#holdate,1) < 0
          tone("error")
          messbox(#holdate&"is a bad date! Enter again ",0,0,1)
        elseif days(#holdate) < days(today)
          tone("error")
          messbox(" Only future entries allowed ",0,0,1)
        else
          exit while
        end if
      end if
    end while
    screen shortrestore dsa
    x = popuplist(8,54,23,"Christmas˙Day Boxing˙Day New˙Year Good˙Friday Easter˙Monday May˙Day Spring˙Bank˙Holiday Summer˙Bank˙Holiday","",1,0)
    holdes = ptstr
    case holdes
      when "Good˙Friday"
        if dayname(#holdate)<>"Friday"
          messbox(" Incorrect date - re-enter ",0,0,1)
          continue while
        end if
      when "Easter˙Monday"
        if dayname(#holdate)<>"Monday"
          messbox(" Incorrect date - re-enter ",0,0,1)
          continue while
        end if
      when "May˙Day"
        if dayname(#holdate)<>"Monday"
          messbox(" Incorrect date - re-enter ",0,0,1)
          continue while
        end if
      when "Spring˙Bank˙Holiday"
        if dayname(#holdate)<>"Monday"
          messbox(" Incorrect date - re-enter ",0,0,1)
          continue while
        end if
      when "Summer˙Bank˙Holiday"
        if dayname(#holdate)<>"Monday"
          messbox(" Incorrect date - re-enter ",0,0,1)
          continue while
        end if
    end case
  exit while
end while

  data enter lock
    [Dates] = #holdate
    [Description] = holdes
  write-record
  repaint on
  repaint

END MAIN

