April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
|
|
@ -1,127 +1,199 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Mail\MailInvoice;
|
||||
use App\Mail\MailLogistic;
|
||||
use App\Services\Util;
|
||||
use App\Models\Setting;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserCredit;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class Invoice
|
||||
{
|
||||
|
||||
public static function getInvoiceNumber(){
|
||||
public static function getInvoiceNumber()
|
||||
{
|
||||
return (int) Setting::getContentBySlug('invoice-number');
|
||||
}
|
||||
|
||||
public static function makeNextInvoiceNumber(){
|
||||
public static function makeNextInvoiceNumber()
|
||||
{
|
||||
$invoice_number = self::getInvoiceNumber();
|
||||
$invoice_number = $invoice_number+1;
|
||||
$invoice_number = $invoice_number + 1;
|
||||
Setting::setContentBySlug('invoice-number', $invoice_number, 'int');
|
||||
|
||||
return $invoice_number;
|
||||
}
|
||||
|
||||
public static function createInvoiceNumber($invoice_number, $invoice_date){
|
||||
public static function createInvoiceNumber($invoice_number, $invoice_date)
|
||||
{
|
||||
$prefix = \Carbon::parse($invoice_date)->format('Ym');
|
||||
|
||||
return $prefix.$invoice_number;
|
||||
}
|
||||
|
||||
public static function getInvoiceStorageDir($invoice_date){
|
||||
return "/invoice/".\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
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 getDeliveryStorageDir($invoice_date)
|
||||
{
|
||||
return '/delivery/'.\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
public static function makeInvoiceFilename($invoice_number){
|
||||
return "Rechnung-".$invoice_number.".pdf";
|
||||
public static function makeInvoiceFilename($invoice_number)
|
||||
{
|
||||
return 'Rechnung-'.$invoice_number.'.pdf';
|
||||
}
|
||||
|
||||
public static function makeDeliveryFilename($invoice_number){
|
||||
return "Lieferschein-".$invoice_number.".pdf";
|
||||
public static function makeDeliveryFilename($invoice_number)
|
||||
{
|
||||
return 'Lieferschein-'.$invoice_number.'.pdf';
|
||||
}
|
||||
//invoice
|
||||
public static function isInvoice(ShoppingOrder $shopping_order){
|
||||
|
||||
public static function makeCancellationFilename($invoice_number)
|
||||
{
|
||||
return 'Stornorechnung-'.$invoice_number.'.pdf';
|
||||
}
|
||||
|
||||
public static function getCancellationStorageDir($invoice_date)
|
||||
{
|
||||
return '/cancellation/'.\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
// invoice
|
||||
public static function isInvoice(ShoppingOrder $shopping_order)
|
||||
{
|
||||
return isset($shopping_order->invoice['filename']) ? true : false;
|
||||
}
|
||||
|
||||
public static function getFilename($shopping_order){
|
||||
public static function getFilename($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->invoice['filename']) ? $shopping_order->invoice['filename'] : false;
|
||||
}
|
||||
|
||||
public static function getDir($shopping_order){
|
||||
public static function getDir($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->invoice['dir']) ? $shopping_order->invoice['dir'] : false;
|
||||
}
|
||||
|
||||
public static function getDate($shopping_order){
|
||||
public static function getDate($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->invoice['invoice_date']) ? $shopping_order->invoice['invoice_date'] : false;
|
||||
}
|
||||
|
||||
public static function getNumber($shopping_order){
|
||||
public static function getNumber($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->invoice['invoice_number']) ? $shopping_order->invoice['invoice_number'] : false;
|
||||
}
|
||||
//delivery
|
||||
public static function isDelivery(ShoppingOrder $shopping_order){
|
||||
|
||||
// cancellation
|
||||
public static function isCancellationInvoice(ShoppingOrder $shopping_order)
|
||||
{
|
||||
return isset($shopping_order->cancellation_invoice['filename']) ? true : false;
|
||||
}
|
||||
|
||||
public static function getCancellationFilename($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->cancellation_invoice['filename']) ? $shopping_order->cancellation_invoice['filename'] : false;
|
||||
}
|
||||
|
||||
public static function getCancellationDir($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->cancellation_invoice['dir']) ? $shopping_order->cancellation_invoice['dir'] : false;
|
||||
}
|
||||
|
||||
public static function getCancellationDate($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->cancellation_invoice['cancellation_date']) ? $shopping_order->cancellation_invoice['cancellation_date'] : false;
|
||||
}
|
||||
|
||||
public static function getCancellationNumber($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->cancellation_invoice['cancellation_number']) ? $shopping_order->cancellation_invoice['cancellation_number'] : false;
|
||||
}
|
||||
|
||||
public static function getCancellationDownloadPath(ShoppingOrder $shopping_order, $full = false)
|
||||
{
|
||||
$dir = self::getCancellationDir($shopping_order);
|
||||
$filename = self::getCancellationFilename($shopping_order);
|
||||
if (! $full) {
|
||||
return $dir.$filename;
|
||||
}
|
||||
|
||||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
// delivery
|
||||
public static function isDelivery(ShoppingOrder $shopping_order)
|
||||
{
|
||||
return isset($shopping_order->delivery['filename']) ? true : false;
|
||||
}
|
||||
public static function getDeliveryFilename($shopping_order){
|
||||
|
||||
public static function getDeliveryFilename($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->delivery['filename']) ? $shopping_order->delivery['filename'] : self::makeDeliveryFilename(self::getDeliveryNumber($shopping_order));
|
||||
}
|
||||
|
||||
public static function getDeliveryDir($shopping_order){
|
||||
public static function getDeliveryDir($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->delivery['dir']) ? $shopping_order->delivery['dir'] : self::getDeliveryStorageDir(self::getDeliveryDate($shopping_order));
|
||||
}
|
||||
|
||||
public static function getDeliveryDate($shopping_order){
|
||||
public static function getDeliveryDate($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->delivery['date']) ? $shopping_order->delivery['date'] : self::getDate($shopping_order);
|
||||
}
|
||||
|
||||
public static function getDeliveryNumber($shopping_order){
|
||||
public static function getDeliveryNumber($shopping_order)
|
||||
{
|
||||
return isset($shopping_order->delivery['number']) ? $shopping_order->delivery['number'] : self::getNumber($shopping_order);
|
||||
}
|
||||
|
||||
|
||||
public static function getDownloadPath(ShoppingOrder $shopping_order, $full = false){
|
||||
public static function getDownloadPath(ShoppingOrder $shopping_order, $full = false)
|
||||
{
|
||||
$dir = self::getDir($shopping_order);
|
||||
$filename = self::getFilename($shopping_order);
|
||||
if(!$full){
|
||||
if (! $full) {
|
||||
return $dir.$filename;
|
||||
}
|
||||
|
||||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function getDownloadPathDelivery(ShoppingOrder $shopping_order, $full = false){
|
||||
public static function getDownloadPathDelivery(ShoppingOrder $shopping_order, $full = false)
|
||||
{
|
||||
$dir = self::getDeliveryDir($shopping_order);
|
||||
$filename = self::getDeliveryFilename($shopping_order);
|
||||
if(!$full){
|
||||
if (! $full) {
|
||||
return $dir.$filename;
|
||||
}
|
||||
|
||||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function sendInvoiceMail($shopping_order){
|
||||
public static function sendInvoiceMail($shopping_order)
|
||||
{
|
||||
$bcc = [];
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
if(!$billing_email){
|
||||
if($shopping_order->mode === 'test'){
|
||||
if (! $billing_email) {
|
||||
if ($shopping_order->mode === 'test') {
|
||||
$billing_email = config('app.checkout_test_mail');
|
||||
}else{
|
||||
} else {
|
||||
$billing_email = config('app.checkout_mail');
|
||||
}
|
||||
}
|
||||
if($shopping_order->mode === 'test'){
|
||||
if ($shopping_order->mode === 'test') {
|
||||
$bcc[] = config('app.checkout_test_mail');
|
||||
}else{
|
||||
} else {
|
||||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
Mail::to($billing_email)->bcc($bcc)->send(new MailInvoice($shopping_order));
|
||||
}
|
||||
|
||||
public static function sendLogisticMail(ShoppingOrder $shopping_order){
|
||||
$to = [config('app.logistic_mail')]; //['versand@aloe-vera.bio'];
|
||||
public static function sendLogisticMail(ShoppingOrder $shopping_order)
|
||||
{
|
||||
$to = [config('app.logistic_mail')]; // ['versand@aloe-vera.bio'];
|
||||
Mail::to($to)->send(new MailLogistic($shopping_order));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue