diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 06957ae8ce10..c1b41dd4b7e2 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -328,6 +328,7 @@ class InvoiceFilters extends QueryFilters } if($sort_col[0] == 'number') { + // return $this->builder->orderByRaw('CAST(number AS UNSIGNED), number ' . $dir); return $this->builder->orderByRaw('ABS(number) ' . $dir); } diff --git a/app/Livewire/RequiredClientInfo.php b/app/Livewire/RequiredClientInfo.php index fdb117de2801..733f9a0b4559 100644 --- a/app/Livewire/RequiredClientInfo.php +++ b/app/Livewire/RequiredClientInfo.php @@ -427,6 +427,6 @@ $_contact->push(); public function render() { - return render('components.livewire.required-client-infox'); + return render('components.livewire.required-client-info'); } } diff --git a/app/Services/Template/TemplateService.php b/app/Services/Template/TemplateService.php index 37bd568f8ee5..e9fcced20a5e 100644 --- a/app/Services/Template/TemplateService.php +++ b/app/Services/Template/TemplateService.php @@ -1032,6 +1032,8 @@ class TemplateService 'payment_balance' => $purchase_order->client->payment_balance, 'credit_balance' => $purchase_order->client->credit_balance, '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' => PurchaseOrder::stringStatus($purchase_order->status_id ?? 1), diff --git a/app/Utils/Number.php b/app/Utils/Number.php index cf7c0130ec3a..bc1739f64c9f 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -93,59 +93,59 @@ class Number * @param string $value The formatted number to be converted back to float * @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) // return 0; - // $multiplier = false; + // //remove everything except for numbers, decimals, commas and hyphens + // $value = preg_replace('/[^0-9.,-]+/', '', $value); - // if(substr($value, 0,1) == '-') - // $multiplier = -1; + // $decimal = strpos($value, '.'); + // $comma = strpos($value, ','); + + // if($comma === false) //no comma must be a decimal number already + // return (float) $value; - // $s = str_replace(',', '.', $value); - - // $s = preg_replace("/[^0-9\.]/", '', $s); - - // if ($s < 1) { - // return (float) $s; + // if($decimal < $comma){ //decimal before a comma = euro + // $value = str_replace(['.',','], ['','.'], $value); + // // $value = str_replace(',', '.', $value); + // return (float) $value; // } - // $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) - // $s = floatval($s)*-1; + $multiplier = false; - // 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 - public static function parseFloat($value) + public static function parseFloat2($value) { if(!$value) {