} //get jam lembur $sGetLembur = "select jamaktual, jamlembur,tipelembur from " . $dbname . ".sdm_5lembur where kodeorg = '" . substr($kdeOrg, 0, 4) . "'"; //exit("Error".$sGetLembur); $rGetLembur = fetchData($sGetLembur); foreach ($rGetLembur as $row => $kar) { $GetLembur[$kar['tipelembur']][$kar['jamaktual']] = $kar['jamlembur']; } //semua data lembur $sLembur = "select uangkelebihanjam,a.karyawanid,jamaktual,tipelembur from " . $dbname . ".sdm_lemburdt b\r\n LEFT JOIN " . $dbname . ".datakaryawan a on a.karyawanid = b.karyawanid\r\n WHERE b.tanggal between '" . $tgl_1 . "' and '" . $tgl_2 . "' " . $where2 . " " . $where3 . " " . $where4 . " order by namakaryawan asc "; $qLembur = mysql_query($sLembur) or die(mysql_error($conn)); $dtKaryawan = array(); while ($rLembur = mysql_fetch_assoc($qLembur)) { setIt($jlhJmLembur[$rLembur['karyawanid']], 0); setIt($jlhJamLemburKali[$rLembur['karyawanid']], 0); setIt($jlhUang[$rLembur['karyawanid']], 0); $jlhJmLembur[$rLembur['karyawanid']] += $GetLembur[$rLembur['tipelembur']][$rLembur['jamaktual']]; //jumlah jam sblm perkalian $jlhJamLemburKali[$rLembur['karyawanid']] += $rLembur['jamaktual']; $jlhUang[$rLembur['karyawanid']] += $rLembur['uangkelebihanjam']; $dtKaryawan[$rLembur['karyawanid']] = $rLembur['karyawanid']; } $iGaji = "select jumlah,karyawanid from " . $dbname . ".sdm_5gajipokok where tahun='" . substr($periodeGaji, 0, 4) . "' " . " and idkomponen=1"; $nGaji = mysql_query($iGaji) or die(mysql_error($conn)); while ($dGaji = mysql_fetch_assoc($nGaji)) { $gajiPokok[$dGaji['karyawanid']] = $dGaji['jumlah']; } $tab .= "<table cellspacing='1' border='" . $brdr . "' class='sortable'>\r\n <thead class=rowheader>\r\n <tr>\r\n <td " . $bgclr . ">No.</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['nama'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['subbagian'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['tipekaryawan'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['bagian'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['jabatan'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['total'] . " " . $_SESSION['lang']['absensi'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['totLembur'] . " Actual</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['totLembur'] . "</td>\r\n <td " . $bgclr . ">" . $_SESSION['lang']['jumlah'] . " (Rp)</td>"; $tab .= "<td " . $bgclr . ">" . $_SESSION['lang']['gaji'] . "</td><td " . $bgclr . ">" . $_SESSION['lang']['persen'] . " " . $_SESSION['lang']['lembur'] . "</td>"; $tab .= "</tr><thead><tbody>"; foreach ($dtKaryawan as $dtKary) {
#tunjangan Provesi #gaji pokok if ($nojms[$val['karyawanid']] != '') { #jika No. JMS diisi maka ada potongan jamsostek setIt($tjms[$val['karyawanid']], 0); $tjms[$val['karyawanid']] += $val['jumlah']; } } } else { #BHL //diabaikan yang dari gaji pokok } #bentuk BPJS di sini if ($val['idkomponen'] == 1) { if ($nobpjs[$val['karyawanid']] != '') { setIt($bpjs[$val['karyawanid']], 0); $bpjs[$val['karyawanid']] = $val['jumlah']; } } } #ambil komponen pengurang dari sdm_5gajipokok untuk PHL $strphl = "select a.*,b.namakaryawan from " . $dbname . ".sdm_5gajipokok a left join \r\n " . $dbname . ".datakaryawan b on a.karyawanid=b.karyawanid\r\n where a.tahun=" . substr($tanggal1, 0, 4) . " and b.tipekaryawan='4' and b.lokasitugas='" . $param['kodeorg'] . "' \r\n and (b.tanggalkeluar>='" . $tanggal1 . "' or b.tanggalkeluar='0000-00-00') and b.alokasi=0 \r\n and sistemgaji='Harian' and idkomponen in (select id from " . $dbname . ".sdm_ho_component where plus=0 and type='basic')"; $resphl = fetchData($strphl); foreach ($resphl as $idx => $val) { $readyData[] = array('kodeorg' => $param['kodeorg'], 'periodegaji' => $param['periodegaji'], 'karyawanid' => $val['karyawanid'], 'idkomponen' => $val['idkomponen'], 'jumlah' => $val['jumlah'], 'pengali' => 1); } ###################update indra ini sudah tidak dipakai lagi, pembentukan di bawah semua #### 8 januari 2015 #masukin BPJS ke sini /*foreach($bpjs as $key=>$nilai){ #add bpjs to ready data====================================
if ($rData['kodetransaksi'] == 'PNB') { $dzArr[$rData['batch']]['kirimbibit'] += $rData['jumlah']; } } setIt($dzTot['kecambahterima'], 0); setIt($dzTot['seleksiawal'], 0); setIt($dzTot['kecambahtanam'], 0); setIt($dzTot['seleksibibitpn'], 0); setIt($dzTot['pindahbibitpnmn'], 0); setIt($dzTot['saldobibitpn'], 0); setIt($dzTot['seleksibibitmn'], 0); setIt($dzTot['totalseleksi'], 0); setIt($dzTot['bibitdoubletone'], 0); setIt($dzTot['kirimbibit'], 0); setIt($dzTot['saldobibitmn'], 0); setIt($dzTot['saldobibit'], 0); if (!empty($batches)) { foreach ($batches as $bat) { $stab .= "<tr class=rowcontent>"; $stab .= "<td align=center>" . $dzArr[$bat]['batch'] . "</td>"; $stab .= "<td align=center>" . $dzArr[$bat]['tanggaltanam'] . "</td>"; $stab .= "<td align=left>" . $dzArr[$bat]['jenisbibit'] . "</td>"; $stab .= "<td align=right>" . number_format($dzArr[$bat]['kecambahterima']) . "</td>"; //b $stab .= "<td align=right>" . number_format($dzArr[$bat]['seleksiawal']) . "</td>"; //c $stab .= "<td align=right>" . number_format($dzArr[$bat]['kecambahtanam']) . "</td>"; //d=b-c $stab .= "<td align=right>" . number_format($dzArr[$bat]['seleksibibitpn'] * -1) . "</td>"; //e $stab .= "<td align=right>" . number_format($dzArr[$bat]['pindahbibitpnmn'] * -1) . "</td>";
function createSaldoAwal($dariperiode, $keperiode, $kodeorg) { global $conn; global $dbname; global $akunRAT; global $akunCLM; global $akunCLY; $sawal = array(); $mtdebet = array(); $mtkredit = array(); $salak = array(); #ambil saldoawal bulan berjalan $str = "select awal" . substr($dariperiode, 5, 2) . ",noakun from " . $dbname . ".keu_saldobulanan\n where periode='" . str_replace("-", "", $dariperiode) . "' and kodeorg='" . $kodeorg . "'"; $res = mysql_query($str); while ($bar = mysql_fetch_array($res)) { $sawal[$bar[1]] = $bar[0]; $mtdebet[$bar[1]] = 0; $mtkredit[$bar[1]] = 0; $salak[$bar[1]] = $bar[0]; } #ambil transaksi transaksi bln berjalan $str = "select debet,kredit,noakun from " . $dbname . ".keu_jurnalsum_vw \n where periode='" . $dariperiode . "' and kodeorg='" . $kodeorg . "'"; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { setIt($sawal[$bar->noakun], 0); $mtdebet[$bar->noakun] = $bar->debet; $mtkredit[$bar->noakun] = $bar->kredit; $salak[$bar->noakun] = $mtdebet[$bar->noakun] + $sawal[$bar->noakun] - $mtkredit[$bar->noakun]; } #ambil semu nomor akun $str = "select noakun from " . $dbname . ".keu_5akun where length(noakun)=7"; $res = mysql_query($str); $temp = ''; while ($bar = mysql_fetch_object($res)) { #create string update current if ($sawal[$bar->noakun] != '') { #jika sudah ada di database maka update if ($mtdebet[$bar->noakun] == '') { $mtdebet[$bar->noakun] = 0; } if ($mtkredit[$bar->noakun] == '') { $mtkredit[$bar->noakun] = 0; } $temp = "update " . $dbname . ".keu_saldobulanan \n set debet" . substr($dariperiode, 5, 2) . "=" . $mtdebet[$bar->noakun] . ",\n kredit" . substr($dariperiode, 5, 2) . "=" . $mtkredit[$bar->noakun] . "\n where periode='" . str_replace("-", "", $dariperiode) . "'\n and kodeorg='" . $kodeorg . "' and noakun='" . $bar->noakun . "';"; if (!mysql_query($temp)) { exit("Error update mutasi bulanan " . mysql_error($conn)); } } else { #jika belum ada maka insert if (isset($sawal[$bar->noakun]) and ($sawal[$bar->noakun] != '' or $mtdebet[$bar->noakun] != '' or $mtkredit[$bar->noakun] != '')) { if ($mtdebet[$bar->noakun] == '') { $mtdebet[$bar->noakun] = 0; } if ($mtkredit[$bar->noakun] == '') { $mtkredit[$bar->noakun] = 0; } $temp = "insert into " . $dbname . ".keu_saldobulanan (kodeorg,periode,noakun,\n awal" . substr($dariperiode, 5, 2) . ",debet" . substr($dariperiode, 5, 2) . ",\n kredit" . substr($dariperiode, 5, 2) . ")values('" . $kodeorg . "','" . str_replace("-", "", $dariperiode) . "','" . $bar->noakun . "',0," . $mtdebet[$bar->noakun] . "," . $mtkredit[$bar->noakun] . ");"; if (!mysql_query($temp)) { exit("Error insert mutasi bulanan " . mysql_error($conn)); } } } } #delete saldo awal bulan selanjutnya; $str = "delete from " . $dbname . ".keu_saldobulanan where periode='" . str_replace("-", "", $keperiode) . "'\n and kodeorg='" . $kodeorg . "';"; if (mysql_query($str)) { $saldoditahan = 0; foreach ($salak as $key => $val) { if ($salak[$key] != '') { $temp = "insert into " . $dbname . ".keu_saldobulanan (kodeorg,periode,noakun,\n awal" . substr($keperiode, 5, 2) . ")values('" . $kodeorg . "','" . str_replace("-", "", $keperiode) . "','" . $key . "'," . $salak[$key] . ")"; if (substr($keperiode, 5, 2) != '01') { if (!mysql_query($temp)) { exit("Error insert saldo awal " . mysql_error($conn) . ":" . $temp); } } else { if ($key < $akunRAT) { #jika awal tahun maka hanya akan membawa aktiva saja ke bulan selanjutnya #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #deteksi jika saldo ditahan #sudah mengakomodasi tutup akhir tahun if ($key == $akunCLY) { $saldoditahan += $salak[$key]; } else { if ($key == $akunCLM) { $saldoditahan += $salak[$key]; #tampung laba tahun berjalan ke laba ditahan $salak[$key] = 0; } $temp1 = "insert into " . $dbname . ".keu_saldobulanan (kodeorg,periode,noakun,\n awal" . substr($keperiode, 5, 2) . ")values('" . $kodeorg . "','" . str_replace("-", "", $keperiode) . "','" . $key . "'," . $salak[$key] . ")"; #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if (!mysql_query($temp1)) { exit("Error insert saldo awal " . mysql_error($conn)); } } } } } } //masukkan saldo laba ditahan if (substr($keperiode, 5, 2) == '01') { //hanya pada bulan 12 $temp2 = "insert into " . $dbname . ".keu_saldobulanan (kodeorg,periode,noakun,\n awal" . substr($keperiode, 5, 2) . ")values\n ('" . $kodeorg . "','" . str_replace("-", "", $keperiode) . "','" . $akunCLY . "'," . $saldoditahan . ")"; if (!mysql_query($temp2)) { exit("Error insert laba ditahan pada saldo awal " . mysql_error($conn)); } } } }
{ setIt($arrTotal[$peng1],0); setIt($arrTotal[$peng2],0); $stream.="<td>-".number_format($arrTotal[$peng1],2)."</td>"; $stream.="<td>-".number_format($arrTotal[$peng2],2)."</td>"; }*/ } $totDpt = array_sum($arrPlus); //$totDpt=array_sum($arrPlus)-($arrTotal[$peng1]+$arrTotal[$peng2]); $stream .= "<td align=right>" . number_format($totDpt, 2) . "</td>"; $arrMin = array(); $q = 0; foreach ($arrIdKompMin as $lstKompMin) { //if(($lstKompMin!=37)&&($lstKompMin!=36)) //{ setIt($arrTotal[$lstKompMin], 0); $stream .= "<td align=right>" . number_format($arrTotal[$lstKompMin]) . "</td>"; $arrMin[$q] = $arrTotal[$lstKompMin]; $q++; // } } $gajiBersih = $totDpt - array_sum($arrMin); //$stream.="<td align=right>".number_format(array_sum($arrPlus),2)."</td>"; $stream .= "<td align=right>" . number_format(array_sum($arrMin), 2) . "</td>"; $stream .= "<td align=right>" . number_format($gajiBersih, 0) . "</td>"; $stream .= "</tr>"; } else { $stream .= "<tr><td colspan=20> </td></tr>"; } //echo "warning:".$strx; //=================================================
echo "<td bgcolor=pink>" . $hasilAbsn[$hslAkhir[0]][$isiTgl][0]['absensi'] . "</td>"; } else { echo "<td><font color=red>" . $hasilAbsn[$hslAkhir[0]][$isiTgl][0]['absensi'] . "</font></td>"; } } else { if ($hasilAbsn[$hslAkhir[0]][$isiTgl][0]['absensi'] == '0') { echo "<td></td>"; } else { echo "<td>" . $hasilAbsn[$hslAkhir[0]][$isiTgl][0]['absensi'] . "</td>"; } } $brt[$hslAkhir[0]][$hasilAbsn[$hslAkhir[0]][$isiTgl][0]['absensi']] += 1; } foreach ($klmpkAbsn as $brsKet => $hslKet) { setIt($subtot[$hslAkhir[0]]['total'], 0); setIt($brt[$hslAkhir[0]][$hslKet['kodeabsen']], 0); if ($hslKet['kodeabsen'] != 'H') { echo "<td width=5px align=right><font color=red>" . $brt[$hslAkhir[0]][$hslKet['kodeabsen']] . "</font></td>"; } else { echo "<td width=5px align=right>" . $brt[$hslAkhir[0]][$hslKet['kodeabsen']] . "</td>"; } $subtot[$hslAkhir[0]]['total'] += $brt[$hslAkhir[0]][$hslKet['kodeabsen']]; } echo "<td width=5px>" . $subtot[$hslAkhir[0]]['total'] . "</td>"; $subtot['total'] = 0; echo "</tr>"; } } //echo"warning:"; /* echo"<pre>"; print_r($hasilAbsn);
$no = 0; if (mysql_num_rows($res) < 1) { echo "<tr class=rowcontent><td colspan=8 style='text-align:center'>" . $_SESSION['lang']['datanotfound'] . "</td></tr>"; } else { #ambil jumlah jam per kendaraan $str1 = "select sum(jumlah) as jumlah,kodevhc from " . $dbname . ".vhc_rundt a left join \r\n " . $dbname . ".vhc_runht b on a.notransaksi=b.notransaksi\r\n where tanggal>='" . $tglAwal . "' and tanggal<='" . $tglAkhir . "' and kodevhc in (select kodevhc from " . $dbname . ".vhc_5master\r\n where kodetraksi like '" . $unit . "%')\r\n group by kodevhc"; $res1 = mysql_query($str1); $jumlahjam = array(); while ($bar1 = mysql_fetch_object($res1)) { $jumlahjam[str_replace(" ", "", $bar1->kodevhc)] = $bar1->jumlah; } #loop per kendaraan while ($bar = mysql_fetch_object($res)) { $no += 1; $total = 0; setIt($jumlahjam[str_replace(" ", "", $bar->kodevhc)], 0); if ($jumlahjam[str_replace(" ", "", $bar->kodevhc)] > 0) { $rpunit = $bar->jumlah / $jumlahjam[str_replace(" ", "", $bar->kodevhc)]; } else { $rpunit = 0; } if (isset($jumlahjam[str_replace(" ", "", $bar->kodevhc)])) { $color = '#dedede'; $title = 'Normal'; $tmblDetail = "<img onclick=\"detailAlokasi(event,'" . str_replace(" ", "", $bar->kodevhc) . "','" . $rpunit . "');\" title=\"Detail Alokasi\" class=\"resicon\" src=\"images/zoom.png\">"; } else { $color = 'red'; $title = 'No activity record'; $tmblDetail = ""; } $ondiKlik = " style='cursor:pointer;' title='Click' onclick=\"viewDetail(event,'" . str_replace(" ", "", $bar->kodevhc) . "','" . $tglAwal . "','" . $tglAkhir . "','" . substr($unit, 0, 4) . "','" . $periode . "','" . $akunkdari . "','" . $akunksampai . "');\"";
$tab .= "<td align=center " . $bg . ">" . $_SESSION['lang']['total'] . "</td>"; $tab .= "</tr><thead><tbody>"; if ($dtblokkedua != 0) { foreach ($lstKodeorg as $dtBlok2) { setIt($panenHslBln[$dtBlok2], 0); setIt($hkBln[$dtBlok2]['KBL'], 0); setIt($hkBln[$dtBlok2]['KHT'], 0); setIt($hkBln[$dtBlok2]['KHL'], 0); setIt($hkBln[$dtBlok2]['Kontrak'], 0); setIt($hkBln[$dtBlok2]['Kontrak Karywa (Usia Lanjut)'], 0); setIt($panenHslBlnLalu[$dtBlok2], 0); setIt($hkBlnLalu[$dtBlok2]['KBL'], 0); setIt($hkBlnLalu[$dtBlok2]['KHT'], 0); setIt($hkBlnLalu[$dtBlok2]['KHL'], 0); setIt($hkBlnLalu[$dtBlok2]['Kontrak'], 0); setIt($hkBlnLalu[$dtBlok2]['Kontrak Karywa (Usia Lanjut)'], 0); $tab .= "<tr class=rowcontent>"; $tab .= "<td>" . $dtBlok2 . "</td>"; $tab .= "<td>611010101</td>"; $tab .= "<td>" . $optNmkeg[611010101] . "</td>"; $tab .= "<td align=center>" . $optSatkeg[611010101] . "</td>"; $tab .= "<td align=right>" . number_format($panenHslBln[$dtBlok2], 2) . "</td>"; $tab .= "<td align=right>" . number_format($hkBln[$dtBlok2]['KBL'], 0) . "</td>"; $tab .= "<td align=right>" . number_format($hkBln[$dtBlok2]['KHT'], 0) . "</td>"; $tab .= "<td align=right>" . number_format($hkBln[$dtBlok2]['KHL'], 0) . "</td>"; $tab .= "<td align=right>" . number_format($hkBln[$dtBlok2]['Kontrak'], 0) . "</td>"; $tab .= "<td align=right>" . number_format($hkBln[$dtBlok2]['Kontrak Karywa (Usia Lanjut)'], 0) . "</td>"; $totSubPanen[$dtBlok2] = $hkBln[$dtBlok2]['KBL'] + $hkBln[$dtBlok2]['KHT'] + $hkBln[$dtBlok2]['KHL'] + $hkBln[$dtBlok2]['Kontrak'] + $hkBln[$dtBlok2]['Kontrak Karywa (Usia Lanjut)']; @($hkSatuanPanen[$dtBlok2] = $totSub[$dtBlok2] / $panenHslBln[$dtBlok2]); $tab .= "<td align=right>" . number_format($totSubPanen[$dtBlok2], 0) . "</td>"; $tab .= "<td align=right>" . number_format($hkSatuanPanen[$dtBlok2], 2) . "</td>";
setIt($subPerKom[$per][$idKom], ''); $stream .= "<td align=right>" . number_format((double) $gaji[$idKar][$per][$idKom], 2) . "</td>"; $subTotKar[$idKar] += $gaji[$idKar][$per][$idKom]; $subPerKom[$per][$idKom] += $gaji[$idKar][$per][$idKom]; } } $granTot = ""; $granTot += $subTotKar[$idKar]; //$stream.="<td align=right>".number_format($subTotKar[$idKar])."</td>"; $stream .= "</tr>"; } $stream .= "<thead><tr class=rowcontent>"; $stream .= "<td colspan=5 align=right>" . $_SESSION['lang']['grnd_total'] . "</td>"; foreach ($rangePer as $ar => $per) { foreach ($idKomponen as $idKom) { setIt($subPerKom[$per][$idKom], ''); $stream .= "<td align=right>" . number_format((double) $subPerKom[$per][$idKom], 2) . "</td>"; } } //$stream.="<td>".number_format($granTot,2)."</td>"; $stream .= "</tr></thead>"; $stream .= "<tbody></table>"; switch ($proses) { ######PREVIEW case 'preview': echo $stream; break; ######EXCEL ######EXCEL case 'excel': //$stream.="Print Time : ".date('H:i:s, d/m/Y')."<br>By : ".$_SESSION['empl']['name'];
$subtotal[$judul]['umum'] += $dz[$list]['umum']; $subtotal[$judul]['tbm0'] += $dz[$list]['tbm0']; $subtotal[$judul]['tbm1'] += $dz[$list]['tbm1']; $subtotal[$judul]['tbm2'] += $dz[$list]['tbm2']; $subtotal[$judul]['tbm3'] += $dz[$list]['tbm3']; $subtotal[$judul]['tm'] += $dz[$list]['tm']; $subtotal[$judul]['total1'] += $dz[$list]['total1']; //GranTotal setIt($grandtotal[$judul]['umum'], 0); setIt($grandtotal['hmkm'], 0); setIt($grandtotal['tbm0'], 0); setIt($grandtotal['tbm1'], 0); setIt($grandtotal['tbm2'], 0); setIt($grandtotal['tbm3'], 0); setIt($grandtotal['tm'], 0); setIt($grandtotal['total1'], 0); $grandtotal['hmkm'] += $rowListDetail[$list]['hmkm']; $grandtotal['umum'] += $dz[$list]['umum']; $grandtotal['tbm0'] += $dz[$list]['tbm0']; $grandtotal['tbm1'] += $dz[$list]['tbm1']; $grandtotal['tbm2'] += $dz[$list]['tbm2']; $grandtotal['tbm3'] += $dz[$list]['tbm3']; $grandtotal['tm'] += $dz[$list]['tm']; $grandtotal['total1'] += $dz[$list]['total1']; } } $stream .= "<tr class=rowcontent>\r\n\t\t\t\t<td colspan=5 style='text-align:center'><b>SUB TOTAL</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['hmkm'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['umum'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['tbm0'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['tbm1'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['tbm2'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['tbm3'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['tm'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($subtotal[$judul]['total1'], 2) . "</b></td>\r\n\t\t</tr>"; } $stream .= "<tr class=rowcontent>\r\n\t\t\t\t<td colspan=13 style='height:10px;'> </td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class=rowcontent>\r\n\t\t\t\t<td colspan=5 style='text-align:center'><b>GRANDTOTAL</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['hmkm'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['umum'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['tbm0'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['tbm1'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['tbm2'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['tbm3'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['tm'], 2) . "</b></td>\r\n\t\t\t\t<td style='text-align:right'><b>" . number_format($grandtotal['total1'], 2) . "</b></td>\r\n\t\t</tr>\r\n\t</tbody>\r\n\t</table><p />"; if (isset($_GET['type']) and $_GET['type'] == 'excel') { $handle = '';
function display($kodeorg, $periode, $harga, $dbname, $conn) { $tgl1 = ''; $tgl2 = ''; $str = "select tanggalmulai,tanggalsampai from " . $dbname . ".sdm_5periodegaji where kodeorg='" . $kodeorg . "'\r\n and periode='" . $periode . "' and jenisgaji='H'"; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { $tgl1 = str_replace("-", "", $bar->tanggalmulai); $tgl2 = str_replace("-", "", $bar->tanggalsampai); } if ($tgl1 == '' or $tgl2 == '') { exit(" Error: Periode penggajian Harian tidak ditemukan/ Daily base payrol period not found"); } else { //ambil kamus karyawan $str = "select a.karyawanid,a.namakaryawan,a.kodecatu,a.subbagian,b.tipe,c.keterangan,a.kodecatu,a.tipekaryawan,a.kodejabatan,d.namajabatan\r\n from " . $dbname . ".datakaryawan a left join " . $dbname . ".sdm_5tipekaryawan b on a.tipekaryawan=b.id \r\n left join " . $dbname . ".sdm_5catuporsi c on a.kodecatu=c.kode\r\n left join " . $dbname . ".sdm_5jabatan d on a.kodejabatan=d.kodejabatan \r\n where a.lokasitugas='" . $kodeorg . "' and tipekaryawan!=0 and (a.tanggalkeluar>'" . $_POST['periode'] . "-01' or a.tanggalkeluar='0000-00-00')"; $res = mysql_query($str); $kamusKar = array(); while ($bar = mysql_fetch_object($res)) { if ($bar->tipe != 'KHL') { $kamusKar[$bar->karyawanid]['id'] = $bar->karyawanid; $kamusKar[$bar->karyawanid]['nama'] = $bar->namakaryawan; $kamusKar[$bar->karyawanid]['kodecatu'] = $bar->kodecatu; $kamusKar[$bar->karyawanid]['subbagian'] = $bar->subbagian; $kamusKar[$bar->karyawanid]['tipekaryawan'] = $bar->tipekaryawan; $kamusKar[$bar->karyawanid]['namatipe'] = $bar->tipe; $kamusKar[$bar->karyawanid]['kelompok'] = $bar->keterangan; $kamusKar[$bar->karyawanid]['kode'] = $bar->kodecatu; $kamusKar[$bar->karyawanid]['jabatan'] = $bar->namajabatan; } } } //ambil subbagian untuk pengurutan perafdeling $str = "select kodeorganisasi from " . $dbname . ".organisasi where induk='" . $kodeorg . "' order by kodeorganisasi"; $res = mysql_query($str); $subbagian = array(); while ($bar = mysql_fetch_object($res)) { array_push($subbagian, $bar->kodeorganisasi); } //ambil dari absensi. jika sudah diabsen di atas, dan di sini diabsen juga namun catu = 0, maka akan dioverride tidak dapat catu. $sAbsn = "select absensi,tanggal,karyawanid,catu from " . $dbname . ".sdm_absensidt \r\n where tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and kodeorg like '" . $kodeorg . "%'\r\n and left(absensi,1)='H' and catu = 1"; // echo $sAbsn; $res = mysql_query($sAbsn); $kehadiran = array(); while ($bar = mysql_fetch_object($res)) { $tgl = str_replace("-", "", $bar->tanggal); // if($bar->catu==1){ $kehadiran[$bar->karyawanid][$tgl] = $bar->absensi; // }else{ // unset($kehadiran[$bar->karyawanid][$tgl]); // } } //ambil dari perawatan $sKehadiran = "select absensi,tanggal,karyawanid from " . $dbname . ".kebun_kehadiran_vw \r\n where tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and unit='" . $kodeorg . "'"; $res = mysql_query($sKehadiran); while ($bar = mysql_fetch_object($res)) { $tgl = str_replace("-", "", $bar->tanggal); $kehadiran[$bar->karyawanid][$tgl] = $bar->absensi; } //ambil Panen $sPrestasi = "select b.tanggal,a.jumlahhk,a.nik from " . $dbname . ".kebun_prestasi a left join " . $dbname . ".kebun_aktifitas b on a.notransaksi=b.notransaksi \r\n where b.notransaksi like '%PNN%' and substr(b.kodeorg,1,4)='" . $kodeorg . "' and b.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "'"; $res = mysql_query($sPrestasi); while ($bar = mysql_fetch_object($res)) { $tgl = str_replace("-", "", $bar->tanggal); $kehadiran[$bar->nik][$tgl] = 'H'; } // ambil pengawas $dzstr = "SELECT tanggal,nikmandor FROM " . $dbname . ".kebun_aktifitas a\r\n left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n left join " . $dbname . ".datakaryawan c on a.nikmandor=c.karyawanid\r\n where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '" . $kodeorg . "%' and c.namakaryawan is not NULL\r\n union select tanggal,nikmandor1 FROM " . $dbname . ".kebun_aktifitas a \r\n left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n left join " . $dbname . ".datakaryawan c on a.nikmandor1=c.karyawanid\r\n where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '" . $kodeorg . "%' and c.namakaryawan is not NULL"; $dzres = mysql_query($dzstr); while ($bar = mysql_fetch_object($dzres)) { $tgl = str_replace("-", "", $bar->tanggal); $kehadiran[$bar->nikmandor][$tgl] = 'H'; } // ambil administrasi $dzstr = "SELECT tanggal,nikasisten as nikmandor FROM " . $dbname . ".kebun_aktifitas a\r\n left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n left join " . $dbname . ".datakaryawan c on a.nikasisten=c.karyawanid\r\n where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '" . $kodeorg . "%' and c.namakaryawan is not NULL\r\n union select tanggal,keranimuat FROM " . $dbname . ".kebun_aktifitas a \r\n left join " . $dbname . ".kebun_prestasi b on a.notransaksi=b.notransaksi\r\n left join " . $dbname . ".datakaryawan c on a.keranimuat=c.karyawanid\r\n where a.tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and b.kodeorg like '" . $kodeorg . "%' and c.namakaryawan is not NULL"; $dzres = mysql_query($dzstr); while ($bar = mysql_fetch_object($dzres)) { $tgl = str_replace("-", "", $bar->tanggal); $kehadiran[$bar->nikmandor][$tgl] = 'H'; } // ambil dari traksi $dzstr = "SELECT tanggal,idkaryawan FROM " . $dbname . ".vhc_runhk\r\n where tanggal between '" . $tgl1 . "' and '" . $tgl2 . "' and notransaksi like '" . $kodeorg . "%'"; $dzres = mysql_query($dzstr); while ($bar = mysql_fetch_object($dzres)) { $tgl = str_replace("-", "", $bar->tanggal); $kehadiran[$bar->idkaryawan][$tgl] = 'H'; } //buang hari minggu $hari = dates_inbetween($tgl1, $tgl2); foreach ($hari as $ar => $isi) { $qwe = date('D', strtotime($isi)); $tglini = date('Ymd', strtotime($isi)); if ($qwe == 'Sun') { foreach ($kehadiran as $key => $val) { $sCek = "select distinct catu from " . $dbname . ".sdm_absensidt \r\n where karyawanid='" . $key . "' and tanggal='" . $tglini . "'"; $qCek = mysql_query($sCek) or die(mysql_error($conn)); $rCek = mysql_fetch_assoc($qCek); if ($rCek['catu'] == 0) { unset($kehadiran[$key][$tglini]); } } } } //jumlahkan hk masing-masing orang $jumlahHK = array(); foreach ($kehadiran as $key => $val) { $jumlahHK[$key] = count($kehadiran[$key]); } //ambil jumlah porsi catu masing-masing orang $str = "select kelompok, jumlah as porsi from " . $dbname . ".sdm_5catu where kodeorg='" . $kodeorg . "' and tahun=" . substr($periode, 0, 4); $porsi = array(); $res = mysql_query($str); if (mysql_num_rows($res) == 0) { if ($_SESSION['language'] == 'ID') { exit("Error:Setup->Natura untuk tahun " . substr($periode, 0, 4) . " belum ada, silahkan isi terlebih dahulu"); } else { exit("Error:Setup->Natura for year " . substr($periode, 0, 4) . " not defined, please define first"); } } while ($bar = mysql_fetch_object($res)) { $porsi[$bar->kelompok] = $bar->porsi; } //bentuk rupiah catu masing-masing orang $rupiahCatu = array(); foreach ($jumlahHK as $key => $val) { setIt($jumlahHK[$key], 0); setIt($kamusKar[$key]['kode'], ''); setIt($porsi[$kamusKar[$key]['kode']], 0); $rupiahCatu[$key] = $jumlahHK[$key] * $porsi[$kamusKar[$key]['kode']] * $harga; } if ($_POST['aksi'] == 'display') { //print echo "<font color=red>Scroll down to save</font>\r\n <table class=sortable border=0 cellspacing=1>\r\n <thead>\r\n <tr class=rowheader>\r\n <td>No.</td>\r\n <td>" . $_SESSION['lang']['kodeorg'] . "</td>\r\n <td>" . $_SESSION['lang']['subbagian'] . "</td>\r\n <td>" . $_SESSION['lang']['periode'] . "</td>\r\n <td>" . $_SESSION['lang']['namakaryawan'] . "</td>\r\n <td>" . $_SESSION['lang']['tipe'] . "</td>\r\n <td>" . $_SESSION['lang']['jabatan'] . "</td>\r\n <td>" . $_SESSION['lang']['status'] . "</td>\r\n <td>Ltr/Hk</td>\r\n <td>" . $_SESSION['lang']['jumlah'] . " HK</td>\r\n <td>" . $_SESSION['lang']['hargasatuan'] . "</td>\r\n <td>" . $_SESSION['lang']['total'] . " (Rp)</td>\r\n </tr>\r\n </thead>\r\n <tbody>"; $no = 0; $ttl = 0; foreach ($subbagian as $unit => $sub) { $SUBTTL = 0; foreach ($kamusKar as $key => $val) { setIt($kamusKar[$key]['subbagian'], ''); if ($kamusKar[$key]['subbagian'] == $sub) { $no += 1; setIt($jumlahHK[$key], 0); setIt($rupiahCatu[$key], 0); setIt($rupiahCatu[$key], 0); setIt($porsi[$kamusKar[$key]['kode']], 0); echo "<tr class=rowcontent>\r\n <td>" . $no . "</td>\r\n <td>" . $kodeorg . "</td>\r\n <td>" . $kamusKar[$key]['subbagian'] . "</td>\r\n <td>" . $periode . "</td>\r\n <td>" . $kamusKar[$key]['nama'] . "</td>\r\n <td>" . $kamusKar[$key]['namatipe'] . "</td>\r\n <td>" . $kamusKar[$key]['jabatan'] . "</td>\r\n <td>" . $kamusKar[$key]['kode'] . "</td>\r\n <td>" . number_format($porsi[$kamusKar[$key]['kode']], 2, '.', ',') . "</td>\r\n <td align=right>" . number_format($jumlahHK[$key], 0, '.', ',') . "</td>\r\n <td align=right>" . number_format($harga, 0, '.', ',') . "</td> \r\n <td align=right>" . number_format($rupiahCatu[$key], 0, '.', ',') . "</td></tr> \r\n "; $ttl += $rupiahCatu[$key]; $SUBTTL += $rupiahCatu[$key]; } } //print subtotal per afdeling echo "<tr class=rowcontent>\r\n <td colspan=11>Sub Total " . $sub . "</td> \r\n <td align=right>" . number_format($SUBTTL, 0, '.', ',') . "</td></tr> \r\n "; } //khusus karyawan kantor $SUBTTL = 0; foreach ($kamusKar as $key => $val) { if ($kamusKar[$key]['subbagian'] == '' or $kamusKar[$key]['subbagian'] == '0') { $no += 1; setIt($kamusKar[$key]['nama'], ''); setIt($kamusKar[$key]['namatipe'], ''); setIt($kamusKar[$key]['jabatan'], ''); setIt($kamusKar[$key]['kode'], ''); echo "<tr class=rowcontent>\r\n <td>" . $no . "</td>\r\n <td>" . $kodeorg . "</td>\r\n <td>" . $kamusKar[$key]['subbagian'] . "</td>\r\n <td>" . $periode . "</td>\r\n <td>" . $kamusKar[$key]['nama'] . "</td>\r\n <td>" . $kamusKar[$key]['namatipe'] . "</td>\r\n <td>" . $kamusKar[$key]['jabatan'] . "</td>\r\n <td>" . $kamusKar[$key]['kode'] . "</td>\r\n <td>" . number_format($porsi[$kamusKar[$key]['kode']], 2, '.', ',') . "</td>\r\n <td align=right>" . number_format($jumlahHK[$key], 0, '.', ',') . "</td>\r\n <td align=right>" . number_format($harga, 0, '.', ',') . "</td> \r\n <td align=right>" . number_format($rupiahCatu[$key], 0, '.', ',') . "</td></tr> \r\n "; $ttl += $rupiahCatu[$key]; $SUBTTL += $rupiahCatu[$key]; } } //print subtotal per afdeling echo "<tr class=rowcontent>\r\n <td colspan=11>Sub Total Kantor</td> \r\n <td align=right>" . number_format($SUBTTL, 0, '.', ',') . "</td></tr>"; echo "<tr class=rowheader>\r\n <td colspan=11>TOTAL</td> \r\n <td align=right>" . number_format($ttl, 0, '.', ',') . "</td></tr> \r\n "; echo "</tbody>\r\n <tfoot>\r\n </tfoot>\r\n </table>\r\n <button onclick=simpanCatu()>" . $_SESSION['lang']['save'] . "</button>"; } else { if ($_POST['aksi'] == 'simpan' or $_POST['aksi'] == 'replace') { if ($_POST['aksi'] == 'simpan') { //periksa dulu apakah sudah ada atau sdah posting $str = "select posting from " . $dbname . ".sdm_catu where kodeorg='" . $kodeorg . "' \r\n and periodegaji='" . $periode . "' order by posting desc \r\n limit 1"; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { if ($bar->posting == '1') { $stat = '1'; } elseif ($bar->posting == '0') { $stat = '0'; } else { $stat = ''; } } if ($stat != '') { exit($stat); } } $ttl = 0; $stsimpan = ''; foreach ($kamusKar as $key => $val) { if ($rupiahCatu[$key] > 0) { if ($no == 0) { $stsimpan = " \r\n insert into " . $dbname . ".sdm_catu(\r\n kodeorg, \r\n subbagian,\r\n periodegaji, \r\n karyawanid, \r\n hargacatu, \r\n jumlahhk, \r\n catuperhk, \r\n totalcatu, \r\n jumlahrupiah, \r\n posting, \r\n updateby)\r\n values(\r\n '" . $kodeorg . "',\r\n '" . $kamusKar[$key]['subbagian'] . "', \r\n '" . $periode . "',\r\n " . $key . ", \r\n " . $harga . ",\r\n " . $jumlahHK[$key] . ", \r\n " . $porsi[$kamusKar[$key]['kode']] . ",\r\n " . $jumlahHK[$key] * $porsi[$kamusKar[$key]['kode']] . ", \r\n " . $rupiahCatu[$key] . ",\r\n 0,\r\n " . $_SESSION['standard']['userid'] . " \r\n )"; } else { $stsimpan .= ",(\r\n '" . $kodeorg . "',\r\n '" . $kamusKar[$key]['subbagian'] . "', \r\n '" . $periode . "',\r\n " . $key . ", \r\n " . $harga . ",\r\n " . $jumlahHK[$key] . ", \r\n " . $porsi[$kamusKar[$key]['kode']] . ",\r\n " . $jumlahHK[$key] * $porsi[$kamusKar[$key]['kode']] . ", \r\n " . $rupiahCatu[$key] . ",\r\n 0,\r\n " . $_SESSION['standard']['userid'] . " \r\n )"; } $no += 1; } } $str = "delete from " . $dbname . ".sdm_catu where kodeorg='" . $kodeorg . "' and periodegaji='" . $periode . "'"; mysql_query($str); //hapus dulu yang ada if (mysql_query($stsimpan)) { } else { echo " Error: " . mysql_error($conn) . $stsimpan; } } } }
if ($pres == '') { $mangkir += 1; } // $pdf->Cell(2.7/100*$width,$height,$pres,'TRL',0,'L',1); } } $pdf->SetFillColor(255, 255, 255); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(2.7 / 100 * $width, $height, $hadir, 'TRL', 0, 'R', 1); $pdf->Cell(2.7 / 100 * $width, $height, $telat, 'TRL', 0, 'R', 1); $pdf->Cell(2.7 / 100 * $width, $height, $dinas, 'TRL', 0, 'R', 1); $pdf->Cell(2.7 / 100 * $width, $height, $cuti, 'TRL', 0, 'R', 1); $pdf->Cell(2.7 / 100 * $width, $height, $mangkir, 'TRL', 0, 'R', 1); $pdf->Ln(); // LINE KEDUA setIt($jabakar[$kar['id']], ''); $pdf->Cell(2 / 100 * $width, $height, '', 'BRL', 0, 'R', 1); $pdf->Cell(9.5 / 100 * $width, $height, $jabakar[$kar['id']], 'BRL', 0, 'L', 1); if (!empty($tanggaltanggal)) { foreach ($tanggaltanggal as $tang) { $pres = ''; if (isset($presensi[$kar['id']]['k' . $tang])) { $ontime = true; $pres .= substr($presensi[$kar['id']]['k' . $tang], 0, 5); if (substr($presensi[$kar['id']]['k' . $tang], 0, 5) >= '17:00') { // pulang ontime } else { $ontime = false; } if ($ontime) { $pdf->SetTextColor(0, 0, 0);
$sMan = "select a.nikmandor, b.namakaryawan from " . $dbname . ".kebun_aktifitas a\r\n\t\t\tleft join " . $dbname . ".datakaryawan b on a.nikmandor=b.karyawanid\r\n\t\t\twhere a.kodeorg = '" . $kebun . "' and b.subbagian like '%" . $divisi . "%' and a.nikmandor != '' and a.tanggal between '" . $tanggal . "' and '" . $tanggal2 . "'\r\n\t\t\tgroup by a.nikmandor\r\n\t\t\torder by b.namakaryawan"; // exit("error: ".$sMan); $qMan = mysql_query($sMan) or die(mysql_error($conn)); while ($rMan = mysql_fetch_assoc($qMan)) { $namamandor[$rMan['nikmandor']] = $rMan['namakaryawan']; } $str = "select a.*, b.*, c.namakaryawan from " . $dbname . ".kebun_kehadiran a\r\n left join " . $dbname . ".kebun_aktifitas b on a.notransaksi = b.notransaksi\r\n left join " . $dbname . ".datakaryawan c on a.nik = c.karyawanid\r\n where b.kodeorg like '" . $kebun . "%' and c.subbagian like '" . $divisi . "%' and b.nikmandor like '" . $mandor . "%' and b.nikmandor != '' and b.tanggal between '" . $tanggal . "' and '" . $tanggal2 . "' \r\n "; // exit("error: ".$str); $res = mysql_query($str); $stream .= "<table cellspacing='1' border='" . $border . "' class='sortable'>\r\n\t<thead>\r\n\t<tr class=rowheader>\r\n <td>" . $_SESSION['lang']['nomor'] . "</td>\r\n <td>" . $_SESSION['lang']['notransaksi'] . "</td> \r\n\t\t<td>" . $_SESSION['lang']['tanggal'] . "</td>\r\n\t\t<td>" . $_SESSION['lang']['namakaryawan'] . "</td>\r\n\t\t<td>" . $_SESSION['lang']['jhk'] . "</td>\r\n\t\t<td>" . $_SESSION['lang']['umr'] . "</td>\r\n\t\t<td>" . $_SESSION['lang']['insentif'] . "</td> \r\n\t</tr></thead>\r\n\t<tbody>"; $no = $jhk = $umr = $insentif = 0; while ($bar = mysql_fetch_object($res)) { $dzda[$bar->nikmandor] = $bar->nikmandor; setIt($dzdata[$bar->nikmandor]['jhk'], 0); setIt($dzdata[$bar->nikmandor]['umr'], 0); setIt($dzdata[$bar->nikmandor]['insentif'], 0); $dzdata[$bar->nikmandor]['mandor'] = $bar->nikmandor; $dzdata[$bar->nikmandor]['jhk'] += $bar->jhk; $dzdata[$bar->nikmandor]['umr'] += $bar->umr; $dzdata[$bar->nikmandor]['insentif'] += $bar->insentif; $niknotransaksi = $bar->nik . $bar->notransaksi; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['notransaksi'] = $bar->notransaksi; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['tanggal'] = $bar->tanggal; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['namakaryawan'] = $bar->namakaryawan; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['jhk'] = $bar->jhk; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['umr'] = $bar->umr; $dzdatadetail[$bar->nikmandor][$niknotransaksi]['insentif'] = $bar->insentif; $jhk += $bar->jhk; $umr += $bar->umr; $insentif += $bar->insentif; }
echo "<td align=right ><font color=red>" . number_format($arey[$tang . 'l'], 2) . "</font></td>"; echo "<td align=right ><font color=red>" . number_format($arey[$tang . 'h']) . "</font></td>"; } else { echo "<td align=right " . $dbg . " " . $tittle . ">" . number_format($arey[$tang . 'j']) . "</td>"; echo "<td align=right >" . number_format($arey[$tang . 'k'], 2) . "</td>"; echo "<td align=right >" . number_format($arey[$tang . 'l'], 2) . "</td>"; echo "<td align=right >" . number_format($arey[$tang . 'h']) . "</td>"; } setIt($total[$tang . 'j'], 0); setIt($total[$tang . 'k'], 0); setIt($total[$tang . 'l'], 0); setIt($total[$tang . 'h'], 0); setIt($totalj, 0); setIt($totalk, 0); setIt($totall, 0); setIt($totalh, 0); $total[$tang . 'j'] += $arey[$tang . 'j']; // tambahin total bawah $total[$tang . 'k'] += $arey[$tang . 'k']; // tambahin total bawah $total[$tang . 'h'] += $arey[$tang . 'h']; // tambahin total bawah $total[$tang . 'l'] += $arey[$tang . 'l']; // tambahin total bawah $totalj += $arey[$tang . 'j']; // tambahin total kanan $totalk += $arey[$tang . 'k']; // tambahin total kanan $totalh += $arey[$tang . 'h']; // tambahin total kanan $totall += $arey[$tang . 'l'];
$stream .= "<td align=center><font color=red>" . substr($isi, 8, 2) . "</font></td>"; foreach ($kdAfd as $afd) { setIt($bjr[$isi][$afd], ''); if ($bjr[$isi][$afd] == '') { $isiBjr = ""; } else { $isiBjr = $bjr[$isi][$afd]; } $stream .= "<td align=center>" . number_format((double) $isiBjr, 2) . "</td>"; } $stream .= "</tr>"; } else { $stream .= "<tr class=rowcontent>"; $stream .= "<td align=center>" . substr($isi, 8, 2) . "</font></td>"; foreach ($kdAfd as $afd) { setIt($bjr[$isi][$afd], ''); if ($bjr[$isi][$afd] == '') { $isiBjr = ""; } else { $isiBjr = $bjr[$isi][$afd]; } $stream .= "<td align=center>" . number_format((double) $isiBjr, 2) . "</td>"; } $stream .= "</tr>"; } } $stream .= "</thead>"; $stream .= "<tbody></table>"; switch ($proses) { ######PREVIEW case 'preview':
$tbgtjam = 0; $tab .= "<tr class=rowcontent>\r\n\t\t\t <td>" . $no . "</td>\r\n\t\t\t <td>" . $val . "</td>\r\n\t\t\t <td>" . $jenisvhc[$val] . "</td>\r\n <td>" . $nmJenis[$jenisvhc[$val]] . "</td>\r\n <td>" . $tahunperolehan[$val] . "</td>"; for ($kk = 1; $kk <= 12; $kk++) { if ($kk < 10) { $zz = $waktu . "-0" . $kk; } else { $zz = $waktu . "-" . $kk; } $color = 'bgcolor=green'; if (@($realHM[$zz][$val] / $real[$zz][$val]) < @($bgtjam[$zz][$val] / $bgtfis[$zz][$val])) { $color = 'bgcolor=red'; } setIt($real[$zz][$val], 0); setIt($realHM[$zz][$val], 0); setIt($bgtjam[$zz][$val], 0); setIt($bgtfis[$zz][$val], 0); $tab .= "<td align=right>" . number_format($real[$zz][$val], 2) . "</td><td align=right>" . number_format($realHM[$zz][$val], 2) . "</td><td " . $color . " align=right>" . @number_format($realHM[$zz][$val] / $real[$zz][$val], 2) . "</td><td align=right>" . number_format($bgtfis[$zz][$val], 2) . "</td><td align=right>" . number_format($bgtjam[$zz][$val], 2) . "</td><td align=right bgcolor=#dedede>" . @number_format($bgtjam[$zz][$val] / $bgtfis[$zz][$val], 2) . "</td>"; $treal += $real[$zz][$val]; $trealHM += $realHM[$zz][$val]; $tbgtfis += $bgtfis[$zz][$val]; $tbgtjam += $bgtjam[$zz][$val]; } #total $color = 'bgcolor=green'; if (@($trealHM / $treal) < @($tbgtjam / $tbgtfis)) { $color = 'bgcolor=red'; } $tab .= "<td align=right>" . number_format($treal, 2) . "</td><td align=right>" . number_format($trealHM, 2) . "</td><td " . $color . " align=right>" . @number_format($trealHM / $treal, 2) . "</td><td align=right>" . number_format($tbgtfis, 2) . "</td><td align=right>" . number_format($tbgtjam, 2) . "</td><td align=right bgcolor=#dedede>" . @number_format($tbgtjam / $tbgtfis, 2) . "</td>"; $tab .= "</tr>"; } $tab .= "</tbody><tfoot>\r\n </tfoot></table>";
$stream .= "</td>"; } $stream .= "<td bgcolor=#DEDEDE>Jumlah</td>"; if ($pilihan == 'rupiah') { // $stream.="indra"; $stream .= "<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['gaji'] . "</td>" . "<td bgcolor=#DEDEDE align=center>" . $_SESSION['lang']['persen'] . " " . $_SESSION['lang']['lembur'] . "</td>"; } $stream .= "=</tr></thead><tbody>"; // preview: nampilin data ================================================================================ foreach ($dzArr as $idkar => $qwe) { $no += 1; $stream .= "<tr class=rowcontent><td>" . $no . "</td>\r\n <td>" . $qwe['nm'] . "</td>\r\n <td>" . $qwe['sb'] . "</td>\r\n <td>" . $qwe['jb'] . "</td>\r\n <td>" . $qwe['bg'] . "</td>"; $zxc = 0; foreach ($test as $ar => $isi) { setIt($qwe[$isi], 0); setIt($asd[$isi], 0); if ($qwe[$isi] != 0) { if ($pilihan == 'rupiah') { $stream .= "<td align=right>" . number_format($qwe[$isi]) . "</td>"; } else { $stream .= "<td align=right>" . number_format($qwe[$isi], 1) . "</td>"; } } else { $stream .= "<td align=right></td>"; } $zxc += $qwe[$isi]; $asd[$isi] += $qwe[$isi]; } if ($pilihan == 'rupiah') { $stream .= "<td align=right>" . number_format($zxc) . "</td>"; $stream .= "<td>" . number_format($gajiPokok[$idkar]) . "</td>";
$koef = $optPT[$res['millcode']] == 'SMA' ? 12.5 : 7; if ($jmlhFraksi[$res['notransaksi']][$listFraksi] > $koef) { $jmlhFraksi[$res['notransaksi']][$listFraksi] = 0; } else { $jmlhFraksi[$res['notransaksi']][$listFraksi] = ($koef - $jmlhFraksi[$res['notransaksi']][$listFraksi]) * 0.3 * $res['beratbersih'] / 100; } } else { $jmlhFraksi[$res['notransaksi']][$listFraksi] = $jmlhFraksi[$res['notransaksi']][$listFraksi] * $res['beratbersih'] * $optPot[$listFraksi] / 100; } if ($listFraksi == 'A' || $listFraksi == 'B') { $stream .= "<td width=60 align=right>" . number_format($jmlhFraksi[$res['notransaksi']][$listFraksi], 2) . "</td>"; $stream .= "<td width=60 align=right>" . number_format($persendt[$res['notransaksi']][$listFraksi], 2) . "</td>"; } else { $stream .= "<td width=60 align=right>" . number_format($jmlhFraksi[$res['notransaksi']][$listFraksi], 2) . "</td>"; } setIt($subTotal[$listFraksi], 0); $subTotal[$listFraksi] += $jmlhFraksi[$res['notransaksi']][$listFraksi]; $j++; } $stream .= "<td align=right>" . number_format($res['persenBrondolan'], 2) . "</td>"; $stream .= "<td align=right>" . number_format($res['kgpotsortasi'], 2) . "</td>"; $stream .= "\t\r\n </tr>\r\n "; } $stream .= "<tr class=rowcontent><td colspan=6>" . $_SESSION['lang']['total'] . "</td>\r\n <td align=right>" . number_format($subTotal['beratmasuk'], 2) . "</td>\r\n <td align=right>" . number_format($subTotal['beratkeluar'], 2) . "</td>\r\n <td align=right>" . number_format($subTotal['beratbersih'], 2) . "</td>\r\n <td align=right>" . number_format($subTotal['jmlhTndn'], 2) . "</td>\r\n <td align=right> </td>\r\n <td align=right>" . number_format($subTotal['jjgSortasitot'], 2) . "</td>\r\n <td align=right> </td>\r\n "; $sFraksi = "select kode from " . $dbname . ".pabrik_5fraksi2 order by kode asc"; $qFraksi = mysql_query($sFraksi) or die(mysql_error()); while ($rFraksi = mysql_fetch_assoc($qFraksi)) { if ($rFraksi['kode'] == 'A' || $rFraksi['kode'] == 'B') { $stream .= "<td align=right>" . number_format($subTotal[$rFraksi['kode']], 2) . "</td>"; $stream .= "<td align=right> </td>"; } else {
$tglTtd = explode("-", $tlgKontrk); $tglnya = $tglTtd[0]; $blnnya = numToMonth($tglTtd[1], $lang = 'I', $format = 'long'); $thnnya = $tglTtd[2]; $tglbenernya = $tglnya . ' ' . $blnnya . ' ' . $thnnya; $pdf->Cell(39, 5, ucwords(strtolower('Jakarta')) . ", " . $tglbenernya, '', 0, 'L'); $pdf->Ln(); $pdf->Cell(20, 5, '', 0, 'L'); $pdf->Cell(12, 5, $_SESSION['lang']['penjual'] . ',', '', 0, 'L'); $pdf->Cell(80, 5, '', '', 0, 'L'); $pdf->Cell(18, 5, $_SESSION['lang']['Pembeli'] . ',', '', 1, 'L'); $pdf->SetFont('Arial', 'B', '10'); $pdf->Cell(20, 5, '', 0, 'L'); $nmPt = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi'); $nmPtS = explode(".", $nmPt[$bar['kodept']]); setIt($nmPtS[1], ''); $pdf->Cell(80, 5, $nmPtS[0] . "." . ucwords(strtolower($nmPtS[1])), '', 0, 'C'); //$pdf->Cell(80,5,$nmdt2[0].".".ucwords(strtolower($nmdt2[1])),'',1,'C'); $pdf->Cell(80, 5, $nmdt2[0] . "." . $nmdt2[1], '', 1, 'C'); $jabatanTtd = makeOption($dbname, 'pmn_5ttd', 'nama,jabatan'); $namaTtdBeli = makeOption($dbname, 'pmn_4customer', 'kodecustomer,penandatangan'); $jabTtdBeli = makeOption($dbname, 'pmn_4customer', 'kodecustomer,jabatan'); $pdf->Ln(25); $pdf->SetFont('Arial', 'BU', '10'); $pdf->Cell(20, 5, '', 0, 'L'); $pdf->Cell(80, 5, ucwords(strtolower($bar['penandatangan'])), '', 0, 'C'); $pdf->Cell(80, 5, ucwords(strtolower($namaTtdBeli[$bar['koderekanan']])), '', 1, 'C'); $pdf->SetFont('Arial', 'B', '10'); $pdf->Cell(20, 5, '', 0, 'L'); $pdf->Cell(80, 5, ucwords(strtolower($jabatanTtd[$bar['penandatangan']])), '', 0, 'C'); $pdf->Cell(80, 5, ucwords(strtolower($jabTtdBeli[$bar['koderekanan']])), '', 1, 'C');
$jumlahnotif += 1; $modulenotif[$tipetransaksi] = $tipetransaksi; $modulenotifextras[$tipetransaksi]['jumlah'] += 1; $modulenotifextras[$tipetransaksi]['note'] .= $bar->notransaksi . "; "; $modulenotifextras[$tipetransaksi]['title'] = "[" . $bahasa['posting'] . " " . $bahasa['traksi'] . "] " . $bahasa['pekerjaan']; $modulenotifextras[$tipetransaksi]['file'] = 'vhc_postingPekerjaan'; } // transaksi VHC service yang belum diposting $str = "SELECT * FROM " . $dbname . ".vhc_penggantianht\r\n WHERE kodeorg like '" . $lokasitugas . "%' and posting = 0 and tanggal between '" . $tanggal1 . "' and '" . $tanggal2 . "' "; //echo $str; $res = mysql_query($str); while ($bar = mysql_fetch_object($res)) { $tipetransaksi = "vhcserv"; $jumlahnotif += 1; setIt($modulenotifextras[$tipetransaksi]['jumlah'], 0); setIt($modulenotifextras[$tipetransaksi]['note'], ''); $modulenotif[$tipetransaksi] = $tipetransaksi; $modulenotifextras[$tipetransaksi]['jumlah'] += 1; $modulenotifextras[$tipetransaksi]['note'] .= $bar->notransaksi . "; "; $modulenotifextras[$tipetransaksi]['title'] = "[" . $bahasa['posting'] . " " . $bahasa['traksi'] . "] " . $bahasa['service']; $modulenotifextras[$tipetransaksi]['file'] = 'vhc_postingPenggunaanKomponen'; } // lembur yang belum diposting // $str="SELECT * FROM ".$dbname.".sdm_lemburht // WHERE kodeorg like '".$lokasitugas."%' and posting = 0 and tanggal between '".$tanggal1."' and '".$tanggal2."' "; // //echo $str; // $res=mysql_query($str); // while($bar=mysql_fetch_object($res)) // { // $tipetransaksi="lembur"; // $jumlahnotif+=1;
$pdf->SetFillColor(220, 220, 220); $pdf->Cell(20 / 100 * $width, $height, "B.External", 1, 0, 'L', 1); $pdf->Cell($coldt / 100 * $width, $height, " ", 1, 1, 'L', 1); $pdf->SetFont('Arial', '', 6); if (!empty($tbsExt)) { $pdf->SetFillColor(255, 255, 255); if (!empty($tbsExt)) { foreach ($tbsExt as $suppid => $art) { $no += 1; $pdf->Cell(5 / 100 * $width, $height, " ", 1, 0, 'L', 1); $pdf->Cell(2 / 100 * $width, $height, $no, 1, 0, 'L', 1); $pdf->Cell(13 / 100 * $width, $height, $optSupp[$suppid], 1, 0, 'L', 1); $tt = 0; if (!empty($TGL)) { foreach ($TGL as $kei => $tang) { setIt($art[$tang], 0); $pdf->Cell(9 / 100 * $width, $height, number_format($art[$tang]), 1, 0, 'R', 1); } } $pdf->Cell(9 / 100 * $width, $height, number_format($tottbsExt[$suppid]), 1, 1, 'R', 1); // $ttExt+=$tottbsExt[$suppid]; } } } $pdf->SetFillColor(220, 220, 220); #total External $pdf->Cell(20 / 100 * $width, $height, "Total External (B)", 1, 0, 'L', 1); if (!empty($TGL)) { foreach ($TGL as $key => $tg) { $pdf->Cell(9 / 100 * $width, $height, number_format($tExt[$tg]), 1, 0, 'R', 1); // $ttExt+=$tExt[$tg];
$subTotal[$afd]['costvhc1'] += $row1['costvhc1']; $subTotal[$afd]['costvhc2'] += $row1['costvhc2']; $subTotal[$afd]['costtotal1'] += $row1['costtotal1']; $subTotal[$afd]['costtotal2'] += $row1['costtotal2']; $subTotal[$afd]['costharv1'] += $row1['costharv1']; $subTotal[$afd]['costharv2'] += $row1['costharv2']; $subTotal[$afd]['brondolan1'] += $row1['brondolan1']; $subTotal[$afd]['brondolan2'] += $row1['brondolan2']; $subTotal[$afd]['brondolanpercent1'] += $row1['brondolanpercent1']; $subTotal[$afd]['brondolanpercent2'] += $row1['brondolanpercent2']; setIt($subTotal[$afd]['tbs11'], 0); setIt($subTotal[$afd]['tbs12'], 0); setIt($subTotal[$afd]['tbs21'], 0); setIt($subTotal[$afd]['tbs22'], 0); setIt($subTotal[$afd]['bjr1'], 0); setIt($subTotal[$afd]['bjr2'], 0); $subTotal[$afd]['tbs11'] += $row1['tbs11']; $subTotal[$afd]['tbs12'] += $row1['tbs12']; $subTotal[$afd]['tbs21'] += $row1['tbs21']; $subTotal[$afd]['tbs22'] += $row1['tbs22']; //$subTotal[$afd]['bjr1']+=$row1['bjr1']; //$subTotal[$afd]['bjr2']+=$row1['bjr2']; $grandtotal['hamature'] += $row1['hamature']; $grandtotal['haharvest'] += $row1['haharvest']; $grandtotal['habudget'] += $row1['habudget']; $grandtotal['haavg'] += $row1['haavg']; $grandtotal['jumlahpokok'] += $row1['jumlahpokok']; $grandtotal['pokokperha'] += $row1['pokokperha']; $grandtotal['luaspanen'] += $row1['luaspanen']; $grandtotal['harvestround'] += $row1['harvestround']; $grandtotal['mandays11'] += $row1['mandays11'];
$this->Ln(); } } //================================ $pdf = new PDF('L', 'mm', 'A4'); $pdf->AddPage(); $sal_awal = 0; $sal_debet = 0; $sal_kredit = 0; $sal_salak = 0; foreach ($TAB as $baris => $data) { $no += 1; setIt($data['sawal'], 0); setIt($data['debet'], 0); setIt($data['kredit'], 0); setIt($data['salak'], 0); $pdf->Cell(15, 5, $no, 0, 0, 'C'); $pdf->Cell(20, 5, $data['noakun'], 0, 0, 'L'); $pdf->Cell(160, 5, $data['namaakun'], 0, 0, 'L'); $pdf->Cell(20, 5, number_format($data['sawal'], 2), 0, 0, 'R'); $pdf->Cell(20, 5, number_format($data['debet'], 2), 0, 0, 'R'); $pdf->Cell(20, 5, number_format($data['kredit'], 2), 0, 0, 'R'); $pdf->Cell(20, 5, number_format($data['salak'], 2), 0, 1, 'R'); $sal_awal += $data['sawal']; $sal_debet += $data['debet']; $sal_kredit += $data['kredit']; $sal_salak += $data['salak']; } $pdf->Cell(195, 5, 'T O T A L', 0, 0, 'C'); $pdf->Cell(20, 5, number_format($sal_awal, 2), 0, 0, 'R'); $pdf->Cell(20, 5, number_format($sal_debet, 2), 0, 0, 'R');
$tab .= "<td " . $bgcoloraja . ">" . $_SESSION['lang']['taksasi'] . " (JJG)</td>"; $tab .= "<td " . $bgcoloraja . ">" . $_SESSION['lang']['panen'] . " (JJG)</td>"; $tab .= "<td " . $bgcoloraja . ">" . $_SESSION['lang']['selisih'] . " (%)</td>"; } $tab .= "</tr> \r\n </thead>\r\n <tbody>"; foreach ($listafdeling as $laf) { $tab .= "<tr class=rowcontent>"; $tab .= "<td align=center>" . $laf . "</td>"; for ($i = 1; $i <= $tanggalterakhir; $i++) { if (strlen($i) == 1) { $ii = '0' . $i; } else { $ii = $i; } setIt($janjangtaksasi[$laf][$periode . '-' . $ii], 0); setIt($janjangpanen[$laf][$periode . '-' . $ii], 0); $tab .= "<td>" . number_format($janjangtaksasi[$laf][$periode . '-' . $ii]) . "</td>"; $tab .= "<td>" . number_format($janjangpanen[$laf][$periode . '-' . $ii]) . "</td>"; @($selisih = abs($janjangtaksasi[$laf][$periode . '-' . $ii] - $janjangpanen[$laf][$periode . '-' . $ii]) / $janjangtaksasi[$laf][$periode . '-' . $ii] * 100); if ($selisih > 10) { $warna = " bgcolor=red"; } else { $warna = ""; } $tab .= "<td align=right" . $warna . ">" . number_format($selisih, 2) . "</td>"; } $tab .= "</tr>"; } // foreach($dzArr as $datanya){ // $tab.="<tr class=rowcontent>"; // if($proses!='excel')$tab.="<td align=right>".tanggalnormal($datanya['tanggal'])."</td>";
$totjjgsmpng[$lstIntex] += $totsmpngjjg[$lstIntex . $lsdtSup]; } } if (!isset($drt) or $drt != $lstIntex) { $drt = $lstIntex; $tab .= "<tr bgcolor=darkblue><td><font color=white>" . $intex[$lstIntex] . "</font></td>"; foreach ($dateDt as $ar => $isi) { $tab .= "<td align=right bgcolor=MediumBlue><font color=white>" . number_format($totInKg[$lstIntex . $isi], 0) . "</font></td>"; $tab .= "<td align=right bgcolor=darkblue><font color=white>" . number_format($totInJjg[$lstIntex . $isi], 0) . "</font></td>"; } $tab .= "<td align=right bgcolor=MediumBlue><font color=white>" . number_format($totkgsmpng[$lstIntex], 0) . "</font></td>"; $tab .= "<td align=right><font color=white>" . number_format($totjjgsmpng[$lstIntex], 0) . "</font></td>"; $tab .= "</tr>"; } setIt($totSmaKg, 0); setIt($totSmaJjg, 0); $totSmaKg += $totkgsmpng[$lstIntex]; $totSmaJjg += $totjjgsmpng[$lstIntex]; } $tab .= "<tr bgcolor=darkgreen><td><font color=white>" . $_SESSION['lang']['total'] . "</font></td>"; foreach ($dateDt as $ar => $isi) { $tab .= "<td align=right bgcolor=Green><font color=white>" . number_format($totKg[$isi], 0) . "</font></td>"; $tab .= "<td align=right><font color=white>" . number_format($totJjg[$isi], 0) . "</font></td>"; } $tab .= "<td align=right bgcolor=Green><font color=white>" . number_format($totSmaKg, 0) . "</font></td>"; $tab .= "<td align=right><font color=white>" . number_format($totSmaJjg, 0) . "</font></td>"; $tab .= "</tr></tbody></table>"; } } else { $tab .= "<tr class=rowcontent><td colspan=10 align=center>Data empty</td></tr>"; }
setIt($oerpkTotal, 0); setIt($siKps, 0); $tbsSd = $tbs[$bar->kodeorg][$tglServ . $agl + 1]; $tbsSd2 = $tbs[$bar->kodeorg][$bar->tanggal]; $tbsTot = $tbsSd2 + $tbsSd; $des += $tbsTot; //get cpo setIt($jmOer[$bar->kodeorg][$tglServ . $agl + 1], 0); setIt($jmOer[$bar->kodeorg][$bar->tanggal], 0); $oerSd = $jmOer[$bar->kodeorg][$tglServ . $agl + 1]; $oerSd2 = $jmOer[$bar->kodeorg][$bar->tanggal]; $oerTot = $oerSd2 + $oerSd; $oerTotal += $oerTot; //get pk setIt($jmOerPk[$bar->kodeorg][$tglServ . $agl + 1], 0); setIt($jmOerPk[$bar->kodeorg][$bar->tanggal], 0); $oerpkSd = $jmOerPk[$bar->kodeorg][$tglServ . $agl + 1]; $oerpkSd2 = $jmOerPk[$bar->kodeorg][$bar->tanggal]; $oerpkTot = $oerpkSd + $oerpkSd2; $oerpkTotal += $oerpkTot; @($kpsitas = $bar->tbsdiolah / $rPengolahan['jampengolahan'] / 1000); $siKps += $rPengolahan['jampengolahan']; // exit("Error:".substr($bar->tanggal,-2)); if ($ared == 1) { $olhShi = $kpsitas; @($oershi = $oerTotal / $bar->tbsdiolah * 100); @($oerpkshi = $oerpkTotal / $bar->tbsdiolah * 100); } else { @($olhShi = $des / $siKps / 1000); @($oershi = $oerTotal / $des * 100); @($oerpkshi = $oerpkTotal / $des * 100);
$tgapok['11'] += $dJMS[$karid]['gapok']['11']; $tgapok['12'] += $dJMS[$karid]['gapok']['12']; $tgapok['total'] += $dJMS[$karid]['gptahunan']; setIt($ttj['01'], 0); setIt($ttj['02'], 0); setIt($ttj['03'], 0); setIt($ttj['04'], 0); setIt($ttj['05'], 0); setIt($ttj['06'], 0); setIt($ttj['07'], 0); setIt($ttj['08'], 0); setIt($ttj['09'], 0); setIt($ttj['10'], 0); setIt($ttj['11'], 0); setIt($ttj['12'], 0); setIt($ttj['total'], 0); $ttj['01'] += $dzArr[$karid]['01'] - $dJMS[$karid]['gapok']['01']; $ttj['02'] += $dzArr[$karid]['02'] - $dJMS[$karid]['gapok']['02']; $ttj['03'] += $dzArr[$karid]['03'] - $dJMS[$karid]['gapok']['03']; $ttj['04'] += $dzArr[$karid]['04'] - $dJMS[$karid]['gapok']['04']; $ttj['05'] += $dzArr[$karid]['05'] - $dJMS[$karid]['gapok']['05']; $ttj['06'] += $dzArr[$karid]['06'] - $dJMS[$karid]['gapok']['06']; $ttj['07'] += $dzArr[$karid]['07'] - $dJMS[$karid]['gapok']['07']; $ttj['08'] += $dzArr[$karid]['08'] - $dJMS[$karid]['gapok']['08']; $ttj['09'] += $dzArr[$karid]['09'] - $dJMS[$karid]['gapok']['09']; $ttj['10'] += $dzArr[$karid]['10'] - $dJMS[$karid]['gapok']['10']; $ttj['11'] += $dzArr[$karid]['11'] - $dJMS[$karid]['gapok']['11']; $ttj['12'] += $dzArr[$karid]['12'] - $dJMS[$karid]['gapok']['12']; $ttj['total'] += $dzArr[$karid]['total'] - $dJMS[$karid]['gptahunan']; } }
} // ambil data mutasi kurang $sCek = "select blok, sum(pokokmati) as kurang from " . $dbname . ".kebun_rencanasisip where blok like '" . $kdOrg . "%' and periode like '" . $periode . "%'\r\n and posting = '1'\r\n group by blok order by blok"; $qCek = mysql_query($sCek) or die(mysql_error()); while ($rCek = mysql_fetch_assoc($qCek)) { $kurang[$rCek['blok']] = $rCek['kurang']; } $masihadasalah = false; if (!empty($listkodeorg)) { foreach ($listkodeorg as $daftar) { setIt($luasareaproduktif[$daftar], 0); setIt($luasareanonproduktif[$daftar], 0); setIt($tambah[$daftar], 0); setIt($kurang[$daftar], 0); setIt($jumlahpokokcek[$daftar], 0); setIt($jumlahpokoklalu[$daftar], 0); $luasareaproduktif1[$daftar] = $luasareaproduktif[$daftar]; $luasareanonproduktif1[$daftar] = $luasareanonproduktif[$daftar]; $jumlahpokok1[$daftar] = $jumlahpokok[$daftar] + $tambah[$daftar] - $kurang[$daftar]; if (number_format($jumlahpokoklalu[$daftar]) == 0) { // blok baru, ambil langsung dari setup blok... by pass itung2an $jumlahpokok1[$daftar] = $jumlahpokokcek[$daftar]; } if ($tahun1 - $tahuntanam[$daftar] >= 3) { // TM, umur tahun depan >= 3 $statusblok1[$daftar] = 'TM'; } else { if ($tahun1 == $tahuntanam[$daftar]) { // TB // umur tahun depan = tahun... tak mungkin terjadi? $statusblok1[$daftar] = 'TB'; } else {
if ($_SESSION['empl']['tipelokasitugas'] == 'KANWIL') { if ($_SESSION['empl']['regional'] == 'SULAWESI') { $sDet = "select * from " . $dbname . ".sdm_potongandt where periodegaji='" . $param['periode'] . "' " . "and kodeorg in (select distinct kodeunit from " . $dbname . ".bgt_regional_assignment where regional='" . $_SESSION['empl']['regional'] . "')\r\n\t\t\t\t\t and tipepotongan='" . $param['tipePot'] . "' order by nik asc"; // echo $str;exit(); } else { $sDet = "select * from " . $dbname . ".sdm_potongandt where periodegaji='" . $param['periode'] . "' " . "and kodeorg in (select distinct kodeunit from " . $dbname . ".bgt_regional_assignment where regional='" . $_SESSION['empl']['regional'] . "')\r\n\t\t\t\t\t and tipepotongan='" . $param['tipePot'] . "' and updateby='" . $_SESSION['standard']['userid'] . "' order by nik asc"; // echo $str;exit(); } } else { $sDet = "select * from " . $dbname . ".sdm_potongandt where periodegaji='" . $param['periode'] . "' " . "and kodeorg='" . $_SESSION['empl']['lokasitugas'] . "'\r\n\t\t\t\t and tipepotongan='" . $param['tipePot'] . "' and updateby='" . $_SESSION['standard']['userid'] . "' order by nik asc"; } $qDet = mysql_query($sDet) or die(mysql_error($conn)); $tot = 0; while ($rDet = mysql_fetch_assoc($qDet)) { $no += 1; setIt($optNmKar[$rDet['updateby']], ''); $tab .= "<tr class=rowcontent>"; $tab .= "<td>" . $no . "</td>"; $tab .= "<td>" . $optNikKar[$rDet['nik']] . "</td>"; $tab .= "<td>" . $optNmKar[$rDet['nik']] . "</td>"; $tab .= "<td align=right>" . number_format($rDet['jumlahpotongan'], 0) . "</td>"; $tab .= "<td>" . $rDet['keterangan'] . "</td>"; $tab .= "<td>" . $optNmKar[$rDet['updateby']] . "</td>"; $tab .= "<td>\r\n\t\t\t\t<img src=images/application/application_edit.png class=resicon title='Edit' onclick=\"editDetail('" . $rDet['nik'] . "','" . $rDet['jumlahpotongan'] . "','" . $rDet['keterangan'] . "');\">\r\n\t\t\t\t<img src=images/application/application_delete.png class=resicon title='Delete' onclick=\"delDetail('" . $rDet['kodeorg'] . "','" . $rDet['periodegaji'] . "','" . $rDet['nik'] . "','" . $rDet['tipepotongan'] . "');\" >\t</td>"; $tab .= "</tr>"; $tot += $rDet['jumlahpotongan']; } $tab .= "<tr class=rowcontent>"; $tab .= "<td colspan=3>" . $_SESSION['lang']['total'] . "</td>"; $tab .= "<td align=right>" . number_format($tot, 0) . "</td><td colspan=3> </td></tr>"; echo $tab;
$stream .= "Periode : " . $periodegaji . "<br>"; $stream .= "Tipe Potongan : " . $optTipePot[$tipepotongan] . "<br>"; $stream .= "<br /><table class=sortable border=1 cellspacing=1>\r\n\t\t\t <thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['nourut'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['nik'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['namakaryawan'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['tipekaryawan'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['lokasitugas'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['potongan'] . "</td> \r\n\t\t\t\t\t<td align=center bgcolor=#CCCCCC>" . $_SESSION['lang']['keterangan'] . "</td>\r\n\t\t\t\t</tr>"; if ($_SESSION['empl']['tipelokasitugas'] == 'KANWIL') { $iDet = "select * from " . $dbname . ".sdm_potongandt where periodegaji='" . $periodegaji . "' " . "and kodeorg in (select distinct kodeunit from " . $dbname . ".bgt_regional_assignment where regional='" . $_SESSION['empl']['regional'] . "')\r\n and tipepotongan='" . $tipepotongan . "' order by nik asc"; // echo $str;exit(); } else { $iDet = "select * from " . $dbname . ".sdm_potongandt where periodegaji='" . $periodegaji . "' " . "and kodeorg='" . $_SESSION['empl']['lokasitugas'] . "'\r\n and tipepotongan='" . $tipepotongan . "' order by nik asc"; } $nDet = mysql_query($iDet) or die(mysql_error($conn)); $tot = 0; while ($dDet = mysql_fetch_assoc($nDet)) { $wh = "karyawanid='" . $dDet['nik'] . "'"; $optNik = makeOption($dbname, 'datakaryawan', 'karyawanid,nik', $wh); $optNm = makeOption($dbname, 'datakaryawan', 'karyawanid,namakaryawan', $wh); $optTp = makeOption($dbname, 'datakaryawan', 'karyawanid,tipekaryawan', $wh); $no += 1; $stream .= "<tr>\r\n\t\t\t\t\t\t<td>" . $no . "</td>\r\n\t\t\t\t\t\t<td>'" . $optNik[$dDet['nik']] . "</td>\r\n\t\t\t\t\t\t<td>" . $optNm[$dDet['nik']] . "</td>\r\n\t\t\t\t\t\t<td>" . $arrNmtp[$optTp[$dDet['nik']]] . "</td>\r\n\t\t\t\t\t\t<td>" . $dDet['kodeorg'] . "</td>\r\n\t\t\t\t\t\t<td>" . number_format($dDet['jumlahpotongan']) . "</td>\r\n\t\t\t\t\t\t<td>" . $dDet['keterangan'] . "</td>\r\n\t\t\t\t\t</tr>"; $tot += $dDet['jumlahpotongan']; } $stream .= "<tr>\r\n\t\t\t\t\t\t<td colspan=5>Total</td>\r\n\t\t\t\t\t\t<td colspan=1>" . number_format($tot) . "</td>\r\n\t\t\t\t\t</tr></table>"; $stream .= "</tbody></table>Print Time:" . date('YmdHis') . "<br>By:" . $_SESSION['empl']['name']; $dte = date("Hms"); setIt($dHead['kode'], ''); $nop_ = "Laporan_Potongan_" . $dHead['kode']; $gztralala = gzopen("tempExcel/" . $nop_ . ".xls.gz", "w9"); gzwrite($gztralala, $stream); gzclose($gztralala); echo "<script language=javascript1.2>\r\n\t\t window.location='tempExcel/" . $nop_ . ".xls.gz';\r\n\t\t </script>"; break; }