' Il seguente snippet mostra come sia possibile eseguire la valutazione fornitori da task
' N.B. è utilizzabile solo sulla versione 2021.07+ o successiva
dim state as new valforform.valforstate()
state.dmd_ref=new ValforDataModule(DB)
DB.QWSession.DESCRITT.rowset.refresh()
state.dmd_ref.VALFOR.beginappend()
state.dmd_ref.VALFOR.replace("NUMVAL",ltrim(str(DB.QWSession.DESCRITT.rowset.fields("ANNO").value))+right(" "+ltrim(str(DB.QWSession.DESCRITT.rowset.fields("NUMVALFOR").value)),4))
state.dmd_ref.VALFOR.replace("APPL",1)
state.dmd_ref.VALFOR.replace("DATA",Today())
state.dmd_ref.VALFOR.replace("CODRED","AM1")
state.dmd_ref.VALFOR.replace("DATA_INF",ctod("01/01/2021"))
state.dmd_ref.VALFOR.replace("DATA_SUP",ctod("31/12/2021"))
dim msg as string=""
if state.dmd_ref.VALFOR.saverecord(msg)
DB.QWSession.DESCRITT.replace("NUMVALFOR",DB.QWSession.DESCRITT.rowset.fields("NUMVALFOR").value+1)
DB.QWSession.DESCRITT.saverecord()
valforform.Valutazione_Fornitori(DB.QWSession,state) ' Esegue la valutazione
if state.error=""
state.dmd_ref.VALFOR.replace("CALC_ESEG",true)
state.dmd_ref.VALFOR.replace("CODAPPR","AM1")
state.dmd_ref.VALFOR.saverecord()
valforform.Assegna_Qualificazione_Fornitori(DB.QWSession,state) ' Assegna le classi ai fornitori
else
throw new exception(state.error)
end If
Else
throw new exception(msg)
End If
state.dmd_ref.dispose()