From a0b2fd4340680061e243799cf30184de23f26acb Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 18 Nov 2025 17:08:53 +0800 Subject: [PATCH] Added list of printing for building --- backend/main.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/backend/main.go b/backend/main.go index 45a02be..25761e0 100644 --- a/backend/main.go +++ b/backend/main.go @@ -205,6 +205,35 @@ func connect() { "result2": array2, }) + case "get-listopprinting-building": + var result2 string + + array := []string{} + array2 := []string{} + + results, err := db.Query(`SELECT IFNULL(r.applicationNo, '') AS result, IF(c.firstName IS NULL OR c.firstName = '', c.lastName, CONCAT(c.firstName, ' ', IF(c.middleInitial IS NULL OR c.middleInitial = '', '', CONCAT(c.middleInitial, '. ')), c.lastName) ) AS result2 + FROM receiving r JOIN customer c ON r.customerid = c.customerid JOIN ref_occupancy_type rot ON r.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN docflowtxn d ON r.receivingid = d.receivingid + WHERE d.remarks = "FOR ORDER OF PAYMENT PRINT" AND d.is_approve = 0 ORDER BY r.applicationNo ASC LIMIT 10`) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + return + } + for results.Next() { + err = results.Scan(&result, &result2) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + return + } + array = append(array, result) + array2 = append(array2, result2) + } + c.JSON(http.StatusOK, gin.H{ + "result": array, + "result2": array2, + }) + case "get-listopprinting-occupancy": var result2 string