Format output for the proper code syntax, this should fix many various issues with output formatting and page breakage

This commit is contained in:
johnnyq
2022-12-02 19:58:21 -05:00
parent 3067e6bd1e
commit b6e540825f
128 changed files with 1222 additions and 1227 deletions

214
quote.php
View File

@@ -16,44 +16,44 @@ if(isset($_GET['quote_id'])){
$row = mysqli_fetch_array($sql);
$quote_id = $row['quote_id'];
$quote_prefix = $row['quote_prefix'];
$quote_number = $row['quote_number'];
$quote_scope = $row['quote_scope'];
$quote_status = $row['quote_status'];
$quote_prefix = htmlentities($row['quote_prefix']);
$quote_number = htmlentities($row['quote_number']);
$quote_scope = htmlentities($row['quote_scope']);
$quote_status = htmlentities($row['quote_status']);
$quote_date = $row['quote_date'];
$quote_amount = $row['quote_amount'];
$quote_currency_code = $row['quote_currency_code'];
$quote_note = $row['quote_note'];
$quote_url_key = $row['quote_url_key'];
$quote_amount = htmlentities($row['quote_amount']);
$quote_currency_code = htmlentities($row['quote_currency_code']);
$quote_note = htmlentities($row['quote_note']);
$quote_url_key = htmlentities($row['quote_url_key']);
$quote_created_at = $row['quote_created_at'];
$category_id = $row['quote_category_id'];
$client_id = $row['client_id'];
$client_name = $row['client_name'];
$location_address = $row['location_address'];
$location_city = $row['location_city'];
$location_state = $row['location_state'];
$location_zip = $row['location_zip'];
$contact_email = $row['contact_email'];
$client_name = htmlentities($row['client_name']);
$location_address = htmlentities($row['location_address']);
$location_city = htmlentities($row['location_city']);
$location_state = htmlentities($row['location_state']);
$location_zip = htmlentities($row['location_zip']);
$contact_email = htmlentities($row['contact_email']);
$contact_phone = formatPhoneNumber($row['contact_phone']);
$contact_extension = $row['contact_extension'];
$contact_extension = htmlentities($row['contact_extension']);
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
$client_website = $row['client_website'];
$client_currency_code = $row['client_currency_code'];
$client_net_terms = $row['client_net_terms'];
$client_website = htmlentities($row['client_website']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = htmlentities($row['client_net_terms']);
if($client_net_terms == 0){
$client_net_terms = $config_default_net_terms;
}
$company_id = $row['company_id'];
$company_name = $row['company_name'];
$company_country = $row['company_country'];
$company_address = $row['company_address'];
$company_city = $row['company_city'];
$company_state = $row['company_state'];
$company_zip = $row['company_zip'];
$company_name = htmlentities($row['company_name']);
$company_country = htmlentities($row['company_country']);
$company_address = htmlentities($row['company_address']);
$company_city = htmlentities($row['company_city']);
$company_state = htmlentities($row['company_state']);
$company_zip = htmlentities($row['company_zip']);
$company_phone = formatPhoneNumber($row['company_phone']);
$company_email = $row['company_email'];
$company_website = $row['company_website'];
$company_logo = $row['company_logo'];
$company_email = htmlentities($row['company_email']);
$company_website = htmlentities($row['company_website']);
$company_logo = htmlentities($row['company_logo']);
if(!empty($company_logo)){
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
}
@@ -221,13 +221,13 @@ if(isset($_GET['quote_id'])){
while($row = mysqli_fetch_array($sql_items)){
$item_id = $row['item_id'];
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$item_quantity = $row['item_quantity'];
$item_price = $row['item_price'];
$item_subtotal = $row['item_price'];
$item_tax = $row['item_tax'];
$item_total = $row['item_total'];
$item_name = htmlentities($row['item_name']);
$item_description = htmlentities($row['item_description']);
$item_quantity = htmlentities($row['item_quantity']);
$item_price = htmlentities($row['item_price']);
$item_subtotal = htmlentities($row['item_price']);
$item_tax = htmlentities($row['item_tax']);
$item_total = htmlentities($row['item_total']);
$item_created_at = $row['item_created_at'];
$tax_id = $row['item_tax_id'];
$total_tax = $item_tax + $total_tax;
@@ -272,8 +272,8 @@ if(isset($_GET['quote_id'])){
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
while($row = mysqli_fetch_array($taxes_sql)){
$tax_id = $row['tax_id'];
$tax_name = $row['tax_name'];
$tax_percent = $row['tax_percent'];
$tax_name = htmlentities($row['tax_name']);
$tax_percent = htmlentities($row['tax_percent']);
?>
<option value="<?php echo $tax_id; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
@@ -337,7 +337,7 @@ if(isset($_GET['quote_id'])){
<hr class="d-none d-print-block mt-5">
<center class="d-none d-print-block" style="white-space:pre-line"><?php echo $config_quote_footer; ?></center>
<center class="d-none d-print-block" style="white-space:pre-line"><?php echo htmlentities($config_quote_footer); ?></center>
</div>
</div>
@@ -369,8 +369,8 @@ if(isset($_GET['quote_id'])){
while($row = mysqli_fetch_array($sql_history)){
$history_created_at = $row['history_created_at'];
$history_status = $row['history_status'];
$history_description = $row['history_description'];
$history_status = htmlentities($row['history_status']);
$history_description = htmlentities($row['history_description']);
?>
<tr>
@@ -429,8 +429,8 @@ include("footer.php");
var docDefinition = {
info: {
title: '<?php echo "$company_name - Quote"; ?>',
author: '<?php echo $company_name; ?>'
title: <?php echo json_encode(html_entity_decode($company_name) . "- Quote") ?>,
author: <?php echo json_encode(html_entity_decode($company_name)) ?>
},
//watermark: {text: '<?php echo $quote_status; ?>', color: 'lightgrey', opacity: 0.3, bold: true, italics: false},
@@ -441,7 +441,7 @@ var docDefinition = {
columns: [
<?php if(!empty($company_logo_base64)){ ?>
{
image: '<?php echo "data:image;base64,$company_logo_base64"; ?>',
image: <?php echo json_encode("data:image;base64,$company_logo_base64") ?>,
width: 120
},
<?php } ?>
@@ -453,7 +453,7 @@ var docDefinition = {
width: '*'
},
{
text: '<?php echo "$quote_prefix$quote_number"; ?>',
text: <?php echo json_encode("$quote_prefix$quote_number") ?>,
style: 'invoiceNumber',
width: '*'
},
@@ -464,12 +464,12 @@ var docDefinition = {
{
columns: [
{
text: <?php echo json_encode($company_name); ?>,
style:'invoiceBillingTitle',
text: <?php echo json_encode(html_entity_decode($company_name)) ?>,
style: 'invoiceBillingTitle'
},
{
text: <?php echo json_encode($client_name); ?>,
style:'invoiceBillingTitleClient',
text: <?php echo json_encode(html_entity_decode($client_name)) ?>,
style: 'invoiceBillingTitleClient'
},
]
},
@@ -477,11 +477,11 @@ var docDefinition = {
{
columns: [
{
text: <?php echo json_encode("$company_address \n $company_city $company_state $company_zip \n $company_phone \n $company_website"); ?>,
text: <?php echo json_encode(html_entity_decode("$company_address \n $company_city $company_state $company_zip \n $company_phone \n $company_website")) ?>,
style: 'invoiceBillingAddress'
},
{
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
text: <?php echo json_encode(html_entity_decode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone")) ?>,
style: 'invoiceBillingAddressClient'
},
]
@@ -498,7 +498,7 @@ var docDefinition = {
// Total
[
{
text:'',
text: '',
rowSpan: 2
},
{},
@@ -507,12 +507,12 @@ var docDefinition = {
[
{},
{
text:'Quote Date',
style:'invoiceDateTitle',
text: 'Quote Date',
style: 'invoiceDateTitle'
},
{
text:'<?php echo $quote_date ?>',
style:'invoiceDateValue',
text: <?php echo json_encode($quote_date) ?>,
style: 'invoiceDateValue'
},
],
]
@@ -577,29 +577,29 @@ var docDefinition = {
[
[
{
text: <?php echo json_encode($item_name); ?>,
style:'itemTitle'
text: <?php echo json_encode($item_name) ?>,
style: 'itemTitle'
},
{
text: <?php echo json_encode($item_description); ?>,
style:'itemDescription'
text: <?php echo json_encode($item_description) ?>,
style: 'itemDescription'
}
],
{
text:'<?php echo $item_quantity; ?>',
style:'itemQty'
text: <?php echo json_encode($item_quantity) ?>,
style: 'itemQty'
},
{
text:'<?php echo numfmt_format_currency($currency_format, $item_price, $quote_currency_code); ?>',
style:'itemNumber'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $item_price, $quote_currency_code)) ?>,
style: 'itemNumber'
},
{
text:'<?php echo numfmt_format_currency($currency_format, $item_tax, $quote_currency_code); ?>',
style:'itemNumber'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $item_tax, $quote_currency_code)) ?>,
style: 'itemNumber'
},
{
text:'<?php echo numfmt_format_currency($currency_format, $item_total, $quote_currency_code); ?>',
style:'itemNumber'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $item_total, $quote_currency_code)) ?>,
style: 'itemNumber'
}
],
@@ -624,7 +624,7 @@ var docDefinition = {
[
{
text: 'Notes',
style:'notesTitle'
style: 'notesTitle'
},
{},
{}
@@ -632,38 +632,38 @@ var docDefinition = {
[
{
rowSpan: 3,
text: <?php echo json_encode($quote_note); ?>,
style:'notesText'
text: <?php echo json_encode(html_entity_decode($quote_note)) ?>,
style: 'notesText'
},
{
text:'Subtotal',
style:'itemsFooterSubTitle'
text: 'Subtotal',
style: 'itemsFooterSubTitle'
},
{
text:'<?php echo numfmt_format_currency($currency_format, $sub_total, $quote_currency_code); ?>',
style:'itemsFooterSubValue'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $sub_total, $quote_currency_code)) ?>,
style: 'itemsFooterSubValue'
}
],
[
{},
{
text:'Tax',
style:'itemsFooterSubTitle'
text: 'Tax',
style: 'itemsFooterSubTitle'
},
{
text: '<?php echo numfmt_format_currency($currency_format, $total_tax, $quote_currency_code); ?>',
style:'itemsFooterSubValue'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $total_tax, $quote_currency_code)) ?>,
style: 'itemsFooterSubValue'
}
],
[
{},
{
text:'Total',
style:'itemsFooterSubTitle'
text: 'Total',
style: 'itemsFooterSubTitle'
},
{
text: '<?php echo numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code); ?>',
style:'itemsFooterSubValue'
text: <?php echo json_encode(numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code)) ?>,
style: 'itemsFooterSubValue'
}
],
]
@@ -672,7 +672,7 @@ var docDefinition = {
},
// TERMS / FOOTER
{
text: <?php echo json_encode("$config_quote_footer"); ?>,
text: <?php echo json_encode($config_quote_footer) ?>,
style: 'documentFooterCenter'
}
], //End Content,
@@ -681,14 +681,14 @@ var docDefinition = {
documentFooterCenter: {
fontSize: 9,
margin: [10,50,10,10],
alignment:'center'
alignment: 'center'
},
// Invoice Title
invoiceTitle: {
fontSize: 18,
bold: true,
alignment:'right',
margin:[0,0,0,3]
alignment: 'right',
margin: [0,0,0,3]
},
// Invoice Number
invoiceNumber: {
@@ -699,14 +699,14 @@ var docDefinition = {
invoiceBillingTitle: {
fontSize: 14,
bold: true,
alignment:'left',
margin:[0,20,0,5]
alignment: 'left',
margin: [0,20,0,5]
},
invoiceBillingTitleClient: {
fontSize: 14,
bold: true,
alignment:'right',
margin:[0,20,0,5]
alignment: 'right',
margin: [0,20,0,5]
},
// Billing Details
invoiceBillingAddress: {
@@ -716,26 +716,26 @@ var docDefinition = {
invoiceBillingAddressClient: {
fontSize: 10,
lineHeight: 1.2,
alignment:'right',
margin:[0,0,0,30]
alignment: 'right',
margin: [0,0,0,30]
},
// Invoice Dates
invoiceDateTitle: {
fontSize: 10,
alignment:'left',
margin:[0,5,0,5]
alignment: 'left',
margin: [0,5,0,5]
},
invoiceDateValue: {
fontSize: 10,
alignment:'right',
margin:[0,5,0,5]
alignment: 'right',
margin: [0,5,0,5]
},
// Items Header
itemsHeader: {
fontSize: 10,
margin: [0,5,0,5],
bold: true,
alignment:'right'
alignment: 'right'
},
// Item Title
itemTitle: {
@@ -752,61 +752,61 @@ var docDefinition = {
itemQty: {
fontSize: 10,
margin: [0,5,0,5],
alignment: 'center',
alignment: 'center'
},
itemNumber: {
fontSize: 10,
margin: [0,5,0,5],
alignment: 'right',
alignment: 'right'
},
itemTotal: {
fontSize: 10,
margin: [0,5,0,5],
bold: true,
alignment: 'right',
alignment: 'right'
},
// Items Footer (Subtotal, Total, Tax, etc)
itemsFooterSubTitle: {
fontSize: 10,
margin: [0,5,0,5],
alignment:'right',
alignment: 'right'
},
itemsFooterSubValue: {
fontSize: 10,
margin: [0,5,0,5],
bold: false,
alignment:'right',
alignment: 'right'
},
itemsFooterTotalTitle: {
fontSize: 10,
margin: [0,5,0,5],
bold: true,
alignment:'right',
alignment: 'right'
},
itemsFooterTotalValue: {
fontSize: 10,
margin: [0,5,0,5],
bold: true,
alignment:'right',
alignment: 'right'
},
notesTitle: {
fontSize: 10,
bold: true,
margin: [0,5,0,5],
margin: [0,5,0,5]
},
notesText: {
fontSize: 9,
margin: [0,5,50,5]
},
left: {
alignment:'left',
alignment: 'left'
},
center: {
alignment:'center',
alignment: 'center'
},
},
defaultStyle: {
columnGap: 20,
columnGap: 20
}
}
</script>