added penyelarasan and fix onepercent formula for lejeram
This commit is contained in:
@@ -71,37 +71,38 @@ class OnePercentService
|
||||
$keuntungan = TransaksiKeuntungan::on('mysql7')
|
||||
->whereIn('norujukan',$norujukan)
|
||||
->sum('onepercent_rebet');
|
||||
|
||||
}else{
|
||||
$akrual = Gadai::on($this->cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['t_gadai','<=',$start],['sttebus','=',''],['tagbaru',1]])
|
||||
->orWhere([['tagbaru',1],['tagpalsu','=',0],['t_update','>',$start],['sttebus','!=',''],['t_gadai','<=',$start]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC')
|
||||
->get();
|
||||
// $akrual = Gadai::on($this->cawangan['mysql'])
|
||||
// ->where([['tagpalsu','=',0],['t_gadai','<=',$start],['sttebus','=',''],['tagbaru',1]])
|
||||
// ->orWhere([['tagbaru',1],['tagpalsu','=',0],['t_update','>',$start],['sttebus','!=',''],['t_gadai','<=',$start]])
|
||||
// ->orderBy('t_gadai', 'ASC')
|
||||
// ->orderBy('sirig', 'ASC')
|
||||
// ->get();
|
||||
|
||||
|
||||
$keuntungan = $this->calculateTotalProfit($akrual,$start);
|
||||
$keuntungan = $keuntungan['onepercent'];
|
||||
// $keuntungan = $this->calculateTotalProfit($akrual,$start);
|
||||
// $keuntungan = $keuntungan['onepercent'];
|
||||
|
||||
$formData = [
|
||||
'kodcaw' => $this->cawangan['kodcaw'],
|
||||
'tarikh' => $start,
|
||||
];
|
||||
|
||||
$request = new Request($formData);
|
||||
|
||||
$akru = $this->calculateAccruedIncome($request);
|
||||
|
||||
$keuntungan = $akru['accrual_income_onepercent'];
|
||||
}
|
||||
return $keuntungan;
|
||||
|
||||
}else if($type == 'L'){
|
||||
$akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1],['t_update','>=',$start],['t_update','<=',$end]])->sum('tunggakanonepercent');
|
||||
|
||||
$norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->where('t_update','>=',$start)->where('t_update','<=',$end)->pluck('norujukan');
|
||||
|
||||
|
||||
//Keuntungan Pada Bukan Bulan Yang Sama
|
||||
$keuntungan = TransaksiKeuntungan::on('mysql7')
|
||||
->whereIn('norujukan',$norujukan)
|
||||
->whereDate('tarikh_bayaran','>=',$start)
|
||||
->whereDate('tarikh_bayaran','<=',$end)
|
||||
->sum('onepercent_rebet');
|
||||
/* Keuntungan Semasa */
|
||||
$keuntungan_semasa = $this->CurrentProfit($start,$end,$this->cawangan['kodcaw']);
|
||||
$totalkeuntungan=$keuntungan_semasa['onepercent'];
|
||||
}
|
||||
|
||||
$totalkeuntungan = $keuntungan + $akrual;
|
||||
|
||||
return $totalkeuntungan;
|
||||
}
|
||||
|
||||
@@ -125,31 +126,35 @@ class OnePercentService
|
||||
->whereIn('norujukan',$norujukan)
|
||||
->sum('ujrah_rebet');
|
||||
}else{
|
||||
$akrual = Gadai::on($this->cawangan['mysql'])
|
||||
->where([['tagpalsu','=',0],['t_gadai','<=',$start],['sttebus','=',''],['tagbaru',1]])
|
||||
->orWhere([['tagbaru',1],['tagpalsu','=',0],['t_update','>',$start],['sttebus','!=',''],['t_gadai','<=',$start]])
|
||||
->orderBy('t_gadai', 'ASC')
|
||||
->orderBy('sirig', 'ASC')
|
||||
->get();
|
||||
// $akrual = Gadai::on($this->cawangan['mysql'])
|
||||
// ->where([['tagpalsu','=',0],['t_gadai','<=',$start],['sttebus','=',''],['tagbaru',1]])
|
||||
// ->orWhere([['tagbaru',1],['tagpalsu','=',0],['t_update','>',$start],['sttebus','!=',''],['t_gadai','<=',$start]])
|
||||
// ->orderBy('t_gadai', 'ASC')
|
||||
// ->orderBy('sirig', 'ASC')
|
||||
// ->get();
|
||||
|
||||
$keuntungan = $this->calculateTotalProfit($akrual,$start);
|
||||
$keuntungan = $keuntungan['ujrah'];
|
||||
// $keuntungan = $this->calculateTotalProfit($akrual,$start);
|
||||
// $keuntungan = $keuntungan['ujrah'];
|
||||
|
||||
$formData = [
|
||||
'kodcaw' => $this->cawangan['kodcaw'],
|
||||
'tarikh' => $start,
|
||||
];
|
||||
|
||||
$request = new Request($formData);
|
||||
|
||||
$akru = $this->calculateAccruedIncome($request);
|
||||
|
||||
$keuntungan = $akru['accrual_income_ujrah'];
|
||||
}
|
||||
return $keuntungan;
|
||||
|
||||
}else if($type == 'L'){
|
||||
$akrual = Gadai::on($this->cawangan['mysql'])->where([['sttebus',''],['tagbaru',1],['t_update','>=',$start],['t_update','<=',$end]])->sum('tunggakanujrah');
|
||||
|
||||
$norujukan = Gadai::on($this->cawangan['mysql'])->where('sttebus','T')->where('tagbaru',1)->pluck('norujukan');
|
||||
|
||||
$ujrah = TransaksiKeuntungan::on('mysql7')
|
||||
->whereIn('norujukan',$norujukan)
|
||||
->whereDate('tarikh_bayaran','>=',$start)
|
||||
->whereDate('tarikh_bayaran','<=',$end)
|
||||
->sum('ujrah_rebet');;
|
||||
/* Keuntungan Semasa */
|
||||
$keuntungan_semasa = $this->CurrentProfit($start,$end,$this->cawangan['kodcaw']);
|
||||
$totalujrah = $keuntungan_semasa['ujrah'];
|
||||
}
|
||||
|
||||
$totalujrah = $ujrah + $akrual;
|
||||
return $totalujrah;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user