mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes and improvements for templates
This commit is contained in:
parent
f0ad4175aa
commit
08dee1309e
@ -328,6 +328,7 @@ class InvoiceFilters extends QueryFilters
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($sort_col[0] == 'number') {
|
if($sort_col[0] == 'number') {
|
||||||
|
// return $this->builder->orderByRaw('CAST(number AS UNSIGNED), number ' . $dir);
|
||||||
return $this->builder->orderByRaw('ABS(number) ' . $dir);
|
return $this->builder->orderByRaw('ABS(number) ' . $dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,6 +427,6 @@ $_contact->push();
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return render('components.livewire.required-client-infox');
|
return render('components.livewire.required-client-info');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1032,6 +1032,8 @@ class TemplateService
|
|||||||
'payment_balance' => $purchase_order->client->payment_balance,
|
'payment_balance' => $purchase_order->client->payment_balance,
|
||||||
'credit_balance' => $purchase_order->client->credit_balance,
|
'credit_balance' => $purchase_order->client->credit_balance,
|
||||||
'vat_number' => $purchase_order->client->vat_number ?? '',
|
'vat_number' => $purchase_order->client->vat_number ?? '',
|
||||||
|
'address' => $purchase_order->client->present()->address(),
|
||||||
|
'shipping_address' => $purchase_order->client->present()->shipping_address(),
|
||||||
] : [],
|
] : [],
|
||||||
'status_id' => (string)($purchase_order->status_id ?: 1),
|
'status_id' => (string)($purchase_order->status_id ?: 1),
|
||||||
'status' => PurchaseOrder::stringStatus($purchase_order->status_id ?? 1),
|
'status' => PurchaseOrder::stringStatus($purchase_order->status_id ?? 1),
|
||||||
|
@ -93,59 +93,59 @@ class Number
|
|||||||
* @param string $value The formatted number to be converted back to float
|
* @param string $value The formatted number to be converted back to float
|
||||||
* @return float The formatted value
|
* @return float The formatted value
|
||||||
*/
|
*/
|
||||||
public static function parseFloat2($value)
|
public static function parseFloat($value)
|
||||||
{
|
{
|
||||||
if(!$value)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
//remove everything except for numbers, decimals, commas and hyphens
|
|
||||||
$value = preg_replace('/[^0-9.,-]+/', '', $value);
|
|
||||||
|
|
||||||
$decimal = strpos($value, '.');
|
|
||||||
$comma = strpos($value, ',');
|
|
||||||
|
|
||||||
if($comma === false) //no comma must be a decimal number already
|
|
||||||
return (float) $value;
|
|
||||||
|
|
||||||
if($decimal < $comma){ //decimal before a comma = euro
|
|
||||||
$value = str_replace(['.',','], ['','.'], $value);
|
|
||||||
// $value = str_replace(',', '.', $value);
|
|
||||||
return (float) $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
//comma first = traditional thousan separator
|
|
||||||
$value = str_replace(',', '', $value);
|
|
||||||
|
|
||||||
return (float)$value;
|
|
||||||
|
|
||||||
|
|
||||||
// if(!$value)
|
// if(!$value)
|
||||||
// return 0;
|
// return 0;
|
||||||
|
|
||||||
// $multiplier = false;
|
// //remove everything except for numbers, decimals, commas and hyphens
|
||||||
|
// $value = preg_replace('/[^0-9.,-]+/', '', $value);
|
||||||
|
|
||||||
// if(substr($value, 0,1) == '-')
|
// $decimal = strpos($value, '.');
|
||||||
// $multiplier = -1;
|
// $comma = strpos($value, ',');
|
||||||
|
|
||||||
|
// if($comma === false) //no comma must be a decimal number already
|
||||||
|
// return (float) $value;
|
||||||
|
|
||||||
// $s = str_replace(',', '.', $value);
|
// if($decimal < $comma){ //decimal before a comma = euro
|
||||||
|
// $value = str_replace(['.',','], ['','.'], $value);
|
||||||
// $s = preg_replace("/[^0-9\.]/", '', $s);
|
// // $value = str_replace(',', '.', $value);
|
||||||
|
// return (float) $value;
|
||||||
// if ($s < 1) {
|
|
||||||
// return (float) $s;
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);
|
// //comma first = traditional thousan separator
|
||||||
|
// $value = str_replace(',', '', $value);
|
||||||
|
|
||||||
|
// return (float)$value;
|
||||||
|
|
||||||
|
|
||||||
|
if(!$value)
|
||||||
|
return 0;
|
||||||
|
|
||||||
// if($multiplier)
|
$multiplier = false;
|
||||||
// $s = floatval($s)*-1;
|
|
||||||
|
|
||||||
// return (float) $s;
|
if(substr($value, 0,1) == '-')
|
||||||
|
$multiplier = -1;
|
||||||
|
|
||||||
|
$s = str_replace(',', '.', $value);
|
||||||
|
|
||||||
|
$s = preg_replace("/[^0-9\.]/", '', $s);
|
||||||
|
|
||||||
|
if ($s < 1) {
|
||||||
|
return (float) $s;
|
||||||
|
}
|
||||||
|
|
||||||
|
$s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);
|
||||||
|
|
||||||
|
if($multiplier)
|
||||||
|
$s = floatval($s)*-1;
|
||||||
|
|
||||||
|
return (float) $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//next iteration of float parsing
|
//next iteration of float parsing
|
||||||
public static function parseFloat($value)
|
public static function parseFloat2($value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$value) {
|
if(!$value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user