Untitled
raw download clone
TEXT
views 44
,
size 3140 b
///////////////
/// include ///
//////////////
<input type="hidden" id="linkLoadPaket" value="{{url($kdRtRwNet.'/fakturPajakTerpisah')}}">

///////////////////
/// Billing.php ///
//////////////////
tambah select faktur dan kdISP
tambah leftjoin('ms_rtrwnet','ms_rtrwnet.kdRtRwNet','=','tr_billing.kdRtRwNet')


/////////////////////////////
/// fakturPajak.blade.php ///
////////////////////////////

<div class="col-md-12" id="loading-control">
  <table class="table" id="tablePaket">
      <thead>
       <tr>
         <th scope="col">No</th>
         <th scope="col">Nama</th>
         <th scope="col">Kode Faktur</th>
         <th scope="col">Total (Rp)</th>
         <th scope="col" style='width=10px;'>Aksi</th>
       </tr>
     </thead>
     <tbody id="tableTerpisah">
  </tbody>
</table>




//////////////////
/// JavaScript ///
/////////////////

$(document).ready(function(){
    loadPaket();	
});

function loadPaket(){
    var link = $('#linkLoadPaket').val();
    var txt = "";
    var no = 1;
    $.getJSON(link, function(data){
        $('#loading-control').loading('toggle');
        $.each(data, function(key, val){
            var namaPembeda = val.namaPembeda;
            txt = txt + "<tr>";
            txt = txt+"<td style='width: 10px;'>"+no+"</td>";
            if(namaPembeda){
                txt = txt+"<td>"+val.namaLengkap+" ("+val.namaPembeda+")"+"</td>";

            }else{
                txt = txt+"<td>"+val.namaLengkap+"</td>";
            }
            txt = txt+"<td>"+val.faktur+"</td>";
            txt = txt+"<td>"+"Rp. "+number_format(val.totalTagihan)+"</td>";
            txt = txt+"<td><a href='https://isp.jasainter.net/"+val.kdISP+"/fakturPajak/printPdf?kdBilling="+val.kdBilling+"'><i class='fa fa-file text-primary' ></i></td>";
            no++;
        });
        $('#loading-control').loading('toggle');
        $('#tableTerpisah').html(txt);
    }).done(function(){
        $('#tablePaket').DataTable({
            "aaSorting": [],ordering:true,"pageLength": 10
        });
    });
}


function number_format(number, decimals, decPoint, thousandsSep) {
    decimals = Math.abs(decimals) || 0;
    number = parseFloat(number);

    if (!decPoint || !thousandsSep) {
        decPoint = ',';
        thousandsSep = '.';
    }

    var roundedNumber = Math.round(Math.abs(number) * ('1e' + decimals)) + '';
    var numbersString = decimals ? (roundedNumber.slice(0, decimals * -1) || 0) : roundedNumber;
    var decimalsString = decimals ? roundedNumber.slice(decimals * -1) : '';
    var formattedNumber = "";

    while (numbersString.length > 3) {
        formattedNumber += thousandsSep + numbersString.slice(-3)
        numbersString = numbersString.slice(0, -3);
    }

    if (decimals && decimalsString.length === 1) {
        while (decimalsString.length < decimals) {
            decimalsString = decimalsString + decimalsString;
        }
    }

    return (number < 0 ? '-' : '') + numbersString + formattedNumber + (decimalsString ? (decPoint + decimalsString) : '');
}
close fullscreen
Login or Register to edit or fork this paste. It's free.