Compare commits
7 commits
60cff9a216
...
217b7fa3d7
| Author | SHA1 | Date | |
|---|---|---|---|
| 217b7fa3d7 | |||
| c8eab94bf9 | |||
| afa20dbc94 | |||
| 519b901928 | |||
| 1de668d7a7 | |||
| 32ab2bdc8c | |||
| b8ead5e603 |
8 changed files with 111 additions and 34 deletions
|
|
@ -652,7 +652,7 @@ func connect() {
|
||||||
})
|
})
|
||||||
|
|
||||||
case "get-printdetails-electrical":
|
case "get-printdetails-electrical":
|
||||||
var result2, result3, result4, result5, result6, result7, result8, result9 string
|
var result2, result3, result4, result5, result6, result7, result8 string
|
||||||
array := []string{}
|
array := []string{}
|
||||||
array2 := []string{}
|
array2 := []string{}
|
||||||
array3 := []string{}
|
array3 := []string{}
|
||||||
|
|
@ -661,9 +661,8 @@ func connect() {
|
||||||
array6 := []string{}
|
array6 := []string{}
|
||||||
array7 := []string{}
|
array7 := []string{}
|
||||||
array8 := []string{}
|
array8 := []string{}
|
||||||
array9 := []string{}
|
|
||||||
|
|
||||||
results, err := db.Query(`SELECT DISTINCT IFNULL(el.electricalNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(el.locationofinstallation, '') AS result3, IFNULL(occ.occupancy, '') AS result4, IFNULL(u.occupancyoruse, '') AS result5, IFNULL(el.noofUnits, '') 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.optn, '') AS result9
|
results, err := db.Query(`SELECT DISTINCT IFNULL(el.electricalNo, '') AS result, IFNULL(op.opDate, '') AS result2, IFNULL(el.locationofinstallation, '') AS result3, IFNULL(occ.occupancy, '') AS result4, IFNULL(u.occupancyoruse, '') AS result5, IFNULL(el.noofUnits, '') 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
|
||||||
FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
|
FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
|
||||||
WHERE el.customerid = cu.customerid AND el.ref_elec_occupancyid = u.ref_elec_occupancyid AND u.ref_occupancyid = occ.ref_occupancyid AND op.assessedbyid = e.employeeid
|
WHERE el.customerid = cu.customerid AND el.ref_elec_occupancyid = u.ref_elec_occupancyid AND u.ref_occupancyid = occ.ref_occupancyid AND op.assessedbyid = e.employeeid
|
||||||
AND el.electricalid = op.electricalid AND op.is_approve = 0 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND el.electricalid = ?`, data)
|
AND el.electricalid = op.electricalid AND op.is_approve = 0 AND op.for_approval = 1 AND op.is_release = 0 AND is_paid = 0 AND popstransmitted = 0 AND el.electricalid = ?`, data)
|
||||||
|
|
@ -673,7 +672,7 @@ func connect() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for results.Next() {
|
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)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
c.String(http.StatusBadRequest, err.Error())
|
c.String(http.StatusBadRequest, err.Error())
|
||||||
|
|
@ -687,8 +686,6 @@ func connect() {
|
||||||
array6 = append(array6, result6)
|
array6 = append(array6, result6)
|
||||||
array7 = append(array7, result7)
|
array7 = append(array7, result7)
|
||||||
array8 = append(array8, result8)
|
array8 = append(array8, result8)
|
||||||
array9 = append(array9, result9)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"result": array,
|
"result": array,
|
||||||
|
|
@ -699,7 +696,6 @@ func connect() {
|
||||||
"result6": array6,
|
"result6": array6,
|
||||||
"result7": array7,
|
"result7": array7,
|
||||||
"result8": array8,
|
"result8": array8,
|
||||||
"result9": array9,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
"solidjs-use": "^2.3.0"
|
"solidjs-use": "^2.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@nanostores/solid": "^1.1.1",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/node": "^24.7.0",
|
"@types/node": "^24.7.0",
|
||||||
"sass-embedded": "^1.93.2",
|
"sass-embedded": "^1.93.2",
|
||||||
|
|
|
||||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
|
|
@ -63,6 +63,9 @@ importers:
|
||||||
specifier: ^2.3.0
|
specifier: ^2.3.0
|
||||||
version: 2.3.0
|
version: 2.3.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@nanostores/solid':
|
||||||
|
specifier: ^1.1.1
|
||||||
|
version: 1.1.1(nanostores@1.0.1)(solid-js@1.9.9)
|
||||||
'@types/crypto-js':
|
'@types/crypto-js':
|
||||||
specifier: ^4.2.2
|
specifier: ^4.2.2
|
||||||
version: 4.2.2
|
version: 4.2.2
|
||||||
|
|
@ -618,6 +621,12 @@ packages:
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
solid-js: ^1.8.8
|
solid-js: ^1.8.8
|
||||||
|
|
||||||
|
'@nanostores/solid@1.1.1':
|
||||||
|
resolution: {integrity: sha512-gF0Eat1/c3hOaklBMSVoEjcNzJc5zGk4VSg94H9LPmXYww1pxgr7zylpi3jjyxRu24c8+aYNkmRWzolAwzSA1A==}
|
||||||
|
peerDependencies:
|
||||||
|
nanostores: '>=0.9.0 <2.0.0'
|
||||||
|
solid-js: ^1.6.0
|
||||||
|
|
||||||
'@parcel/watcher-android-arm64@2.5.1':
|
'@parcel/watcher-android-arm64@2.5.1':
|
||||||
resolution: {integrity: sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==}
|
resolution: {integrity: sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
|
|
@ -2353,6 +2362,11 @@ snapshots:
|
||||||
'@solid-primitives/utils': 6.3.2(solid-js@1.9.9)
|
'@solid-primitives/utils': 6.3.2(solid-js@1.9.9)
|
||||||
solid-js: 1.9.9
|
solid-js: 1.9.9
|
||||||
|
|
||||||
|
'@nanostores/solid@1.1.1(nanostores@1.0.1)(solid-js@1.9.9)':
|
||||||
|
dependencies:
|
||||||
|
nanostores: 1.0.1
|
||||||
|
solid-js: 1.9.9
|
||||||
|
|
||||||
'@parcel/watcher-android-arm64@2.5.1':
|
'@parcel/watcher-android-arm64@2.5.1':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { checkConnection, createPdf } from '../../utils/functions'
|
||||||
import { FaSolidThumbsUp } from 'solid-icons/fa'
|
import { FaSolidThumbsUp } from 'solid-icons/fa'
|
||||||
import { _employeeName, _employeeId } from '../../stores/employee'
|
import { _employeeName, _employeeId } from '../../stores/employee'
|
||||||
import { useNavigate } from '@solidjs/router'
|
import { useNavigate } from '@solidjs/router'
|
||||||
|
import { _applicationNo, _date, _optn, _name, _location, _type } from '../../stores/pdfinfo'
|
||||||
|
|
||||||
const API = import.meta.env.VITE_BACKEND
|
const API = import.meta.env.VITE_BACKEND
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
|
|
@ -47,6 +48,10 @@ export default () => {
|
||||||
const [employeeId, setEmployeeId] = createSignal(0)
|
const [employeeId, setEmployeeId] = createSignal(0)
|
||||||
const [employeeName, setEmployeeName] = createSignal('')
|
const [employeeName, setEmployeeName] = createSignal('')
|
||||||
|
|
||||||
|
// const [docApplicationNo, setDocApplicationNo] = createSignal('')
|
||||||
|
// const [docDate, setDocDate] = createSignal('')
|
||||||
|
// const [docLocation, setDocLocation] = createSignal('')
|
||||||
|
|
||||||
const checkAccess = async (access: string) => {
|
const checkAccess = async (access: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await ofetch(`${API}check-access/${access}/${employeeId()}`)
|
const response = await ofetch(`${API}check-access/${access}/${employeeId()}`)
|
||||||
|
|
@ -58,6 +63,26 @@ export default () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPrintDetails = async (id: number) => {
|
||||||
|
const response = await ofetch(API + 'get-printdetails-electrical/' + id)
|
||||||
|
const applicationno = response.result[0]
|
||||||
|
const date = response.result2[0]
|
||||||
|
const location = response.result3[0]
|
||||||
|
const name = response.result8[0]
|
||||||
|
const type = `${response.result4[0]} - ${response.result5[0]}`
|
||||||
|
|
||||||
|
_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)
|
||||||
|
|
||||||
|
// setDocApplicationNo(applicationno)
|
||||||
|
// setDocDate(dayjs(date).format('MMMM DD, YYYY'))
|
||||||
|
// setDocLocation(location)
|
||||||
|
}
|
||||||
|
|
||||||
// const calculateAmounts = () => {
|
// const calculateAmounts = () => {
|
||||||
// const amounts: string[] = amountList()
|
// const amounts: string[] = amountList()
|
||||||
// let gflguList: number[] = []
|
// let gflguList: number[] = []
|
||||||
|
|
@ -114,6 +139,8 @@ export default () => {
|
||||||
// setAmountList(op.result9)
|
// setAmountList(op.result9)
|
||||||
// setDateOpList(op.result10)
|
// setDateOpList(op.result10)
|
||||||
// calculateAmounts()
|
// calculateAmounts()
|
||||||
|
|
||||||
|
getPrintDetails(op.result11[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
const calculateTotal = (list: number[]) => {
|
const calculateTotal = (list: number[]) => {
|
||||||
|
|
@ -161,18 +188,20 @@ export default () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED')
|
// signed = await setNewStatus('ELECTRICAL ORDER OF PAYMENT PRINTED', '171', 'ELECOPPRINTED')
|
||||||
if (!signed) return
|
// if (!signed) return
|
||||||
|
|
||||||
forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE')
|
// forprinting = await setNewStatus('FOR ELECTRICAL OFFICIAL RECEIPT VALIDATION', '98', 'ELECORVALIDATE')
|
||||||
if (!forprinting) return
|
// if (!forprinting) return
|
||||||
|
|
||||||
updateOrderofpayment = await updateOp()
|
// updateOrderofpayment = await updateOp()
|
||||||
|
|
||||||
if (updateOrderofpayment) {
|
// if (updateOrderofpayment) {
|
||||||
setPrintedApplication(application)
|
// setPrintedApplication(application)
|
||||||
setPrinted(true)
|
// setPrinted(true)
|
||||||
}
|
// getPrintDetails(applicationId())
|
||||||
|
createPdf()
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateOp = async () => {
|
const updateOp = async () => {
|
||||||
|
|
|
||||||
10
src/stores/pdfinfo.ts
Normal file
10
src/stores/pdfinfo.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { atom } from 'nanostores'
|
||||||
|
|
||||||
|
export const _optn = atom('')
|
||||||
|
export const _applicationNo = atom('')
|
||||||
|
export const _date = atom('')
|
||||||
|
export const _name = atom('')
|
||||||
|
export const _location = atom('')
|
||||||
|
export const _type = atom('')
|
||||||
|
export const _code = atom('')
|
||||||
|
|
||||||
|
|
@ -77,13 +77,12 @@
|
||||||
padding: 16px
|
padding: 16px
|
||||||
|
|
||||||
.table
|
.table
|
||||||
width: 90%
|
width: 80%
|
||||||
border-collapse: collapse
|
border-collapse: collapse
|
||||||
margin: 2rem
|
margin: 2rem
|
||||||
box-shadow: inset 0 1px 2px #16212C, 0 2px 4px #2a3f5332, 0 4px 8px #344c654e
|
box-shadow: inset 0 1px 2px #16212C, 0 2px 4px #2a3f5332, 0 4px 8px #344c654e
|
||||||
|
|
||||||
th, td
|
th, td
|
||||||
// border: 1px solid vars.$tableBorderColor
|
|
||||||
padding: 0.75rem
|
padding: 0.75rem
|
||||||
text-align: left
|
text-align: left
|
||||||
font-size: 1rem
|
font-size: 1rem
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,25 @@
|
||||||
import jsPDF from 'jspdf'
|
import jsPDF from 'jspdf'
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import jspdfBarcode from 'jspdf-barcode'
|
import jspdfBarcode from 'jspdf-barcode'
|
||||||
|
// import { ofetch } from 'ofetch'
|
||||||
|
// import dayjs from 'dayjs'
|
||||||
|
import { _optn, _applicationNo, _date, _name, _type, _location } from '../../stores/pdfinfo'
|
||||||
|
|
||||||
export default () => {
|
export default async () => {
|
||||||
const PESO = import.meta.env.VITE_PESO
|
const PESO = import.meta.env.VITE_PESO
|
||||||
const OPTN = 'M25-000123'
|
const API = import.meta.env.VITE_API
|
||||||
const APPLICATION = '25-000123'
|
|
||||||
const DATE = 'October 8, 2025'
|
const OPTN = _optn.get()
|
||||||
const NAME = 'BRUCE WAYNE'
|
const APPLICATION = _applicationNo.get()
|
||||||
const LOCATION = 'DAVAO CITY'
|
const DATE = _date.get()
|
||||||
const TYPE = 'RESIDENTIAL - NEW INSTALLATION'
|
const NAME = _name.get()
|
||||||
|
const LOCATION = _location.get()
|
||||||
|
const TYPE = _type.get()
|
||||||
const CODE = '40201010-5-3'
|
const CODE = '40201010-5-3'
|
||||||
const AMOUNT = 100
|
const AMOUNT = 100
|
||||||
const ASSESSOR = 'ENGR. BATMAN'
|
|
||||||
const APPROVER = 'AR. KHASHAYAR L. TOGHYANI'
|
|
||||||
|
|
||||||
|
// const ASSESSOR = 'ENGR. BATMAN'
|
||||||
const init = async () => {
|
// const APPROVER = 'AR. KHASHAYAR L. TOGHYANI'
|
||||||
// console.log('yeah')
|
|
||||||
console.log(PESO)
|
|
||||||
}
|
|
||||||
|
|
||||||
init()
|
|
||||||
|
|
||||||
const doc = new jsPDF({
|
const doc = new jsPDF({
|
||||||
orientation: 'l',
|
orientation: 'l',
|
||||||
|
|
|
||||||
30
src/utils/scripts/optimizeLogo.js
Normal file
30
src/utils/scripts/optimizeLogo.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
import sharp from 'sharp'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
import { consola } from 'consola'
|
||||||
|
;(async () => {
|
||||||
|
try {
|
||||||
|
const dirPath = path.resolve('../../../public')
|
||||||
|
const webpImage = 'src/assets/images/optimized/logo.webp'
|
||||||
|
const avifImage = 'src/assets/images/optimized/logo.avif'
|
||||||
|
const inputSrc = 'src/assets/images/logo.png'
|
||||||
|
|
||||||
|
const avifBuffer = await sharp(inputSrc).avif({ quality: 60 }).resize(props.size).toBuffer()
|
||||||
|
await sharp(avifBuffer).toFile(avifImage)
|
||||||
|
|
||||||
|
const webpBuffer = await sharp(inputSrc).webp({ quality: 75 }).resize(props.size).toBuffer()
|
||||||
|
await sharp(webpBuffer).toFile(webpImage)
|
||||||
|
|
||||||
|
if (fs.existsSync(dirPath)) {
|
||||||
|
const inputSrc = '../../assets/images/logo.png'
|
||||||
|
const favicon = dirPath + '/favicon.png'
|
||||||
|
const faviconBuffer = await sharp(inputSrc).png({ quality: 90 }).resize(50).toBuffer()
|
||||||
|
await sharp(faviconBuffer).toFile(favicon)
|
||||||
|
consola.success('Favicon generated successfully')
|
||||||
|
} else {
|
||||||
|
consola.error('Directory does not exist:', dirPath)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
consola.error('Error generating favicon:', error)
|
||||||
|
}
|
||||||
|
})()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue