Updated backend
This commit is contained in:
parent
d2eff35791
commit
f029c4a651
1 changed files with 45 additions and 11 deletions
|
|
@ -15,12 +15,12 @@ import (
|
|||
)
|
||||
|
||||
// DEV
|
||||
var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
||||
var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
||||
// var connection string = "root:superuser@tcp(localhost:3306)/iips"
|
||||
// var connectionPops string = "root:superuser@tcp(localhost:3306)/pops"
|
||||
|
||||
// SERVER
|
||||
// var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
||||
// var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||
var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips"
|
||||
var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops"
|
||||
|
||||
func main() {
|
||||
err := godotenv.Load()
|
||||
|
|
@ -46,13 +46,13 @@ func connect() {
|
|||
router.Use(cors.Default())
|
||||
|
||||
//DEV
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
AllowMethods: []string{"GET", "POST"},
|
||||
AllowHeaders: []string{"Origin", "OCBO-Token"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
AllowCredentials: true,
|
||||
}))
|
||||
// router.Use(cors.New(cors.Config{
|
||||
// AllowOrigins: []string{"http://localhost:5173"},
|
||||
// AllowMethods: []string{"GET", "POST"},
|
||||
// AllowHeaders: []string{"Origin", "OCBO-Token"},
|
||||
// ExposeHeaders: []string{"Content-Length"},
|
||||
// AllowCredentials: true,
|
||||
// }))
|
||||
|
||||
//SERVER
|
||||
// router.Use(cors.New(cors.Config{
|
||||
|
|
@ -856,6 +856,40 @@ func connect() {
|
|||
"result3": array3,
|
||||
})
|
||||
|
||||
case "get-printdetailsfees-bldgadditional":
|
||||
var result2, result3, result4 string
|
||||
array := []string{}
|
||||
array2 := []string{}
|
||||
array3 := []string{}
|
||||
array4 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3, IFNULL(op.numUnits, 0) AS result4
|
||||
FROM occupancy o JOIN building_orderofpayment op ON o.occupancyid = op.occupancyid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE op.is_approve = 1 AND op.for_approval = 1 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.occupancyid = ?`, data)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
for results.Next() {
|
||||
err = results.Scan(&result, &result2, &result3, &result4)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
array = append(array, result)
|
||||
array2 = append(array2, result2)
|
||||
array3 = append(array3, result3)
|
||||
array4 = append(array4, result4)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": array,
|
||||
"result2": array2,
|
||||
"result3": array3,
|
||||
"result4": array4,
|
||||
})
|
||||
|
||||
case "get-printdetailsfees-electrical":
|
||||
var result2, result3 string
|
||||
array := []string{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue