Compare commits

..

No commits in common. "320a53aac9db03d603b67158ca660427ff7f61e2" and "217b7fa3d78ea6c0a6220d3faa81541a7a5518f4" have entirely different histories.

4 changed files with 46 additions and 115 deletions

View file

@ -653,67 +653,26 @@ func connect() {
case "get-printdetails-electrical": case "get-printdetails-electrical":
var result2, result3, result4, result5, result6, result7, result8 string var result2, result3, result4, result5, result6, result7, result8 string
// array := []string{}
// array2 := []string{}
// array3 := []string{}
// array4 := []string{}
// array5 := []string{}
// array6 := []string{}
// array7 := []string{}
// array8 := []string{}
err := db.QueryRow(`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
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).Scan(&result, &result2, &result3, &result4, &result5, &result6, &result7, &result8)
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)
// 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)
// array5 = append(array5, result5)
// array6 = append(array6, result6)
// array7 = append(array7, result7)
// array8 = append(array8, result8)
// }
c.JSON(http.StatusOK, gin.H{
"result": result,
"result2": result2,
"result3": result3,
"result4": result4,
"result5": result5,
"result6": result6,
"result7": result7,
"result8": result8,
})
case "get-printdetailsfees-electrical":
var result2, result3 string
array := []string{} array := []string{}
array2 := []string{} array2 := []string{}
array3 := []string{} array3 := []string{}
array4 := []string{}
array5 := []string{}
array6 := []string{}
array7 := []string{}
array8 := []string{}
results, err := db.Query(`SELECT IFNULL(ref.accountdescription, '') AS result, IFNULL(ref.accountcode, '') AS result2, IFNULL(op.amount, '') AS result3 FROM electrical_orderofpayment_new op, ref_bldgcomputationsheet ref, electrical el 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
WHERE op.is_approve = 0 AND op.for_approval = 1 AND op.is_release = 0 AND op.is_paid = 0 AND op.popstransmitted = 0 AND op.is_delete <> 1 AND op.ref_bldgcomputationsheetid = ref.ref_bldgcomputationsheetid FROM electrical el, electrical_orderofpayment_new op, ref_occupancy occ, ref_elec_occupancy u, customer cu, employee e
AND el.electricalid = op.electricalid AND op.electricalid = ?`, data) 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)
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())
return return
} }
for results.Next() { for results.Next() {
err = results.Scan(&result, &result2, &result3) 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())
@ -722,11 +681,21 @@ func connect() {
array = append(array, result) array = append(array, result)
array2 = append(array2, result2) array2 = append(array2, result2)
array3 = append(array3, result3) array3 = append(array3, result3)
array4 = append(array4, result4)
array5 = append(array5, result5)
array6 = append(array6, result6)
array7 = append(array7, result7)
array8 = append(array8, result8)
} }
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"result": array, "result": array,
"result2": array2, "result2": array2,
"result3": array3, "result3": array3,
"result4": array4,
"result5": array5,
"result6": array6,
"result7": array7,
"result8": array8,
}) })
} }

View file

@ -9,7 +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, _assessor, _feeList, _codeList, _amountList } from '../../stores/pdfinfo' 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
@ -65,12 +65,11 @@ export default () => {
const getPrintDetails = async (id: number) => { const getPrintDetails = async (id: number) => {
const response = await ofetch(API + 'get-printdetails-electrical/' + id) const response = await ofetch(API + 'get-printdetails-electrical/' + id)
const applicationno = response.result const applicationno = response.result[0]
const date = response.result2 const date = response.result2[0]
const location = response.result3 const location = response.result3[0]
const name = response.result8 const name = response.result8[0]
const type = `${response.result4} - ${response.result5}` const type = `${response.result4[0]} - ${response.result5[0]}`
const assessor = response.result7
_optn.set('M' + applicationno.split('-')[0] + applicationno.split('-')[1]) _optn.set('M' + applicationno.split('-')[0] + applicationno.split('-')[1])
_applicationNo.set(applicationno) _applicationNo.set(applicationno)
@ -78,18 +77,10 @@ export default () => {
_name.set(name) _name.set(name)
_location.set(location) _location.set(location)
_type.set(type) _type.set(type)
_assessor.set(assessor)
}
const getPrintDetailsFees = async (id: number) => { // setDocApplicationNo(applicationno)
const response = await ofetch(API + 'get-printdetailsfees-electrical/' + id) // setDocDate(dayjs(date).format('MMMM DD, YYYY'))
const feeList = response.result // setDocLocation(location)
const accountCodeList = response.result2
const amountList = response.result3
_feeList.set(feeList)
_codeList.set(accountCodeList)
_amountList.set(amountList)
} }
// const calculateAmounts = () => { // const calculateAmounts = () => {
@ -150,7 +141,6 @@ export default () => {
// calculateAmounts() // calculateAmounts()
getPrintDetails(op.result11[0]) getPrintDetails(op.result11[0])
getPrintDetailsFees(op.result11[0])
} }
const calculateTotal = (list: number[]) => { const calculateTotal = (list: number[]) => {

View file

@ -7,8 +7,4 @@ export const _name = atom('')
export const _location = atom('') export const _location = atom('')
export const _type = atom('') export const _type = atom('')
export const _code = atom('') export const _code = atom('')
export const _assessor = atom('')
export const _feeList = atom<string[]>([])
export const _codeList = atom<string[]>([])
export const _amountList = atom<string[]>([])

View file

@ -1,7 +1,9 @@
import jsPDF from 'jspdf' import jsPDF from 'jspdf'
// @ts-ignore // @ts-ignore
import jspdfBarcode from 'jspdf-barcode' import jspdfBarcode from 'jspdf-barcode'
import { _optn, _applicationNo, _date, _name, _type, _location, _assessor, _feeList, _codeList, _amountList } from '../../stores/pdfinfo' // import { ofetch } from 'ofetch'
// import dayjs from 'dayjs'
import { _optn, _applicationNo, _date, _name, _type, _location } from '../../stores/pdfinfo'
export default async () => { export default async () => {
const PESO = import.meta.env.VITE_PESO const PESO = import.meta.env.VITE_PESO
@ -15,11 +17,9 @@ export default async () => {
const TYPE = _type.get() const TYPE = _type.get()
const CODE = '40201010-5-3' const CODE = '40201010-5-3'
const AMOUNT = 100 const AMOUNT = 100
const ASSESSOR = _assessor.get()
const APPROVER = 'AR. KHASHAYAR L. TOGHYANI' // const ASSESSOR = 'ENGR. BATMAN'
const FEES = _feeList.get() // const APPROVER = 'AR. KHASHAYAR L. TOGHYANI'
const CODES = _codeList.get()
const AMOUNTS = _amountList.get()
const doc = new jsPDF({ const doc = new jsPDF({
orientation: 'l', orientation: 'l',
@ -158,53 +158,29 @@ export default async () => {
doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 84) doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 84)
doc.setFont('arial', 'normal') doc.setFont('arial', 'normal')
// doc.text('SAMPLE FEE', 16, 92) doc.text('SAMPLE FEE', 16, 92)
// doc.text('ANOTHER SAMPLE FEE', 16, 96) doc.text('ANOTHER SAMPLE FEE', 16, 96)
let yPosition = 92 doc.text(CODE, 76, 92)
FEES.forEach((fee) => { doc.text(CODE, 76, 96)
doc.text(fee, 16, yPosition)
yPosition += 4
})
yPosition = 92
CODES.forEach((code) => {
doc.text(code, 76, yPosition)
yPosition += 4
})
yPosition = 92
AMOUNTS.forEach((amount) => {
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 122, yPosition)
yPosition += 4
})
doc.text(`P ${AMOUNT.toFixed(2)}`, 122, 92)
doc.text(`P ${AMOUNT.toFixed(2)}`, 122, 96)
doc.text('x1', 140, 92) doc.text('x1', 140, 92)
doc.text('x1', 140, 96) doc.text('x1', 140, 96)
doc.text('=', 148, 92) doc.text('=', 148, 92)
doc.text('=', 148, 96) doc.text('=', 148, 96)
doc.setFont('arial-bold', 'bold')
yPosition = 92 doc.text(`P ${AMOUNT.toFixed(2)}`, 156, 92)
AMOUNTS.forEach((amount) => { doc.text(`P ${AMOUNT.toFixed(2)}`, 156, 96)
doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 156, yPosition)
yPosition += 4
})
doc.setFont('arial-bold', 'bold') doc.setFont('arial-bold', 'bold')
doc.text('Assessed By :', 16, 112) doc.text('Assessed By :', 16, 112)
doc.text('Approved By :', 142, 112) doc.text('Approved By :', 142, 112)
doc.text(ASSESSOR, 16, 128)
doc.text(APPROVER, 142, 128)
doc.setFont('arial', 'normal')
doc.setFontSize(6)
doc.text('Officer-in-Charge', 154, 132)
// doc.text(CODE, 76, 96) // doc.text(CODE, 76, 96)
doc.setFont('arial-bold', 'bold') // doc.setFont('arial', 'normal')
doc.setFontSize(7) doc.text('Please use the OPTN when paying online.', 16, 136)
doc.text('Please use the OPTN when paying online.', 16, 140)
const note = doc.splitTextToSize('Note: The 72 Hours Transaction Policy of the City Mayor, shall commence upon submission of the Bureau of Fire Protection clearance/certificate and other requirement stated in the notice to comply to be issued by this office.', 185) const note = doc.splitTextToSize('Note: The 72 Hours Transaction Policy of the City Mayor, shall commence upon submission of the Bureau of Fire Protection clearance/certificate and other requirement stated in the notice to comply to be issued by this office.', 185)
doc.text(note, 16, 144) doc.text(note, 16, 144)