Added getting list of assessors on backend

This commit is contained in:
Patrick Alvin Alcala 2025-09-22 11:43:49 +08:00
parent 71564cd6fa
commit 788007ca03

View file

@ -98,22 +98,47 @@ func connect() {
case "get-listopapproval-electrical":
array := []string{}
results, err := db.Query("SELECT DISTINCT electricalid FROM electricaldocflowtxn WHERE remarks = 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL'")
results, err := db.Query("SELECT DISTINCT electricalid as result FROM electricaldocflowtxn WHERE remarks = 'FOR ELECTRICAL ORDER OF PAYMENT APPROVAL'")
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
})
err = results.Scan(&result)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
})
case "get-list-assessors":
var result2 string
array := []string{}
array2 := []string{}
results, err := db.Query("SELECT employeeid as result, employeename as result2 FROM employee WHERE is_assessment = 1")
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
for results.Next() {
err = results.Scan(&result, &result2)
if err != nil {
c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error())
}
array = append(array, result)
array2 = append(array2, result2)
}
c.JSON(http.StatusOK, gin.H{
"result": array,
"result2": array2,
})
}
})
@ -336,6 +361,7 @@ func connect() {
"result4": array4,
})
case "get-laststatus-building":
err := db.QueryRow(`SELECT IFNULL(remarks, '') AS result FROM docflowtxn WHERE docflowtxnid = (SELECT MAX(docflowtxnid) FROM docflowtxn WHERE receivingid = ?)`, data).Scan(&result)
if err != nil {
@ -397,6 +423,8 @@ func connect() {
"result": result,
})
case "GetFeesBuilding":
var result2, result3 string
array := []string{}