Compare commits
No commits in common. "050f98f2960c885f3396a67b25dcf68659b94121" and "225269a7d43c337dfc8277282d571612a08fbc51" have entirely different histories.
050f98f296
...
225269a7d4
4 changed files with 48 additions and 124 deletions
|
|
@ -754,7 +754,7 @@ func connect() {
|
|||
})
|
||||
|
||||
case "get-popsdetails-electrical":
|
||||
var result2, result3, result4, result5, result6, result7, result8, result9 string
|
||||
var result2, result3, result4, result5, result6, result7, result8, result9, result10 string
|
||||
array := []string{}
|
||||
array2 := []string{}
|
||||
array3 := []string{}
|
||||
|
|
@ -764,18 +764,19 @@ func connect() {
|
|||
array7 := []string{}
|
||||
array8 := []string{}
|
||||
array9 := []string{}
|
||||
array10 := []string{}
|
||||
|
||||
results, err := db.Query(`SELECT IFNULL(e.electricalNo, '') AS result, IFNULL(c.customerid, 0) AS result2, IFNULL(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 result3,
|
||||
IFNULL(e.locationofinstallation, '') AS result4, IFNULL(op.amount, '') AS result5, IFNULL(op.amt_Gflgu, '') AS result6, IFNULL(op.amt_Gfdpwh, '') AS result7, IFNULL(op.amt_Tfbo, '') AS result8, IFNULL(ref.accountcode, '') AS result9
|
||||
FROM electrical e JOIN customer c ON e.customerid = c.customerid JOIN electrical_orderofpayment_new op ON e.electricalid = op.electricalid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE e.electricalid = ?`, data)
|
||||
IFNULL(e.locationofinstallation, '') AS result4, IFNULL(op.amount, '') AS result5, IFNULL(op.amt_Gflgu, '') AS result6, IFNULL(op.amt_Gfdpwh, '') AS result7, IFNULL(op.amt_Tfbo, '') AS result8, IFNULL(ref.accountdescription, '') AS result9, IFNULL(ref.accountcode, '') AS result10
|
||||
FROM electrical e JOIN customer c ON e.customerid = c.customerid JOIN electrical_orderofpayment_new op ON e.electricalid = op.electricalid JOIN ref_bldgcomputationsheet ref ON op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid
|
||||
WHERE e.electricalid = ?`, 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, &result5, &result6, &result7, &result8, &result9)
|
||||
err = results.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())
|
||||
|
|
@ -790,17 +791,19 @@ func connect() {
|
|||
array7 = append(array7, result7)
|
||||
array8 = append(array8, result8)
|
||||
array9 = append(array9, result9)
|
||||
array10 = append(array10, result10)
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": array,
|
||||
"result2": array2,
|
||||
"result3": array3,
|
||||
"result4": array4,
|
||||
"result5": array5,
|
||||
"result6": array6,
|
||||
"result7": array7,
|
||||
"result8": array8,
|
||||
"result9": array9,
|
||||
"result": array,
|
||||
"result2": array2,
|
||||
"result3": array3,
|
||||
"result4": array4,
|
||||
"result5": array5,
|
||||
"result6": array6,
|
||||
"result7": array7,
|
||||
"result8": array8,
|
||||
"result9": array9,
|
||||
"result10": array10,
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
@ -956,24 +959,18 @@ func connect() {
|
|||
|
||||
dbpost, err := db.Prepare("UPDATE electricaldocflowtxn SET is_approve = 1 WHERE electricalid = ? AND remarks = ?")
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
panic(err.Error())
|
||||
}
|
||||
defer dbpost.Close()
|
||||
|
||||
exec, err := dbpost.Exec(updateDocflowData.Data, updateDocflowData.Data2)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
affect, err := exec.RowsAffected()
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
if affect > 0 {
|
||||
|
|
@ -1118,52 +1115,5 @@ func connect() {
|
|||
}
|
||||
})
|
||||
|
||||
router.POST("/api/update-opapproved-electrical", func(c *gin.Context) {
|
||||
type UpdateOpData struct {
|
||||
Data int `json:"data"`
|
||||
}
|
||||
var updateOpData UpdateOpData
|
||||
if err := c.ShouldBindJSON(&updateOpData); err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, "Invalid request body")
|
||||
return
|
||||
}
|
||||
|
||||
c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||
c.Writer.Header().Set("X-Frame-Options", "DENY")
|
||||
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
|
||||
dbpost, err := db.Prepare("UPDATE electrical_orderofpayment_new SET is_approve = 1 WHERE electricalid = ? AND for_approval = 1 AND is_paid = 0")
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
}
|
||||
defer dbpost.Close()
|
||||
|
||||
exec, err := dbpost.Exec(updateOpData.Data)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
}
|
||||
|
||||
affect, err := exec.RowsAffected()
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
return
|
||||
}
|
||||
|
||||
if affect > 0 {
|
||||
c.String(http.StatusOK, "Success on Updating Order of Payment on Approval")
|
||||
} else {
|
||||
c.String(http.StatusInternalServerError, "Failed on Updating Order of Payment on Approval")
|
||||
}
|
||||
})
|
||||
|
||||
router.Run(":4320")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,22 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="name" content="OCBO e-Sign Server" />
|
||||
<meta name="description" content="Backend application for OCBO e-Sign" />
|
||||
<meta name="author" content="Patrick Alvin Alcala" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>OCBO e-Sign Server</title>
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #16212c;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
padding: 20px 0;
|
||||
color: rgba(255, 255, 255, 0.848);
|
||||
padding: 20px;
|
||||
color: white;
|
||||
font-size: 3.25rem;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 768px) {
|
||||
.title {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<meta property="og:description" content="Digital Signature added for OCBO (Office of the City Building Official)" />
|
||||
<meta property="og:type" content="website" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
|
||||
<!-- <link rel="preconnect" href="https://cdn.jsdelivr.net" /> -->
|
||||
<title>OCBO e-Sign</title>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ import { _applicationNo, _date, _optn, _name, _location, _type, _assessor, _feeL
|
|||
const API = import.meta.env.VITE_BACKEND
|
||||
const PESO = import.meta.env.VITE_PESO
|
||||
const ID = import.meta.env.VITE_HEADID
|
||||
const NAME = import.meta.env.VITE_HEAD
|
||||
const PUBLICIP = import.meta.env.VITE_PUBLICIP
|
||||
|
||||
export default () => {
|
||||
const navigate = useNavigate()
|
||||
|
|
@ -110,10 +108,9 @@ export default () => {
|
|||
updateOrderofpayment = await updateOp()
|
||||
|
||||
if (updateOrderofpayment) {
|
||||
postTransaction()
|
||||
postPops(application)
|
||||
setApprovedApplication(application)
|
||||
setApproved(true)
|
||||
postTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,48 +142,34 @@ export default () => {
|
|||
}
|
||||
}
|
||||
|
||||
// const getPrintDetails = async (id: number) => {
|
||||
// const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||
// const applicationno = response.result
|
||||
// const date = response.result2
|
||||
// const location = response.result3
|
||||
// const name = response.result8
|
||||
// const type = `${response.result4} - ${response.result5}`
|
||||
// const assessor = response.result7
|
||||
const getPrintDetails = async (id: number) => {
|
||||
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||
const applicationno = response.result
|
||||
const date = response.result2
|
||||
const location = response.result3
|
||||
const name = response.result8
|
||||
const type = `${response.result4} - ${response.result5}`
|
||||
const assessor = response.result7
|
||||
|
||||
// _optn.set('M' + applicationno.split('-')[0] + applicationno.split('-')[1])
|
||||
// _applicationNo.set(applicationno)
|
||||
// _date.set(dayjs(date).format('MMMM DD, YYYY'))
|
||||
// _name.set(name)
|
||||
// _location.set(location)
|
||||
// _type.set(type)
|
||||
// _assessor.set(assessor)
|
||||
// _assessorid.set(employeeId())
|
||||
// }
|
||||
_optn.set('M' + applicationno.split('-')[0] + applicationno.split('-')[1])
|
||||
_applicationNo.set(applicationno)
|
||||
_date.set(dayjs(date).format('MMMM DD, YYYY'))
|
||||
_name.set(name)
|
||||
_location.set(location)
|
||||
_type.set(type)
|
||||
_assessor.set(assessor)
|
||||
_assessorid.set(employeeId())
|
||||
}
|
||||
|
||||
const postPops = async (application: string) => {
|
||||
const applicationId = await ofetch(API + 'get-idbyapplication-electrical/' + application, { parseResponse: JSON.parse })
|
||||
const response = await ofetch(API + 'get-popsdetails-electrical/' + applicationId.result, { parseResponse: JSON.parse })
|
||||
const applicationNo = response.result[0]
|
||||
const customerid = response.result2[0]
|
||||
const customerName = response.result3[0]
|
||||
const location = response.result4[0]
|
||||
const amountList = response.result5
|
||||
const lguList = response.result6
|
||||
const dpwhList = response.result7
|
||||
const boList = response.result8
|
||||
const codeList = response.result9
|
||||
|
||||
const today = new Date()
|
||||
const formattedDate = dayjs(today).format('YYYY-MM-DD')
|
||||
const formattedDatewithTime = dayjs(today).format('YYYY-MM-DD HH:mm:ss')
|
||||
|
||||
for (let i = 0; i < applicationNo.length; i++) {
|
||||
await ofetch(API + 'post-pops', {
|
||||
method: 'POST',
|
||||
body: { data: application, data2: formattedDate, data3: customerid, data4: customerName, data5: location, data6: codeList[i], data7: amountList[i], data8: NAME, data9: formattedDatewithTime, data10: lguList[i], data11: dpwhList[i], data12: boList[i], data13: PUBLICIP },
|
||||
})
|
||||
}
|
||||
await ofetch(API + 'update-opapproved-electrical', {
|
||||
method: 'POST',
|
||||
body: { data: application, data2: formattedDate },
|
||||
})
|
||||
}
|
||||
|
||||
// const calculateAmounts = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue