diff --git a/app/Console/Commands/ExportMigrations.php b/app/Console/Commands/ExportMigrations.php index 382e91ea40..bc9f4c2236 100644 --- a/app/Console/Commands/ExportMigrations.php +++ b/app/Console/Commands/ExportMigrations.php @@ -52,7 +52,7 @@ class ExportMigrations extends Command if($this->option('random')){ - User::all()->random(50)->each(function ($user){ + User::all()->random(200)->each(function ($user){ $this->export($user); }); diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 171fad522a..78cf9a69ec 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -321,6 +321,7 @@ trait GenerateMigrationResources $export_credits = Invoice::where('account_id', $this->account->id) ->where('amount', '<', '0') ->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD) + ->where('is_public', true) ->withTrashed() ->get(); @@ -333,7 +334,7 @@ trait GenerateMigrationResources 'status_id' => $credit->invoice_status_id, 'design_id' => $this->getDesignId($credit->invoice_design_id), 'number' => $credit->invoice_number, - 'discount' => $credit->discount ?: 0, + 'discount' => $credit->discount ? $credit->discount*-1: 0, 'is_amount_discount' => $credit->is_amount_discount ?: false, 'po_number' => $credit->po_number ?: '', 'date' => $credit->invoice_date, @@ -758,11 +759,13 @@ trait GenerateMigrationResources foreach ($items as $item) { - if($item->cost < 0) - $item->cost = $item->cost * -1; + // if($item->cost < 0) + // $item->cost = $item->cost * -1; - if($item->qty < 0) - $item->qty = $item->qty * -1; + $item->qty = $item->qty * -1; + + // if($item->discount < 0) + // $item->discount = $item->discount * -1; $transformed[] = [ 'id' => $item->id,