Fix payment migration

This commit is contained in:
Amir
2022-11-04 22:16:46 +08:00
parent 5501cf1338
commit 3d614dd677
6 changed files with 66 additions and 49 deletions
+1
View File
@@ -414,6 +414,7 @@ class ApiController extends Controller
$payment->user_id = $request->user_id;
$payment->lelong_id = $request->lelong_id;
$payment->kodcaw = $index['kodcaw'];
$payment->lelongbid_id = $index['lelongbid_id'];
$payment->norujukan = $index['norujukan'];
$payment->total_payment = $index['total_payment'];
$payment->status_payment_opt = 2; //bayar secara online 2
@@ -583,6 +583,7 @@ class LelongMobileController extends Controller
->where('lelongbid.kodcaw', $kodcaw->kodcaw)
->select(
'lelongbidder.id AS id',
'lelongbid.id AS lelongbid_id',
'lelongbid.norujukan AS norujukan',
'lelongbid.kodcaw AS kodcaw',
'lelongbidder.hargabida AS total_payment',
+2 -2
View File
@@ -943,9 +943,9 @@ class SimulasiController extends Controller
public function show($id)
{
$simulasi_id = $id;
$simulasi = Simulasi::with(['cawangan', 'simulasiBid.simulasiBidMarhun'])->where('id', '=', $id)->first();
$simulasi = Simulasi::with(['cawangan', 'simulasiBid.simulasiBidMarhun', 'simkarat'])->find($id);
$data = $simulasi;
$simkarat = SimKarat::where('simulasi_id', '=', $id)->get();
$simkarat = $simulasi->simkarat;
$jeniskarat = JenisKarat::all();
$cawanganAll = $simulasi->cawangan;
+1 -1
View File
@@ -23,7 +23,7 @@ class Lelong extends Model
public function cawangan()
{
return $this->belongsToMany(Cawangan::class, 'cawangan_lelong', 'lelong_id', 'caw_id');
return $this->belongsToMany(Cawangan::class, 'cawangan_lelong', 'lelong_id', 'caw_id')->withPivot('export_data_sts');
}
public function cawanganLelong()
@@ -13,18 +13,69 @@ class CreatePaymentTable extends Migration
*/
public function up()
{
Schema::create('invoice', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('invoice_no')->nullable();
$table->decimal('total_invoice', $precision = 11, $scale = 2);
$table->string('invoice_type'); // 1 = fee , 2 = bid
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
$table->string('opencash')->nullable()->default(0);
$table->timestamp('paid_at')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('resit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('reference_no')->nullable();
$table->unsignedBigInteger('invoice_id')->unsigned();
$table->string('invoice_no')->nullable();
$table->string('billplz_id');
$table->decimal('total_payment', $precision = 11, $scale = 2);
$table->string('resit_type'); // 1 = fee , 2 = bid
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
$table->timestamp('paid_at')->nullable();
$table->timestamps();
$table->foreign('invoice_id')
->references('id')->on('invoice')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('payment', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->unsignedBigInteger('resit_id')->unsigned();
$table->string('kodcaw')->nullable();
$table->integer('invoice_id')->nullable();
$table->string('norujukan')->nullable();
$table->string('back_acc_pembeli')->nullable();
$table->string('bank_acc_no_pembeli')->nullable();
$table->string('nama_bank_acc_caw')->nullable();
$table->string('bank_no_acc_caw')->nullable();
$table->integer('status_payment_opt')->nullable(); //1=kaunter,2=online,3=CDM
$table->integer('resit_id');
$table->integer('status'); //1 = fee RM10 , 2 = paybidifwin
$table->string('remark');
$table->integer('1sen')->nullable();
@@ -45,6 +96,10 @@ class CreatePaymentTable extends Migration
$table->integer('diminta_oleh')->nullable();
$table->timestamps();
$table->foreign('resit_id')
->references('id')->on('resit')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
@@ -52,6 +107,10 @@ class CreatePaymentTable extends Migration
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
Schema::create('paydenokaunter', function (Blueprint $table) {
@@ -90,50 +149,6 @@ class CreatePaymentTable extends Migration
->onDelete('cascade');
});
Schema::create('resit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('reference_no')->nullable();
$table->integer('invoice_id')->nullable();
$table->string('invoice_no')->nullable();
$table->string('billplz_id');
$table->decimal('total_payment', $precision = 11, $scale = 2);
$table->string('resit_type'); // 1 = fee , 2 = bid
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
$table->timestamp('paid_at')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('invoice', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->unsigned();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('invoice_no')->nullable();
$table->decimal('total_invoice', $precision = 11, $scale = 2);
$table->string('invoice_type'); // 1 = fee , 2 = bid
$table->string('status')->nullable(); //status => 1 = paid , 2 = pending
$table->string('opencash')->nullable()->default(0);
$table->timestamp('paid_at')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
}
/**
@@ -73,7 +73,6 @@
<button class="btn btn-info btn-sm" disabled>JANA PEMENANG</button>
@elseif($data['laporan']['sts_lelong'] == 3)
<button class="btn btn-success btn-sm" disabled>LELONG SELESAI</button>
<a href="{{ route('lelong.exportDataByCawangan', $data['laporan']['lelong_id']) }}" class="btn btn-primary btn-sm">EXPORT <i class="fas fa-file-export"></i></a>
@endif
@endhasrole
@@ -97,6 +96,7 @@
{{-- <button class="btn btn-success btn-sm" disabled>LELONG SELESAI</button> --}}
<a href="{{ route('lelong.showsimulasi',$data['laporan']['lelong_id']) }}" data-toggle="tooltip" data-placement="top" title="Lihat Simulasi" style="margin-right:40px" ><i class="far fa-edit"></i></a>
<a href="{{ route('lelong.showlelongdone',$data['laporan']['lelong_id']) }}" data-toggle="tooltip" data-placement="top" title="Lihat Senarai Lelong Selesai" style="margin-right:40px" ><i class="far fa-calendar"></i></a>
<a href="{{ route('lelong.exportDataByCawangan', $data['laporan']['lelong_id']) }}" class="btn btn-primary btn-sm">Export <i class="fas fa-file-export"></i></a>
@endif
@endhasrole
</td>