new calculation upah

This commit is contained in:
afiq
2021-02-25 05:23:18 +08:00
parent 4a6fb03882
commit 6ab2203fea
6 changed files with 80 additions and 69 deletions
+40 -39
View File
@@ -1,89 +1,90 @@
APP_NAME=Lumen
APP_ENV=production
APP_ENV=local
APP_KEY=WbPGkYNmXZ6ZQplGlvl0iZ7zyW1b09xa
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://api_arrahn.test
APP_TIMEZONE=Asia/Kuala_Lumpur
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
DB_CONNECTION=mysql
DB_HOST=192.168.0.102
DB_PORT=3307
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=arrahn
DB_USERNAME=root
DB_PASSWORD=G0dz!ll42020
DB_PASSWORD=root
DB_CONNECTION_2=mysql
DB_HOST_2=192.168.0.102
DB_PORT_2=3307
DB_HOST_2=localhost
DB_PORT_2=3306
DB_DATABASE_2=arrahn_kangar
DB_USERNAME_2=root
DB_PASSWORD_2=G0dz!ll42020
DB_PASSWORD_2=root
DB_CONNECTION_3=mysql
DB_HOST_3=192.168.0.102
DB_PORT_3=3307
DB_HOST_3=localhost
DB_PORT_3=3306
DB_DATABASE_3=arrahn_kuantan
DB_USERNAME_3=root
DB_PASSWORD_3=G0dz!ll42020
DB_PASSWORD_3=root
DB_CONNECTION_4=mysql
DB_HOST_4=192.168.0.102
DB_PORT_4=3307
DB_HOST_4=localhost
DB_PORT_4=3306
DB_DATABASE_4=arrahn_pmas
DB_USERNAME_4=root
DB_PASSWORD_4=G0dz!ll42020
DB_PASSWORD_4=root
DB_CONNECTION_5=mysql
DB_HOST_5=192.168.0.102
DB_PORT_5=3307
DB_HOST_5=localhost
DB_PORT_5=3306
DB_DATABASE_5=arrahn_putatan
DB_USERNAME_5=root
DB_PASSWORD_5=G0dz!ll42020
DB_PASSWORD_5=root
DB_CONNECTION_6=mysql
DB_HOST_6=192.168.0.102
DB_PORT_6=3307
DB_HOST_6=localhost
DB_PORT_6=3306
DB_DATABASE_6=arrahn_koklanas
DB_USERNAME_6=root
DB_PASSWORD_6=G0dz!ll42020
DB_PASSWORD_6=root
DB_CONNECTION_7=mysql
DB_HOST_7=192.168.0.102
DB_PORT_7=3307
DB_HOST_7=localhost
DB_PORT_7=3306
DB_DATABASE_7=online_arrahn
DB_USERNAME_7=root
DB_PASSWORD_7=G0dz!ll42020
DB_PASSWORD_7=root
DB_CONNECTION_8=mysql
DB_HOST_8=192.168.0.102
DB_PORT_8=3307
DB_HOST_8=localhost
DB_PORT_8=3306
DB_DATABASE_8=arrahn_kb1
DB_USERNAME_8=root
DB_PASSWORD_8=G0dz!ll42020
DB_PASSWORD_8=root
DB_CONNECTION_9=mysql
DB_HOST_9=192.168.0.102
DB_PORT_9=3307
DB_HOST_9=localhost
DB_PORT_9=3306
DB_DATABASE_9=arrahn_kb2
DB_USERNAME_9=root
DB_PASSWORD_9=G0dz!ll42020
DB_CONNECTION_9=mysql
DB_HOST_9=192.168.0.102
DB_PORT_9=3307
DB_DATABASE_9=arrahn_kb2
DB_USERNAME_9=root
DB_PASSWORD_9=G0dz!ll42020
DB_PASSWORD_9=root
DB_CONNECTION_10=mysql
DB_HOST_10=192.168.0.102
DB_PORT_10=3307
DB_HOST_10=localhost
DB_PORT_10=3306
DB_DATABASE_10=arrahn_sandakan
DB_USERNAME_10=root
DB_PASSWORD_10=G0dz!ll42020
DB_PASSWORD_10=root
DB_CONNECTION_11=mysql
DB_HOST_11=localhost
DB_PORT_11=3306
DB_DATABASE_11=arrahn_pputeh
DB_USERNAME_11=root
DB_PASSWORD_11=root
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
+2 -1
View File
@@ -70,7 +70,8 @@ class Gadai extends Model
'bakihargajualan',
'hargajualan',
'upah12',
'tagkomuditi'
'tagkomuditi',
'tempohbayar',
];
/**
+13 -14
View File
@@ -265,27 +265,24 @@ class GadaiController extends Controller
->first();
if($gadai_data['tempoh'] > 6){
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = round($upahsemasa_raw,2);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}else{
if($gadai_data['tempoh'] == 6){
if($gadai_data['bakiupah'] != 0){
$upah_semasa = $gadai_data['bakiupah'];
}else{
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = round($upahsemasa_raw,2);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}
}else{
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = round($upahsemasa_raw,2);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}
}
@@ -346,7 +343,8 @@ class GadaiController extends Controller
'bakiupah' => $baki_upah,
'jbg' => 0,
't_update' => $current->toDateString(),
'bakihargajualan' => $baki_hargajualan
'bakihargajualan' => $baki_hargajualan,
'tempohbayar' => $gadai['tempoh']
));
return response()->json($update_gadai, 200);
}
@@ -404,7 +402,8 @@ class GadaiController extends Controller
'bakiupah' => $baki_upah,
'jbg' => 0,
't_update' => $current->toDateString(),
'bakihargajualan' => $baki_hargajualan
'bakihargajualan' => $baki_hargajualan,
'tempohbayar' => $gadai['tempoh']
));
return response()->json($update_gadai, 200);
}
+16 -5
View File
@@ -6,6 +6,7 @@ use App\Komuditi;
use App\KomuditiPurchase;
use App\KomuditiTransaksi;
use App\KomuditiProduk;
use App\Cawangan;
use DB;
use Illuminate\Http\Request;
@@ -77,7 +78,7 @@ class KomuditiController extends Controller
'harga'=> $komuditi_asal['nilai']
]);
return response()->json($komuditi_purchase);
return response()->json('berjaya');
}
public function rekodKomuditi(){
@@ -179,8 +180,8 @@ class KomuditiController extends Controller
return response()->json($komuditi_transaksi);
}
public function jumlahKomoditiDashboard()
{
public function jumlahKomoditiDashboard(){
$current = Carbon::now();
$current = new Carbon();
$komoditi = [];
@@ -195,8 +196,7 @@ class KomuditiController extends Controller
}
public function statistikKomoditiDashboard(Request $request)
{
public function statistikKomoditiDashboard(Request $request){
$current = Carbon::now();
$current = new Carbon();
$weekly = Carbon::now();
@@ -286,4 +286,15 @@ class KomuditiController extends Controller
return response()->json($array_totalup);
}
public function rekodTransaksiKomoditi(Request $request){
$rekod = KomuditiTransaksi::on('mysql7')->selectRaw('SUM(unit_komuditi) as totalkomoditi')->addSelect('kodcaw')->where('tarikh','=',$request->tarikh)->groupBy('kodcaw')->get();
$rekodkomoditi = [];
foreach($rekod as $index=>$rekodtransaksi){
$cawangan =Cawangan::on('mysql7')->select('details_caw')->where('kodcaw','=',$rekodtransaksi['kodcaw'])->first();
array_push($rekodkomoditi,['totalkomoditi'=>$rekodtransaksi['totalkomoditi'],'cawangan'=>$cawangan['details_caw']]);
}
return response()->json($rekodkomoditi);
}
}
+8 -10
View File
@@ -67,8 +67,8 @@ class TebusController extends Controller
->first();
if($gadai_data['tempoh'] > 6){
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}else{
@@ -76,17 +76,15 @@ class TebusController extends Controller
if($gadai_data['bakiupah'] != 0){
$upah_semasa = $gadai_data['bakiupah'];
}else{
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = round($upahsemasa_raw,2);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}
}else{
$upahsemasa_raw = $gadai_data['jbg'] * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = round($upahsemasa_raw,2);
$tempoh_sebenar = $gadai_data['tempoh'] - $gadai_data['tempohbayar'];
$upahsemasa_raw = $tempoh_sebenar * (($gadai_data['kadarupah']/100 )* $gadai_data['bakipjm']);
$upah_semasa_round = number_format($upahsemasa_raw,2);
$upah_semasa = (float)substr($upah_semasa_round, 0, -1);
}
}
+1
View File
@@ -273,6 +273,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
$router->get('komuditi/description',['uses'=>'KomuditiController@getKomuditiProductDescription']);
$router->get('komuditi/rekodharian',['uses'=>'KomuditiController@rekodTransaksiHarian']);
$router->get('komuditi/rekodkomuditi',['uses'=>'KomuditiController@rekodKomuditi']);
$router->get('komoditi/rekod/transaksi',['uses'=>'KomuditiController@rekodTransaksiKomoditi']);
});
$router->group(['prefix'=>'e-arrahn'], function () use ($router){