123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 |
- <?php
-
- namespace App\Http\Controllers\Api\Export;
-
- use Illuminate\Http\Request;
- use App\Http\Controllers\Api\BaseController;
- use Carbon\Carbon;
-
- use App\Model\Module\Compound;
- use App\Model\Module\Faulty;
- use App\Model\Module\ReportFaulty;
- use App\Model\Staff;
- use App\Model\StaffDetail;
- use App\Model\Module\Department;
-
- class CalculationReportFaulty extends BaseController
- {
- private function jumlah_kesalahan_bulanan($start_date, $end_date, $month, $jabatan, $faulty_id){
-
- $dateS = Carbon::createFromFormat('Y-m-d', $start_date);
- $start = $dateS->copy()->startOfDay();
- $dateE = Carbon::createFromFormat('Y-m-d', $end_date);
- $end = $dateE->copy()->endOfDay();
-
- $jumlah_kompaun = 0; $amaun_kompaun = 0;
- $jumlah_byr = 0; $amaun_byr = 0;
- $jum_kompaun_belum_byr = 0; $amaun_tunggakan = 0;
- $kompaun_batal = 0; $amaun_batal = 0;
- $kompaun_kurang = 0; $amaun_kurang = 0;
-
- $compound = Compound::whereBetween('created_at', array($start, $end))->where('jbkod', $jabatan)->where('seksyen_kesalahan', $faulty_id)->get();
-
- foreach ($compound as $key => $c) {
- if(date('m', strtotime($c->created_at)) == $month){
-
- $jumlah_kompaun = $jumlah_kompaun + 1;
- $amaun_kompaun = $amaun_kompaun + floatval($c->jumlah_asal_kompaun);
- $amaun_tunggakan = $amaun_tunggakan + floatval($c->amount_tunggakan);
-
- if($c->status == 'Berbayar'){
- $jumlah_byr = $jumlah_byr + 1;
- $amaun_byr = $amaun_byr + floatval($c->amount_payment);
- }
-
- if($c->status == 'Belum Bayar'){
- $jum_kompaun_belum_byr = $jum_kompaun_belum_byr + 1;
- }
-
- if($c->status == 'Batal'){
- $kompaun_batal = $kompaun_batal + 1;
- $amaun_batal = $amaun_batal + floatval($c->jumlah_asal_kompaun);
- }
-
- if($c->jumlah_kemaskini_kompaun != ''){
- $kompaun_kurang = $kompaun_kurang + 1;
- $amaun_kurang = $amaun_kurang + floatval($c->jumlah_kemaskini_kompaun);
- }
- }
- }
-
- $result = array(
- 'jum_kompaun_keluar' => $jumlah_kompaun,
- 'amaun_kompaun' => $amaun_kompaun,
- 'jumlah_byr' => $jumlah_byr,
- 'amaun_byr' => $amaun_byr,
- 'jum_kompaun_belum_byr' => $jum_kompaun_belum_byr,
- 'amaun_tunggakan' => $amaun_tunggakan,
- 'kompaun_batal' => $kompaun_batal,
- 'amaun_batal' => $amaun_batal,
- 'kompaun_kurang' => $kompaun_kurang,
- 'amaun_kurang' => $amaun_kurang,
- );
- return json_encode($result);
- }
-
- public function masukkan_report($start_date, $end_date, $jabatan, $month){
-
- $dateS = Carbon::createFromFormat('Y-m-d', $start_date);
- $start = $dateS->copy()->startOfDay();
- $dateE = Carbon::createFromFormat('Y-m-d', $end_date);
- $end = $dateE->copy()->endOfDay();
-
- $compound = Compound::where('jbkod', $jabatan)->whereBetween('created_at', array($start, $end))->groupBy('seksyen_kesalahan')->get(['created_at','jbkod']);
-
-
- if($month == 'All'){
- foreach ($compound as $key => $c) {
- $f = Faulty::find($c->seksyen_kesalahan);
-
- $report = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', date('m',strtotime($c->created_at)))->where('faulty_id', $f->_id)->where('jbkod', $jabatan)->first();
- if(empty($report)){
- $dataN = new ReportFaulty;
- $dataN->start_date = $start_date;
- $dataN->end_date = $end_date;
- $dataN->month = date('m',strtotime($c->created_at));
- $dataN->jbkod = $jabatan;
- $dataN->jumlah_kompaun_keluar = '';
- $dataN->amaun_kompaun_rm = '';
- $dataN->jumlah_bayar = '';
- $dataN->amaun_bayar_rm = '';
- $dataN->jumlah_kompaun_belum_bayar = '';
- $dataN->amaun_tunggakan_rm = '';
- $dataN->kompaun_batal = '';
- $dataN->amaun_batal_rm = '';
- $dataN->kompaun_kurang = '';
- $dataN->amaun_kurang_rm = '';
- $dataN->faulty_id = $c->seksyen_kesalahan;
- $dataN->sketr = $f->sketr;
- $dataN->save();
- }
-
- $reportTahun = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', 'All')->where('faulty_id', $f->_id)->where('jbkod', $jabatan)->first();
- if(empty($reportTahun)){
- $dataNt = new ReportFaulty;
- $dataNt->start_date = $start_date;
- $dataNt->end_date = $end_date;
- $dataNt->month = 'All';
- $dataNt->jbkod = $jabatan;
- $dataNt->jumlah_kompaun_keluar = '';
- $dataNt->amaun_kompaun_rm = '';
- $dataNt->jumlah_bayar = '';
- $dataNt->amaun_bayar_rm = '';
- $dataNt->jumlah_kompaun_belum_bayar = '';
- $dataNt->amaun_tunggakan_rm = '';
- $dataNt->kompaun_batal = '';
- $dataNt->amaun_batal_rm = '';
- $dataNt->kompaun_kurang = '';
- $dataNt->amaun_kurang_rm = '';
- $dataNt->faulty_id = $c->seksyen_kesalahan;
- $dataNt->sketr = $f->sketr;
- $dataNt->save();
- }
- }
-
- return 'true';
- }
- }
-
- public function report_faulty($start_date, $end_date, $jabatan, $month){
-
- $masukkan_report = $this->masukkan_report($start_date, $end_date, $jabatan, $month);
-
- if($masukkan_report){
-
- $dateS = Carbon::createFromFormat('Y-m-d', $start_date);
- $start = $dateS->copy()->startOfDay();
- $dateE = Carbon::createFromFormat('Y-m-d', $end_date);
- $end = $dateE->copy()->endOfDay();
-
- $compound = Compound::where('jbkod', $jabatan)->whereBetween('created_at', array($start, $end))->groupBy('seksyen_kesalahan')->get(['created_at','jbkod']);
-
-
-
- foreach ($compound as $key => $c) {
- $f = Faulty::find($c->seksyen_kesalahan);
-
- $months = date('m',strtotime($c->created_at));
- $report = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month',$months)->where('faulty_id', $f->_id)->where('jbkod', $jabatan)->first();
-
- if(!empty($report)){
-
- $data_bulan = json_decode($this->jumlah_kesalahan_bulanan($start_date, $end_date, $months, $jabatan, $c->seksyen_kesalahan));
-
- $report->jumlah_kompaun_keluar = $data_bulan->jum_kompaun_keluar;
- $report->amaun_kompaun_rm = $data_bulan->amaun_kompaun;
- $report->jumlah_bayar = $data_bulan->jumlah_byr;
- $report->amaun_bayar_rm = $data_bulan->amaun_byr;
- $report->jumlah_kompaun_belum_bayar = $data_bulan->jum_kompaun_belum_byr;
- $report->amaun_tunggakan_rm = $data_bulan->amaun_tunggakan;
- $report->kompaun_batal = $data_bulan->kompaun_batal;
- $report->amaun_batal_rm = $data_bulan->amaun_batal;
- $report->kompaun_kurang = $data_bulan->kompaun_kurang;
- $report->amaun_kurang_rm = $data_bulan->amaun_kurang;
- $report->save();
- }
- }
-
- return true;
- }
- }
-
- public function report_faulty_all($start_date, $end_date, $jabatan, $month){
-
- $dateS = Carbon::createFromFormat('Y-m-d', $start_date);
- $start = $dateS->copy()->startOfDay();
- $dateE = Carbon::createFromFormat('Y-m-d', $end_date);
- $end = $dateE->copy()->endOfDay();
-
- $compound = Compound::where('jbkod', $jabatan)->whereBetween('created_at', array($start, $end))->groupBy('seksyen_kesalahan')->get(['created_at','jbkod']);
-
- foreach ($compound as $key => $c) {
-
- $report = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', '!=', 'All')->where('faulty_id', $c->seksyen_kesalahan)->where('jbkod', $jabatan)->get();
-
- if(count($report) > 0){
-
- foreach ($report as $key => $r) {
- $jum_kompaun_keluar = 0; $amaun_kompaun = 0; $jumlah_byr = 0; $amaun_byr = 0;
- $jum_kompaun_belum_byr = 0; $amaun_tunggakan = 0; $kompaun_batal = 0; $amaun_batal = 0;
- $kompaun_kurang = 0 ; $amaun_kurang = 0;
-
- if ($r->amaun_kompaun_rm == ""){
- $temp_amount_rm = 0;
- }else {
- $temp_amount_rm = $r->amaun_kompaun_rm;
- }
-
- if ($r->jumlah_kompaun_keluar == ""){
- $temp_kompaun_keluar = 0;
- }else {
- $temp_kompaun_keluar = $r->jumlah_kompaun_keluar;
- }
-
- if ($r->jumlah_bayar == ""){
- $temp_jumlah_bayar = 0;
- }else {
- $temp_jumlah_bayar = $r->jumlah_bayar;
- }
-
- if ($r->amaun_bayar_rm == ""){
- $temp_amaun_bayar = 0;
- }else {
- $temp_amaun_bayar = $r->amaun_bayar_rm;
- }
-
- if ($r->jumlah_kompaun_belum_bayar == ""){
- $temp_kompaun_belum_bayar = 0;
- }else {
- $temp_kompaun_belum_bayar = $r->jumlah_kompaun_belum_bayar;
- }
-
- if ($r->amaun_tunggakan_rm == ""){
- $temp_tunggakan = 0;
- }else {
- $temp_tunggakan = $r->amaun_tunggakan_rm;
- }
-
- if ($r->kompaun_batal == ""){
- $temp_kompaun_batal = 0;
- }else {
- $temp_kompaun_batal = $r->kompaun_batal;
- }
-
- if ($r->amaun_batal_rm == ""){
- $temp_amaun_batal = 0;
- }else {
- $temp_amaun_batal = $r->amaun_batal_rm;
- }
-
-
- if ($r->kompaun_kurang == ""){
- $temp_kompaun_kurang = 0;
- }else {
- $temp_kompaun_kurang = $r->kompaun_kurang;
- }
-
- if ($r->amaun_kurang_rm == ""){
- $temp_amaun_kurang = 0;
- }else {
- $temp_amaun_kurang = $r->amaun_kurang_rm;
- }
-
- $jum_kompaun_keluar = $jum_kompaun_keluar + $temp_kompaun_keluar;
- $amaun_kompaun = $amaun_kompaun + $temp_amount_rm;
- $jumlah_byr = $jumlah_byr + $temp_jumlah_bayar;
- $amaun_byr = $amaun_byr + $temp_amaun_bayar;
- $jum_kompaun_belum_byr = $jum_kompaun_belum_byr + $temp_kompaun_belum_bayar;
- $amaun_tunggakan = $amaun_tunggakan + $temp_tunggakan;
- $kompaun_batal = $kompaun_batal + $temp_kompaun_batal;
- $amaun_batal = $amaun_batal + $temp_amaun_batal;
- $kompaun_kurang = $kompaun_kurang + $temp_kompaun_kurang;
- $amaun_kurang = $amaun_kurang + $temp_amaun_kurang;
- }
- }
-
- $reportTahun = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month','All')->where('faulty_id', $c->seksyen_kesalahan)->where('jbkod', $jabatan)->first();
-
- if(!empty($reportTahun)){
-
- $months = date('m',strtotime($c->created_at));
- $data_bulan = json_decode($this->jumlah_kesalahan_bulanan($start_date, $end_date, $months, $jabatan, $c->seksyen_kesalahan));
-
- $reportTahun->jumlah_kompaun_keluar = $jum_kompaun_keluar;
- $reportTahun->amaun_kompaun_rm = $amaun_kompaun;
- $reportTahun->jumlah_bayar = $jumlah_byr;
- $reportTahun->amaun_bayar_rm = $amaun_byr;
- $reportTahun->jumlah_kompaun_belum_bayar = $jum_kompaun_belum_byr;
- $reportTahun->amaun_tunggakan_rm = $amaun_tunggakan;
- $reportTahun->kompaun_batal = $kompaun_batal;
- $reportTahun->amaun_batal_rm = $amaun_batal;
- $reportTahun->kompaun_kurang = $kompaun_kurang;
- $reportTahun->amaun_kurang_rm = $amaun_kurang;
- $reportTahun->save();
-
- }
- }
-
- return true;
-
- }
-
- private function runCalculation($start_date, $end_date, $jabatan, $month){
-
- $dataFaulty = $this->report_faulty($start_date, $end_date, $jabatan, $month);
- if($dataFaulty){
- $dataFYear = $this->report_faulty_all($start_date, $end_date, $jabatan, $month);
- }
-
- return true;
- }
-
- public function returnReportFaulty(Request $request){
-
- $nested_data = array();
-
- $start_date = $request->start_date;
- $end_date = $request->end_date;
- $month = $request->month;
- $jabatan = $request->jabatan;
-
- if($start_date != '' && $end_date != '' && $jabatan != 'null'){
- $dataFYear = $this->runCalculation($start_date, $end_date, $jabatan, 'All');
- if($dataFYear){
-
- if($month == 'All'){
-
- $data_sketr = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', 'All')->where('jbkod', $jabatan)->groupBy('sketr')->get();
-
- if(count($data_sketr) > 0){
- foreach ($data_sketr as $key => $d) {
-
- $jumlah_kompaun_keluar = 0; $amaun_kompaun_rm = 0;
- $jumlah_bayar = 0; $amaun_bayar_rm = 0;
- $jumlah_kompaun_belum_bayar = 0; $amaun_tunggakan_rm = 0;
- $kompaun_batal = 0; $amaun_batal_rm = 0;
- $kompaun_kurang = 0; $amaun_kurang_rm = 0;
-
- $name = '';
- $ft = Faulty::where('sketr', $d->sketr)->first();
- if(strpos($ft->nama, '(RM500)') !== false){
- $name = str_replace("(RM500)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM100)') !== false){
- $name = str_replace("(RM100)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM50)') !== false){
- $name = str_replace("(RM50)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM250)') !== false){
- $name = str_replace("(RM250)","",$ft->nama);
- }else {
- $name = $ft->nama;
- }
-
- $data_report = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', 'All')->where('jbkod', $jabatan)->where('sketr', $d->sketr)->get();
-
- if(count($data_report) > 0){
- foreach ($data_report as $key => $r) {
-
- if ($r->amaun_kompaun_rm == ""){
- $temp_amount_rm = 0;
- }else {
- $temp_amount_rm = $r->amaun_kompaun_rm;
- }
-
- if ($r->jumlah_kompaun_keluar == ""){
- $temp_kompaun_keluar = 0;
- }else {
- $temp_kompaun_keluar = $r->jumlah_kompaun_keluar;
- }
-
- if ($r->jumlah_bayar == ""){
- $temp_jumlah_bayar = 0;
- }else {
- $temp_jumlah_bayar = $r->jumlah_bayar;
- }
-
- if ($r->amaun_bayar_rm == ""){
- $temp_amaun_bayar = 0;
- }else {
- $temp_amaun_bayar = $r->amaun_bayar_rm;
- }
-
- if ($r->jumlah_kompaun_belum_bayar == ""){
- $temp_kompaun_belum_bayar = 0;
- }else {
- $temp_kompaun_belum_bayar = $r->jumlah_kompaun_belum_bayar;
- }
-
- if ($r->amaun_tunggakan_rm == ""){
- $temp_tunggakan = 0;
- }else {
- $temp_tunggakan = $r->amaun_tunggakan_rm;
- }
-
- if ($r->kompaun_batal == ""){
- $temp_kompaun_batal = 0;
- }else {
- $temp_kompaun_batal = $r->kompaun_batal;
- }
-
- if ($r->amaun_batal_rm == ""){
- $temp_amaun_batal = 0;
- }else {
- $temp_amaun_batal = $r->amaun_batal_rm;
- }
-
-
- if ($r->kompaun_kurang == ""){
- $temp_kompaun_kurang = 0;
- }else {
- $temp_kompaun_kurang = $r->kompaun_kurang;
- }
-
- if ($r->amaun_kurang_rm == ""){
- $temp_amaun_kurang = 0;
- }else {
- $temp_amaun_kurang = $r->amaun_kurang_rm;
- }
-
- $jumlah_kompaun_keluar = $jumlah_kompaun_keluar + $temp_kompaun_keluar;
- $amaun_kompaun_rm = $amaun_kompaun_rm + $temp_amount_rm;
- $jumlah_bayar = $jumlah_bayar + $temp_jumlah_bayar;
- $amaun_bayar_rm = $amaun_bayar_rm + $temp_amaun_bayar;
- $jumlah_kompaun_belum_bayar = $jumlah_kompaun_belum_bayar + $temp_kompaun_belum_bayar;
- $amaun_tunggakan_rm = $amaun_tunggakan_rm + $temp_tunggakan;
- $kompaun_batal = $kompaun_batal + $temp_kompaun_batal;
- $amaun_batal_rm = $amaun_batal_rm + $temp_amaun_batal;
- $kompaun_kurang = $kompaun_kurang + $temp_kompaun_kurang;
- $amaun_kurang_rm = $amaun_kurang_rm + $temp_amaun_kurang;
- }
- }
-
- array_push($nested_data, array(
- 'index' => '',
- 'sketr' => $d->sketr,
- 'name' => $name.' - '.$ft->sketr,
- 'jum_kompaun_keluar' => $jumlah_kompaun_keluar,
- 'amaun_kompaun' => $amaun_kompaun_rm,
- 'jumlah_byr' => $jumlah_bayar,
- 'amaun_byr' => $amaun_bayar_rm,
- 'jum_kompaun_belum_byr' => $jumlah_kompaun_belum_bayar,
- 'amaun_tunggakan' => $amaun_tunggakan_rm,
- 'kompaun_batal' => $kompaun_batal,
- 'amaun_batal' => $amaun_batal_rm,
- 'kompaun_kurang' => $kompaun_kurang,
- 'amaun_kurang' => $amaun_kurang_rm,
- ));
- }
- }
-
- }else {
-
- // Calculate by sketr
- $data_sketr = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', $month)->where('jbkod', $jabatan)->groupBy('sketr')->get();
-
- if(count($data_sketr) > 0){
- foreach ($data_sketr as $key => $d) {
-
- $jumlah_kompaun_keluar = 0; $amaun_kompaun_rm = 0;
- $jumlah_bayar = 0; $amaun_bayar_rm = 0;
- $jumlah_kompaun_belum_bayar = 0; $amaun_tunggakan_rm = 0;
- $kompaun_batal = 0; $amaun_batal_rm = 0;
- $kompaun_kurang = 0; $amaun_kurang_rm = 0;
-
- $name = '';
- $ft = Faulty::where('sketr', $d->sketr)->first();
- if(strpos($ft->nama, '(RM500)') !== false){
- $name = str_replace("(RM500)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM100)') !== false){
- $name = str_replace("(RM100)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM50)') !== false){
- $name = str_replace("(RM50)","",$ft->nama);
- }else if(strpos($ft->nama, '(RM250)') !== false){
- $name = str_replace("(RM250)","",$ft->nama);
- }else {
- $name = $ft->nama;
- }
-
- $data_report = ReportFaulty::where('start_date', $start_date)->where('end_date', $end_date)->where('month', $month)->where('jbkod', $jabatan)->where('sketr', $d->sketr)->get();
-
- if(count($data_report) > 0){
- foreach ($data_report as $key => $r) {
-
- if ($r->amaun_kompaun_rm == ""){
- $temp_amount_rm = 0;
- }else {
- $temp_amount_rm = $r->amaun_kompaun_rm;
- }
-
- if ($r->jumlah_kompaun_keluar == ""){
- $temp_kompaun_keluar = 0;
- }else {
- $temp_kompaun_keluar = $r->jumlah_kompaun_keluar;
- }
-
- if ($r->jumlah_bayar == ""){
- $temp_jumlah_bayar = 0;
- }else {
- $temp_jumlah_bayar = $r->jumlah_bayar;
- }
-
- if ($r->amaun_bayar_rm == ""){
- $temp_amaun_bayar = 0;
- }else {
- $temp_amaun_bayar = $r->amaun_bayar_rm;
- }
-
- if ($r->jumlah_kompaun_belum_bayar == ""){
- $temp_kompaun_belum_bayar = 0;
- }else {
- $temp_kompaun_belum_bayar = $r->jumlah_kompaun_belum_bayar;
- }
-
- if ($r->amaun_tunggakan_rm == ""){
- $temp_tunggakan = 0;
- }else {
- $temp_tunggakan = $r->amaun_tunggakan_rm;
- }
-
- if ($r->kompaun_batal == ""){
- $temp_kompaun_batal = 0;
- }else {
- $temp_kompaun_batal = $r->kompaun_batal;
- }
-
- if ($r->amaun_batal_rm == ""){
- $temp_amaun_batal = 0;
- }else {
- $temp_amaun_batal = $r->amaun_batal_rm;
- }
-
-
- if ($r->kompaun_kurang == ""){
- $temp_kompaun_kurang = 0;
- }else {
- $temp_kompaun_kurang = $r->kompaun_kurang;
- }
-
- if ($r->amaun_kurang_rm == ""){
- $temp_amaun_kurang = 0;
- }else {
- $temp_amaun_kurang = $r->amaun_kurang_rm;
- }
-
- $jumlah_kompaun_keluar = $jumlah_kompaun_keluar + $temp_kompaun_keluar;
- $amaun_kompaun_rm = $amaun_kompaun_rm + $temp_amount_rm;
- $jumlah_bayar = $jumlah_bayar + $temp_jumlah_bayar;
- $amaun_bayar_rm = $amaun_bayar_rm + $temp_amaun_bayar;
- $jumlah_kompaun_belum_bayar = $jumlah_kompaun_belum_bayar + $temp_kompaun_belum_bayar;
- $amaun_tunggakan_rm = $amaun_tunggakan_rm + $temp_tunggakan;
- $kompaun_batal = $kompaun_batal + $temp_kompaun_batal;
- $amaun_batal_rm = $amaun_batal_rm + $temp_amaun_batal;
- $kompaun_kurang = $kompaun_kurang + $temp_kompaun_kurang;
- $amaun_kurang_rm = $amaun_kurang_rm + $temp_amaun_kurang;
-
- }
- }
-
- array_push($nested_data, array(
- 'index' => '',
- 'sketr' => $d->sketr,
- 'name' => $name.' - '.$ft->sketr,
- 'jum_kompaun_keluar' => $jumlah_kompaun_keluar,
- 'amaun_kompaun' => $amaun_kompaun_rm,
- 'jumlah_byr' => $jumlah_bayar,
- 'amaun_byr' => $amaun_bayar_rm,
- 'jum_kompaun_belum_byr' => $jumlah_kompaun_belum_bayar,
- 'amaun_tunggakan' => $amaun_tunggakan_rm,
- 'kompaun_batal' => $kompaun_batal,
- 'amaun_batal' => $amaun_batal_rm,
- 'kompaun_kurang' => $kompaun_kurang,
- 'amaun_kurang' => $amaun_kurang_rm,
- ));
- }
- }
-
- }
- }
-
- }
-
- return \DataTables::of($nested_data)->make(true);
- }
- }
|