diff --git a/backend/main.go b/backend/main.go index 0753780..3f179b4 100644 --- a/backend/main.go +++ b/backend/main.go @@ -692,7 +692,7 @@ func connect() { array5 := []string{} array6 := []string{} - results, err := db.Query(`SELECT IFNULL(r.locationofconstruction, '') AS result, IFNULL(CONCAT(ro.occupancy, '-', rot.occupancyType), '') AS result2, IFNULL(em.employeename, '') AS result3, IFNULL(o.amount, '') AS result4, IFNULL(o.assessedDate, '') AS result5, IFNULL(oc.occupancyid, 0) AS result6 + results, err := db.Query(`SELECT IFNULL(r.locationofconstruction, '') AS result, IFNULL(CONCAT(ro.occupancy, ' - ', rot.occupancyType), '') AS result2, IFNULL(em.employeename, '') AS result3, IFNULL(o.amount, '') AS result4, IFNULL(o.assessedDate, '') AS result5, IFNULL(oc.occupancyid, 0) AS result6 FROM occupancy oc LEFT JOIN receiving r ON oc.bldgApplicationNo = r.applicationNo JOIN ref_occupancy_type rot ON oc.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN occupancy_orderofpayment o ON oc.occupancyid = o.occupancyid JOIN employee em ON o.assessedbyid = em.employeeid WHERE oc.controlNo = ?`, data) if err != nil { @@ -779,26 +779,27 @@ func connect() { }) case "get-printdetails-occupancy": - var result2, result3, result4, result5, result6, result7, result8 string + var result2, result3, result4, result5, result6, result7, result8, result9, result10 string - err := db.QueryRow(`SELECT DISTINCT IFNULL(o.controlNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(r.locationofconstruction, '') AS result3, IFNULL(ro.occupancy, '') AS result4, IFNULL(rot.occupancyType, '') AS result5, IFNULL(o.noOfPermitsApplied, '') AS result6, IFNULL(e.employeename, '') AS result7, - IF(cu.firstName IS NULL OR cu.firstName = '', cu.lastName, CONCAT(cu.firstName, ' ', IF(cu.middleInitial IS NULL OR cu.middleInitial = '', '', CONCAT(cu.middleInitial, '. ')), cu.lastName) ) AS result8 + err := db.QueryRow(`SELECT DISTINCT IFNULL(o.controlNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(r.locationofconstruction, '') AS result3, IFNULL(ro.occupancy, '') AS result4, IFNULL(rot.occupancyType, '') AS result5, IFNULL(o.noOfPermitsApplied, '') AS result6, IFNULL(e.employeename, '') AS result7, IF(cu.firstName IS NULL OR cu.firstName = '', cu.lastName, CONCAT(cu.firstName, ' ', IF(cu.middleInitial IS NULL OR cu.middleInitial = '', '', CONCAT(cu.middleInitial, '. ')), cu.lastName) ) AS result8, IFNULL(op.numUnits, 0) AS result9, IFNULL(o.totalFloorArea, 0) AS result10 FROM occupancy o LEFT JOIN receiving r on o.bldgApplicationNo = r.applicationNo JOIN occupancy_orderofpayment op ON o.occupancyid = op.occupancyid JOIN ref_occupancy_type rot ON o.ref_occupancy_typeid = rot.ref_occupancy_typeid JOIN ref_occupancy ro ON rot.ref_occupancyid = ro.ref_occupancyid JOIN customer cu ON o.customerid = cu.customerid JOIN employee e ON op.assessedbyid = e.employeeid - WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND o.occupancyid = ?`, data).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8) + WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND o.occupancyid = ?`, data).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8, &result9, &result10) if err != nil { c.AbortWithError(http.StatusBadRequest, err) c.String(http.StatusBadRequest, err.Error()) return } c.JSON(http.StatusOK, gin.H{ - "result": result, - "result2": result2, - "result3": result3, - "result4": result4, - "result5": result5, - "result6": result6, - "result7": result7, - "result8": result8, + "result": result, + "result2": result2, + "result3": result3, + "result4": result4, + "result5": result5, + "result6": result6, + "result7": result7, + "result8": result8, + "result9": result9, + "result10": result10, }) case "get-printdetails-electrical":