####################################################################
IF [MIH1]BPRVCR<>””
Local Char REQUEST1(255)(8)
REQUEST1(0) = ” SELECT NUM_0 FROM “+nomap+”.PINVOICE P “
REQUEST1(1) = ” WHERE P.BPR_0='”+[PIH0]BPR+”‘ AND UPPER(P.BPRVCR_0)=UPPER(‘”+[PIH1]BPRVCR+”‘) and “
REQUEST1(2) = ” P.BPRDAT_0 BETWEEN DateFromParts((CASE WHEN MONTH(‘”+[MIH1]BPRDAT+”‘) IN(1,2,3) THEN (YEAR(‘”+[MIH1]BPRDAT+”‘)-1) ELSE YEAR(‘”+[M:PIH1]BPRDAT+”‘) END),04,01) “
REQUEST1(3) = ” and DateFromParts((CASE WHEN MONTH(‘”+[M:PIH1]BPRDAT+”‘) NOT IN(1,2,3) THEN (YEAR(‘”+[M:PIH1]BPRDAT+”‘)+1) ELSE YEAR(‘”+[M:PIH1]BPRDAT+”‘) END),03,31)”
FOR (Char DTEXTE_0) FROM “5” Sql REQUEST1 As [YCHD]
IF [M:PIH0]NUM =[YCHD]DTEXTE_0
ELSE
INFBOX “This Supplier Document number ” +num$([M:PIH1]BPRVCR)+” already enteredon invoice “+[YCHD]DTEXTE_0
OK =0
GOK = 0
GPE = 1
ENDIF
NEXT
ENDIF
####################################################################