close #1340 Fixed: Missing edit invoice and bill item taxes.
This commit is contained in:
parent
f05425b091
commit
397b050eae
@ -27,6 +27,15 @@ class BillItem extends Model
|
|||||||
*/
|
*/
|
||||||
public $cloneable_relations = ['taxes'];
|
public $cloneable_relations = ['taxes'];
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::retrieved(function($model) {
|
||||||
|
$model->setTaxIds();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function bill()
|
public function bill()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Purchase\Bill');
|
return $this->belongsTo('App\Models\Purchase\Bill');
|
||||||
@ -74,4 +83,20 @@ class BillItem extends Model
|
|||||||
{
|
{
|
||||||
$this->attributes['tax'] = (double) $value;
|
$this->attributes['tax'] = (double) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert tax to Array.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setTaxIds()
|
||||||
|
{
|
||||||
|
$tax_ids = [];
|
||||||
|
|
||||||
|
foreach ($this->taxes as $tax) {
|
||||||
|
$tax_ids[] = (string) $tax->tax_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setAttribute('tax_id', $tax_ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,15 @@ class InvoiceItem extends Model
|
|||||||
*/
|
*/
|
||||||
public $cloneable_relations = ['taxes'];
|
public $cloneable_relations = ['taxes'];
|
||||||
|
|
||||||
|
public static function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
|
static::retrieved(function($model) {
|
||||||
|
$model->setTaxIds();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function invoice()
|
public function invoice()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Sale\Invoice');
|
return $this->belongsTo('App\Models\Sale\Invoice');
|
||||||
@ -73,4 +82,20 @@ class InvoiceItem extends Model
|
|||||||
{
|
{
|
||||||
$this->attributes['tax'] = (double) $value;
|
$this->attributes['tax'] = (double) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert tax to Array.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setTaxIds()
|
||||||
|
{
|
||||||
|
$tax_ids = [];
|
||||||
|
|
||||||
|
foreach ($this->taxes as $tax) {
|
||||||
|
$tax_ids[] = (string) $tax->tax_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setAttribute('tax_id', $tax_ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user