Update Framework, Invoices

This commit is contained in:
Kevin Adametz 2022-04-14 13:14:36 +02:00
parent cc5c147c27
commit 9b0b5feb7e
174 changed files with 28356 additions and 8093 deletions

File diff suppressed because it is too large Load diff

View file

@ -1006,7 +1006,7 @@ namespace App\Models{
* @property float $tax_rate
* @property int $points
* @property float $margin
* @property float $ek-price
* @property float $ek_price
* @property string $slug
* @property Carbon $created_at
* @property Carbon $updated_at

2
_todo.txt Normal file
View file

@ -0,0 +1,2 @@

View file

@ -2,8 +2,8 @@
namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
@ -29,10 +29,12 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
@ -41,10 +43,12 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}

View file

@ -4,15 +4,12 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Mail\MailCheckout;
use App\Models\PaymentTransaction;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\Services\Payment;
use App\Services\Shop;
use App\Services\Util;
use App\User;
use Illuminate\Support\Facades\Mail;
class PayoneController extends Controller

View file

@ -48,7 +48,6 @@ class ShoppingUserController extends Controller
$wp_order_numbers = $request->wp_order_numbers;
}
if(!$wp_order_numbers || !is_array($wp_order_numbers)){
return response()->json([
'success' => false,
@ -594,7 +593,7 @@ class ShoppingUserController extends Controller
if ($order->price != ($product->price * 100)) {
$error[] = "different price: " . ($product->price * 100);
}
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight]);
Yard::instance('shopping')->add($product->id, $product->name, (int) $order->qty, $product->price, false, false, ['image' => [], 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
}
}
$order->message = $error;
@ -621,6 +620,7 @@ class ShoppingUserController extends Controller
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => auth()->user()->user_sponsor->shop->id,
'payment_for' => 7,
'member_id' => $shopping_user->member_id,
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
@ -646,8 +646,11 @@ class ShoppingUserController extends Controller
}
$items = Yard::instance('shopping')->content();
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order) {
foreach ($items as $item) {
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
if ($model->row_id === $item->rowId) {
$model->fill([
'shopping_order_id' => $shopping_order->id,
@ -655,8 +658,12 @@ class ShoppingUserController extends Controller
'product_id' => $item->id,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug,
])->save();
return false;
@ -667,19 +674,27 @@ class ShoppingUserController extends Controller
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count())
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count()){
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
ShoppingOrderItem::create([
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
'product_id' => $item->id,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
]);
}
}
}
$shopping_order->makeTaxSplit();
return $shopping_order;
}

View file

@ -0,0 +1,125 @@
<?php
namespace App\Http\Controllers;
use Storage;
use Response;
use Auth;
class FileController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
}
private function isPermission($shopping_order){
$user_id = $shopping_order->auth_user_id ? $shopping_order->auth_user_id : $shopping_order->member_id;
if(Auth::user()->isAdmin() || $user_id == Auth::user()->id){
return true;
}
abort(404);
}
public function show($id = null, $disk = null, $do='file')
{
$path = "";
$filename = "";
/*if($disk === 'user'){
$file = \App\Models\File::findOrFail($id);
$this->isPermission($file->user_id);
$path = Storage::disk($disk)->path($file->dir.$file->filename);
if (file_exists($path)) {
return Response::file($path);
}
}*/
if ($disk === 'invoice'){
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
if($shopping_order->user_invoice){
$this->isPermission($shopping_order);
$user_invoice = $shopping_order->user_invoice;
$filename = $user_invoice->filename;
$disk = $user_invoice->disk;
$path = $user_invoice->getDownloadPath();
if (!Storage::disk($disk)->exists($path)) {
return Response::make('File no found.', 404);;
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);
}
if($do === 'download'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
}
if($do === 'stream'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition','inline; filename="'.$filename.'"');
}
}
if ($disk === 'delivery'){
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
if($shopping_order->user_invoice){
$this->isPermission($shopping_order);
$user_invoice = $shopping_order->user_invoice;
$filename = $user_invoice->delivery_filename;
$disk = $user_invoice->disk;
$path = $user_invoice->getDownloadPathDelivery();
if (!Storage::disk($disk)->exists($path)) {
return Response::make('File no found.', 404);;
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);
}
if($do === 'download'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
}
if($do === 'stream'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition','inline; filename="'.$filename.'"');
}
}
/*if ($disk === 'credit'){
$UserCredit = \App\Models\UserCredit::findOrFail($id);
$this->isPermission($UserCredit->auth_user_id);
$filename = Credit::getFilename($UserCredit);
$path = Credit::getDownloadPath($UserCredit);
if (!Storage::disk('public')->exists($path)) {
return Response::make('File no found.', 404);
}
$file = Storage::disk('public')->get($path);
$mime = Storage::disk('public')->mimeType($path);
if($do === 'download'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
}
if($do === 'stream'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition','filename="'.$filename.'"');
}
}*/
}
}

View file

@ -391,22 +391,23 @@ class LeadController extends Controller
->addColumn('payment_shop_date', function (User $user) {
return $user->payment_shop ? $user->getPaymentShopDateFormat(false) : "-";
})
->addColumn('shop_domain', function (User $user) {
return $user->shop ? ' <span class="small">'.$user->shop->getSubdomain(false).'</span>' : '';
})
->addColumn('turnover', function (User $user) {
return "-";
})
->addColumn('sales_total', function (User $user) {
return "-";
})
->orderColumn('id', 'id $1')
->orderColumn('confirmed', 'confirmed $1')
->orderColumn('active', 'active $1')
->orderColumn('agreement', 'agreement $1')
->orderColumn('payment_account', 'payment_account $1')
->orderColumn('payment_shop', 'payment_shop $1')
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account', 'payment_shop'])
->rawColumns(['id', 'confirmed', 'active', 'agreement', 'payment_account', 'payment_shop', 'shop_domain'])
->make(true);
}
}

View file

@ -132,7 +132,7 @@ class MembershipController extends Controller
$image = $product->images->first()->slug;
}
$qty = Request::get('qty') ? Request::get('qty') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $qty, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -0,0 +1,239 @@
<?php
namespace App\Http\Controllers;
use Carbon;
use Request;
use App\User;
use App\Services\Util;
use App\Services\Credit;
use App\Services\Payment;
use App\Models\UserCredit;
use App\Models\ShoppingOrderMargin;
use App\Models\UserCreditMargin;
use App\Repositories\CreditRepository;
class PaymentCreditController extends Controller
{
private $startYear;
private $endYear;
private $rangeYears;
private $activeYear;
public function __construct()
{
$this->middleware('auth');
$this->startYear = 2021;
$this->endYear = date('Y');
$this->rangeYears = range($this->startYear, $this->endYear);
$this->activeYear = $this->endYear;
}
public function index()
{
abort(403, "in progress");
$data = $this->makeData();
return view('admin.payment.credit.index', $data);
}
public function store(){
$data = Request::all();
if(isset($data['action']) && $data['action'] === 'add-user-credit'){
$add_credit_error = false;
if(!isset($data['member_id']) || !$user = User::find($data['member_id'])){
$add_credit_error = 'Vertriebspartner nicht gefunden';
}
if(!isset($data['credit'])){
$add_credit_error = 'Bitte Betrag eingeben';
}
if(!isset($data['message'])){
$add_credit_error = 'Bitte Mitteilung eingeben';
}
if($add_credit_error){
$data = $this->makeData();
$data['add_credit_error'] = $add_credit_error;
return view('admin.payment.credit.index', $data);
}
$credit = Util::reFormatNumber($data['credit']);
$credit = number_format($credit, 2, '.', '');
Payment::addUserCreditMargin($user, $credit, 3, $data['message']);
\Session()->flash('alert-success', "Guthaben hinzugefügt");
}
return redirect(route('admin_payments_credit'));
}
public function create(){
$data = Request::all();
if(isset($data['action'])){
if($data['action'] === 'create_credit'){
if(!isset($data['userid'])){
abort(404);
}
$user = User::findOrFail($data['userid']);
$invoice_repo = new CreditRepository($user);
$invoice_repo->create($data);
\Session()->flash('alert-success', "Gutschrift erstellt");
return redirect($data['back']);
}
if($data['action'] === 'user-credit-status'){
$UserCredit = UserCredit::findOrFail($data['id']);
$UserCredit->status = $data['status'];
$UserCredit->save();
\Session()->flash('alert-success', "Status gespeichert");
return back();
}
}
}
private function makeData(){
$this->setActiveYears();
//$date1 = Carbon::parse('01.01.'.$this->activeYear." 00:00:00")->format('Y-m-d H:i:s');
//$date2 = Carbon::parse('31.12.'.$this->activeYear." 23:59:59")->toDateString();
$ShoppingOrderMargins = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
->groupBy('m_sponsor_id')
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
->get();
$ShoppingOrderMarginPendings = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
->groupBy('m_sponsor_id')
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
->get();
$UserCreditMargins = UserCreditMargin::wherePaid(false)->get();
$ShoppingOrderMarginUserIds = ShoppingOrderMargin::select('m_sponsor_id')->groupBy('m_sponsor_id')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
->get()->pluck('m_sponsor_id')->toArray();
$onlyUserCreditMargins = [];
foreach($UserCreditMargins as $key => $UserCreditMargin){
if(!in_array($UserCreditMargin->user_id, $ShoppingOrderMarginUserIds)){
if(isset($onlyUserCreditMargins[$UserCreditMargin->user_id])){
$onlyUserCreditMargins[$UserCreditMargin->user_id]['sum'] += $UserCreditMargin->credit;
$onlyUserCreditMargins[$UserCreditMargin->user_id]['entries'][$UserCreditMargin->id] = $UserCreditMargin;
}else{
$onlyUserCreditMargins[$UserCreditMargin->user_id] = [
'user_id' => $UserCreditMargin->user->id,
'first_name' => $UserCreditMargin->user->account->first_name,
'last_name' => $UserCreditMargin->user->account->last_name,
'email' => $UserCreditMargin->user->email,
'sum' => $UserCreditMargin->credit,
'entries' => [$UserCreditMargin->id => $UserCreditMargin],
];
}
}
}
$data = [
'years' => $this->rangeYears,
'active_year' => $this->activeYear,
'ShoppingOrderMargins' => $ShoppingOrderMargins,
'ShoppingOrderMarginPendings' => $ShoppingOrderMarginPendings,
'onlyUserCreditMargins' => $onlyUserCreditMargins,
];
return $data;
}
private function setActiveYears(){
if(Request::get('filter_sales_year')){
$this->activeYear = Request::get('filter_sales_year');
}
}
public function delete($id, $del){
if($del === 'user_credit_margin'){
$UserCreditMargin = UserCreditMargin::findOrFail($id);
if($deleteTime = $UserCreditMargin->deleteTime()){
$UserCreditMargin->delete();
\Session()->flash('alert-success', "Guthaben ist gelöscht");
}else{
\Session()->flash('alert-error', "Guthaben kann nicht gelöscht werden");
}
}
return redirect(route('admin_payments_credit'));
}
public function datatable(){
$this->setActiveYears();
$date1 = Carbon::parse('01.01.'.$this->activeYear)->format('Y-m-d');
$date2 = Carbon::parse('31.12.'.$this->activeYear)->format('Y-m-d');
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
//::with('shopping_user', )->select('shopping_orders.*')
//->where('paid', '=', 1)
->whereBetween('date', [$date1, $date2]);
//->orderBy('created_at', 'DESC');
return \DataTables::eloquent($query)
->addColumn('total', function (UserCredit $UserCredit) {
return $UserCredit->getFormattedTotal()."";
})
->addColumn('user_margins', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->user_margins){
foreach($UserCredit->user_margins as $user_margin){
$ret .= $user_margin->firstname."/".$user_margin->lastname."/".$user_margin->reference."/".$user_margin->created_at."<br>";
}
}
if($UserCredit->user_credits){
foreach($UserCredit->user_credits as $user_credit){
$ret .= nl2br($user_credit->message)." / ".$user_credit->created_at."<br>";
}
}
return $ret;
})
/* ->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
return Payment::getShoppingOrderBadge($ShoppingOrder);
})*/
->addColumn('credit', function (UserCredit $UserCredit) {
$ret = "";
if(Credit::isCredit($UserCredit)){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
}else{
$ret = "-";
}
return $ret;
})
->addColumn('status', function (UserCredit $UserCredit) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserCredit->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-'.$UserCredit->getStatusColor().'">'.$UserCredit->getStatusType().' <span class="ion ion-md-cash"></span></span>
</a>';
})
->orderColumn('id', 'id $1')
->orderColumn('status', 'status $1')
->orderColumn('total', 'total $1')
->rawColumns(['shipping_order', 'total', 'credit', 'status', 'user_margins'])
->make(true);
}
}

View file

@ -0,0 +1,129 @@
<?php
namespace App\Http\Controllers;
use Carbon;
use Request;
use App\Services\Payment;
use App\Models\UserInvoice;
class PaymentInvoiceController extends Controller
{
private $startYear;
private $endYear;
private $rangeYears;
private $activeYear;
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$this->setFilterVars();
$data = [
'filter_months' => UserInvoice::$monthNames,
'filter_years' => UserInvoice::getYearRange(),
];
return view('admin.payment.invoice', $data);
}
private function setFilterVars(){
if(!session('invoice_filter_month')){
session(['invoice_filter_month' => intval(date('m'))]);
}
if(!session('invoice_filter_year')){
session(['invoice_filter_year' => intval(date('Y'))]);
}
if(Request::get('invoice_filter_name')){
session(['invoice_filter_name' => Request::get('invoice_filter_name')]);
}
if(Request::get('invoice_filter_month')){
session(['invoice_filter_month' => Request::get('invoice_filter_month')]);
}
if(Request::get('invoice_filter_year')){
session(['invoice_filter_year' => Request::get('invoice_filter_year')]);
}
}
private function initSearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = UserInvoice::with('shopping_order')->with('shopping_order.shopping_user')->select('user_invoices.*')
->where('user_invoices.month', '=', Request::get('invoice_filter_month'))
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
if(Request::get('invoice_filter_name')){
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
}
//->orderBy('created_at', 'DESC');
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
})*/
return $query;
}
public function datatable(){
$query = $this->initSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order->auth_user_id){
return '<a href="' . route('admin_sales_users_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
}
return '<a href="' . route('admin_sales_customers_detail', [$UserInvoice->shopping_order->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
})
->addColumn('total_shipping', function (UserInvoice $UserInvoice) {
return '<span class="no-line-break">'.$UserInvoice->shopping_order->getFormattedTotalShipping()." €</span>";
})
->addColumn('created_at', function (UserInvoice $UserInvoice) {
return $UserInvoice->created_at->format("d.m.Y");
})
/*
->addColumn('shipping_order', function (UserInvoice $UserInvoice) {
$ret = "";
foreach($UserInvoice->shopping_order_items as $shopping_order_item){
$ret .= $shopping_order_item->product->name."<br>";
}
return $ret;
})
*/
->addColumn('txaction', function (UserInvoice $UserInvoice) {
if($UserInvoice->shopping_order){
return Payment::getShoppingOrderBadge($UserInvoice->shopping_order);
}
return "-";
})
->addColumn('status', function (UserInvoice $UserInvoice) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserInvoice->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
<span class="badge badge-pill badge-'.$UserInvoice->getStatusColor().'">'.$UserInvoice->getStatusType().'</span>
</a>';
})
->addColumn('invoice', function (UserInvoice $UserInvoice) {
$ret = "";
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
return $ret;
})
->orderColumn('id', 'id $1')
->orderColumn('invoice_number', 'invoice_number $1')
->orderColumn('txaction', 'txaction $1')
->orderColumn('shipped', 'shipped $1')
->orderColumn('total_shipping', 'total_shipping $1')
->rawColumns(['id', 'shipping_order', 'txaction', 'total_shipping', 'status', 'txaction', 'invoice'])
->make(true);
}
}

View file

@ -2,14 +2,15 @@
namespace App\Http\Controllers;
use App\Models\PaymentTransaction;
use Request;
use App\Models\UserShop;
use App\Services\Payment;
use App\Models\ShoppingUser;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\Models\ShoppingUser;
use App\Models\UserShop;
use App\Models\PaymentTransaction;
use App\Services\CustomerPriority;
use App\Services\Payment;
use Request;
use App\Repositories\InvoiceRepository;
class SalesController extends Controller
{
@ -70,7 +71,7 @@ class SalesController extends Controller
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getFormattedTotalShipping()."";
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()."</span>";
})
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
@ -78,17 +79,12 @@ class SalesController extends Controller
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
return '<span class="badge badge-pill badge-secondary">Beraterbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('reference');
@ -108,8 +104,9 @@ class SalesController extends Controller
->orderColumn('user_shop_id', 'user_shop_id $1')
->orderColumn('shipped', 'shipped $1')
->orderColumn('total_shipping', 'total_shipping $1')
->orderColumn('payment_for', 'payment_for $1')
->rawColumns(['id', 'txaction', 'user_shop_id', 'auth_user_shop', 'is_for', 'shipped'])
->rawColumns(['id', 'txaction', 'user_shop_id', 'auth_user_shop', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
->make(true);
}
@ -220,7 +217,7 @@ class SalesController extends Controller
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getFormattedTotalShipping()."";
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()."</span>";
})
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
@ -228,17 +225,15 @@ class SalesController extends Controller
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
return '<span class="badge badge-pill badge-secondary">Beraterbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->txaction === 'extern' && $ShoppingOrder->wp_invoice_path){
return '<span class="no-line-break"><a href="'.$ShoppingOrder->wp_invoice_path.'" class="btn btn-secondary btn-xs"><i class="fa fa-external-link-alt"></i> <i class="fa fa-download"></i></a> </div>';
}
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('reference');
@ -267,8 +262,9 @@ class SalesController extends Controller
->orderColumn('user_shop_id', 'user_shop_id $1')
->orderColumn('member_id', 'member_id $1')
->orderColumn('shipped', 'shipped $1')
->orderColumn('payment_for', 'payment_for $1')
->orderColumn('total_shipping', 'total_shipping $1')
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'is_for', 'shipped'])
->rawColumns(['id', 'member_id', 'txaction', 'user_shop_id', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
->make(true);
}
@ -306,6 +302,8 @@ class SalesController extends Controller
$shopping_payment->save();
//TODO can send MAIL
//Bei Zahlung auf Rechnung wurde die Rechnung schon erstellt,
//wenn muss hier die Storno erstellt werden
//Payment::paymentStatusSendMail($shopping_order, $shopping_payment, $data);
}
@ -315,4 +313,31 @@ class SalesController extends Controller
}
}
/*
Manuelle Rechnung erstellen.*/
public function invoice(){
$data = Request::all();
if(!isset($data['id'])){
abort(404);
}
if(isset($data['action'])){
if($data['action'] === 'create_invoice'){
$shopping_order = ShoppingOrder::findOrFail($data['id']);
$invoice_repo = new InvoiceRepository($shopping_order);
if($shopping_order->isInvoice()){
$invoice_repo->update($data);
}else{
$invoice_repo->createAndSalesVolume($data);
}
if(isset($data['view']) && $data['view'] === 'sales_customer'){
return redirect(route('admin_sales_customers_detail', [$shopping_order->id]));
}
return redirect(route('admin_sales_users_detail', [$shopping_order->id]));
}
}
}
}

View file

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use App\Models\Setting;
use Request;
class SettingController extends Controller
{
public function __construct()
{
$this->middleware('admin');
}
public function index()
{
$data = [
'values' => [],
];
return view('admin.settings.index', $data);
}
public function store()
{
$data = Request::all();
if(isset($data['action'])){
if(isset($data['settings'])){
foreach ($data['settings'] as $key=>$value){
$value['val'] = isset($value['val']) ? $value['val'] : false;
Setting::setContentBySlug($key, $value['val'], $value['type']);
}
}
}
\Session()->flash('alert-save', '1');
return redirect(route('admin_settings'));
}
}

View file

@ -3,20 +3,23 @@
namespace App\Http\Controllers\SyS;
use App\Http\Controllers\Api\KasController;
use App\Http\Controllers\Api\KasSLLController;
use App\Http\Controllers\Controller;
use App\Mail\MailInfo;
use App\Models\PaymentMethod;
use App\Models\ShoppingUser;
use App\Models\UserShop;
use App\Repositories\ContractPDFRepository;
use App\Services\CustomerPriority;
use App\Services\Shop;
use App\User;
use Auth;
use Illuminate\Support\Facades\Mail;
use Request;
use App\User;
use App\Mail\MailInfo;
use App\Services\Shop;
use App\Models\UserShop;
use App\Models\Homeparty;
use App\Models\ShoppingUser;
use App\Models\PaymentMethod;
use App\Models\ShoppingOrder;
use App\Models\ShoppingOrderItem;
use App\Services\CustomerPriority;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Mail;
use App\Http\Controllers\Api\KasController;
use App\Repositories\ContractPDFRepository;
use App\Http\Controllers\Api\KasSLLController;
class AdminToolsController extends Controller
@ -86,6 +89,165 @@ class AdminToolsController extends Controller
return back();
}
public function points()
{
$c = 0;
if(false){ //8
dump("make homeparty tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('payment_for', '=', NULL)->get();
foreach($ShoppingOrders as $ShoppingOrder){
dump($ShoppingOrder->id);
dump($ShoppingOrder->shopping_user->getOrderPaymentFor());
$ShoppingOrder->payment_for = $ShoppingOrder->shopping_user->getOrderPaymentFor();
$ShoppingOrder->save();
$c ++;
}
dd($c);
}
if(false){ //8
dump("make homeparty tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeHomepartyTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //7
dump("make homeparty shipping_tax in homeparty order user_cart");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '!=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
if(isset($ShoppingOrder->homeparty->order['user_carts'])){
$user_carts = [];
foreach($ShoppingOrder->homeparty->order['user_carts'] as $id => $values){
$values['shipping_tax'] = round($values['shipping_price'] - $values['shipping_price_net'], 2);
dump($values['shipping_tax']);
$user_carts[$id] = $values;
}
$order = $ShoppingOrder->homeparty->order;
$order['user_carts'] = $user_carts;
$ShoppingOrder->homeparty->order = $order;
$ShoppingOrder->homeparty->save();
}
$c ++;
}
dd($c);
}
if(false){ //6
dump("make tax_split in shopping_order");
dd('check point function');
$ShoppingOrders = ShoppingOrder::where('homeparty_id', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$ShoppingOrder->makeTaxSplit();
$c ++;
}
dd($c);
}
if(false){ //5
//run after make points etc.
dump("correction shopping_order homeparty");
//dd('check point function');
$ShoppingOrders = ShoppingOrder::where('payment_for', 5)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$homeparty = Homeparty::find($ShoppingOrder->homeparty_id);
if($homeparty && $homeparty->completed && $homeparty->step > 10){
$ShoppingOrder->subtotal = $homeparty->order['ek_price_net'];
$ShoppingOrder->subtotal_ws = 0;
$ShoppingOrder->tax = $ShoppingOrder->total - $homeparty->order['ek_price_net'];
$ShoppingOrder->points = $homeparty->order['points'] - $homeparty->order['bonus_points_diff'];
$ShoppingOrder->save();
$c ++;
}
}
dd($c);
}
if(false){ //4
dump("make tax in ShoppingOrderItem");
dd('check point function');
$ShoppingOrderItems = ShoppingOrderItem::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->tax = $item->price - $item->price_net;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //3
dump("make price_net in ShoppingOrderItem");
dd('check point function');
$ShoppingOrderItems = ShoppingOrderItem::where('price_net', '=', NULL)->get();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrderItems as $item){
$item->price_net = $item->price / (100 + $item->tax_rate) * 100;
$item->save();
$c ++;
}
dd($c);
}
if(false){ //2
dump("add payment_for in shopping_order");
dd('check point function');
$ShoppingUsers = ShoppingUser::all();
foreach($ShoppingUsers as $ShoppingUser){
if($ShoppingUser->shopping_order){
$ShoppingUser->shopping_order->payment_for = $ShoppingUser->getOrderPaymentFor();
$ShoppingUser->shopping_order->save();
$c ++;
}
}
dd($c);
}
if(false){ //1
dump("make points in shopping_order_item and total in ShoppingOrder");
dd('check point function');
$ShoppingOrders = ShoppingOrder::all();
//->skip(0)->take(500)->get();
//->skip(500)->take(500)->get();
foreach($ShoppingOrders as $ShoppingOrder){
$points_total = 0;
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
$points = $shopping_order_item->product ? $shopping_order_item->product->points : 0;
$points_total += $points;
$shopping_order_item->points = $points;
$shopping_order_item->save();
$c ++;
}
$ShoppingOrder->points = $points_total;
$ShoppingOrder->save();
}
dd($c);
}
}

View file

@ -342,8 +342,8 @@ class HomepartyController extends Controller
'tax_rate' => 0,
'points' => $product->points,
'margin' => $margin,
'ek-price' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'ek-price_net' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'ek_price' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'ek_price_net' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'slug' => $product->slug
]);
}else{
@ -357,8 +357,8 @@ class HomepartyController extends Controller
'tax_rate' => $product->getTaxWith($homeparty->getUserCountry()),
'points' => $product->points,
'margin' => $margin,
'ek-price' => $product->getPriceWith(false, true, $homeparty->getUserCountry()),
'ek-price_net' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'ek_price' => $product->getPriceWith(false, true, $homeparty->getUserCountry()),
'ek_price_net' => $product->getPriceWith(true, true, $homeparty->getUserCountry()),
'slug' => $product->slug
]);
}
@ -459,7 +459,7 @@ class HomepartyController extends Controller
$date = date('d.m.Y H:i:s', $time);
$user = User::find(Auth::user()->id);
Yard::instance('shopping')->destroy();
$cartItem = Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$ek_price, ['image' => "", 'slug' => $time, 'weight' => 0]);
$cartItem = Yard::instance('shopping')->add($homeparty->id, 'Bestellung Homeparty '.$date, 1, \App\Services\HomepartyCart::$ek_price, false, false, ['image' => "", 'slug' => $time, 'weight' => 0]);
Yard::setTax($cartItem->rowId, 0);
do {
$identifier = Util::getToken();

View file

@ -68,7 +68,7 @@ class OrderController extends Controller
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getFormattedTotalShipping()."";
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()."</span>";
})
->addColumn('payment', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('getPaymentType');
@ -76,17 +76,12 @@ class OrderController extends Controller
->addColumn('shipped', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getShippedColor().'">'.$ShoppingOrder->getShippedType().'</span>';
})
->addColumn('is_for', function (ShoppingOrder $ShoppingOrder) {
if($ShoppingOrder->shopping_user->is_for === 'me'){
return '<span class="badge badge-pill badge-secondary">Beraterbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'ot'){
return '<span class="badge badge-pill badge-info">Kundenbestellung</span>';
}
if($ShoppingOrder->shopping_user->is_for === 'hp'){
return '<span class="badge badge-pill badge-dark">Homepartybestellung</span>';
}
return '-';
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
})
->addColumn('reference', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getLastShoppingPayment('reference');
@ -95,7 +90,9 @@ class OrderController extends Controller
->orderColumn('txaction', 'txaction $1')
->orderColumn('shipped', 'shipped $1')
->orderColumn('total_shipping', 'total_shipping $1')
->rawColumns(['id', 'txaction', 'is_for', 'shipped'])
->orderColumn('payment_for', 'payment_for $1')
->rawColumns(['id', 'txaction', 'payment_for', 'total_shipping', 'invoice', 'shipped'])
->make(true);
}
@ -381,7 +378,7 @@ class OrderController extends Controller
}
//get the card item
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(false, true, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
Yard::setTax($cartItem->rowId, $product->getTaxWith(Yard::instance('shopping')->getUserCountry()));
if(isset($data['qty']) && $data['qty'] > 0){
@ -458,7 +455,7 @@ class OrderController extends Controller
if ($product->images->count()) {
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0,
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, 0, false, false,
['image' => $image, 'slug' => $product->slug, 'weight' => 0, 'points' => 0,
'comp' => $data['comp_num'], 'product_id' => $product->id]);
Yard::setTax($cartItem->rowId, 0);

View file

@ -53,7 +53,7 @@ class ShopSalesController extends Controller
return Payment::getShoppingOrderBadge($ShoppingOrder);
})
->addColumn('total_shipping', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->getFormattedTotalShipping();
return '<span class="no-line-break">'.$ShoppingOrder->getFormattedTotalShipping()." €</span>";
})
->addColumn('orders', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->shopping_user ? $ShoppingOrder->shopping_user->orders : '';
@ -61,11 +61,22 @@ class ShopSalesController extends Controller
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
})
->addColumn('payment_for', function (ShoppingOrder $ShoppingOrder) {
return '<span class="badge badge-pill badge-'.$ShoppingOrder->getPaymentForColor().'">'.$ShoppingOrder->getPaymentForType().'</span>';
})
->addColumn('invoice', function (ShoppingOrder $ShoppingOrder) {
return $ShoppingOrder->isInvoice() ? '<span class="no-line-break"><a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a>
<a href="'.route('storage_file', [$ShoppingOrder->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a></span>' : '-';
})
->orderColumn('payment_for', 'payment_for $1')
->orderColumn('id', 'id $1')
->orderColumn('txaction', 'txaction $1')
->orderColumn('user_shop_id', 'user_shop_id $1')
->rawColumns(['id', 'txaction', 'user_shop_id'])
->orderColumn('total_shipping', 'total_shipping $1')
->rawColumns(['id', 'txaction', 'user_shop_id', 'total_shipping', 'invoice', 'payment_for'])
->make(true);
}

View file

@ -33,7 +33,7 @@ class CardController extends Controller
if($product->images->count()){
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -59,7 +59,7 @@ class CardController extends Controller
$image = $product->images->first()->slug;
}
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
if(Yard::instance('shopping')->getUserTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -81,6 +81,7 @@ class CardController extends Controller
}else{
Yard::instance('shopping')->reCalculateShippingPrice();
}
$data = [
'user_shop' => Util::getUserShop(),
'mylangs' => Shop::getLangChange(),

View file

@ -255,7 +255,6 @@ class CheckoutController extends Controller
if ($validator->fails()) {
return back()->withErrors($validator)->withInput(Request::all());
}
$data = Request::all();
//make User
$shopping_user = $this->makeShoppingUser($data);
@ -471,19 +470,20 @@ class CheckoutController extends Controller
//get data
$homeparty = Homeparty::find($shopping_user->homeparty_id);
//set Data!
$total = Yard::instance('shopping')->total(2, '.', ''); //ek_price
$data = [
'shopping_user_id' => $shopping_user->id,
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
'payment_for' => $shopping_user->getOrderPaymentFor(),
'homeparty_id' => $shopping_user->homeparty_id,
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => $homeparty->order['price_net'],
'total' => $total,
'subtotal' => $homeparty->order['ek_price_net'],
'shipping' => $homeparty->order['shipping_price'],
'shipping_net' => $homeparty->order['shipping_price_net'],
'subtotal_ws' => 0,
'tax' => 0,
'tax' => $total - $homeparty->order['ek_price_net'],
'total_shipping' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
'points' => $homeparty->order['points'] - $homeparty->order['bonus_points_diff'],
'weight' => 0,
@ -496,7 +496,7 @@ class CheckoutController extends Controller
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => $user_shop->id,
'payment_for' => Util::getUserPaymentFor(),
'payment_for' => $shopping_user->getOrderPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
@ -528,6 +528,8 @@ class CheckoutController extends Controller
$shopping_order->shopping_order_items()->each(function($model) use ($items, $shopping_order, $shopping_user) {
foreach ($items as $item) {
if ($model->row_id === $item->rowId) {
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
@ -535,8 +537,12 @@ class CheckoutController extends Controller
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug,
];
if($shopping_user->is_from === 'homeparty'){
@ -549,10 +555,12 @@ class CheckoutController extends Controller
}
return $model->delete();
});
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count()){
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
@ -560,8 +568,12 @@ class CheckoutController extends Controller
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];
@ -573,8 +585,11 @@ class CheckoutController extends Controller
$shopping_order_item = ShoppingOrderItem::create($data);
}
}
if($shopping_user->is_from === 'homeparty'){
$shopping_order->makeHomepartyTaxSplit();
}else{
$shopping_order->makeTaxSplit();
}
return $shopping_order;
}
@ -605,7 +620,7 @@ class CheckoutController extends Controller
{
$this->session->remove($this->instance);
}
//is for Rechnung MIV
private function directPaymentStatus(PaymentTransaction $payt){
if(isset($payt->transmitted_data['param'])){

View file

@ -479,7 +479,7 @@ class WizardController extends Controller
$image = $product->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight]);
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{
@ -494,7 +494,7 @@ class WizardController extends Controller
if($product_on_board->images->count()){
$image = $product_on_board->images->first()->slug;
}
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight]);
$cartItem = Yard::instance('shopping')->add($product_on_board->id, $product_on_board->getLang('name'), 1, $product_on_board->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product_on_board->slug, 'weight' => $product_on_board->weight, 'points' => $product_on_board->points]);
if(\App\Services\UserService::getTaxFree()){
Yard::setTax($cartItem->rowId, 0);
}else{

View file

@ -27,11 +27,10 @@ class Subdomain
$request->route()->forgetParameter('subdomain');
Util::setPostRoute('user/');
if($user_shop){
if(!$user_shop->active){
abort(503);
}
if(!$user_shop->user->isActiveShop()){
if(!$user_shop->user && !$user_shop->user->isActiveShop()){
abort(503);
}
\Session::put('user_shop', $user_shop);

View file

@ -0,0 +1,45 @@
<?php
namespace App\Libraries;
use App\Libraries\CouponPDF;
use App\Models\Coupon;
use Storage;
class InvoicePDF{
protected $view;
protected $pdf;
public function __construct($view)
{
$this->view = $view;
}
public function create($data, $name='test.pdf', $output='stream', $path = false){
header('Content-type: text/html; charset=UTF-8') ;//chrome
//dd($data);
$pdf = app('dompdf.wrapper');
$pdf->getDomPDF()->set_option("enable_php", true);
$pdf->loadView($this->view, $data);
$pdf->setPaper('A4', 'portrait');
if($output === 'stream'){
return $pdf->stream($name);
}
if($output === 'download'){
return $pdf->download($name);
}
if($output === 'save'){
if($path){
$pdf->save($path.$name);
return $path.$name;
}
}
}
}
?>

53
app/Mail/MailInvoice.php Normal file
View file

@ -0,0 +1,53 @@
<?php
namespace App\Mail;
use App\Services\Invoice;
use App\Models\ShoppingOrder;
use App\Models\UserInvoice;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Storage;
class MailInvoice extends Mailable
{
use Queueable, SerializesModels;
protected $shopping_order;
protected $user_invoice;
public $subject;
public function __construct(ShoppingOrder $shopping_order, UserInvoice $user_invoice)
{
$this->shopping_order = $shopping_order;
$this->user_invoice = $user_invoice;
$this->subject = 'Rechnung zu Deiner Bestellung: '.$shopping_order->getLastShoppingPayment('reference') ;
}
public function build()
{
$title = __('email.invoice_title');
$copy1line = __('email.invoice_copy1line').$this->shopping_order->getLastShoppingPayment('reference');
$filename = $this->user_invoice->filename;
$disk = $this->user_invoice->disk;
$path = $this->user_invoice->getDownloadPath();
if (!Storage::disk($disk)->exists($path)) {
return;
}
$file = Storage::disk($disk)->path($path);
$file = str_replace('//', '/', $file);
$mime = Storage::disk($disk)->mimeType($path);
return $this->view('emails.blank')->with([
'title' => $title,
'copy1line' => $copy1line,
])->attach($file,[
'as' => $filename,
'mime' => $mime,
]); // attach file;
}
}

View file

@ -45,6 +45,7 @@ use Cviebrock\EloquentSluggable\Sluggable;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Category whereTransHeadline($value)
* @property-read \App\Models\IqImage|null $iq_image
* @property-read int|null $product_categories_count
* @method static \Illuminate\Database\Eloquent\Builder|Category withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class Category extends Model
{

View file

@ -57,6 +57,10 @@ use PHPUnit\Framework\Constraint\Count;
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\CountryPrice[] $country_prices
* @property-read int|null $country_prices_count
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCurrencyUnit($value)
* @property bool|null $eu_country
* @property bool|null $supply_country
* @method static \Illuminate\Database\Eloquent\Builder|Country whereEuCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|Country whereSupplyCountry($value)
*/
class Country extends Model
{

View file

@ -59,6 +59,19 @@ use Illuminate\Database\Eloquent\Collection;
* @property-read int|null $homeparty_guests_count
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Homeparty whereTokenActive($value)
* @property int|null $country_id
* @property int|null $step
* @property array|null $settings
* @property array|null $order
* @property array|null $card_info
* @property-read Country|null $country
* @property-read Collection|\App\Models\HomepartyUserOrderItem[] $homeparty_order_items
* @property-read int|null $homeparty_order_items_count
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereCardInfo($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereCountryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereSettings($value)
* @method static \Illuminate\Database\Eloquent\Builder|Homeparty whereStep($value)
*/
class Homeparty extends Model
{

View file

@ -105,6 +105,10 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\HomepartyUserOrderItem[] $homeparty_user_order_items
* @property-read int|null $homeparty_user_order_items_count
* @property string|null $delivery
* @property array|null $settings
* @method static \Illuminate\Database\Eloquent\Builder|HomepartyUser whereDelivery($value)
* @method static \Illuminate\Database\Eloquent\Builder|HomepartyUser whereSettings($value)
*/
class HomepartyUser extends Model
{

View file

@ -22,7 +22,7 @@ use Illuminate\Database\Eloquent\Model;
* @property float $tax_rate
* @property int $points
* @property float $margin
* @property float $ek-price
* @property float $ek_price
* @property string $slug
* @property Carbon $created_at
* @property Carbon $updated_at
@ -48,6 +48,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUserOrderItem whereTaxRate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\HomepartyUserOrderItem whereUpdatedAt($value)
* @mixin \Eloquent
* @property float|null $ek_price_net
* @method static \Illuminate\Database\Eloquent\Builder|HomepartyUserOrderItem whereEkPriceNet($value)
*/
class HomepartyUserOrderItem extends Model
{
@ -63,8 +65,8 @@ class HomepartyUserOrderItem extends Model
'tax_rate' => 'float',
'points' => 'int',
'margin' => 'float',
'ek-price' => 'float',
'ek-price_net' => 'float'
'ek_price' => 'float',
'ek_price_net' => 'float'
];
@ -78,8 +80,8 @@ class HomepartyUserOrderItem extends Model
'tax_rate',
'points',
'margin',
'ek-price',
'ek-price_net',
'ek_price',
'ek_price_net',
'slug'
];
@ -120,32 +122,32 @@ class HomepartyUserOrderItem extends Model
public function getFormattedEKPrice()
{
return formatNumber($this->attributes['ek-price']);
return formatNumber($this->attributes['ek_price']);
}
public function getFormattedTotalEKPrice()
{
return formatNumber($this->attributes['ek-price'] * $this->attributes['qty']);
return formatNumber($this->attributes['ek_price'] * $this->attributes['qty']);
}
public function getFormattedEKPriceNet()
{
return formatNumber($this->attributes['ek-price_net']);
return formatNumber($this->attributes['ek_price_net']);
}
public function getFormattedTotalEKPriceNet()
{
return formatNumber($this->attributes['ek-price_net'] * $this->attributes['qty']);
return formatNumber($this->attributes['ek_price_net'] * $this->attributes['qty']);
}
public function getFormattedIncomePrice()
{
return formatNumber($this->attributes['price'] - $this->attributes['ek-price']);
return formatNumber($this->attributes['price'] - $this->attributes['ek_price']);
}
public function getFormattedTotalIncomePrice()
{
return formatNumber(($this->attributes['price'] - $this->attributes['ek-price']) * $this->attributes['qty']);
return formatNumber(($this->attributes['price'] - $this->attributes['ek_price']) * $this->attributes['qty']);
}
public function getFormattedTotalPoints()
@ -171,22 +173,22 @@ class HomepartyUserOrderItem extends Model
public function geTotalEKPrice()
{
return (float) ($this->attributes['ek-price'] * $this->attributes['qty']);
return (float) ($this->attributes['ek_price'] * $this->attributes['qty']);
}
public function geTotalEKPriceNet()
{
return (float) ($this->attributes['ek-price_net'] * $this->attributes['qty']);
return (float) ($this->attributes['ek_price_net'] * $this->attributes['qty']);
}
public function getIncomePrice()
{
return (float) ($this->attributes['price'] - $this->attributes['ek-price']);
return (float) ($this->attributes['price'] - $this->attributes['ek-ek_price']);
}
public function geTotalIncomePrice()
{
return (float) (($this->attributes['price'] - $this->attributes['ek-price']) * $this->attributes['qty']);
return (float) (($this->attributes['price'] - $this->attributes['ek_price']) * $this->attributes['qty']);
}

View file

@ -38,6 +38,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query()
* @property int|null $pos
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\IqImage wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|IqImage withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class IqImage extends Model
{

View file

@ -35,6 +35,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereShowAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\PaymentMethod whereUpdatedAt($value)
* @mixin \Eloquent
* @property array|null $show_on
* @method static \Illuminate\Database\Eloquent\Builder|PaymentMethod whereShowOn($value)
*/
class PaymentMethod extends Model
{
@ -85,7 +87,7 @@ class PaymentMethod extends Model
public function getShowOnTypes(){
$ret = [];
if($this->show_on){
if($this->show_on && is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset(self::$showONs[$show]) ? self::$showONs[$show] : '-';
}

View file

@ -108,6 +108,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read int|null $ingredients_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductIngredient[] $product_ingredients
* @property-read int|null $product_ingredients_count
* @property bool|null $no_commission
* @property array|null $show_on
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Ingredient[] $p_ingredients
* @property-read int|null $p_ingredients_count
* @method static \Illuminate\Database\Eloquent\Builder|Product whereNoCommission($value)
* @method static \Illuminate\Database\Eloquent\Builder|Product whereShowOn($value)
* @method static \Illuminate\Database\Eloquent\Builder|Product withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class Product extends Model
{
@ -298,7 +305,6 @@ class Product extends Model
return isset($this->attributes['price_ek']) ? Util::formatNumber($this->attributes['price_ek']) : "";
}
public function getFormattedPriceOld()
{
return isset($this->attributes['price_old']) ? Util::formatNumber($this->attributes['price_old']) : "";
@ -437,17 +443,18 @@ class Product extends Model
public function getShowOnTypes(){
$ret = [];
foreach($this->show_on as $show){
$ret[] = isset($this->showONs[$show]) ? $this->showONs[$show] : '-';
if($this->show_on && is_array($this->show_on)){
foreach($this->show_on as $show){
$ret[] = isset($this->showONs[$show]) ? $this->showONs[$show] : '-';
}
}
return $ret;
}
public function setPosAttribute($value){
$this->attributes['pos'] = is_numeric($value) ? $value : null;
}
public function getLang($key)
{
$lang = \App::getLocale();

View file

@ -23,6 +23,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductCategory query()
* @property int|null $pos
* @method static \Illuminate\Database\Eloquent\Builder|ProductCategory wherePos($value)
*/
class ProductCategory extends Model
{

View file

@ -38,6 +38,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage query()
* @property int|null $pos
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductImage wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|ProductImage withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class ProductImage extends Model
{

144
app/Models/Setting.php Normal file
View file

@ -0,0 +1,144 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Setting
*
* @property int $id
* @property string|null $identifier
* @property string $slug
* @property int $referenz
* @property string|null $action
* @property string|null $object
* @property string|null $full_text
* @property string|null $text
* @property int|null $int
* @property int $status
* @property string|null $type
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|Setting newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Setting newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Setting query()
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereAction($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereFullText($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereIdentifier($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereInt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereObject($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereReferenz($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereSlug($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereText($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereType($value)
* @method static \Illuminate\Database\Eloquent\Builder|Setting whereUpdatedAt($value)
* @mixin \Eloquent
*/
class Setting extends Model
{
protected $table = 'settings';
protected $casts = [
'referenz' => 'int',
'status' => 'int',
'int' => 'int',
'object' => 'array'
];
protected $fillable = [
'identifier',
'slug',
'referenz',
'action',
'object',
'full_text',
'text',
'int',
'status',
'type'
];
protected static $types = [
'object' => 'Object',
'full_text' => 'Full Text',
'text' => 'Text',
'int' => 'Zahl',
'bool' => 'Bool',
];
public function sluggable()
{
return [
'slug' => [
'source' => 'name'
]
];
}
public static function getContentBySlug($slug){
$content = self::whereSlug(trim($slug))->first();
if($content){
switch ($content->type){
case 'object':
return $content->object;
break;
case 'full_text':
return $content->full_text;
break;
case 'text':
return $content->text;
break;
case 'int':
return $content->int;
break;
case 'bool':
return $content->int === 1 ? true : false;
break;
}
}
return false;
}
public static function setContentBySlug($slug, $value, $type = "full_text"){
$content = self::whereSlug(trim($slug))->first();
if(!$content) {
$content = self::create([
'slug' => $slug,
'type' => $type,
]);
}
$content->type = $type;
switch ($content->type){
case 'object':
$content->object = $value ? $value : null;;
break;
case 'full_text':
$content->full_text = $value ? $value : null;;
break;
case 'text':
$content->text = $value ? $value : null;;
break;
case 'int':
$content->int = (int) $value;
break;
case 'bool':
$content->int = $value ? 1 : 0;
break;
}
$content->save();
return $content;
}
}

View file

@ -80,6 +80,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereSubtotalWs($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereTracking($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrder whereWpInvoicePath($value)
* @property int|null $homeparty_id
* @property array|null $wp_notice
* @property-read \App\Models\Homeparty|null $homeparty
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereHomepartyId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereWpNotice($value)
*/
class ShoppingOrder extends Model
{
@ -93,6 +98,7 @@ class ShoppingOrder extends Model
'auth_user_id',
'member_id',
'homeparty_id',
'payment_for',
'country_id',
'user_shop_id',
'total',
@ -101,6 +107,7 @@ class ShoppingOrder extends Model
'shipping_net',
'subtotal_ws',
'tax',
'tax_split',
'total_shipping',
'points',
'weight',
@ -115,6 +122,7 @@ class ShoppingOrder extends Model
protected $casts = [
'wp_notice' => 'array',
'tax_split' => 'array',
];
public static $shippedTypes = [
@ -141,6 +149,34 @@ class ShoppingOrder extends Model
10 => 'danger',
];
public static $paymentForTypes = [
0 => '',
1 => 'Registrierung',
2 => 'Mitgliedschaft',
3 => 'Bestellung',
4 => 'Kundenbestellung',
5 => 'Homeparty',
6 => 'Shop',
7 => 'extern',
10 => '',
];
public static $paymentForColors = [
0 => 'default',
1 => 'warning',
2 => 'warning',
3 => 'secondary',
4 => 'info',
5 => 'dark',
6 => 'secondary',
7 => 'dark',
8 => 'info',
9 => 'default',
10 => 'info',
11 => 'default'
];
public function shopping_user()
{
@ -183,6 +219,9 @@ class ShoppingOrder extends Model
return $this->hasOne('App\Models\UserHistory','shopping_order_id')->latest();
}
public function user_invoice(){
return $this->hasOne('App\Models\UserInvoice', 'shopping_order_id', '');
}
public function shopping_order_items(){
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
@ -192,6 +231,18 @@ class ShoppingOrder extends Model
return $this->hasMany('App\Models\ShoppingPayment', 'shopping_order_id');
}
public function user_sales_volume(){
return $this->hasMany('App\Models\UserSalesVolume', 'shopping_order_id');
}
public function user_sales_volume_no_userid(){
return $this->hasMany('App\Models\UserSalesVolume', 'shopping_order_id')->where('user_id', '=', NULL)->first();
}
public function setUserHistoryValue($values = []){
if($user_history = $this->user_history){
foreach ($values as $key=>$val){
@ -251,6 +302,11 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['subtotal_ws']);
}
public function getFormattedSubtotalShipping()
{
return formatNumber($this->attributes['subtotal_shipping']);
}
public function getFormattedTax()
{
return formatNumber($this->attributes['tax']);
@ -261,8 +317,33 @@ class ShoppingOrder extends Model
return formatNumber($this->attributes['total_shipping']);
}
public function getPriceVkNetBy($product_id)
{
if($product = Product::find($product_id)){
if($this->shipping_country && $this->shipping_country->country){
return $product->getPriceWith(true, false, $this->shipping_country->country);
}
}
return 0;
}
public function getPaymentForType(){
return isset(self::$paymentForTypes[$this->payment_for]) ? self::$paymentForTypes[$this->payment_for] : "";
}
public function getPaymentForColor(){
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
}
public function getUserDiscount()
{
if($this->auth_user && $this->auth_user->user_level){
return $this->auth_user->user_level->getFormattedMargin();
}
if($this->member && $this->member->user_level){
return $this->member->user_level->getFormattedMargin();
}
return 0;
}
public function getItemsCount(){
$count = 0;
@ -271,9 +352,128 @@ class ShoppingOrder extends Model
$count += $shopping_order_item->qty;
}
}
return $count;
}
public function isInvoice(){
return $this->user_invoice ? true : false;
}
public function getStatusByOrder(){
if($this->payment_for){
if($this->payment_for === 6){ //Kunde-Shop
return 2;
}
return 1;
}
return 0;
}
public function makeHomepartyTaxSplit()
{
$tax_split = [];
if($this->homeparty){
foreach($this->homeparty->homeparty_order_items as $item){
$tax_rate = intval($item->tax_rate);
if($tax_rate > 0){
$vk_tax = round((($item->price - $item->price_net) * $item->qty), 2);
$ek_tax = round((($item->ek_price - $item->ek_price_net) * $item->qty), 2);
if(isset($tax_split[$tax_rate])){
$tax_split[$tax_rate]['vk_tax'] = round($tax_split[$tax_rate]['vk_tax'] + $vk_tax, 2);
$tax_split[$tax_rate]['ek_tax'] = round($tax_split[$tax_rate]['ek_tax'] + $ek_tax, 2);
}else{
$tax_split[$tax_rate] = ['vk_tax' => $vk_tax, 'ek_tax' => $ek_tax];
}
}
}
$order_vk_tax = 0;
$order_ek_tax = 0;
if($this->homeparty->order){
if(isset($this->homeparty->order['ek_price_net'])){
$order_vk_tax = round((($this->homeparty->order['price'] - $this->homeparty->order['price_net'])), 2);
$order_ek_tax = round((($this->homeparty->order['ek_price'] - $this->homeparty->order['ek_price_net'])), 2);
}
}
if(isset($tax_split[16])){
$tax_split[16] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
}
if(isset($tax_split[19])){
$tax_split[19] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
}
if(isset($tax_split[5])){
if(!isset($tax_split[16])){
$tax_split[16] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
}
$tax_split[16]['vk_tax'] = round($tax_split[16]['vk_tax'] - $tax_split[5]['vk_tax'], 2);
$tax_split[16]['ek_tax'] = round($tax_split[16]['ek_tax'] - $tax_split[5]['ek_tax'], 2);
}
if(isset($tax_split[7])){
if(!isset($tax_split[19])){
$tax_split[19] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
}
$tax_split[19]['vk_tax'] = round($tax_split[19]['vk_tax'] - $tax_split[7]['vk_tax'], 2);
$tax_split[19]['ek_tax'] = round($tax_split[19]['ek_tax'] - $tax_split[7]['ek_tax'], 2);
}
foreach($tax_split as $key=>$value){
$tax_split[$key]['vk_tax'] = number_format($value['vk_tax'], 2);
$tax_split[$key]['ek_tax'] = number_format($value['ek_tax'], 2);
}
}
if(!isset($tax_split[16]) && !isset($tax_split[19])){
$tax_split = NULL;
}
$this->tax_split = $tax_split;
$this->save();
}
public function makeTaxSplit()
{
$tax_split = NULL;
if($this->tax > 0){
$tax_split = [];
foreach($this->shopping_order_items as $item){
$tax_rate = intval($item->tax_rate);
if($tax_rate > 0){
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ?
round($tax_split[$tax_rate] + ($item->tax * $item->qty), 2) :
round(($item->tax * $item->qty), 2);
}
}
if(isset($tax_split[16])){
$tax_split[16] = $this->tax;
}
if(isset($tax_split[19])){
$tax_split[19] = $this->tax;
}
if(isset($tax_split[5])){
if(!isset($tax_split[16])){
$tax_split[16] = $this->tax;
}
$tax_split[16] = round($tax_split[16] - $tax_split[5], 2);
}
if(isset($tax_split[7])){
if(!isset($tax_split[19])){
$tax_split[19] = $this->tax;
}
$tax_split[19] = round($tax_split[19] - $tax_split[7], 2);
}
foreach($tax_split as $key=>$value){
$tax_split[$key] = number_format($value, 2);
}
}
$this->tax_split = $tax_split;
$this->save();
}

View file

@ -45,6 +45,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property float|null $price_net
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem whereComp($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingOrderItem wherePriceNet($value)
* @property int|null $homeparty_id
* @property-read \App\Models\Homeparty|null $homeparty
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrderItem whereHomepartyId($value)
*/
class ShoppingOrderItem extends Model
{
@ -63,10 +66,13 @@ class ShoppingOrderItem extends Model
'price',
'price_net',
'tax_rate',
'tax',
'price_vk_net',
'discount',
'points',
'slug',
];
public function shopping_order()
{
return $this->belongsTo('App\Models\ShoppingOrder','shopping_order_id');
@ -97,6 +103,27 @@ class ShoppingOrderItem extends Model
return formatNumber($this->attributes['price_net']);
}
public function getFormattedPriceVkNet()
{
return formatNumber($this->attributes['price_vk_net']);
}
public function getFormattedTaxRate()
{
return cleanNumberFormat($this->attributes['tax_rate']);
}
public function getTaxRate()
{
return formatNumber($this->attributes['tax']);
}
public function getFormattedDiscount()
{
return cleanNumberFormat($this->attributes['discount']);
}
public function getFormattedTotalPriceNet()
{
return formatNumber($this->attributes['price_net'] * $this->attributes['qty']);

View file

@ -113,6 +113,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereIsFrom($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShippingEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShoppingUserId($value)
* @property int|null $homeparty_id
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereHomepartyId($value)
*/
class ShoppingUser extends Model
{
@ -246,6 +248,26 @@ class ShoppingUser extends Model
return $this;
}
public function getOrderPaymentFor() {
switch($this->is_from){
case 'wizard':
return 1;
case 'membership':
return 2;
case 'user_order':
return $this->is_for === 'me' ? 3 : 4;
case 'homeparty':
return 5;
case 'shopping':
return 6;
case 'extern':
return 7;
}
return 0;
}
public function getAPIShippedType() {
if($this->shopping_order){
return $this->shopping_order->getAPIShippedType();

View file

@ -37,6 +37,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereUpdatedAt($value)
* @mixin \Eloquent
* @method static \Illuminate\Database\Eloquent\Builder|SySetting withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class SySetting extends Model
{

View file

@ -119,6 +119,12 @@ use Carbon\Carbon;
* @property array|null $notice
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereAcceptedContract($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserAccount whereNotice($value)
* @property int $reverse_charge
* @property string|null $reverse_charge_code
* @property string|null $reverse_charge_valid
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseCharge($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeValid($value)
*/
class UserAccount extends Model
{

183
app/Models/UserInvoice.php Normal file
View file

@ -0,0 +1,183 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class UserInvoice
*
* @property int $id
* @property int $shopping_order_id
* @property int|null $month
* @property int|null $year
* @property Carbon|null $date
* @property string|null $full_number
* @property int|null $number
* @property string|null $file
* @property string|null $infos
* @property bool $paid
* @property Carbon|null $paid_date
* @property bool $cancellation
* @property int|null $cancellation_id
* @property Carbon|null $cancellation_date
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
*
* @property ShoppingOrder $shopping_order
*
* @package App\Models
*/
class UserInvoice extends Model
{
use SoftDeletes;
protected $table = 'user_invoices';
protected $casts = [
'shopping_order_id' => 'int',
'month' => 'int',
'year' => 'int',
'number' => 'int',
'paid' => 'bool',
'cancellation' => 'bool',
'cancellation_id' => 'int',
'status' => 'int',
'infos' => 'array',
];
protected $dates = [
'date',
'paid_date',
'cancellation_date'
];
protected $fillable = [
'shopping_order_id',
'month',
'year',
'date',
'full_number',
'number',
'filename',
'dir',
'delivery_filename',
'delivery_dir',
'disk',
'infos',
'paid',
'paid_date',
'cancellation',
'cancellation_id',
'cancellation_date',
'status'
];
public static $monthNames = [
1 => 'Januar',
2 => 'Februar',
3 => 'März',
4 => 'April',
5 => 'Mai',
6 => 'Juni',
7 => 'Juli',
8 => 'August',
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'Dezember'
];
public static $statusTypes = [
0 => '-',
1 => 'Bestellung',
2 => 'Shop',
11 => 'storniert B.',
12 => 'storniert Shop',
];
public static $statusColors = [
0 => 'warning',
1 => 'success',
2 => 'secondary',
11 => 'danger',
12 => 'danger',
];
public function shopping_order(){
return $this->belongsTo(ShoppingOrder::class);
}
public function getDateAttribute($value){
return $this->attributes['date'] ? Carbon::parse($this->attributes['date'])->format(\Util::formatDateDB()) : '';
}
public function setDateAttribute( $value ) {
$this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getDateRaw(){
return isset($this->attributes['date']) ? $this->attributes['date'] : NULL;
}
public function getPaidDateAttribute($value){
return $this->attributes['paid_date'] ? Carbon::parse($this->attributes['paid_date'])->format(\Util::formatDateDB()) : '';
}
public function setPaidDateAttribute( $value ) {
$this->attributes['paid_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getPaidDateRaw(){
return isset($this->attributes['paid_date']) ? $this->attributes['paid_date'] : NULL;
}
public function getCancellationDateAttribute($value){
return $this->attributes['cancellation_date'] ? Carbon::parse($this->attributes['cancellation_date'])->format(\Util::formatDateDB()) : '';
}
public function setCancellationDateAttribute( $value ) {
$this->attributes['cancellation_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getCancellationDateRaw(){
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
}
public static function getYearRange()
{
$start = 2021;
$end = date("Y");
return array_reverse(range($start, $end));
}
public static function getMonthName($month)
{
return isset(self::$monthNames[$month]) ? self::$monthNames[$month] : $month;
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
public function getDownloadPath($full = false){
if(!$full){
return $this->dir.$this->filename;
}
return \Storage::disk($this->disk)->path($this->dir.$this->filename);
}
public function getDownloadPathDelivery($full = false){
if(!$full){
return $this->delivery_dir.$this->delivery_filename;
}
return \Storage::disk($this->disk)->path($this->delivery_dir.$this->delivery_filename);
}
}

View file

@ -0,0 +1,229 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class UserInvoiceCredit
*
* @property int $id
* @property int|null $auth_user_id
* @property int|null $shopping_order_id
* @property int|null $shopping_user_id
* @property string $type
* @property string|null $full_number
* @property int|null $number
* @property float|null $net
* @property float|null $tax_rate
* @property float|null $tax
* @property float|null $total
* @property string|null $file
* @property string|null $contents
* @property string|null $infos
* @property string|null $subject
* @property string|null $address
* @property bool $paid
* @property Carbon|null $paid_date
* @property int|null $cancellation_id
* @property Carbon|null $cancellation_date
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
* @property User|null $user
* @property UserInvoiceCredit|null $user_invoice_credit
* @property ShoppingOrder|null $shopping_order
* @property ShoppingUser|null $shopping_user
* @property Collection|UserInvoiceCredit[] $user_invoice_credits
* @package App\Models
* @property-read int|null $user_invoice_credits_count
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newQuery()
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit query()
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAddress($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAuthUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereContents($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFile($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFullNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereInfos($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNet($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaid($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaidDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingOrderId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereSubject($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTax($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTaxRate($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTotal($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereType($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withTrashed()
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withoutTrashed()
* @mixin \Eloquent
*/
class UserInvoiceCredit extends Model
{
use SoftDeletes;
protected $table = 'user_invoice_credits';
protected $casts = [
'auth_user_id' => 'int',
'shopping_order_id' => 'int',
'shopping_user_id' => 'int',
'number' => 'int',
'year' => 'int',
'month' => 'int',
'net' => 'float',
'tax_rate' => 'float',
'tax' => 'float',
'total' => 'float',
'paid' => 'bool',
'cancellation_id' => 'int',
'status' => 'int',
'file' => 'array',
'contents' => 'array',
'infos' => 'array',
];
protected $dates = [
'paid_date',
'cancellation_date'
];
protected $fillable = [
'auth_user_id',
'shopping_order_id',
'shopping_user_id',
'type',
'year',
'month',
'full_number',
'number',
'net',
'tax_rate',
'tax',
'total',
'file',
'contents',
'infos',
'subject',
'address',
'paid',
'paid_date',
'cancellation_id',
'cancellation_date',
'status'
];
public static $monthNames = [
1 => 'Januar',
2 => 'Februar',
3 => 'März',
4 => 'April',
5 => 'Mai',
6 => 'Juni',
7 => 'Juli',
8 => 'August',
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'Dezember'
];
public static $statusTypes = [
0 => 'offen',
1 => 'bezahlt',
2 => 'prüfen',
10 => 'storniert'
];
public static $statusColors = [
0 => 'warning',
1 => 'success',
2 => 'secondary',
10 => 'danger',
];
public function user()
{
return $this->belongsTo(\App\User::class, 'auth_user_id');
}
public function user_invoice_credit()
{
return $this->belongsTo(UserInvoiceCredit::class, 'cancellation_id');
}
public function shopping_order()
{
return $this->belongsTo(ShoppingOrder::class);
}
public function shopping_user()
{
return $this->belongsTo(ShoppingUser::class);
}
public function user_invoice_credits()
{
return $this->hasMany(UserInvoiceCredit::class, 'cancellation_id');
}
public function getPaidDateAttribute($value){
return $this->attributes['paid_date'] ? Carbon::parse($this->attributes['paid_date'])->format(\Util::formatDateDB()) : '';
}
public function setPaidDateAttribute( $value ) {
$this->attributes['paid_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getPaidDateRaw(){
return isset($this->attributes['paid_date']) ? $this->attributes['paid_date'] : NULL;
}
public function getCancellationDateAttribute($value){
return $this->attributes['cancellation_date'] ? Carbon::parse($this->attributes['cancellation_date'])->format(\Util::formatDateDB()) : '';
}
public function setCancellationDateAttribute( $value ) {
$this->attributes['cancellation_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getCancellationDateRaw(){
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
}
public static function getYearRange()
{
$start = 2021;
$end = date("Y");
return array_reverse(range($start, $end));
}
public static function getMonthName($month)
{
return isset(self::$monthNames[$month]) ? self::$monthNames[$month] : $month;
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
}

View file

@ -0,0 +1,152 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use App\Models\ShoppingOrder;
/**
* Class UserSalesVolume
*
* @property int $id
* @property int $user_id
* @property int|null $shopping_order_id
* @property int|null $month
* @property int|null $year
* @property Carbon|null $date
* @property int|null $points
* @property int|null $month_points
* @property float|null $total_net
* @property float|null $month_total_net
* @property string|null $message
* @property int $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property ShoppingOrder|null $shopping_order
* @property User $user
*
* @package App\Models
*/
class UserSalesVolume extends Model
{
protected $table = 'user_sales_volumes';
protected $casts = [
'user_id' => 'int',
'shopping_order_id' => 'int',
'user_invoice_id' => 'int',
'month' => 'int',
'year' => 'int',
'points' => 'int',
'month_points' => 'int',
'month_shop_points' => 'int',
'total_net' => 'float',
'month_total_net' => 'float',
'month_shop_total_net' => 'float',
'status' => 'int'
];
protected $dates = [
'date'
];
protected $fillable = [
'user_id',
'shopping_order_id',
'user_invoice_id',
'month',
'year',
'date',
'points',
'month_points',
'month_shop_points',
'total_net',
'month_total_net',
'month_shop_total_net',
'message',
'status'
];
public static $statusTypes = [
0 => 'nicht zugewiesen',
1 => 'hinzugefügt aus Bestellung',
2 => 'hinzugefügt aus Shop',
3 => 'hinzugefügt aus Shop / pending',
10 => ''
];
public function shopping_order()
{
return $this->belongsTo(ShoppingOrder::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function user_invoice()
{
return $this->belongsTo(UserInvoice::class);
}
public function getDateAttribute(){
return $this->attributes['date'] ? Carbon::parse($this->attributes['date'])->format(\Util::formatDateDB()) : '';
}
public function setDateAttribute( $value ) {
$this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getDateRaw(){
return isset($this->attributes['date']) ? $this->attributes['date'] : NULL;
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
}
public static function getStatusByOrder($ShoppingOrder){
if($ShoppingOrder->payment_for){
if($ShoppingOrder->payment_for === 6){ //Kunde-Shop
if($ShoppingOrder->shopping_user && $ShoppingOrder->shopping_user->is_like){
return 3; //shop Kunden, berater zuordnen
}
return 2;
}
return 1;
}
return 0;
}
public function getFormatedMonthYear(){
return str_pad($this->month, 2, "0", STR_PAD_LEFT)."/".$this->year;
}
public function setToUserAndCalculate($user_id){
$month = $this->month;
$year = $this->year;
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
$month_shop_points += $this->points;
$month_shop_total_net += $this->total_net;
$this->user_id = $user_id;
$this->month_shop_points = $month_shop_points;
$this->month_shop_total_net = $month_shop_total_net;
$this->month_points = $month_points;
$this->month_total_net = $month_total_net;
$this->status = 2;
$this->save();
}
}

View file

@ -65,6 +65,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\UserShop withoutTrashed()
* @mixin \Eloquent
* @method static \Illuminate\Database\Eloquent\Builder|UserShop withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class UserShop extends Model
{
@ -83,8 +84,8 @@ class UserShop extends Model
use SoftDeletes;
protected $dates = ['deleted_at'];
use Sluggable;
public function sluggable()
{
return [
@ -93,6 +94,7 @@ class UserShop extends Model
]
];
}
public function user()
{
return $this->belongsTo('App\User', 'user_id');
@ -135,6 +137,10 @@ class UserShop extends Model
//check if exisist
$subdomain = $kas->action('get_subdomains', $pra);
if(is_soap_fault($subdomain)){
return false;
}
if(!empty($subdomain[0]['is_active']) && $subdomain[0]['is_active'] == 'Y'){
$this->is_online = true;

View file

@ -34,6 +34,7 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShopOnSite whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserShopOnSite whereUserShopId($value)
* @mixin \Eloquent
* @method static \Illuminate\Database\Eloquent\Builder|UserShopOnSite withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
*/
class UserShopOnSite extends Model
{

View file

@ -92,8 +92,7 @@ class ContractPDFRepository extends BaseRepository {
$pre = $this->model->account->country_id ? $this->convert($this->model->account->country->de)." " : "";
$pdf->Write(0, $pre);
if($this->model->m_sponsor){
if($this->model->m_sponsor && $this->model->user_sponsor->account){
$y += 48;
$pdf->SetXY($x1, $y);
$pdf->Write(0, $this->convert($this->model->user_sponsor->account->company));

View file

@ -55,7 +55,7 @@ class FileRepository extends BaseRepository {
$originalName = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension();
$mine = $file->getClientMimeType();
$size = $file->getClientSize();
$size = $file->getSize();
$originalNameWithoutExt = substr($originalName, 0, strlen($originalName) - strlen($extension) - 1);

View file

@ -0,0 +1,197 @@
<?php
namespace App\Repositories;
use App\Libraries\InvoicePDF;
use PDF;
use Storage;
use App\Services\Invoice;
use App\Models\UserInvoice;
use App\Models\ShoppingOrder;
use App\Services\MyPDFMerger;
use App\Models\UserSalesVolume;
class InvoiceRepository extends BaseRepository {
private $invoice_date;
private $invoice_number;
private $filename;
private $dir;
private $user_sales_volume;
private $delivery_dir;
private $delivery_filename;
public function __construct(ShoppingOrder $model)
{
$this->model = $model;
}
public function create($request = [])
{
//need invoice $data
$number = Invoice::getInvoiceNumber();
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $this->model->created_at->format("d.m.Y");
$invoice_send_mail = isset($request['invoice_send_mail']) ? false : true;
$this->invoice_number = Invoice::createInvoiceNumber($number, $this->invoice_date);
$this->dir = Invoice::getInvoiceStorageDir($this->invoice_date);
$this->filename = Invoice::makeInvoiceFilename($this->invoice_number);
$this->delivery_dir = Invoice::getDeliveryStorageDir($this->invoice_date);
$this->delivery_filename = Invoice::makeDeliveryFilename($this->invoice_number);
$this->makePDF();
$user_invoice = UserInvoice::create([
'shopping_order_id' => $this->model->id,
'year' => \Carbon::parse($this->invoice_date)->format('Y'),
'month' => \Carbon::parse($this->invoice_date)->format('m'),
'date' => $this->invoice_date,
'full_number' => $this->invoice_number,
'number' => $number,
'filename' => $this->filename,
'dir' => $this->dir,
'delivery_filename' => $this->delivery_filename,
'delivery_dir' => $this->delivery_dir,
'disk' => 'public',
'status' => $this->model->getStatusByOrder()
]);
Invoice::makeNextInvoiceNumber();
if($invoice_send_mail){
Invoice::sendInvoiceMail($this->model, $user_invoice);
}
return $user_invoice;
}
public function update($request = []){
if($user_invoice = $this->model->user_invoice){
$number = $user_invoice->number;
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $user_invoice->date;
$invoice_send_mail = isset($request['invoice_send_mail']) ? false: true;
$this->invoice_number = Invoice::createInvoiceNumber($number, $this->invoice_date);
$this->dir = Invoice::getInvoiceStorageDir($this->invoice_date);
$this->filename = Invoice::makeInvoiceFilename($this->invoice_number);
$this->delivery_dir = Invoice::getDeliveryStorageDir($this->invoice_date);
$this->delivery_filename = Invoice::makeDeliveryFilename($this->invoice_number);
$this->user_sales_volume = UserSalesVolume::where('user_invoice_id', $this->model->user_invoice->id)->first();
$this->makePDF();
$user_invoice->fill([
'shopping_order_id' => $this->model->id,
'year' => \Carbon::parse($this->invoice_date)->format('Y'),
'month' => \Carbon::parse($this->invoice_date)->format('m'),
'date' => $this->invoice_date,
'full_number' => $this->invoice_number,
'number' => $number,
'filename' => $this->filename,
'dir' => $this->dir,
'delivery_filename' => $this->delivery_filename,
'delivery_dir' => $this->delivery_dir,
'disk' => 'public',
])->save();
if($invoice_send_mail){
Invoice::sendInvoiceMail($this->model, $user_invoice);
}
return $user_invoice;
}
return null;
}
private function makePDF(){
$data = [
'shopping_order' => $this->model,
'invoice_date' => $this->invoice_date,
'invoice_number' => $this->invoice_number,
'user_sales_volume' => $this->user_sales_volume,
];
if(!Storage::disk('public')->exists( $this->dir )){
Storage::disk('public')->makeDirectory($this->dir); //creates directory
}
if(!Storage::disk('public')->exists( $this->delivery_dir )){
Storage::disk('public')->makeDirectory($this->delivery_dir); //creates directory
}
$path = Storage::disk('public')->getAdapter()->getPathPrefix();
//invoice
$pdf_file = new InvoicePDF('pdf.invoice');
$pdf_file->create($data, $this->filename, 'save', $path.$this->dir);
$pdfMerger = new MyPDFMerger();
$pdfMerger->addPDF($path.$this->dir.$this->filename);
$file = $pdfMerger->myMerge('string', $this->filename, 'template_invoice_de');
Storage::disk('public')->put($this->dir.$this->filename, $file);
$pdf_file = new InvoicePDF('pdf.delivery');
$pdf_file->create($data, $this->delivery_filename, 'save', $path.$this->delivery_dir);
$pdfMerger = new MyPDFMerger();
$pdfMerger->addPDF($path.$this->delivery_dir.$this->delivery_filename);
$file = $pdfMerger->myMerge('string', $this->delivery_filename, 'template_invoice_de');
Storage::disk('public')->put($this->delivery_dir.$this->delivery_filename, $file);
}
public function userSalesVolume()
{
/*
status
1 => 'hinzugefügt aus Bestellung',
2 => 'hinzugefügt aus Shop',
3 => 'hinzugefügt aus Shop / pending',
*/
$status = UserSalesVolume::getStatusByOrder($this->model);
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
$month = date('m');
$year = date('Y');
if($status === 3){ //shop bestellung User pending
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
$month_points = 0;
$month_total_net = 0;
$month_shop_points = 0;
$month_shop_total_net = 0;
}else{
$month_points = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('points');
$month_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 1)->where('month', $month)->where('year', $year)->sum('total_net');
$month_shop_points = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('points');
$month_shop_total_net = UserSalesVolume::where('user_id', $user_id)->where('status', 2)->where('month', $month)->where('year', $year)->sum('total_net');
}
switch ($status) {
case 1: //Bestellung
$month_points += $this->model->points;
$month_total_net += $this->model->subtotal;
break;
case 2: //Shop
$month_shop_points += $this->model->points;
$month_shop_total_net += $this->model->subtotal;
break;
}
return UserSalesVolume::create([
'user_id' => $user_id,
'shopping_order_id' => $this->model->id,
'month' => $month,
'year' => $year,
'date' => date('d.m.Y'),
'points' => $this->model->points,
'month_points' => $month_points,
'month_shop_points' => $month_shop_points,
'total_net' => $this->model->subtotal,
'month_total_net' => $month_total_net,
'month_shop_total_net' => $month_shop_total_net,
'message' => '',
'status' => $status,
]);
}
public function createAndSalesVolume($request = [])
{
$this->user_sales_volume = $this->userSalesVolume();
$user_invoice = $this->create($request);
$this->user_sales_volume->user_invoice_id = $user_invoice->id;
$this->user_sales_volume->save();
}
}

View file

@ -47,7 +47,7 @@ class CustomerPriority
if($mail){ //send mail
Mail::to(config('app.info_mail'))->send(new MailInfo($shopping_user, 'check_is_like_customer'));
}
return 'like';
return 'like'.$shopping_user->member_id;
}
if($newCustomer){
self::newCustomer($shopping_user);
@ -77,6 +77,11 @@ class CustomerPriority
Mail::to($shopping_user->member->email)->send(new MailCheckout($shopping_user->shopping_order->txaction, $shopping_user->shopping_order, $shopping_user->shopping_order->shopping_payments->last(), false, $shopping_user->shopping_order->mode));
}
}
//set Points and Volume
if ($shopping_user->shopping_order && $user_sales_volume = $shopping_user->shopping_order->user_sales_volume_no_userid()) {
$user_sales_volume->setToUserAndCalculate($shopping_user->member_id);
}
return true;
}
@ -233,6 +238,7 @@ class CustomerPriority
->where('auth_user_id', '=', NULL)
->where('number', '!=', NULL) //has number
->where('id', '!=', $shopping_user->id)
->where('member_id', '!=', $shopping_user->member_id)
->where('billing_lastname', '=', $shopping_user->billing_lastname)
->where('billing_zipcode', '=', $shopping_user->billing_zipcode)
->get()->pluck('number', 'id')->unique()->toArray();

View file

@ -212,7 +212,7 @@ class HomepartyCart
$user_cart->shipping_price = $price;
$user_cart->shipping_tax_rate = $shipping_price->tax_rate;
$user_cart->shipping_price_net = round($price / ((100+$shipping_price->tax_rate) / 100), 2);
$user_cart->shipping_tax = round($price / (100+$shipping_price->tax_rate) * 100, 2);
$user_cart->shipping_tax = round($user_cart->shipping_price - $user_cart->shipping_price_net, 2);
}
if($homeparty_user->is_host){

66
app/Services/Invoice.php Normal file
View file

@ -0,0 +1,66 @@
<?php
namespace App\Services;
use App\Mail\MailInvoice;
use App\Models\Setting;
use App\Models\ShoppingOrder;
use Illuminate\Support\Facades\Mail;
class Invoice
{
public static function getInvoiceNumber(){
return (int) Setting::getContentBySlug('invoice-number');
}
public static function makeNextInvoiceNumber(){
$invoice_number = self::getInvoiceNumber();
$invoice_number = $invoice_number+1;
Setting::setContentBySlug('invoice-number', $invoice_number, 'int');
return $invoice_number;
}
public static function createInvoiceNumber($invoice_number, $invoice_date){
$prefix = \Carbon::parse($invoice_date)->format('Y');
$invoice_number = str_pad($invoice_number, 5, '0', STR_PAD_LEFT);
return $prefix.$invoice_number;
}
public static function getInvoiceStorageDir($invoice_date){
return "invoice/".\Carbon::parse($invoice_date)->format('Y/m/');
}
public static function getDeliveryStorageDir($invoice_date){
return "delivery/".\Carbon::parse($invoice_date)->format('Y/m/');
}
public static function makeInvoiceFilename($invoice_number){
return $invoice_number."-MIVITA-Rechnung.pdf";
}
public static function makeDeliveryFilename($invoice_number){
return $invoice_number."-MIVITA-Lieferschein.pdf";
}
public static function isInvoice(ShoppingOrder $shopping_order){
return $shopping_order->isInvoice();
}
public static function sendInvoiceMail($shopping_order, $user_invoice){
$bcc = [];
$billing_email = $shopping_order->shopping_user->billing_email;
if(!$billing_email){
if($shopping_order->mode === 'test'){
$billing_email = config('app.checkout_test_mail');
}else{
$billing_email = config('app.checkout_mail');
}
}
if($shopping_order->mode === 'test'){
$bcc[] = config('app.checkout_test_mail');
}else{
$bcc[] = config('app.checkout_mail');
}
Mail::to($billing_email)->bcc($bcc)->send(new MailInvoice($shopping_order, $user_invoice));
}
}

View file

@ -0,0 +1,188 @@
<?php
namespace App\Services;
//use FPDI in myMerge v2
//use FPDF;
//use FPDI;
class MyPDFMerger
{
private $_files; //['form.pdf'] ["1,2,4, 5-19"]
private $_fpdi;
public function __construct()
{
/* if(!class_exists("FPDF")) {
require_once(__DIR__.'/fpdf/fpdf.php');
}
if(!class_exists("FPDI")) {
require_once(__DIR__.'/fpdi/fpdi.php');
}*/
}
public function addPDF($filepath, $pages = 'all')
{
if (file_exists($filepath)) {
if (strtolower($pages) != 'all') {
$pages = $this->_rewritepages($pages);
}
$this->_files[] = array($filepath, $pages);
} else {
throw new \exception("Could not locate PDF on '$filepath'");
}
return $this;
}
public function myMerge($outputmode = 'browser', $outputpath = 'newfile.pdf', $theme = false)
{
if (!isset($this->_files) || !is_array($this->_files)): throw new \exception("No PDFs to merge."); endif;
$fpdi = new \setasign\Fpdi\Fpdi();
$first = 1;
//
//merger operations
foreach ($this->_files as $file) {
$filename = $file[0];
$filepages = $file[1];
$count = $fpdi->setSourceFile($filename);
//add the pages
if ($filepages == 'all') {
for ($i = 1; $i <= $count; $i++) {
$count = $fpdi->setSourceFile($filename);
$template = $fpdi->importPage($i);
$size = $fpdi->getTemplateSize($template);
$orientation = ($size['height'] > $size['width']) ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['width'], $size['height']));
if($theme){
$fpdi->setSourceFile('pdf/'.$theme.'-'.$first.'.pdf');
if($first == 1){
$first = 2;
}
$backId = $fpdi->importPage(1);
$fpdi->useTemplate($backId);
}
$fpdi->useTemplate($template);
}
} else {
foreach ($filepages as $page) {
$count = $fpdi->setSourceFile($filename);
if (!$template = $fpdi->importPage($page)): throw new \exception("Could not load page '$page' in PDF '$filename'. Check that the page exists."); endif;
$size = $fpdi->getTemplateSize($template);
$orientation = ($size['h'] > $size['w']) ? 'P' : 'L';
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
if($theme){
$fpdi->setSourceFile('pdf/'.$theme.'-'.$first.'.pdf');
if($first == 1){
$first = 2;
}
$backId = $fpdi->importPage(1);
$fpdi->useTemplate($backId);
}
$fpdi->useTemplate($template);
}
}
//after first file (invoice) on bpaper
$slug = false;
}
//output operations
$mode = $this->_switchmode($outputmode);
if ($mode == 'S') {
return $fpdi->Output($outputpath, 'S');
} else {
if ($fpdi->Output($outputpath, $mode) == '') {
return true;
} else {
throw new \exception("Error outputting PDF to '$outputmode'.");
return false;
}
}
}
/**
* FPDI uses single characters for specifying the output location. Change our more descriptive string into proper format.
* @param $mode
* @return Character
*/
private function _switchmode($mode)
{
switch (strtolower($mode)) {
case 'download':
return 'D';
break;
case 'browser':
return 'I';
break;
case 'file':
return 'F';
break;
case 'string':
return 'S';
break;
default:
return 'I';
break;
}
}
/**
* Takes our provided pages in the form of 1,3,4,16-50 and creates an array of all pages
* @param $pages
* @return array
* @throws exception
*/
private function _rewritepages($pages)
{
$pages = str_replace(' ', '', $pages);
$part = explode(',', $pages);
//parse hyphens
foreach ($part as $i) {
$ind = explode('-', $i);
if (count($ind) == 2) {
$x = $ind[0]; //start page
$y = $ind[1]; //end page
if ($x > $y): throw new \exception("Starting page, '$x' is greater than ending page '$y'.");
return false; endif;
//add middle pages
while ($x <= $y): $newpages[] = (int)$x;
$x++; endwhile;
} else {
$newpages[] = (int)$ind[0];
}
}
return $newpages;
}
}
/*
$pdf = new PDFMerger;
$pdf->addPDF('samplepdfs/one.pdf', '1, 3, 4')
->addPDF('samplepdfs/two.pdf', '1-2')
->addPDF('samplepdfs/three.pdf', 'all')
->merge('file', 'samplepdfs/TEST2.pdf');
//REPLACE 'file' WITH 'browser', 'download', 'string', or 'file' for output options
//You do not need to give a file path for browser, string, or download - just the name.
*/

View file

@ -2,11 +2,12 @@
namespace App\Services;
use App\User;
use App\Mail\MailCheckout;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\User;
use Illuminate\Support\Facades\Mail;
use App\Repositories\InvoiceRepository;
class Payment
{
@ -16,15 +17,15 @@ class Payment
'appointed' => "offen",
'failed' => "abbruch",
'extern' => "extern",
'invoice_open' => "Re. offen",
'invoice_paid' => "Re. bezahlt",
'invoice_open' => "offen",
'invoice_paid' => "bezahlt",
'invoice_non' => "keine Zahlung",
'NULL' => 'keine Zahlung',
];
public static $txaction_invoice = [
'invoice_open' => "Re. offen",
'invoice_paid' => "Re. bezahlt",
'invoice_open' => "Rechnung offen",
'invoice_paid' => "Rechnung bezahlt",
'invoice_non' => 'keine Zahlung',
];
@ -70,6 +71,11 @@ class Payment
return '<span class="badge badge-pill badge-'.self::getFormattedTxactionColor($shopping_payment->txaction).'">'.self::getFormattedTxaction($shopping_payment->txaction).'</span>';
}
/*
Wir bei Zahlung aufgerufen.
Betätigung durch Payone oder Zahlung auf MIVITA Rechnung
$paid = Status der Zahlung, Payone = true, MIVITA Rechnung = false
*/
public static function paymentStatusPaidAction(ShoppingOrder $shopping_order, $paid){
$send_link = false;
@ -128,6 +134,12 @@ class Payment
$shopping_order->homeparty->completed = 1;
$shopping_order->homeparty->save();
}
//make Invoice and
$invoice_repo = new InvoiceRepository($shopping_order);
if(!$shopping_order->isInvoice()){
$invoice_repo->createAndSalesVolume();
}
return $send_link;
}

View file

@ -17,7 +17,7 @@ class PaymentHelper
public function setProduct($product){
Yard::instance('shopping')->destroy();
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, ['image' => "", 'slug' => $product->slug, 'weight' => $product->weight]);
Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->price, false, false, ['image' => "", 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points]);
}
public function initELVPayment($user){
@ -122,7 +122,7 @@ class PaymentHelper
'auth_user_id' => $shopping_user->auth_user_id,
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
'user_shop_id' => 1,
'payment_for' => Util::getUserPaymentFor(),
'payment_for' => $shopping_user->getOrderPaymentFor(),
'total' => Yard::instance('shopping')->total(2, '.', ''),
'subtotal' => Yard::instance('shopping')->subtotal(2, '.', ''),
'shipping' => Yard::instance('shopping')->shipping(2, '.', ','),
@ -140,6 +140,8 @@ class PaymentHelper
$items = Yard::instance('shopping')->getContentByOrder();
foreach ($items as $item) {
if (!ShoppingOrderItem::where('shopping_order_id', $shopping_order->id)->where('row_id', $item->rowId)->count()){
$price_net = Yard::instance('shopping')->rowPriceNet($item, 2, '.', '');
$tax = $item->price - $price_net;
$data = [
'shopping_order_id' => $shopping_order->id,
'row_id' => $item->rowId,
@ -147,13 +149,18 @@ class PaymentHelper
'comp' => $item->options->comp,
'qty' => $item->qty,
'price' => $item->price,
'price_net' => Yard::instance('shopping')->rowPriceNet($item, 3, '.', ''),
'price_net' => $price_net,
'tax_rate' => $item->taxRate,
'tax' => $tax,
'price_vk_net' => $shopping_order->getPriceVkNetBy($item->id),
'discount' => $shopping_order->getUserDiscount(),
'points' => $item->options->points,
'slug' => $item->options->slug
];
$shopping_order_item = ShoppingOrderItem::create($data);
}
}
$shopping_order->makeTaxSplit();
return $shopping_order;
}

View file

@ -10,8 +10,6 @@ use App\Models\ShippingCountry;
class Util
{
private static $postRoute = 'base.';
public static function getToken()
@ -57,15 +55,30 @@ class Util
}
public static function _thousands_separator(){
return \App::getLocale() === "en" ? ',' : '.';
}
public static function _decimal_separator(){
return \App::getLocale() === "en" ? '.' : ',';
}
public static function reFormatNumber($value){
return (float) str_replace(',', '.', self::_format_number($value));
}
public static function formatNumber($value, $dec=2){
if(\App::getLocale() === "en"){
return number_format($value, $dec, '.', ',');
return number_format($value, $dec, self::_decimal_separator(), self::_thousands_separator());
}
public static function cleanNumberFormat($num = 0, $dec = 2, $fullzero = false){
if($fullzero && $num == 0){
return number_format($num, $dec, self::_decimal_separator(), self::_thousands_separator());
}
return number_format($value, $dec, ',', '.');
return rtrim(rtrim(number_format($num, $dec, self::_decimal_separator(), self::_thousands_separator()),'0'), self::_decimal_separator());
}
public static function utf8ize( $mixed ) {

View file

@ -11,7 +11,6 @@ use Illuminate\Session\SessionManager;
use Illuminate\Contracts\Events\Dispatcher;
use Gloudemans\Shoppingcart\Contracts\Buyable;
class Yard extends Cart
{
private $shipping_price = 0;
@ -27,6 +26,8 @@ class Yard extends Cart
private $user_country_id;
private $user_country;
private $shopping_data = [];
private $events;
public function __construct(SessionManager $session, Dispatcher $events)
{
@ -71,6 +72,8 @@ class Yard extends Cart
$this->user_country = $this->getYardExtra('user_country');
}
$this->events = $events;
parent::__construct($session, $events);
@ -363,7 +366,7 @@ class Yard extends Cart
* @param string $thousandSeperator
* @return string
*/
public function total($decimals = null, $decimalPoint = null, $thousandSeperator = null)
public function total($decimals = NULL, $decimalPoint = NULL, $thousandSeperator = NULL, $withFees = true)
{
$content = $this->getContent();
$total = $content->reduce(function ($total, CartItem $cartItem) {
@ -381,7 +384,7 @@ class Yard extends Cart
* @param string $thousandSeperator
* @return float
*/
public function tax($decimals = null, $decimalPoint = null, $thousandSeperator = null)
public function tax($decimals = NULL, $decimalPoint = NULL, $thousandSeperator = NULL, $withFees = true)
{
$content = $this->getContent();
@ -584,4 +587,40 @@ class Yard extends Cart
return number_format($value, $decimals, $decimalPoint, $thousandSeperator);
}
public function myStore($identifier, array $eventOptions = [])
{
// Remove any existing identifiers
// Although possibly first or update could work in future
$this
->getConnection()
->table($this->getTableName())
->where('identifier', $identifier)
->delete();
// Insert into the database with the new cart
$content = $this->getContent();
$this->getConnection()->table($this->getTableName())->insert([
'identifier' => $identifier,
'instance' => $this->currentInstance(),
'content' => serialize($content)
]);
$eventOptions = array_merge([
'cartInstance' => $this->currentInstance(),
], $eventOptions);
$this->events->dispatch('cart.stored', $eventOptions);
}
/**
* Restore the cart with the given identifier.
*
* @param mixed $identifier
* @return void
*/
}

View file

@ -68,4 +68,12 @@ if (! function_exists('reFormatNumber')) {
}
}
if (! function_exists('cleanNumberFormat')) {
function cleanNumberFormat($number)
{
return !$number ? $number : Util::cleanNumberFormat($number);
}
}

View file

@ -14,7 +14,7 @@
),
'aliases' =>
array (
'Debugbar' => 'Barryvdh\\Debugbar\\Facade',
'Debugbar' => 'Barryvdh\\Debugbar\\Facades\\Debugbar',
),
),
'barryvdh/laravel-dompdf' =>
@ -25,7 +25,7 @@
),
'aliases' =>
array (
'PDF' => 'Barryvdh\\DomPDF\\Facade',
'PDF' => 'Barryvdh\\DomPDF\\Facade\\Pdf',
),
),
'barryvdh/laravel-ide-helper' =>
@ -42,6 +42,28 @@
0 => 'Cviebrock\\EloquentSluggable\\ServiceProvider',
),
),
'digital-bird/shoppingcart' =>
array (
'providers' =>
array (
0 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
),
'aliases' =>
array (
'Cart' => 'Gloudemans\\Shoppingcart\\Facades\\Cart',
),
),
'facade/ignition' =>
array (
'providers' =>
array (
0 => 'Facade\\Ignition\\IgnitionServiceProvider',
),
'aliases' =>
array (
'Flare' => 'Facade\\Ignition\\Facades\\Flare',
),
),
'fideloper/proxy' =>
array (
'providers' =>
@ -49,6 +71,13 @@
0 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
),
),
'fruitcake/laravel-cors' =>
array (
'providers' =>
array (
0 => 'Fruitcake\\Cors\\CorsServiceProvider',
),
),
'intervention/image' =>
array (
'providers' =>
@ -89,6 +118,13 @@
0 => 'Laravel\\Passport\\PassportServiceProvider',
),
),
'laravel/sail' =>
array (
'providers' =>
array (
0 => 'Laravel\\Sail\\SailServiceProvider',
),
),
'laravel/tinker' =>
array (
'providers' =>
@ -96,6 +132,13 @@
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
),
),
'laravel/ui' =>
array (
'providers' =>
array (
0 => 'Laravel\\Ui\\UiServiceProvider',
),
),
'laravelcollective/html' =>
array (
'providers' =>
@ -133,17 +176,6 @@
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
),
),
'olimortimer/laravelshoppingcart' =>
array (
'providers' =>
array (
0 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
),
'aliases' =>
array (
'Cart' => 'Gloudemans\\Shoppingcart\\Facades\\Cart',
),
),
'reliese/laravel' =>
array (
'providers' =>

View file

@ -28,32 +28,36 @@
24 => 'Barryvdh\\DomPDF\\ServiceProvider',
25 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
26 => 'Cviebrock\\EloquentSluggable\\ServiceProvider',
27 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
28 => 'Intervention\\Image\\ImageServiceProvider',
29 => 'Jenssegers\\Date\\DateServiceProvider',
30 => 'Laracasts\\Flash\\FlashServiceProvider',
31 => 'Laravel\\Passport\\PassportServiceProvider',
32 => 'Laravel\\Tinker\\TinkerServiceProvider',
33 => 'Collective\\Html\\HtmlServiceProvider',
34 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
35 => 'Carbon\\Laravel\\ServiceProvider',
36 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
37 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
38 => 'Reliese\\Coders\\CodersServiceProvider',
39 => 'Yajra\\DataTables\\DataTablesServiceProvider',
40 => 'Reliese\\Coders\\CodersServiceProvider',
41 => 'Laravel\\Tinker\\TinkerServiceProvider',
42 => 'App\\Providers\\AppServiceProvider',
43 => 'App\\Providers\\AuthServiceProvider',
44 => 'App\\Providers\\EventServiceProvider',
45 => 'App\\Providers\\RouteServiceProvider',
46 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
47 => 'Jenssegers\\Date\\DateServiceProvider',
48 => 'Collective\\Html\\HtmlServiceProvider',
49 => 'Intervention\\Image\\ImageServiceProvider',
50 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
51 => 'Yajra\\DataTables\\DataTablesServiceProvider',
52 => 'App\\Providers\\YardServiceProvider',
27 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
28 => 'Facade\\Ignition\\IgnitionServiceProvider',
29 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
30 => 'Fruitcake\\Cors\\CorsServiceProvider',
31 => 'Intervention\\Image\\ImageServiceProvider',
32 => 'Jenssegers\\Date\\DateServiceProvider',
33 => 'Laracasts\\Flash\\FlashServiceProvider',
34 => 'Laravel\\Passport\\PassportServiceProvider',
35 => 'Laravel\\Sail\\SailServiceProvider',
36 => 'Laravel\\Tinker\\TinkerServiceProvider',
37 => 'Laravel\\Ui\\UiServiceProvider',
38 => 'Collective\\Html\\HtmlServiceProvider',
39 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
40 => 'Carbon\\Laravel\\ServiceProvider',
41 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
42 => 'Reliese\\Coders\\CodersServiceProvider',
43 => 'Yajra\\DataTables\\DataTablesServiceProvider',
44 => 'Reliese\\Coders\\CodersServiceProvider',
45 => 'Laravel\\Tinker\\TinkerServiceProvider',
46 => 'App\\Providers\\AppServiceProvider',
47 => 'App\\Providers\\AuthServiceProvider',
48 => 'App\\Providers\\EventServiceProvider',
49 => 'App\\Providers\\RouteServiceProvider',
50 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
51 => 'Jenssegers\\Date\\DateServiceProvider',
52 => 'Collective\\Html\\HtmlServiceProvider',
53 => 'Intervention\\Image\\ImageServiceProvider',
54 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
55 => 'Yajra\\DataTables\\DataTablesServiceProvider',
56 => 'App\\Providers\\YardServiceProvider',
),
'eager' =>
array (
@ -70,30 +74,31 @@
10 => 'Askedio\\Laravel5ProfanityFilter\\Providers\\ProfanityFilterServiceProvider',
11 => 'Barryvdh\\Debugbar\\ServiceProvider',
12 => 'Barryvdh\\DomPDF\\ServiceProvider',
13 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
14 => 'Cviebrock\\EloquentSluggable\\ServiceProvider',
15 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
16 => 'Intervention\\Image\\ImageServiceProvider',
17 => 'Jenssegers\\Date\\DateServiceProvider',
18 => 'Laracasts\\Flash\\FlashServiceProvider',
19 => 'Laravel\\Passport\\PassportServiceProvider',
20 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
21 => 'Carbon\\Laravel\\ServiceProvider',
22 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
23 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
24 => 'Reliese\\Coders\\CodersServiceProvider',
25 => 'Yajra\\DataTables\\DataTablesServiceProvider',
13 => 'Cviebrock\\EloquentSluggable\\ServiceProvider',
14 => 'Gloudemans\\Shoppingcart\\ShoppingcartServiceProvider',
15 => 'Facade\\Ignition\\IgnitionServiceProvider',
16 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
17 => 'Fruitcake\\Cors\\CorsServiceProvider',
18 => 'Intervention\\Image\\ImageServiceProvider',
19 => 'Jenssegers\\Date\\DateServiceProvider',
20 => 'Laracasts\\Flash\\FlashServiceProvider',
21 => 'Laravel\\Passport\\PassportServiceProvider',
22 => 'Laravel\\Ui\\UiServiceProvider',
23 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
24 => 'Carbon\\Laravel\\ServiceProvider',
25 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
26 => 'Reliese\\Coders\\CodersServiceProvider',
27 => 'App\\Providers\\AppServiceProvider',
28 => 'App\\Providers\\AuthServiceProvider',
29 => 'App\\Providers\\EventServiceProvider',
30 => 'App\\Providers\\RouteServiceProvider',
31 => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
32 => 'Jenssegers\\Date\\DateServiceProvider',
33 => 'Intervention\\Image\\ImageServiceProvider',
34 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
35 => 'Yajra\\DataTables\\DataTablesServiceProvider',
36 => 'App\\Providers\\YardServiceProvider',
27 => 'Yajra\\DataTables\\DataTablesServiceProvider',
28 => 'Reliese\\Coders\\CodersServiceProvider',
29 => 'App\\Providers\\AppServiceProvider',
30 => 'App\\Providers\\AuthServiceProvider',
31 => 'App\\Providers\\EventServiceProvider',
32 => 'App\\Providers\\RouteServiceProvider',
33 => 'Jenssegers\\Date\\DateServiceProvider',
34 => 'Intervention\\Image\\ImageServiceProvider',
35 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
36 => 'Yajra\\DataTables\\DataTablesServiceProvider',
37 => 'App\\Providers\\YardServiceProvider',
),
'deferred' =>
array (
@ -103,16 +108,20 @@
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Bus\\BatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
'command.cache.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.cache.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.clear-compiled' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.auth.resets.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.config.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.config.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.db.prune' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.db.wipe' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.down' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.environment' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
@ -123,26 +132,37 @@
'command.optimize' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.optimize.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.package.discover' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.preset' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.failed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.flush' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.listen' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.monitor' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.prune-batches' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.prune-failed-jobs' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.restart' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.retry' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.retry-batch' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.work' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.route.list' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.schema.dump' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.seed' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.storage.link' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.up' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.view.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.view.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.cache.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.cast.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.channel.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.component.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.console.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.controller.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.event.generate' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
@ -161,12 +181,14 @@
'command.provider.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.failed-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.batches-table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.request.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.resource.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.rule.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.seeder.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.session.table' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.serve' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.stub.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.test.make' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.vendor.publish' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
@ -183,16 +205,15 @@
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
'swift.mailer' => 'Illuminate\\Mail\\MailServiceProvider',
'swift.transport' => 'Illuminate\\Mail\\MailServiceProvider',
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
@ -201,6 +222,10 @@
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
'command.ide-helper.generate' => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
'command.ide-helper.models' => 'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider',
'Laravel\\Sail\\Console\\InstallCommand' => 'Laravel\\Sail\\SailServiceProvider',
'Laravel\\Sail\\Console\\PublishCommand' => 'Laravel\\Sail\\SailServiceProvider',
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
'html' => 'Collective\\Html\\HtmlServiceProvider',
'form' => 'Collective\\Html\\HtmlServiceProvider',
@ -245,6 +270,12 @@
'Illuminate\\Validation\\ValidationServiceProvider' =>
array (
),
'Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider' =>
array (
),
'Laravel\\Sail\\SailServiceProvider' =>
array (
),
'Laravel\\Tinker\\TinkerServiceProvider' =>
array (
),

View file

@ -5,47 +5,59 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2.5",
"php": "^7.3|^8.0",
"askedio/laravel5-profanity-filter": "*",
"barryvdh/laravel-dompdf": "^0.8.5",
"cviebrock/eloquent-sluggable": "^6.0",
"barryvdh/laravel-dompdf": "*",
"cviebrock/eloquent-sluggable": "*",
"digital-bird/shoppingcart": "^5.1",
"doctrine/dbal": "*",
"fideloper/proxy": "*",
"guzzlehttp/guzzle": "*",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "*",
"jenssegers/date": "*",
"laracasts/flash": "*",
"laravel/framework": "^6.0",
"laravel/helpers": "^1.1",
"laravel/framework": "^8.12",
"laravel/helpers": "*",
"laravel/passport": "*",
"laravel/tinker": "*",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4",
"laravelcollective/html": "*",
"maatwebsite/excel": "^3.1",
"olimortimer/laravelshoppingcart": "*",
"reliese/laravel": "*",
"setasign/fpdf": "1.8.*",
"setasign/fpdi": "^2.2",
"rguedes/pdfmerger": "^1.0",
"setasign/fpdf": "*",
"setasign/fpdi": "*",
"yajra/laravel-datatables-oracle": "*"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"barryvdh/laravel-ide-helper": "*",
"filp/whoops": "*",
"fzaninotto/faker": "*",
"mockery/mockery": "*",
"nunomaduro/collision": "*",
"phpunit/phpunit": "*"
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3",
"barryvdh/laravel-debugbar": "*",
"barryvdh/laravel-ide-helper": "*"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"files": [
"app/helpers.php"
],
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
@ -53,12 +65,6 @@
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-update-cmd": [
"php artisan clear-compiled",
@ -67,22 +73,18 @@
"php artisan ide-helper:meta",
"php artisan ide-helper:models"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
"@php artisan key:generate --ansi"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}

6977
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ return [
"mid" => '42504',//"your_merchant_id",
"portalid" => '2030693',
"key" => hash("md5", "Zjop5cvP2UeB7Qhy"), // the key has to be hashed as md5
"mode" => "live", // can be "live" for actual transactions
"mode" => "test", // can be "live" for actual transactions
"api_version" => "3.11",
"encoding" => "UTF-8"
]

View file

@ -35,10 +35,12 @@ class CreateShoppingOrdersTable extends Migration
$table->decimal('subtotal_ws', 13, 2)->nullable();
$table->decimal('tax', 8, 2)->nullable();
$table->string('tax_split', 20)->nullable();
$table->decimal('total_shipping', 13, 2)->nullable();
$table->unsignedInteger('points')->nullable();
$table->unsignedInteger('weight')->nullable();
$table->boolean('paid')->default(false);

View file

@ -27,8 +27,13 @@ class CreateShoppingOrderItemsTable extends Migration
$table->unsignedInteger('qty');
$table->decimal('price', 8, 2)->nullable();
$table->decimal('price_net', 8, 3)->nullable();
$table->decimal('tax_rate', 5, 2)->nullable();
$table->decimal('tax', 8, 3)->nullable();
$table->decimal('price_vk_net', 8, 3)->nullable();
$table->decimal('discount', 5, 2)->nullable();
$table->unsignedInteger('points')->nullable();
$table->string('slug')->nullable();
$table->timestamps();

View file

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('identifier')->index()->nullable();
$table->string('slug')->unique()->index();
$table->unsignedInteger('referenz')->default(0);
$table->string('action')->nullable();
$table->text('object')->nullable();
$table->text('full_text')->nullable();
$table->text('text')->nullable();
$table->integer('int')->nullable();
$table->unsignedTinyInteger('status')->default(0);
$table->string('type', 10)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('settings');
}
}

View file

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserInvoiceCreditsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_invoice_credits', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('auth_user_id')->nullable();
$table->unsignedInteger('shopping_order_id')->nullable();
$table->unsignedInteger('shopping_user_id')->nullable();
//invoice //credit
$table->string('type', 7)->index();
$table->string('str_number', 255)->nullable();
$table->unsignedInteger('number', 255)->nullable();
$table->decimal('net', 13, 2)->nullable();
$table->decimal('tax_rate', 8, 2)->nullable();
$table->decimal('tax', 8, 2)->nullable();
$table->decimal('total', 13, 2)->nullable();
$table->text('file')->nullable();
$table->text('contents')->nullable();
$table->text('infos')->nullable();
$table->string('subject')->nullable();
$table->text('address')->nullable();
$table->boolean('paid')->default(false);
$table->date('paid_date')->nullable();
$table->unsignedInteger('cancellation_id')->nullable();
$table->date('cancellation_date')->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->softDeletes();
$table->foreign('auth_user_id')
->references('id')
->on('users');
$table->foreign('shopping_order_id')
->references('id')
->on('shopping_orders');
$table->foreign('shopping_user_id')
->references('id')
->on('shopping_users');
$table->foreign('cancellation_id')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_credits');
}
}

View file

@ -0,0 +1,81 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserInvoiceCreditsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_invoice_credits', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('auth_user_id')->index()->nullable();
$table->unsignedInteger('shopping_order_id')->index()->nullable();
$table->unsignedInteger('shopping_user_id')->index()->nullable();
//invoice //credit
$table->string('type', 7)->index();
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->string('full_number', 255)->nullable();
$table->unsignedInteger('number')->nullable();
$table->decimal('net', 13, 2)->nullable();
$table->decimal('tax_rate', 8, 2)->nullable();
$table->decimal('tax', 8, 2)->nullable();
$table->decimal('total', 13, 2)->nullable();
$table->text('file')->nullable();
$table->text('contents')->nullable();
$table->text('infos')->nullable();
$table->string('subject')->nullable();
$table->text('address')->nullable();
$table->boolean('paid')->default(false);
$table->date('paid_date')->nullable();
$table->unsignedInteger('cancellation_id')->nullable();
$table->date('cancellation_date')->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->softDeletes();
$table->foreign('auth_user_id')
->references('id')
->on('users');
$table->foreign('shopping_order_id')
->references('id')
->on('shopping_orders');
$table->foreign('shopping_user_id')
->references('id')
->on('shopping_users');
$table->foreign('cancellation_id')
->references('id')
->on('user_invoice_credits');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_invoice_credits');
}
}

View file

@ -0,0 +1,65 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_invoices', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('shopping_order_id')->index();
//invoice //credit
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->date('date')->nullable();
$table->string('full_number', 255)->nullable();
$table->unsignedInteger('number')->nullable();
$table->string('filename', 255)->nullable();
$table->string('dir', 100)->nullable();
$table->string('delivery_filename', 255)->nullable();
$table->string('delivery_dir', 100)->nullable();
$table->string('disk', 10)->nullable();
$table->text('infos')->nullable();
$table->boolean('paid')->default(false);
$table->date('paid_date')->nullable();
$table->boolean('cancellation')->default(false);
$table->unsignedInteger('cancellation_id')->nullable();
$table->date('cancellation_date')->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->softDeletes();
$table->foreign('shopping_order_id')
->references('id')
->on('shopping_orders');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_invoices');
}
}

View file

@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserSalesVolumesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_sales_volumes', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('shopping_order_id')->index()->nullable();
$table->unsignedInteger('user_invoice_id')->index()->nullable();
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->date('date')->nullable();
$table->integer('points')->nullable();
$table->integer('month_points')->nullable();
$table->integer('month_shop_points')->nullable();
$table->decimal('total_net', 13, 2)->nullable();
$table->decimal('month_total_net', 13, 2)->nullable();
$table->decimal('month_shop_total_net', 13, 2)->nullable();
$table->string('message', 255)->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users');
$table->foreign('shopping_order_id')
->references('id')
->on('shopping_orders');
$table->foreign('user_invoice_id')
->references('id')
->on('user_invoices');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_sales_volumes');
}
}

View file

@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersSalesVolumesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users_sales_volumes', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('shopping_order_id')->index()->nullable();
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->date('date')->nullable();
$table->unsignedInteger('points')->nullable();
$table->unsignedInteger('month_points')->nullable();
$table->decimal('total_net', 13, 2)->nullable();
$table->decimal('month_total_net', 13, 2)->nullable();
$table->string('message', 255)->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users');
$table->foreign('shopping_order_id')
->references('id')
->on('shopping_orders');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users_sales_volumes');
}
}

View file

@ -78,3 +78,18 @@ a[aria-expanded='true'] > .fa-caret-expand:before {
.no-line-break {
white-space: nowrap;
}
.container-fluid {
margin-right: 0;
margin-left: 0;
/*max-width: 1240px; */
}
.note-toolbar {
z-index: auto;
}
.default-style .datepicker-dropdown {
z-index: 1100 !important;
}
.spinner {
display: none;
}

View file

@ -86,6 +86,11 @@ jQuery(document).ready(function() {
});
}
$('.form-prevent-multiple-submits').on('submit', function(){
$('.button-prevent-multiple-submits').attr('disabled', true);
$(this).find('.spinner').show();
});
});
function _scrollTo(to, offset) {

View file

@ -0,0 +1,55 @@
%!Adobe-FontList 1.22
%Locale:0x409
%BeginFont
Handler:DirectoryHandler
FontType:Invalid
OutlineFileName:/Users/thomaskrummel/Downloads/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/AdobeFnt22.lst
FileLength:1094
FileModTime:661787622
%EndFont
%BeginFont
Handler:DirectoryHandler
FontType:TrueType
FontName:RobotoCondensed-Bold
FamilyName:Roboto Condensed
StyleName:Bold
MenuName:Roboto Condensed
StyleBits:2
WeightClass:700
WidthClass:5
AngleClass:0
FullName:Roboto Condensed Bold
WritingScript:Roman
OutlineFileName:/Users/thomaskrummel/Downloads/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/Roboto Condensed 700.ttf
DataFormat:sfntData
hasSVG:no
VariableFontType:NonVariableFont
FileLength:169352
FileModTime:589984180
NameArray:0,Win,1,Roboto Condensed
%EndFont
%BeginFont
Handler:DirectoryHandler
FontType:TrueType
FontName:RobotoCondensed-Regular
FamilyName:Roboto Condensed
StyleName:Regular
MenuName:Roboto Condensed
StyleBits:0
WeightClass:400
WidthClass:5
AngleClass:0
FullName:Roboto Condensed
WritingScript:Roman
OutlineFileName:/Users/thomaskrummel/Downloads/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/Roboto Condensed regular.ttf
DataFormat:sfntData
hasSVG:no
VariableFontType:NonVariableFont
FileLength:169848
FileModTime:589984181
NameArray:0,Win,1,Roboto Condensed
%EndFont

View file

@ -0,0 +1,63 @@
%!Adobe-FontList 1.23
%Locale:0x409
%BeginFont
Handler:DirectoryHandler
FontType:Invalid
OutlineFileName:/Users/kevinadametz/Desktop/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/AdobeFnt22.lst
FileLength:1305
FileModTime:661787622
%EndFont
%BeginFont
Handler:DirectoryHandler
FontType:Invalid
OutlineFileName:/Users/kevinadametz/Desktop/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/AdobeFnt23.lst
FileLength:1504
FileModTime:668689503
%EndFont
%BeginFont
Handler:DirectoryHandler
FontType:TrueType
FontName:RobotoCondensed-Bold
FamilyName:Roboto Condensed
StyleName:Bold
MenuName:Roboto Condensed
StyleBits:2
WeightClass:700
WidthClass:5
AngleClass:0
FullName:Roboto Condensed Bold
WritingScript:Roman
OutlineFileName:/Users/kevinadametz/Desktop/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/Roboto Condensed 700.ttf
DataFormat:sfntData
hasSVG:no
VariableFontType:NonVariableFont
FileLength:169352
FileModTime:589984180
NameArray:0,Win,1,Roboto Condensed
%EndFont
%BeginFont
Handler:DirectoryHandler
FontType:TrueType
FontName:RobotoCondensed-Regular
FamilyName:Roboto Condensed
StyleName:Regular
MenuName:Roboto Condensed
StyleBits:0
WeightClass:400
WidthClass:5
AngleClass:0
FullName:Roboto Condensed
WritingScript:Roman
OutlineFileName:/Users/kevinadametz/Desktop/MIVITA_Vorlage-Rechnungen Ordner/Document fonts/Roboto Condensed regular.ttf
DataFormat:sfntData
hasSVG:no
VariableFontType:NonVariableFont
FileLength:169848
FileModTime:589984181
NameArray:0,Win,1,Roboto Condensed
%EndFont

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View file

@ -45,6 +45,10 @@
'checkout_copy3line' => 'Bei Fragen sind wir jederzeit für Dich da.',
'checkout_copy3line_extern' => 'Bestellung über Berater:',
'status_copy1line' => 'Status zu Deiner Bestellung auf mivita.care',
'invoice_title' => 'Rechnung zu Deiner Bestellung auf mivita.care',
'credit_title' => 'Deine Gutschrift auf mivita.care',
'invoice_copy1line' => 'vielen Dank für Deine Bestellung bei mivita.care. Nachfolgend senden wir Dir die Rechnung zu deiner Bestellung: ',
'credit_copy1line' => 'nachfolgend senden wir Dir Deine Gutschrift zu.',
'footer_copy1' => 'mivita e.K. | Leinfeld 2 | 87755 Kirchhaslach | Telefon: +49 (0) 8333 946 17 67 | E-Mail: info@mivita.care',
'footer_copy2' => 'Geschäftsinhaber: Alois Ried | Registergericht: Memmingen | Registernummer: HRA 12236 | USt-ID-Nr.: DE 244162340',
'footer_copy3' => '© 2020 All Rights Reserved',

View file

@ -37,5 +37,8 @@ return [
'career_level'=>'Karriere-Level',
'countries'=>'Länder',
'logout'=>'Logout',
'system_settings' => 'Systemeinstellungen'
'payments' => 'Finanzen',
'invoice' => 'Rechnungen',
'credit' => 'Gutschriften',
'system_settings' => 'System-E.'
];

View file

@ -41,12 +41,8 @@
@else
&nbsp; | &nbsp;<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>
@endif
&nbsp; | &nbsp;<span class="small">{{ $product_category->product->getShowAtType() }}</span>
&nbsp; | &nbsp;<span class="small">{!! implode($product_category->product->getShowOnTypes(), ' / ') !!}</span>
&nbsp; | &nbsp;<a href="{{ route('admin_product_edit', [$product_category->product->id]) }}" class="btn btn-xs btn-secondary"><i class="fa fa-eye"></i></a>
@else
-
@endif

View file

@ -23,10 +23,11 @@
<th>{{__('Level')}}</th>
<th>{{__('Mitglied')}}</th>
<th>{{__('bis')}}</th>
<th>{{__('Onlineshop')}}</th>
<th>{{__('Shop')}}</th>
<th>{{__('bis')}}</th>
<th>{{__('Umsatz')}}</th>
<th>{{__('Sales')}}</th>
<th>{{__('Domain')}}</th>
{{-- <th>{{__('Umsatz')}}</th>
<th>{{__('Sales')}}</th> --}}
<th>{{__('verifiziert')}}</th>
<th>{{__('freigegeben')}}</th>
<th>{{__('Einv.')}}</th>
@ -61,8 +62,7 @@
{ data: 'payment_account_date', name: 'payment_account_date' },
{ data: 'payment_shop', name: 'payment_shop' },
{ data: 'payment_shop_date', name: 'payment_shop_date' },
{ data: 'turnover', name: 'turnover' },
{ data: 'sales_total', name: 'sales_total' },
{ data: 'shop_domain', name: 'shop_domain', orderable: false },
{ data: 'confirmed', name: 'confirmed' },
{ data: 'active', name: 'active' },
{ data: 'agreement', name: 'agreement' },

View file

@ -99,7 +99,9 @@
@if($current->shopping_order && $current->shopping_order->user_shop)
<span class="text-muted">#{{$current->shopping_order->user_shop->user->number}}</span><br>
{{$current->shopping_order->user_shop->user->getFullName()}}<br>
{{$current->shopping_order->user_shop->user->account->zipcode}} {{$current->shopping_order->user_shop->user->account->city}}<br>
@if(isset($current->shopping_order->user_shop->user->account->zipcode)){{$current->shopping_order->user_shop->user->account->zipcode}} @endif
@if(isset($current->shopping_order->user_shop->user->account->city)){{$current->shopping_order->user_shop->user->account->city}} @endif
<br>
@if($current->shopping_order->user_shop)
@if($current->shopping_order->user_shop->user->isActive() && $current->shopping_order->user_shop->user->isActiveShop())
<a href="{{$current->shopping_order->user_shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$current->shopping_order->user_shop->getSubdomain(false)}}</a>
@ -186,7 +188,8 @@
@if($possible->member_id)
<span class="text-muted">#{{$possible->member->number}}</span><br>
{{$possible->member->getFullName()}}<br>
{{$possible->member->account->zipcode}} {{$possible->member->account->city}}<br>
@if(isset($possible->member->account->zipcode)){{$possible->member->account->zipcode}} @endif
@if(isset($possible->member->account->city)){{$possible->member->account->city}} @endif <br>
@if($possible->member->shop)
@if($possible->member->isActive() && $possible->member->isActiveShop())
<a href="{{$possible->member->shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$possible->member->shop->getSubdomain(false)}}</a>

View file

@ -0,0 +1,103 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h6 class="card-header">
Finanzen / Rechnungen
</h6>
<div class="card-body p-0">
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_payment_invoices']) !!}
<div class="form-row align-items-center px-4 pb-2 pt-3">
<div class="col-12 col-sm-4 col-md-4 col-lg-4 mb-1">
<input class="form-control on_keyup_invoice" name="invoice_filter_name" type="text" value="{{session('invoice_filter_name')}}" placeholder="Name">
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="invoice_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('invoice_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="invoice_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('invoice_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered" id="datatable-invoice">
<thead>
<tr>
<th>#</th>
<th>{{__('Re.Nr.')}}</th>
<th>{{__('Rechnung')}}</th>
<th>{{__('Betrag') }}</th>
<th>{{__('Status')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname') }}</th>
<th>{{__('E-Mail') }}</th>
<th>{{__('Datum') }}</th>
<th>{{__('Art')}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatable-invoice').DataTable({
"processing": true,
"serverSide": true,
"stateSave": true,
"searching": false,
ajax: {
url: '{!! route('admin_payments_invoice_datatable') !!}',
data: function(d) {
d.invoice_filter_name = $('input[name=invoice_filter_name]').val();
d.invoice_filter_month = $('select[name=invoice_filter_month]').val();
d.invoice_filter_year = $('select[name=invoice_filter_year]').val();
}
},
"order": [[0, "desc" ]],
"columns": [
{ data: 'id', searchable: false },
{ data: 'full_number', name: 'full_number' },
{ data: 'invoice', name: 'invoice', orderable: false, searchable: false },
{ data: 'total_shipping', name: 'total_shipping' },
{ data: 'txaction', name: 'txaction', searchable: false },
{ data: 'shopping_order.shopping_user.billing_firstname', name: 'shopping_order.shopping_user.billing_firstname', orderable: false },
{ data: 'shopping_order.shopping_user.billing_lastname', name: 'shopping_order.shopping_user.billing_lastname', orderable: false },
{ data: 'shopping_order.shopping_user.billing_email', name: 'shopping_order.shopping_user.billing_email', orderable: false },
{ data: 'created_at', name: 'created_at' },
{ data: 'status', name: 'status', searchable: false },
],
"bLengthChange": false,
"iDisplayLength": 100,
"language": {
"url": "/js/German.json"
}
});
$('select.on_change_invoice').on('change', function(){
oTable.draw();
});
$('input.on_keyup_invoice').on('keyup', function(){
oTable.draw();
});
});
/*$('#filter_sales_year').on('change', function(){
$('#form_filter_payment_invoices').submit();
});*/
</script>
@endsection

View file

@ -21,6 +21,7 @@
<th>{{__('Artikelnummer')}}</th>
<th>{{__('Kategorie')}}</th>
<th>{{__('Preis')}}</th>
<th>{{__('MwSt')}}</th>
<th>{{__('Points')}}</th>
<th>{{__('Inhalt')}}</th>
<th>{{__('Einheit')}}</th>
@ -55,6 +56,7 @@
@endforeach
</td>
<td>{{ $value->getFormattedPrice() }}</td>
<td>{{ $value->getFormattedTax() }}</td>
<td>{{ $value->points }}</td>
<td>{{ $value->contents_total }}</td>
<td>{{ $value->getUnitType() }}</td>

View file

@ -3,13 +3,13 @@
<!-- Status -->
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-1">
<div class="col-md-3 mb-1">
<strong class="mr-2">Status:</strong>
<span class="text-big">
{!! \App\Services\Payment::getShoppingOrderBadge($shopping_order); !!}
</span>
</div>
<div class="col-md-6 mb-1">
<div class="col-md-3 mb-1">
<strong class="mr-2">Versand:</strong>
@if($isAdmin)
@ -26,6 +26,54 @@
</span>
@endif
</div>
<div class="col-md-3 mb-1">
<strong class="mr-2">Rechnung:</strong>
@if($isAdmin)
@if($shopping_order->isInvoice())
<a href="{{ route('storage_file', [$shopping_order->id, 'invoice', 'download']) }}" class="btn btn-primary btn-sm"><i class="fa fa-download"></i></a>
<a href="{{ route('storage_file', [$shopping_order->id, 'invoice', 'stream']) }}" target="_blank" class="btn btn-warning btn-sm"><i class="fa fa-eye"></i></a>
@if(Auth::user()->isSySAdmin())
<button type="button" class="btn btn-sm btn-info" data-toggle="modal" data-target="#modals-invoice"
data-id="{{ $shopping_order->id }}"
//TODO
//data-invoice="{{ $shopping_order->invoice_status }}"
data-back="{{url()->current()}}"
data-action="create_invoice">
<span class="fa fa-file"></span>
</button>
@endif
@else
{{--
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-invoice"
data-id="{{ $shopping_order->id }}"
//TODO
// data-invoice="{{ $shopping_order->invoice_status }}"
data-back="{{url()->current()}}"
data-action="create_invoice">
<span class="fa fa-file"></span> <strong>Rechnung erstellen</strong>
</button>
--}}
@endif
@else
@if($shopping_order->isInvoice())
<a href="{{ route('storage_file', [$shopping_order->id, 'invoice', 'download']) }}" class="btn btn-primary btn-sm"><i class="fa fa-download"></i></a>
<a href="{{ route('storage_file', [$shopping_order->id, 'invoice', 'stream']) }}" target="_blank" class="btn btn-warning btn-sm"><i class="fa fa-eye"></i></a>
@endif
@endif
@if($shopping_order->txaction === 'extern' && $shopping_order->wp_invoice_path)
<a href="{{$shopping_order->wp_invoice_path}}" class="btn btn-secondary btn-sm"><i class="fa fa-external-link-alt"></i> <i class="fa fa-download"></i></a>
@endif
</div>
<div class="col-md-3 mb-1">
@if($isAdmin)
<strong class="mr-2">Lieferschein:</strong>
@if($shopping_order->isInvoice())
<a href="{{ route('storage_file', [$shopping_order->id, 'delivery', 'download']) }}" class="btn btn-primary btn-sm"><i class="fa fa-download"></i></a>
<a href="{{ route('storage_file', [$shopping_order->id, 'delivery', 'stream']) }}" target="_blank" class="btn btn-warning btn-sm"><i class="fa fa-eye"></i></a>
@endif
@endif
</div>
</div>
</div>
@ -368,15 +416,14 @@
{{__('email.checkout_mail_shipping')}}
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
@if($shopping_order->shopping_user->is_from === 'user_order')
{{ $shopping_order->getFormattedShippingNet() }} &euro;
@if($shopping_order->tax > 0)
{{ $shopping_order->getFormattedShipping() }} &euro;
@else
{{ $shopping_order->getFormattedShipping() }} &euro;
{{ $shopping_order->getFormattedShippingNet() }} &euro;
@endif
</td>
</tr>
<tr>
<td colspan="3">
{{__('email.checkout_mail_subtotal_ws')}}
</td>
@ -512,7 +559,7 @@
@if($shopping_order->wp_invoice_path)
<div class="row">
<div class="col-sm-12">
<a href="{{$shopping_order->wp_invoice_path}}" target="_blank" class="btn btn-secondary btn-sm">Link zur Rechnung</a>
<a href="{{$shopping_order->wp_invoice_path}}" target="_blank" class="btn btn-secondary btn-sm"><i class="fa fa-external-link-alt"></i> Link zur Rechnung</a>
</div>
</div>
@endif
@ -623,7 +670,6 @@
</div>
@if($isAdmin)
<!-- Modal template -->
<div class="modal fade" id="modals-shipped">
<div class="modal-dialog">
<form class="modal-content" action="{{ route('admin_sales_store') }}" method="post">
@ -651,8 +697,46 @@
</div>
</div>
<div class="modal fade" id="modals-invoice">
<div class="modal-dialog">
<form class="modal-content form-prevent-multiple-submits" action="{{ route('admin_sales_invoice') }}" method="post">
@csrf
<input type="hidden" name="id" value="{{$shopping_order->id}}">
<input type="hidden" name="action" value="create_invoice">
<input type="hidden" name="back" value="{{url()->current()}}">
<input type="hidden" name="view" value="{{$isView}}">
<div class="modal-header">
<h5 class="modal-title">{{__('Rechnung')}}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<div class="form-group col-sm-12">
{{ Form::select('invoice_option', ['create'=>'Rechnung erstellen'], false, array('data-live-search'=>'false', 'class'=>'selectpicker') ) }}
</div>
<div class="form-group col-sm-12">
<label class="form-label" for="invoice_date">{{ __('Rechnungsdatum') }}</label>
{!! Form::text('invoice_date', $shopping_order->created_at->format("d.m.Y"), ['class'=>'form-control datepicker-base']) !!}
</div>
<div class="form-group col-sm-12">
<label class="form-label" for="invoice_number">{{ __('Rechnungsnummer') }}</label>
{!! Form::text('invoice_number', App\Services\Invoice::getInvoiceNumber(), ['class'=>'form-control', 'disabled']) !!}
<em> nächste Rechnungsnummer <a href="{{ route('admin_settings') }}"><i class="fa fa-edit"></i></a></em>
</div>
<div class="form-group col-sm-12">
<label class="custom-control custom-checkbox">
{!! Form::checkbox('invoice_send_mail', 1, false, ['class'=>'custom-control-input']) !!}
<span class="custom-control-label">Rechnung <strong>nicht</strong> senden an: {{ $shopping_order->shopping_user->billing_email }}</span>
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
<button type="submit" class="btn btn-primary button-prevent-multiple-submits"><i class="spinner fa fa-spinner fa-spin"></i> {{__('save')}}</button>
</div>
</form>
</div>
</div>
<!-- Modal template -->
<div class="modal fade" id="modals-txaction">
<div class="modal-dialog">
<form class="modal-content" action="{{ route('admin_sales_store') }}" method="post">
@ -661,7 +745,6 @@
<input type="hidden" name="payment_id">
<input type="hidden" name="action" value="store_txaction">
<input type="hidden" name="back" value="{{url()->current()}}">
<div class="modal-header">
<h5 class="modal-title">{{__('Bestellung')}} {{__('Rechnung')}} </h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>

View file

@ -9,8 +9,8 @@
<th>{{__('Marge')}}</th>
<th class="text-right">{{__('Points')}}</th>
<th class="text-right">{{__('Verdienst')}}</th>
<th class="text-right">{{__('EK-Preis')}}</th>
<th class="text-right">{{__('VK-Preis')}}</th>
<th class="text-right">{{__('EK-Preis')}}</th>
</tr>
</thead>
<tbody>
@ -61,7 +61,7 @@
Lieferung an Gastgeber
@endif
@if($homeparty_guest->getDelivery() === 'direct')
Lieferung direkt an den Gast
Lieferung direkt an den Gast
@endif
</td>
</tr>
@ -121,7 +121,6 @@
<td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
</tr>
@endif
</tfoot>
</table>
@ -130,7 +129,6 @@
@if($homeparty_guest->is_host || $homeparty_guest->getDelivery() === 'direct')
<hr class="m-0">
<div class="card-body" style="background-color: #E5E9EF">
<h6 class="small font-weight-semibold">
Lieferadresse

View file

@ -54,11 +54,13 @@
<th>{{__('Zahlung')}}</th>
<th>{{__('Status')}}</th>
<th>{{__('Versand')}}</th>
<th>{{__('Rechnung')}}</th>
<th>{{__('First name')}}</th>
<th>{{__('Last name')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('zugewiesener Berater')}}</th>
<th>{{__('Rf-Nr.')}}</th>
<th>{{__('Art')}}</th>
<th>{{__('Käufe')}}</th>
<th>{{__('Gekauft im Shop')}}</th>
</tr>
@ -87,11 +89,13 @@
{ data: 'payment', name: 'payment', orderable: false },
{ data: 'txaction', name: 'txaction' },
{ data: 'shipped', name: 'shipped' },
{ data: 'invoice', name: 'invoice', orderable: false },
{ data: 'shopping_user.billing_firstname', name: 'shopping_user.billing_firstname' },
{ data: 'shopping_user.billing_lastname', name: 'shopping_user.billing_lastname' },
{ data: 'shopping_user.billing_email', name: 'shopping_user.billing_email' },
{ data: 'member_id', name: 'member_id', searchable: false, orderable: false },
{ data: 'reference', name: 'reference' },
{ data: 'payment_for', name: 'payment_for' },
{ data: 'shopping_user.orders', name: 'shopping_user.orders' },
{ data: 'user_shop_id', name: 'user_shop_id', searchable: false, orderable: true },
],

View file

@ -21,13 +21,13 @@
<th>{{__('Status')}}</th>
<th>{{__('Versand')}}</th>
<th>{{__('Art')}}</th>
<th>{{__('Rechnung')}}</th>
<th>{{__('First name')}}</th>
<th>{{__('Last name')}}</th>
<th>{{__('E-Mail')}}</th>
<th>B.{{__('First name')}}</th>
<th>B.{{__('Last name')}}</th>
<th>B.{{__('E-Mail')}}</th>
<th>{{__('Rf-Nr.')}}</th>
<th>{{__('Käufe')}}</th>
<th>{{__('Berater-Shop')}}</th>
@ -50,7 +50,8 @@
{ data: 'payment', name: 'payment', orderable: false },
{ data: 'txaction', name: 'txaction' },
{ data: 'shipped', name: 'shipped' },
{ data: 'is_for', name: 'is_for', orderable: false },
{ data: 'payment_for', name: 'payment_for' },
{ data: 'invoice', name: 'invoice', orderable: false },
{ data: 'shopping_user.shipping_firstname', name: 'shopping_user.shipping_firstname', orderable: false },
{ data: 'shopping_user.shipping_lastname', name: 'shopping_user.shipping_lastname', orderable: false },
{ data: 'shopping_user.shipping_email', name: 'shopping_user.shipping_email', orderable: false },

View file

@ -0,0 +1,33 @@
@extends('layouts.layout-2')
@section('content')
<h4 class="font-weight-bold py-2 mb-2">
{{ __('Einstellungen') }}
</h4>
{!! Form::open(['url' => route('admin_setting_store'), 'class' => 'form-horizontal']) !!}
{{-- <div class="card mb-2">
<div class="card-body">
<h4>Rechnungen Einstellungen</h4>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="form-label">{{ __('nächste Rechnungsnummer') }}*</label>
{{ Form::text('settings[invoice-number][val]', \App\Models\Setting::getContentBySlug('invoice-number'), array('class'=>'form-control')) }}
{{ Form::hidden('settings[invoice-number][type]', 'int') }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="form-label">{{ __('nächste Gutschriftsnummer') }}*</label>
{{ Form::text('settings[credit-number][val]', \App\Models\Setting::getContentBySlug('credit-number'), array('class'=>'form-control')) }}
{{ Form::hidden('settings[credit-number][type]', 'int') }}
</div>
</div>
<button type="submit" name="action" value="save_prepayment" class="btn btn-primary btn-sm mb-2"><i class="ion ion-ios-save"></i> speichern</button>
</div>
</div>
--}}
{!! Form::close() !!}
@endsection

View file

@ -0,0 +1,162 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mivita.care</title>
<style type="text/css">
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a {
text-decoration: none;
border: 0;
outline: none;
color: #919f7a;
}
a:hover {
color: #b6b600;
}
a img {
border: none;
}
td, h1, h2, h3 {
font-family: Helvetica, Verdana, Arial, sans-serif;
font-weight: 400;
}
td {
text-align: left;
}
body {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
width: 100%;
height: 100%;
color: #37302d;
background: #ffffff;
font-size: 15px;
line-height: 26px
}
table {
border-collapse: separate !important;
}
.headline {
color: #37302d;
font-size: 18px;
}
.sub_headline {
color: #788662;
font-size: 15px;
}
.force-full-width {
width: 100% !important;
}
hr {
border: none;
border-top: 1px solid #b7c59e;
}
</style>
<style type="text/css" media="screen">
@media screen {
td, h1, h2, h3 {
font-family: Helvetica, Verdana, Arial, sans-serif;
}
}
</style>
<style type="text/css" media="only screen and (max-width: 480px)">
@media only screen and (max-width: 480px) {
table[class="w320"] {
width: 320px !important;
}
}
</style>
</head>
<body class="body" style="padding:0; margin:0; display:block; background:#f8f8f8; -webkit-text-size-adjust:none" bgcolor="#f8f8f8">
<table align="left" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td align="left" valign="top" bgcolor="#f8f8f8" width="100%">
<br>
<table style="margin: 0 auto;" cellpadding="0" cellspacing="0" width="700" class="w320">
<tr>
<td align="left" valign="top">
<table style="margin: 0 auto;" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style=" text-align:center;">
<center>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="">
<tbody class="">
<tr class="">
<td align="center" valign="middle" style="font-size: 0px;" class="">
<center>
<picture style="text-align: center">
<img src="https://my.mivita.care/images/logo_mivita.png" alt="mivita.care" style="border:none" width="230">
</picture>
</center>
</td>
</tr>
<tr>
<td><br></td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table>
<table cellpadding="10" style="padding: 10px;" cellspacing="0" border="0" width="100%" bgcolor="#ffffff">
</table>
<center>
<table cellpadding="0" cellspacing="0" class="force-full-width"
bgcolor="#f8f8f8" style="margin: 0 auto; text-align: center;line-height:1.6em;">
<tr>
<td style="color:#7B7B7E; font-size:14px; text-align: center;line-height:1.6em;" align="center">
<p>
{{__('email.footer_copy1')}}
</p>
<br>
<a href="https://www.mivita.care" style="color: #7B7B7E; text-decoration: underline;">www.mivita.care</a>
<br>
</td>
</tr>
<tr>
<td style="color:#bbbbbb; font-size:12px; text-align: center;line-height:1.6em;" align="center">
<p>{{__('email.footer_copy2')}}</p>
<a href="https://www.mivita.care/datenschutz">Datenschutzerklärung</a> <br>
<p>{{__('email.footer_copy3')}}</p>
<br>
<br>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,223 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>mivita.care</title>
<style type="text/css">
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a {
text-decoration: none;
border: 0;
outline: none;
color: #919f7a;
}
a:hover {
color: #b6b600;
}
a img {
border: none;
}
td, h1, h2, h3 {
font-family: Helvetica, Verdana, Arial, sans-serif;
font-weight: 400;
}
td {
text-align: left;
}
body {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
width: 100%;
height: 100%;
color: #37302d;
background: #ffffff;
font-size: 15px;
line-height: 26px
}
table {
border-collapse: separate !important;
}
.headline {
color: #37302d;
font-size: 18px;
}
.sub_headline {
color: #788662;
font-size: 15px;
}
.force-full-width {
width: 100% !important;
}
hr {
border: none;
border-top: 1px solid #b7c59e;
}
</style>
<style type="text/css" media="screen">
@media screen {
td, h1, h2, h3 {
font-family: Helvetica, Verdana, Arial, sans-serif;
}
}
</style>
<style type="text/css" media="only screen and (max-width: 480px)">
@media only screen and (max-width: 480px) {
table[class="w320"] {
width: 320px !important;
}
}
</style>
</head>
<body class="body" style="padding:0; margin:0; display:block; background:#f8f8f8; -webkit-text-size-adjust:none" bgcolor="#f8f8f8">
@if(isset($copy1line))
<div style="display: none; mso-hide: all; width: 0px; height: 0px; max-width: 0px; max-height: 0px; font-size: 0px; line-height: 0px;">
{{ $copy1line }}
</div>
@endif
<table align="left" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td align="left" valign="top" bgcolor="#f8f8f8" width="100%">
<br>
<table style="margin: 0 auto;" cellpadding="0" cellspacing="0" width="700" class="w320">
<tr>
<td align="left" valign="top">
<table style="margin: 0 auto;" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style=" text-align:center;">
<center>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="">
<tbody class="">
<tr class="">
<td align="center" valign="middle" style="font-size: 0px;" class="">
<center>
<picture style="text-align: center">
<img src="https://my.mivita.care/images/logo_mivita.png" alt="mivita.care" style="border:none" width="230">
</picture>
</center>
</td>
</tr>
<tr>
<td><br></td>
</tr>
</tbody>
</table>
</center>
</td>
</tr>
</table>
<table cellpadding="10" style="padding: 10px;" cellspacing="0" border="0" width="100%" bgcolor="#ffffff">
@if(isset($title))
<tr>
<td class="headline">
<b>{{ $title }} </b>
</td>
</tr>
@endif
@if(isset($copy1line))
<tr>
<td style="color:#37302d;line-height:1.6em;">
{!! nl2br($copy1line) !!}
</td>
</tr>
@endif
@if(isset($url))
<tr>
<td>
<center>
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
<tr>
<td style="word-wrap:break-word;background:transparent;font-size:0px;padding:10px 25px;padding-top:15px;padding-bottom:15px;padding-right:40px;padding-left:40px;" align="center" valign="top" background="data:image/gif;base64,">
<table role="presentation" cellpadding="0" cellspacing="0" align="center" border="0">
<tbody>
<tr>
<td style="border:none;border-radius:20px;color:#ffffff;cursor:auto;padding:15px 25px;" align="center" valign="middle" bgcolor="#b5c49b">
<p style="text-decoration:none;background:#b5c49b;color:#ffffff;font-family:Arial, sans-serif;font-size:13px;font-weight:normal;line-height:120%;text-transform:none;margin:0px;text-align: center">
<a href="{{ $url }}" style="color:#ffffff;font-size:14px;font-weight:bold;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;">{{ $button }}</a>
</p>
</td>
</tr>
<tr>
<td style="color:#37302d;text-align: center">
<span style="color: #cabda9; font-weight: normal; font-size: 13px; text-decoration: underline; word-wrap: break-word;white-space: pre-line;">{{ $url }}</span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</td>
<tr>
@endif
@if(isset($content))
<tr>
<td>
<table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">
<tr>
<td>
{!! nl2br($content) !!}
</td>
</tr>
</table>
</td>
</tr>
@endif
</table>
<center>
<table cellpadding="0" cellspacing="0" class="force-full-width"
bgcolor="#f8f8f8" style="margin: 0 auto; text-align: center;line-height:1.6em;">
<tr>
<td style="color:#7B7B7E; font-size:14px; text-align: center;line-height:1.6em;" align="center">
<p>
{{__('email.footer_copy1')}}
</p>
<br>
<a href="https://www.mivita.care" style="color: #7B7B7E; text-decoration: underline;">www.mivita.care</a>
<br>
</td>
</tr>
<tr>
<td style="color:#bbbbbb; font-size:12px; text-align: center;line-height:1.6em;" align="center">
<p>{{__('email.footer_copy2')}}</p>
<a href="https://www.mivita.care/datenschutz">Datenschutzerklärung</a> <br>
<p>{{__('email.footer_copy3')}}</p>
<br>
<br>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View file

@ -241,10 +241,10 @@
{{__('email.checkout_mail_shipping')}}
</td>
<td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
@if($shopping_order->shopping_user->is_from === 'user_order')
{{ $shopping_order->getFormattedShippingNet() }} &euro;
@if($shopping_order->tax > 0)
{{ $shopping_order->getFormattedShipping() }} &euro;
@else
{{ $shopping_order->getFormattedShipping() }} &euro;
{{ $shopping_order->getFormattedShippingNet() }} &euro;
@endif
</td>
</tr>
@ -366,22 +366,17 @@
@if($shopping_order->shopping_user->billing_company)
{{ $shopping_order->shopping_user->billing_company }}<br>
@endif
{{ $shopping_order->shopping_user->billing_firstname }}
{{ $shopping_order->shopping_user->billing_lastname }} <br>
<br>
{{ $shopping_order->shopping_user->billing_address }} <br>
@if($shopping_order->shopping_user->billing_address_2)
{{ $shopping_order->shopping_user->billing_address_2 }}<br>
@endif
{{ $shopping_order->shopping_user->billing_zipcode }}
{{ $shopping_order->shopping_user->billing_city }} <br>
{{ $shopping_order->shopping_user->billing_country->getLocated() }} <br>
@if($shopping_order->shopping_user->billing_phone)
<br><br> {{ $shopping_order->shopping_user->billing_phone }}<br>
<br>{{ $shopping_order->shopping_user->billing_phone }}<br>
@endif
</td>
</tr>
@ -409,27 +404,20 @@
@if($shopping_order->shopping_user->same_as_billing)
{{__('email.checkout_mail_same_address')}}
@else
@if($shopping_order->shopping_user->shipping_company)
{{ $shopping_order->shopping_user->shipping_company }}<br>
@endif
{{ $shopping_order->shopping_user->shipping_firstname }}
{{ $shopping_order->shopping_user->shipping_lastname }} <br>
<br>
{{ $shopping_order->shopping_user->shipping_address }} <br>
@if($shopping_order->shopping_user->shipping_address_2)
{{ $shopping_order->shopping_user->shipping_address_2 }}<br>
@endif
{{ $shopping_order->shopping_user->shipping_zipcode }}
{{ $shopping_order->shopping_user->shipping_city }} <br>
{{ $shopping_order->shopping_user->shipping_country->getLocated() }} <br>
@if($shopping_order->shopping_user->shipping_phone)
<br><br> {{ $shopping_order->shopping_user->shipping_phone }}<br>
<br> {{ $shopping_order->shopping_user->shipping_phone }}<br>
@endif
@endif
</td>

Some files were not shown because too many files have changed in this diff Show more