Started adding currency symbols and starting with invoice

This commit is contained in:
johnnyq 2021-08-18 20:41:19 -04:00
parent 95b77f7570
commit f409e22a60
4 changed files with 89 additions and 22 deletions

View File

@ -16,6 +16,40 @@
Copy to clipboard
</button>
<?php
// Function to generate OTP
function generateNumericOTP($n) {
// Take a generator string which consist of
// all numeric digits
$generator = "1357902468";
// Iterate for n-times and pick a single character
// from generator and append it to $result
// Login for generating a random character from generator
// ---generate a random number
// ---take modulus of same with length of generator (say i)
// ---append the character at place (i) from generator to result
$result = "";
for ($i = 1; $i <= $n; $i++) {
$result .= substr($generator, (rand()%(strlen($generator))), 1);
}
// Return result
return $result;
}
// Main program
$n = 6;
print_r(generateNumericOTP($n));
?>
<?php
echo "$session_permission_companies";

View File

@ -183,4 +183,39 @@ function truncate($text, $chars = 25) {
return $text;
}
function get_currency_symbol($cc = 'USD')
{
$cc = strtoupper($cc);
$currency = array(
"USD" => "$" , //U.S. Dollar
"AUD" => "$" , //Australian Dollar
"BRL" => "R$" , //Brazilian Real
"CAD" => "C$" , //Canadian Dollar
"CZK" => "" , //Czech Koruna
"DKK" => "kr" , //Danish Krone
"EUR" => "" , //Euro
"HKD" => "&#36" , //Hong Kong Dollar
"HUF" => "Ft" , //Hungarian Forint
"ILS" => "" , //Israeli New Sheqel
"INR" => "", //Indian Rupee
"JPY" => "¥" , //Japanese Yen
"MYR" => "RM" , //Malaysian Ringgit
"MXN" => "&#36" , //Mexican Peso
"NOK" => "kr" , //Norwegian Krone
"NZD" => "&#36" , //New Zealand Dollar
"PHP" => "" , //Philippine Peso
"PLN" => "" ,//Polish Zloty
"GBP" => "£" , //Pound Sterling
"SEK" => "kr" , //Swedish Krona
"CHF" => "Fr" , //Swiss Franc
"TWD" => "$" , //Taiwan New Dollar
"THB" => "฿" , //Thai Baht
"TRY" => "" //Turkish Lira
);
if(array_key_exists($cc, $currency)){
return $currency[$cc];
}
}
?>

View File

@ -48,6 +48,7 @@ if(isset($_GET['invoice_id'])){
}
$client_website = $row['client_website'];
$client_currency_code = $row['client_currency_code'];
$client_currency_symbol = get_currency_symbol("$client_currency_code");
$client_net_terms = $row['client_net_terms'];
if($client_net_terms == 0){
$client_net_terms = $config_default_net_terms;
@ -271,9 +272,9 @@ if(isset($_GET['invoice_id'])){
<td><?php echo $item_name; ?></td>
<td><?php echo $item_description; ?></td>
<td class="text-center"><?php echo $item_quantity; ?></td>
<td class="text-right">$<?php echo number_format($item_price,2); ?></td>
<td class="text-right">$<?php echo number_format($item_tax,2); ?></td>
<td class="text-right">$<?php echo number_format($item_total,2); ?></td>
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($item_price,2); ?></td>
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($item_tax,2); ?></td>
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($item_total,2); ?></td>
</tr>
<?php
@ -344,23 +345,23 @@ if(isset($_GET['invoice_id'])){
<tbody>
<tr class="border-bottom">
<td>Subtotal</td>
<td class="text-right">$<?php echo number_format($sub_total,2); ?></td>
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($sub_total,2); ?></td>
</tr>
<?php if($total_tax > 0){ ?>
<tr class="border-bottom">
<td>Tax</td>
<td class="text-right">$<?php echo number_format($total_tax,2); ?></td>
<td class="text-right"><?php echo $client_currency_symbol; ?><?php echo number_format($total_tax,2); ?></td>
</tr>
<?php } ?>
<?php if($amount_paid > 0){ ?>
<tr class="border-bottom">
<td><div class="text-success">Paid to Date</div></td>
<td class="text-right text-success">$<?php echo number_format($amount_paid,2); ?></td>
<td class="text-right text-success"><?php echo $client_currency_symbol; ?><?php echo number_format($amount_paid,2); ?></td>
</tr>
<?php } ?>
<tr class="border-bottom">
<td><strong>Balance Due</strong></td>
<td class="text-right"><strong>$<?php echo number_format($balance,2); ?></strong></td>
<td class="text-right"><strong><?php echo $client_currency_symbol; ?><?php echo number_format($balance,2); ?></strong></td>
</tr>
</tbody>
</table>
@ -672,15 +673,15 @@ var docDefinition = {
style:'itemQty'
},
{
text:'$<?php echo number_format($item_price,2); ?>',
text:'<?php echo $client_currency_symbol; ?><?php echo number_format($item_price,2); ?>',
style:'itemNumber'
},
{
text:'$<?php echo number_format($item_tax,2); ?>',
text:'<?php echo $client_currency_symbol; ?><?php echo number_format($item_tax,2); ?>',
style:'itemNumber'
},
{
text: '$<?php echo number_format($item_total,2); ?>',
text: '<?php echo $client_currency_symbol; ?><?php echo number_format($item_total,2); ?>',
style:'itemNumber'
}
],
@ -722,7 +723,7 @@ var docDefinition = {
style:'itemsFooterSubTitle'
},
{
text:'$<?php echo number_format($sub_total,2); ?>',
text:'<?php echo $client_currency_symbol; ?><?php echo number_format($sub_total,2); ?>',
style:'itemsFooterSubValue'
}
],
@ -733,7 +734,7 @@ var docDefinition = {
style:'itemsFooterSubTitle'
},
{
text: '$<?php echo number_format($total_tax,2); ?>',
text: '<?php echo $client_currency_symbol; ?><?php echo number_format($total_tax,2); ?>',
style:'itemsFooterSubValue'
}
],
@ -744,7 +745,7 @@ var docDefinition = {
style:'itemsFooterSubTitle'
},
{
text: '$<?php echo number_format($invoice_amount,2); ?>',
text: '<?php echo $client_currency_symbol; ?><?php echo number_format($invoice_amount,2); ?>',
style:'itemsFooterSubValue'
}
],
@ -755,7 +756,7 @@ var docDefinition = {
style:'itemsFooterSubTitle'
},
{
text: '$<?php echo number_format($amount_paid,2); ?>',
text: '<?php echo $client_currency_symbol; ?><?php echo number_format($amount_paid,2); ?>',
style:'itemsFooterSubValue'
}
],
@ -766,7 +767,7 @@ var docDefinition = {
style:'itemsFooterTotalTitle'
},
{
text: '$<?php echo number_format($balance,2); ?>',
text: '<?php echo $client_currency_symbol; ?><?php echo number_format($balance,2); ?>',
style:'itemsFooterTotalTitle'
}

View File

@ -20,7 +20,7 @@
if(isset($_GET['status'])){
$status = mysqli_real_escape_string($mysqli,$_GET['status']);
}else{
$status = "";
$status = "Open";
}
if(!empty($_GET['sb'])){
@ -113,12 +113,9 @@
</div>
<div class="col-sm-8">
<div class="btn-group float-right">
<a href="?status=%" class="btn <?php if($status == '%'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All</a>
<a href="?status=Open" class="btn <?php if($status == 'Open'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Open</a>
<a href="?status=In-Progress" class="btn <?php if($status == 'In-Progress'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">In-Progress</a>
<a href="?status=On-Hold" class="btn <?php if($status == 'On-Hold'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">On-Hold</a>
<a href="?status=Resolved" class="btn <?php if($status == 'Resolved'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Resolved</a>
<a href="?status=Closed" class="btn <?php if($status == 'Closed'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Closed</a>
<a href="<?php echo $_SERVER['REQUEST_URI']; ?>&status=%" class="btn <?php if($status == '%'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All Tickets</a>
<a href="<?php echo $_SERVER['REQUEST_URI']; ?>&status=Open" class="btn <?php if($status == 'Open'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Open Tickets</a>
<a href="<?php echo $_SERVER['REQUEST_URI']; ?>&status=Closed" class="btn <?php if($status == 'Closed'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Closed Tickets</a>
</div>
</div>
</div>