add module konfirmasibank
This commit is contained in:
0
Entities/.gitkeep
Normal file
0
Entities/.gitkeep
Normal file
35
Entities/Account.php
Normal file
35
Entities/Account.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\KonfirmasiBank\Entities;
|
||||
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Account extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'db2';
|
||||
protected $table = 'STG_DB.ACCOUNT';
|
||||
protected $primaryKey = '@ID';
|
||||
|
||||
//public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
"'CUSTOMER_NO',
|
||||
'MNEMONIC'
|
||||
'CATEGORY'"
|
||||
];
|
||||
|
||||
|
||||
public function customers(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class, 'CUSTOMER_NO');
|
||||
}
|
||||
|
||||
|
||||
}
|
65
Entities/Customer.php
Normal file
65
Entities/Customer.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Konfirmasibank\Entities;
|
||||
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// protected $table = 'customer';
|
||||
// protected $primaryKey = 'ID';
|
||||
protected $connection = 'db2';
|
||||
protected $table = 'STG_DB.CUSTOMER';
|
||||
protected $primaryKey = '@ID';
|
||||
|
||||
//public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
"'CUSTOMER_NO',
|
||||
'MNEMONIC'
|
||||
'NAME_1'"
|
||||
];
|
||||
|
||||
public function getAccount(){
|
||||
// $store = DB::connection('oracle');
|
||||
$data = DB::connection("oracle")->table("T24DWH.V_CUSTOMER")->limit(20)->get()->map(function($item) {return (array) $item;});
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getCustomer(){
|
||||
$data = [];
|
||||
$data = DB::connection("oracle")->table("T24DWH.V_CUSTOMER")->select('CUSTOMER_CODE')->limit(50);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function exportPdf($cus_no,$account,$kodecabang,$periode){
|
||||
$data = [];
|
||||
$data = DB::table('view_customers')
|
||||
->where('CUSTOMER_NO',$cus_no)
|
||||
->whereIn('ACCOUNT_NUMBER', $account)
|
||||
->where('SECTOR',$kodecabang)
|
||||
->where('LEGAL_ISS_DATE','LIKE','%'.$periode.'%')
|
||||
->get();
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function accounts(): HasMany
|
||||
{
|
||||
return $this->hasMany(Account::class, 'CUSTOMER_CODE');
|
||||
}
|
||||
|
||||
|
||||
}
|
105
Entities/ViewAccount.php
Normal file
105
Entities/ViewAccount.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Konfirmasibank\Entities;
|
||||
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class ViewAccount extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'db2';
|
||||
protected $table = 'STG_DB.VW_ACCOUNTS';
|
||||
protected $primaryKey = 'CUSTOMER_NO';
|
||||
|
||||
//public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
"' ACCOUNT_NUMBER',
|
||||
'CUSTOMER_NO',
|
||||
'WORKING_BALANCE',
|
||||
'BATCH_DATE',
|
||||
'CO_CODE',
|
||||
'ACCOUNT_TITLE_1',
|
||||
'PRODUCT',
|
||||
'ARR_STATUS',
|
||||
'PRODUCT_LINE',
|
||||
'CURRENCY',
|
||||
'MATURITY_DATE'"
|
||||
];
|
||||
|
||||
public function getAccount($cus_no,$account,$kodecabang,$periode){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_ACCOUNTS")->select('*')->where('CUSTOMER_NO',$cus_no)->whereIn('ACCOUNT_NUMBER',$account)->get();
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getPinjaman($cus_no){
|
||||
$data = [];
|
||||
$data = DB::connection("db2")->table("STG_DB.VW_AA_ARRANGEMENT")->select('CUSTOMER','STREET','ADDRESS','SHORT_NAME','CO_CODE','PRODUCT_LINE','PRODUCT','CURRENCY','COMPANY_NAME',DB::raw('MAX(CATEGORY) AS CATEGORY'),DB::raw('MAX(BATCH_DATE) AS BATCH_DATE'),DB::raw('MAX(WORKING_BALANCE) AS WORKING_BALANCE'),DB::raw('MAX(OPENING_DATE) AS OPENING_DATE'),DB::raw('MAX(MATURITY_DATE) AS MATURITY_DATE'),DB::raw('MAX(MATURITY_DATE) AS MATURITY_DATE'), DB::raw('MAX(ARRANGEMENT_ID) AS ARRANGEMENT_ID'))->where('CUSTOMER',$cus_no)->groupBy('CUSTOMER','STREET','ADDRESS','SHORT_NAME','CO_CODE','PRODUCT_LINE','PRODUCT','CURRENCY','COMPANY_NAME')->get();
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
public function getFasilitas($cus_no){
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.LIMIT")->select('*')->where('@ID', 'like', "%" .$cus_no. "%")->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getTerm($arr_id){
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.AA_ARR_TERM_AMOUNT")->select(DB::raw('MAX(ID) AS ID'),DB::raw('MAX(TERM) AS TERM'))->where('ID', 'like', "%" .$arr_id."%")->orderBy('ID','DESC')->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getInterest($arr_id){
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.AA_ARR_INTEREST")->select(DB::raw('MAX(ID) AS ID'),DB::raw('MAX(FIXED_RATE) AS FIXED_RATE'))->where('ID', 'like', "%".$arr_id."%")->orderBy('ID','DESC')->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getCategory($category_id){
|
||||
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.CATEGORY")->select('ID','SHORT_NAME')->where('ID',$category_id)->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getAA($aa_id){
|
||||
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.AA_ARRANGEMENENT")->select('ID')->where('ID', 'like',"%".$aa_id."%")->orderBy('ID','DESC')->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getLimit($cus_id,$periode){
|
||||
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.LIMIT AS LM")
|
||||
->join('STG_DB.LIMIT_REFERENCE AS LR', 'LM.LIMIT_PRODUCT', '=', 'LR.ID')
|
||||
->join('STG_DB.COMPANY AS CP', 'LM.CO_CODE', '=', 'CP.ID')
|
||||
->join('STG_DB.CATEGORY AS CT', 'LM.LIMIT_PRODUCT', '=', 'CT.ID')
|
||||
->select('LM.LIMIT_CURRENCY','LM.APPROVAL_DATE','LM.EXPIRY_DATE','LM.AVAIL_AMT','LM.BATCH_DATE','LM.EXPIRY_DATE','LR.SHORT_NAME','LR.LIMIT_PERCENTAGE','CP.COMPANY_NAME','CT.SHORT_NAME AS ACCOUNT_TYPE')
|
||||
->where('LM.@ID', 'like',"%".$cus_id."%")
|
||||
->where('LM.BATCH_DATE', 'like',"%".$periode."%")
|
||||
->orderBy('LM.@ID','DESC')->get();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getLimitProduct($limit_product_id){
|
||||
|
||||
$data = [];
|
||||
$data =DB::connection("db2")->table("STG_DB.LIMIT_REFERENCE")->select('ID','SHORT_NAME','LIMIT_PERCENTAGE')->where('ID',$limit_product_id)->first();
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
34
Entities/ViewCustomer.php
Normal file
34
Entities/ViewCustomer.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Konfirmasibank\Entities;
|
||||
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
|
||||
class ViewCustomer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $connection = 'oracle';
|
||||
protected $table = 'T24DWH.V_CUSTOMER';
|
||||
protected $primaryKey = 'CUSTOMER_CODE';
|
||||
|
||||
//public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
"'CUSTOMER_CODE',
|
||||
'CUSTOMER_NAME',
|
||||
'CUSTOMER_TYPE'"
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user