Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Cara merubah tinggi baris enter pada file excel di html?
content .= '<page backtop="4mm" backbottom="10mm" backleft="5mm" backright="5mm">';
$content .= '
<table style="width: 99%;margin-top:10px;">
<tr>
<td style="text-align: left; width: 33%"></td>
<td style="text-align: center;width: 34%">LAPORAN PERJALANAN DINAS<br>'.$_GET[date3].' s/d '.$_GET[date4].'</td>
<td style="text-align: right;width:33%;font-size:9px;">'.date("d/m/Y").' | '.date("H:i:s").'</td>
</tr>
</table>';
$content .='<page_footer>
<table style="width:100%;font-size:9px;">
<tr>
<td style="text-align:left;width:50%">AndroSales 2015</td>
<td style="text-align:right;width:50%">page [[page_cu]]/[[page_nb]]</td>
</tr>
</table>
</page_footer>';
$content .= '<qrcode value="'.$GEncrypt.'" ec="L" style="width:25mm;"></qrcode>';
$content .= '<br><br>';
$content .= 'Nama : '.$rIndex[nama_account];
$db1 = new database;
$no=1;
$number=1;
$content .= "<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin-top:10px;
border-collapse: collapse;
table-layout:automatic;
font-size:10px;
border:1px solid #000000;
width:99%;background:none;\" >
<col style=\"width: 20px\">
<col style=\"width: 80px\">
<col style=\"width: 70px\">
<col style=\"width: 80px\">
<col style=\"width: 180px\">
<col style=\"width: 50px\">
<col style=\"width: 80px\">
<col style=\"width: 80px\">
<thead>
<tr>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >NO</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >TANGGAL</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >JAM</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >NAMA</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >KETERANGAN</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >KM</th>
<th align=\"center\" style=\"padding: 2px;
text-weight:bold;border:1px solid #000000;\" >POSISI</th>
</tr>
</thead>";
$content .= "<tbody>";
$db1->query("SELECT
DATE_FORMAT(tanggal,'%d-%m-%Y') as tgl,
DATE_FORMAT(tanggal,'%H:%i-%s') as jam,
loket_name,saran,km,getLatitude,getLongitude,alamat
FROM
t_report
WHERE phoneNumber='$idimei' AND tanggal BETWEEN '$tgl1' AND '$tgl2' ORDER BY tanggal");
while($row2=$db1->tampilkan()){
/*
$alamat_posisi = "";
if ($row2[alamat] != "") {
$alamat_posisi = $row2[alamat];
}
else {
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=".$row2[getLatitude].",".$row2[getLongitude]."&sensor=false&token=AIzaSyB79S7HmHq7iTZ-miL98qyDdzihglTyvU4";
$json = @file_get_contents($url);
$data = json_decode($json);
$status = $data->status;
$address = '';
if($status == "OK")
{
$alamat_posisi = $data->results[0]->formatted_address;
}
else
{
$alamat_posisi = "";
}
}
*/
$get_alamat = $row2['alamat'];/*
if($row2['alamat'] == "")
{
$geocoder = new \OpenCage\Geocoder\Geocoder('2d266bff8a2c4f6c8320dfef29bc1577');
$result = $geocoder->geocode("$row2['getLatitude'],$row2['getLongitude']"); # latitude,longitude (y,x)
$get_alamat = $result['results'][0]['formatted'];
}else{
$get_alamat = $row2['alamat'];
}*/
$content .= "<tr>
<td style=\"padding: 2px;border:1px solid #000000;\" width='20'>$no</td>
<td style=\"padding: 2px;border:1px solid #000000;\" >$row2[tgl]</td>
<td style=\"padding: 2px;border:1px solid #000000;\" >$row2[jam]</td>
<td style=\"padding: 2px;border:1px solid #000000;\" >$row2[loket_name]</td>
<td style=\"padding: 2px;border:1px solid #000000;\" >$row2[saran]</td>
<td style=\"padding: 2px;border:1px solid #000000;text-align:right;\" >$row2[km]</td>
<td style=\"padding: 2px;border:1px solid #000000;\" >
".$get_alamat."</td>
</tr>";
$no++;
}
//hitung KM
$dbKakhir = new database;
$dbKakhir->query("SELECT km FROM t_report
WHERE phoneNumber='$idimei' AND tanggal BETWEEN '$tgl1' AND '$tgl2' AND km !=' '
ORDER BY tanggal DESC LIMIT 1");
$rKakhir =$dbKakhir->tampilkan();
$kmAkhir = $rKakhir[km];
$dbKawal = new database;
$dbKawal->query("SELECT km FROM t_report
WHERE phoneNumber='$idimei' AND tanggal BETWEEN '$tgl1' AND '$tgl2' AND km !=' '
ORDER BY tanggal ASC LIMIT 1");
$rKawal = $dbKawal->tampilkan();
$kmAwal = $rKawal[km];
$totalKM = $kmAkhir-$kmAwal;
//$hitungBBM = ($totalKM*$hargaBBM)/$indexbbm;
$content .= "<tr><td style=\"padding: 2px;border:1px solid #000000;\" colspan='5' align='center'></td>
<td style=\"padding: 2px;border:1px solid #000000;\" align='right'><b></b></td>
<td style=\"padding: 2px;border:1px solid #000000;\" colspan='2' align='center'></td>
</tr>";
$content .= "</tbody>";
$content .= "</table>";
// Hitung BBM perhari
$dbBbm = new database;
$dbBbm->query("SELECT
i.tanggal,
(SELECT km FROM t_report
WHERE
tanggal BETWEEN DATE_FORMAT(i.tanggal,'%Y-%m-%d 00:00:00') AND DATE_FORMAT(i.tanggal,'%Y-%m-%d 23:59:59')
AND phoneNumber='$idimei' AND (km IS NOT NULL AND km !='') ORDER BY tanggal DESC LIMIT 1)
-(SELECT km FROM t_report
WHERE
tanggal BETWEEN DATE_FORMAT(i.tanggal,'%Y-%m-%d 00:00:00') AND DATE_FORMAT(i.tanggal,'%Y-%m-%d 23:59:59')
AND phoneNumber='$idimei' AND (km IS NOT NULL AND km !='') ORDER BY tanggal ASC LIMIT 1) as km
FROM(
SELECT
DISTINCT
DATE_FORMAT(tanggal,'%Y-%m-%d') as tanggal
FROM
t_report
WHERE tanggal BETWEEN '$tgl1' and '$tgl2' AND phoneNumber='$idimei'
ORDER BY tanggal ASC)i");
$jmlHari = 0;
while($rBbm=$dbBbm->tampilkan()){
$hitBbm = $hitBbm+$rBbm[km];
if(($rBbm[km] != 0) || (!empty($rBbm[km]))){
$jmlHari=$jmlHari+1;
}
//Nilai BBM
if(($rBbm[km] == 0) || (empty($rBbm[km])) ){
$jKm = 0;
}else{
$jKm = $rBbm[km];
}
if(($indexbbm == 0) || (empty($indexbbm)) ){
$ibb = 0;
}else{
$ibb = $indexbbm;
}
//echo "round(($jKm*$hargaBBM)/$ibb)";
$hitungBBM = @(round(($jKm*$hargaBBM)/$ibb));
//hitung pembulatan
$nom = $hitungBBM;
$hasilPot = getPotongAngka($nom);
$hasil = substr($nom,-3);
$nil = $hasilPot.'000';
if($hasil > 500){
$count = 1000;
$nilai = $nil+$count;
}else{
$nilai = $nil;
}
$totBBM = $totBBM+$nilai;
}
//echo $nilai;
//$jmlDataBbm = $dbBbm->getJumlah();
$jmlDataBbm = $jmlHari;
// END Hitung BBM perhari
if($totalKM){
$totalParkir = number_format($jmlDataBbm*$rIndex[uang_parkir],0,",",".");
$content .='<p style="font-size:10px;" >';
$content .="Perhitungan BBM :<br>";
$content .="Jumlah Kilometer(KM) : $hitBbm<br>";
$content .="Index : $indexbbm | Jenis BBM : $jenisBBM | Harga : $hargaBBM<br>";
$content .="<b>Total : ".number_format($totBBM,0,",",".")."</b><br><br>";
$content .="--------------------------------------------------------";
$content .="<br>Parkir : ".$jmlDataBbm." x ".number_format($rIndex[uang_parkir],0,",",".");
$content .="<br>Jumlah : <b>".$totalParkir."</b><br>";
$content .="--------------------------------------------------------";
$content .='</p>';
}
$content .='<br><p style="font-size:10px;" >';
$content .="Dibuat,<br><br><br><br><br><br><br><br>";
$content .=$rIndex[nama_account];
$content .='</p>';
$content .= '</page>';
//}
require_once('../../html2pdf/html2pdf.class.php');
$html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 3);
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->WriteHTML($content);
ob_end_clean();
$html2pdf->Output('laporan_perjalanan.pdf');
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban