Shipping Tax Card

This commit is contained in:
Kevin Adametz 2020-07-01 16:13:38 +02:00
parent da08e9ff37
commit eb55b01b0d
13 changed files with 86 additions and 81 deletions

View file

@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model;
* @property int $id
* @property int $shipping_id
* @property float|null $price
* @property float|null $tax
* @property float|null $tax_rate
* @property float|null $factor
* @property float|null $total_from
* @property float|null $total_to
@ -40,7 +40,7 @@ class ShippingPrice extends Model
protected $table = 'shipping_prices';
protected $fillable = [
'shipping_id', 'price', 'tax', 'factor', 'total_from', 'total_to', 'weight_from', 'weight_to',
'shipping_id', 'price', 'tax_rate', 'factor', 'total_from', 'total_to', 'weight_from', 'weight_to',
];
public function shipping()
@ -75,9 +75,9 @@ class ShippingPrice extends Model
{
$value = $this->_format_number($value);
if ($value == "") {
$this->attributes['tax'] = null;
$this->attributes['tax_rate'] = null;
} else {
$this->attributes['tax'] = floatval(str_replace(',', '.', $value));
$this->attributes['tax_rate'] = floatval(str_replace(',', '.', $value));
}
}
@ -115,15 +115,15 @@ class ShippingPrice extends Model
return number_format($this->attributes['price'], 2, ',', '.');
}
public function getFormattedTax()
public function getFormattedTaxRate()
{
if ($this->attributes['tax'] === NULL) {
return $this->attributes['tax'];
if ($this->attributes['tax_rate'] === NULL) {
return $this->attributes['tax_rate'];
}
if (\App::getLocale() == "en") {
return number_format($this->attributes['tax'], 2, '.', ',');
return number_format($this->attributes['tax_rate'], 2, '.', ',');
}
return number_format($this->attributes['tax'], 2, ',', '.');
return number_format($this->attributes['tax_rate'], 2, ',', '.');
}
public function getFormattedFactor()