|
|
@@ -167,6 +167,13 @@ $controller = new class($document_type, $document_number) {
|
|
|
$document->user_id = $this->user->id;
|
|
|
$document->supplier_id = $supplier->id ?? null;
|
|
|
$document->location_id = $location->id ?? null;
|
|
|
+
|
|
|
+ if($location) {
|
|
|
+ $address = $location->getAddress();
|
|
|
+ $document->billing_address = (string) $address;
|
|
|
+ $document->delivery_address = (string) $address;
|
|
|
+ }
|
|
|
+
|
|
|
$document->type = $type;
|
|
|
$document->number = Document::getNextNumber($type);
|
|
|
$document->date = date("Y-m-d");
|