Fixed missing details on backend
This commit is contained in:
parent
45f8cf85d2
commit
4b80ad9c83
1 changed files with 8 additions and 8 deletions
|
|
@ -108,8 +108,8 @@ func connect() {
|
|||
array2 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(o.controlNo, '') 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 occupancy o JOIN customer c ON o.customerid = c.customerid JOIN ref_occupancy_type ot ON o.ref_occupancy_typeid = ot.ref_occupancy_typeid JOIN ref_occupancy ro ON ot.ref_occupancyid = ro.ref_occupancyid JOIN occupancydocflowtxn od ON o.occupancyid = od.occupancyreceivingid
|
||||
JOIN (SELECT occupancyreceivingid, MAX(occupancydocflowtxnid) AS latest_occupancydocflowtxnid FROM occupancydocflowtxn GROUP BY occupancyreceivingid) latest_doc ON od.occupancyreceivingid = latest_doc.occupancyreceivingid AND od.occupancydocflowtxnid = latest_doc.latest_occupancydocflowtxnid WHERE remarks = ? AND is_approve = 0 ORDER BY od.txndate DESC`, "FOR OCCUPANCY RECOMMENDING APPROVAL")
|
||||
FROM occupancy o JOIN customer c ON o.customerid = c.customerid JOIN ref_occupancy_type ot ON o.ref_occupancy_typeid = ot.ref_occupancy_typeid JOIN ref_occupancy ro ON ot.ref_occupancyid = ro.ref_occupancyid JOIN occupancydocflowtxn od ON o.occupancyid = od.occupancyreceivingid JOIN (SELECT occupancyreceivingid, MAX(occupancydocflowtxnid) AS latest_occupancydocflowtxnid FROM occupancydocflowtxn GROUP BY occupancyreceivingid) latest_doc ON od.occupancyreceivingid = latest_doc.occupancyreceivingid AND od.occupancydocflowtxnid = latest_doc.latest_occupancydocflowtxnid
|
||||
WHERE (remarks = "FOR OCCUPANCY RECOMMENDING APPROVAL" OR remarks = "FOR ADDITIONAL ORDER OF PAYMENT RECOMMENDING APPROVAL") AND od.is_approve = 0 ORDER BY od.txndate DESC`)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
|
|
@ -1214,7 +1214,7 @@ func connect() {
|
|||
|
||||
router.POST("/api/update-docflow-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
||||
type UpdateDocflowData struct {
|
||||
Data int `json:"data"`
|
||||
Data string `json:"data"`
|
||||
Data2 string `json:"data2"`
|
||||
}
|
||||
var updateDocflowData UpdateDocflowData
|
||||
|
|
@ -1230,7 +1230,7 @@ func connect() {
|
|||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
dbpost, err := db.Prepare("UPDATE occupancydocflowtxn SET is_approve = 1 WHERE occupancyreceivingid = ? AND remarks = ?")
|
||||
dbpost, err := db.Prepare("UPDATE occupancydocflowtxn SET is_approve = 1 WHERE remarks = ? AND occupancyreceivingid = (SELECT occupancyid FROM occupancy WHERE controlNo = ?)")
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
|
|
@ -1261,7 +1261,7 @@ func connect() {
|
|||
|
||||
router.POST("/api/update-docflow-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||
type UpdateDocflowData struct {
|
||||
Data int `json:"data"`
|
||||
Data string `json:"data"`
|
||||
Data2 string `json:"data2"`
|
||||
}
|
||||
var updateDocflowData UpdateDocflowData
|
||||
|
|
@ -1277,7 +1277,7 @@ func connect() {
|
|||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
dbpost, err := db.Prepare("UPDATE electricaldocflowtxn SET is_approve = 1 WHERE electricalid = ? AND remarks = ?")
|
||||
dbpost, err := db.Prepare("UPDATE electricaldocflowtxn SET is_approve = 1 WHERE remarks = ? AND electricalid = (SELECT electricalid FROM electrical WHERE electricalNo = ?)")
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
|
|
@ -1323,7 +1323,7 @@ func connect() {
|
|||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
dbpost, err := db.Prepare("UPDATE iips.occupancy_orderofpayment SET popstransmitted = 1, is_release = 1 WHERE occupancyid = ? AND for_approval = 1 AND is_paid = 0 AND is_approve = 1")
|
||||
dbpost, err := db.Prepare("UPDATE occupancy_orderofpayment SET popstransmitted = 1, is_release = 1 WHERE occupancyid = ? AND for_approval = 1 AND is_paid = 0 AND is_approve = 1")
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue