06 2022
This commit is contained in:
parent
9b0b5feb7e
commit
7a040c3e19
106 changed files with 4074 additions and 1349 deletions
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Libraries\InvoicePDF;
|
||||
use PDF;
|
||||
use Storage;
|
||||
use App\Services\Invoice;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Libraries\InvoicePDF;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Services\MyPDFMerger;
|
||||
use App\Services\UserService;
|
||||
use App\Models\UserSalesVolume;
|
||||
|
||||
class InvoiceRepository extends BaseRepository {
|
||||
|
|
@ -32,7 +33,10 @@ class InvoiceRepository extends BaseRepository {
|
|||
{
|
||||
//need invoice $data
|
||||
$number = Invoice::getInvoiceNumber();
|
||||
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $this->model->created_at->format("d.m.Y");
|
||||
if($payt = $this->model->getLastShoppingPaymentTransaction()){
|
||||
$invoice_date = $payt->created_at->format("d.m.Y");
|
||||
}
|
||||
$this->invoice_date = isset($request['invoice_date']) ? $request['invoice_date'] : $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);
|
||||
|
|
@ -100,6 +104,7 @@ class InvoiceRepository extends BaseRepository {
|
|||
}
|
||||
|
||||
private function makePDF(){
|
||||
|
||||
$data = [
|
||||
'shopping_order' => $this->model,
|
||||
'invoice_date' => $this->invoice_date,
|
||||
|
|
@ -107,6 +112,11 @@ class InvoiceRepository extends BaseRepository {
|
|||
'user_sales_volume' => $this->user_sales_volume,
|
||||
];
|
||||
|
||||
if($this->model->auth_user_id){
|
||||
UserService::checkUserTaxShippingCountry($this->model->auth_user, $this->model->country_id);
|
||||
$data = array_merge($data, UserService::getYardInfo());
|
||||
}
|
||||
|
||||
if(!Storage::disk('public')->exists( $this->dir )){
|
||||
Storage::disk('public')->makeDirectory($this->dir); //creates directory
|
||||
}
|
||||
|
|
@ -144,8 +154,10 @@ class InvoiceRepository extends BaseRepository {
|
|||
*/
|
||||
$status = UserSalesVolume::getStatusByOrder($this->model);
|
||||
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
|
||||
//akuteller tag / Monat.
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$date = date('d.m.Y');
|
||||
|
||||
if($status === 3){ //shop bestellung User pending
|
||||
$user_id = $this->model->auth_user_id ? $this->model->auth_user_id : $this->model->member_id;
|
||||
|
|
@ -175,7 +187,7 @@ class InvoiceRepository extends BaseRepository {
|
|||
'shopping_order_id' => $this->model->id,
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'date' => date('d.m.Y'),
|
||||
'date' => $date,
|
||||
'points' => $this->model->points,
|
||||
'month_points' => $month_points,
|
||||
'month_shop_points' => $month_shop_points,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue