last changes since 6-2023
This commit is contained in:
parent
0341c9c189
commit
04d677d37a
142 changed files with 7895 additions and 2855 deletions
|
|
@ -54,6 +54,8 @@ use App\User;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingCollectOrder whereTaxTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingCollectOrder whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingCollectOrder whereUserId($value)
|
||||
* @property array|null $net_split
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingCollectOrder whereNetSplit($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShoppingCollectOrder extends Model
|
||||
|
|
@ -73,6 +75,7 @@ class ShoppingCollectOrder extends Model
|
|||
'points' => 'int',
|
||||
'status' => 'int',
|
||||
'tax_split' => 'array',
|
||||
'net_split' => 'array',
|
||||
'orders' => AsArrayObject::class,
|
||||
'shop_items' => AsArrayObject::class,
|
||||
];
|
||||
|
|
@ -90,6 +93,7 @@ class ShoppingCollectOrder extends Model
|
|||
'qty_total',
|
||||
'points',
|
||||
'tax_split',
|
||||
'net_split',
|
||||
'orders',
|
||||
'shop_items',
|
||||
'status'
|
||||
|
|
@ -115,11 +119,31 @@ class ShoppingCollectOrder extends Model
|
|||
{
|
||||
$tax_split = $this->tax_split;
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : round($add_tax, 2);
|
||||
|
||||
foreach($tax_split as $key=>$value){
|
||||
$tax_split[$key] = number_format($value, 2);
|
||||
}
|
||||
$this->tax_split = $tax_split;
|
||||
}
|
||||
|
||||
public function addNetToSplit($tax_rate, $add_net)
|
||||
{
|
||||
$net_split = $this->net_split;
|
||||
$net_split[$tax_rate] = isset($net_split[$tax_rate]) ? round($net_split[$tax_rate] += $add_net, 2) : round($add_net, 2);
|
||||
|
||||
foreach($net_split as $key=>$value){
|
||||
$net_split[$key] = number_format($value, 2);
|
||||
}
|
||||
$this->net_split = $net_split;
|
||||
}
|
||||
|
||||
public function addShopItem($shop_item_id, $shop_item)
|
||||
{
|
||||
$shop_item->user_price_net = number_format($shop_item->user_price_net, 2);
|
||||
$shop_item->user_price_total_net = number_format($shop_item->user_price_total_net, 2);
|
||||
$shop_item->user_tax = number_format($shop_item->user_tax, 2);
|
||||
$shop_item->user_tax_total = number_format($shop_item->user_tax_total, 2);
|
||||
|
||||
$this->shop_items[$shop_item_id] = $shop_item;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue