Rechnungen + Gutschriften
This commit is contained in:
parent
39ef16686a
commit
35ae3da244
33 changed files with 2834 additions and 34 deletions
|
|
@ -5,6 +5,7 @@ use App\Mail\MailInvoice;
|
|||
use App\Services\Util;
|
||||
use App\Models\Setting;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserCredit;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class Invoice
|
||||
|
|
@ -30,27 +31,44 @@ class Invoice
|
|||
return "/invoice/".\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
public static function getCreditStorageDir($invoice_date){
|
||||
return "/credit/".\Carbon::parse($invoice_date)->format('Y/m/');
|
||||
}
|
||||
|
||||
public static function makeInvoiceFilename($invoice_number){
|
||||
|
||||
return "Rechnung-".$invoice_number.".pdf";
|
||||
}
|
||||
|
||||
public static function makeCreditFilename($invoice_number){
|
||||
return "Gutschrift-".$invoice_number.".pdf";
|
||||
}
|
||||
|
||||
public static function isInvoice(ShoppingOrder $shopping_order){
|
||||
return isset($shopping_order->invoice['filename']) ? true : false;
|
||||
}
|
||||
public static function isCredit(UserCredit $user_credit){
|
||||
return isset($user_credit->credit['filename']) ? true : false;
|
||||
}
|
||||
|
||||
public static function getFilename(ShoppingOrder $shopping_order){
|
||||
return isset($shopping_order->invoice['filename']) ? $shopping_order->invoice['filename'] : false;
|
||||
}
|
||||
|
||||
public static function getCreditFilename(UserCredit $user_credit){
|
||||
return isset($user_credit->credit['filename']) ? $user_credit->credit['filename'] : false;
|
||||
}
|
||||
|
||||
public static function getDir(ShoppingOrder $shopping_order){
|
||||
return isset($shopping_order->invoice['dir']) ? $shopping_order->invoice['dir'] : false;
|
||||
}
|
||||
|
||||
public static function getCreditDir(UserCredit $user_credit){
|
||||
return isset($user_credit->credit['dir']) ? $user_credit->credit['dir'] : false;
|
||||
}
|
||||
|
||||
public static function getDownloadURL(ShoppingOrder $shopping_order, $do = false){
|
||||
return route('storage_file', [$shopping_order->id, 'cms_download_file', $do]);
|
||||
}
|
||||
|
||||
public static function getDownloadPath(ShoppingOrder $shopping_order, $full = false){
|
||||
$dir = self::getDir($shopping_order);
|
||||
$filename = self::getFilename($shopping_order);
|
||||
|
|
@ -60,6 +78,15 @@ class Invoice
|
|||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function getCreditDownloadPath(UserCredit $user_credit, $full = false){
|
||||
$dir = self::getCreditDir($user_credit);
|
||||
$filename = self::getCreditFilename($user_credit);
|
||||
if(!$full){
|
||||
return $dir.$filename;
|
||||
}
|
||||
return \Storage::disk('public')->path($dir.$filename);
|
||||
}
|
||||
|
||||
public static function sendInvoiceMail($shopping_order){
|
||||
$bcc = [];
|
||||
$billing_email = $shopping_order->shopping_user->billing_email;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue