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

View File

@@ -22,44 +22,44 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
$row = mysqli_fetch_array($sql);
$quote_id = $row['quote_id'];
$quote_prefix = $row['quote_prefix'];
$quote_number = $row['quote_number'];
$quote_status = $row['quote_status'];
$quote_prefix = htmlentities($row['quote_prefix']);
$quote_number = htmlentities($row['quote_number']);
$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_amount = htmlentities($row['quote_amount']);
$quote_currency_code = htmlentities($row['quote_currency_code']);
$quote_note = htmlentities($row['quote_note']);
$category_id = $row['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_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_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_logo = $row['company_logo'];
$company_email = htmlentities($row['company_email']);
$company_logo = htmlentities($row['company_logo']);
if(!empty($company_logo)){
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
}
$company_locale = $row['company_locale'];
$config_quote_footer = $row['config_quote_footer'];
$company_locale = htmlentities($row['company_locale']);
$config_quote_footer = htmlentities($row['config_quote_footer']);
//Set Currency Format
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
@@ -170,8 +170,8 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
while($row = mysqli_fetch_array($sql_items)){
$item_id = $row['item_id'];
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$item_name = htmlentities($row['item_name']);
$item_description = htmlentities($row['item_description']);
$item_quantity = $row['item_quantity'];
$item_price = $row['item_price'];
$item_subtotal = $row['item_price'];
@@ -255,8 +255,8 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
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},
@@ -267,7 +267,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 } ?>
@@ -279,7 +279,7 @@ var docDefinition = {
width: '*'
},
{
text: '<?php echo "$quote_prefix$quote_number"; ?>',
text: <?php echo json_encode(html_entity_decode("$quote_prefix$quote_number")) ?>,
style: 'invoiceNumber',
width: '*'
},
@@ -290,12 +290,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'
},
]
},
@@ -303,11 +303,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'
},
]
@@ -324,7 +324,7 @@ var docDefinition = {
// Total
[
{
text:'',
text: '',
rowSpan: 2
},
{},
@@ -333,12 +333,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'
},
],
]
@@ -403,29 +403,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 $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'
}
],
@@ -458,38 +458,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'
}
],
]
@@ -507,32 +507,32 @@ 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: {
fontSize: 14,
alignment:'right'
alignment: 'right'
},
// Billing Headers
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: {
@@ -542,26 +542,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: {
@@ -578,57 +578,57 @@ 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: {