EXCHANGE-149, EXCHANGE-156 - Bug fixes, clean-up. Updated seeder to create sample transactions

This commit is contained in:
Fairuz
2021-05-17 19:20:47 +08:00
parent 8e5e0fee24
commit c47d6ebd64
2 changed files with 19 additions and 12 deletions
+18 -11
View File
@@ -130,12 +130,13 @@ class FakeBookingTransactions extends Seeder
$bank_ids[$added->id][] = $added_bank->id;
}
//Model employee have issue: Unknown column 'updated_at' in 'field list'
DB::table('employees')->updateOrInsert(
['company_id' => $added->id, 'user_id' => $user_id, 'status' => 2],
['company_id' => $added->id, 'user_id' => $user_id, 'status' => 2]
);
DB::table('documents')->updateOrInsert(
Models\Document::updateOrCreate(
['owner_id' => $added->id, 'status' => 2],
[
'owner_type' => 'App\Models\Company',
@@ -145,6 +146,11 @@ class FakeBookingTransactions extends Seeder
'reference' => $company['reference'],
]
);
Models\SegmentCompany::updateOrCreate(
['company_id' => $added->id, 'segment_id' => 1],
['company_id' => $added->id, 'segment_id' => 1]
);
}
@@ -195,25 +201,25 @@ class FakeBookingTransactions extends Seeder
'transaction_id' => null, //fill-up later
'product_code' => 'MBP15',
'product_name' => 'Macbook Pro 15"',
'quantity' => 3,
'quantity' => 2,
'price' => 1000,
'amount' => 3000,
'amount' => 2000,
],
[
'transaction_id' => null, //fill-up later
'product_code' => 'IP12',
'product_name' => 'iPad Pro 12"',
'quantity' => 3,
'quantity' => 2,
'price' => 1000,
'amount' => 3000,
'amount' => 2000,
],
[
'transaction_id' => null, //fill-up later
'product_code' => 'IMC24',
'product_name' => 'iMac',
'quantity' => 3,
'quantity' => 2,
'price' => 1000,
'amount' => 3000,
'amount' => 2000,
],
];
@@ -240,7 +246,8 @@ class FakeBookingTransactions extends Seeder
$booking['company_id'] = $company_id;
$booking['bank_id'] = $bank_ids[$company_id][0];
$booking['marking'] = $marking;
$booking['fix_amount'] = 1000;
$fix_amount = [4000,8000];
$booking['fix_amount'] = $fix_amount[array_rand($fix_amount)];;
$booking['created_at'] = date('Y-m-d H:i:s');
$booking['updated_at'] = date('Y-m-d H:i:s');
@@ -251,15 +258,15 @@ class FakeBookingTransactions extends Seeder
foreach ($transactions as $transaction) {
$bill_no = $code = mt_rand(100000001, 999999999);;
$bill_no = $code = mt_rand(100000001, 999999999);
$transaction['booking_id'] = $booking_id;
$transaction['type'] = $transaction_type;
$transaction['issuer'] = $company_id;
$transaction['bill_no'] = $bill_no;
$transaction['amount'] = 3000;
$transaction['original_amount'] = 3000;
$transaction['amount'] = 6000;
$transaction['original_amount'] = 6000;
$transaction['created_at'] = date('Y-m-d H:i:s');
$transaction['updated_at'] = date('Y-m-d H:i:s');
@@ -127,7 +127,7 @@
</div>
<div class="col-12 text-left m-t-10 m-b-10">
<div class="font-heading fs-12">
<span class="bold" :class="getAmountClass()">{{totalPurchaseAmount}}</span><span class="bold text-success">&nbsp;/&nbsp;{{totalAmount}}</span>
<span class="bold text-success">{{totalPurchaseAmount}}</span>
</div>
</div>
</div>