' Questo script restituisce true se c'è stato almeno un rifiuto sulla fase indicata
Dim tipo, tipo_cont, numero As String
Dim ind_rev As Integer
UnPackCode("DW", CODDOC, tipo, tipo_cont, numero, ind_rev)
Dim par As New AssocArray
par("T") = tipo
par("TC") = tipo_cont
par("N") = numero
par("IR") = ind_rev
par("FASE") = "" ' inserire qui il codice della fase
Dim q1 As QWTable
Dim msg As String
q1 = OpenTable(DB, "select * from DOC_REVE where TIPO=:T and TIPO_CONT=:TC and NUMERO=:N and IND_REV=:IR and RIFIUTATO= 1 and TIPO_P=:FASE", par, False, False, msg)
Dim result As Boolean
If String.IsNullOrEmpty(msg) Then
If q1.RowSet.Count() > 0 Then
result = True
Else
result = False
End If
Else
result = False
End If
CloseTable(q1)
Return result