selamat siang master,
saya mau coba buat function checkall sama uncheckall tapi ga' bisa2,dan saya kurang paham salah dan masalah nya dimana,sekiranya abang2 sekalian bisa membantu buat mecahin masalah ini,ini scriptnya..
<?
session_start();

$namaHari=array(0=>"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$namaBulan=array(1=>"january","February","March","April","May","June","July","August","September","October","November","December");
	function tanggal()
	{
		global $namaHari;
		global $namaBulan;
		return $namaHari[date("w")].", ".$namaBulan[date("n")]." ".date("d").", ".date("Y");
	}
	function cekbox($cek)
	{
		if($cek=="")
		{
		echo("<script>alert('cekbox belum dipilih !');</script>");
		echo("<script>history.back();</script>");
		exit();
		}
	}
?>
<html>
<head>

<title>MY COMPANY</title>

<style type="text/css">
<!--
body {
	background-image: url(IMAGE/web-background.jpg);
}
-->
</style>
<style type="text/css" media="screen">
body {
font-family: "Lucida Grande",Verdana,sans-serif;
font-size: 11px;
line-height: 16px;
padding: 0px;
}

h2 {
margin-top: 0;
}

#wrapper {
	width: 420px;
	margin-left:1px;
	margin-top: 0;
	margin-right: auto;
	margin-bottom: 0;
}

.fader {
opacity: 0;
-moz-opacity: 0;
filter:alpha(opacity=0);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 60px;
background-color: #A4ADB7;
}

.clear {
clear: left;
}

#datacontent {
padding: 20px 10px;
}

#datacontent ul {
list-style: none;
margin: 0;
padding: 5px;
display: block;
height: 30px;
background: #DFDFDF;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
}

#datacontent li {
float: left;
}

#datacontent li a {
outline: 0;
display: block;
background: #DFDFDF;
color: #666;
text-decoration: none;
padding: 1px 5px;
margin: 5px;
border: 1px solid #DFDFDF;
}

#datacontent li a:hover {
border: 1px solid #D1D1D1;
background: #D1D1D1;
color: #000;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}

#datacontent li a.selected {
background: #AFAFAF;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border: 1px inset #fff;
color: #fff;
}

#datacontent .panels {
border: 1px solid #DFDFDF;
border-top: 0;
border-bottom: 10px solid #DFDFDF;
-moz-border-radius-bottomleft: 10px;
-moz-border-radius-bottomright: 10px;
-webkit-border-bottom-right-radius: 10px;
-webkit-border-bottom-left-radius: 10px;
overflow: hidden;
}

#datacontent .panelsInner {
overflow: hidden;
}

#datacontent .panel {
padding: 20px;
}
</style>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.11.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
        <style type="text/css">
<!--
.style6 {font-family: Tahoma}
.style12 {color: #CCCCCC}
.style13 {font-family: Tahoma; font-size: 12px; }
.style14 {font-size: 14px}
.style15 {font-size: 14px; font-weight: bold; }
.style16 {font-family: Tahoma; font-weight: bold; }
.style17 {
	font-family: "Times New Roman", Times, serif;
	font-size: medium;
	font-weight: bold;
}
.style21 {
	font-size: medium;
	font-weight: bold;
}
-->
        </style>
</head>

<?
  if($eksport)
  {
  $tombol='frm_report_salary_status.php';
  }
  else if($cari2)
  {
  $tombol='frm_report_salary.php';
  }
?>
	
<table width="113%" height="97%" border="0" align="center" cellpadding="0" cellspacing="0" id="table1">
  <tr>	
    <td height="52" valign="top" class="headmenu" background="IMAGE/pala.gif"> 
      <p align="right" ><font size="1" face="Arial, Helvetica, sans-serif"> <marquee width="100%" direction="left" scrollamount="1" align="center">
        <span class="style12">MY COMPANY </span>
      </marquee> 
          <span class="style12">&nbsp;          </span></font></p>    </td>
</tr>
<tr>

			
    <td height="30" nowrap>
<? 
	if (($JOBDESC=="ADMINISTRATOR")){
	include("head_admin.php");
	 } else if (($JOBDESC=="USER")){
	  include("head_user.php");
     } else if (($JOBDESC=="TEAMLEADER")){
	  include("head_TL.php"); 
     } else if (($JOBDESC=="MANAGEMENT")){
	  include("head_administrator.php"); }
    ?>
<!--------------------------------------------------------------------------->
<SCRIPT LANGUAGE="JavaScript">
function checkAll()
{
var field=document.forms["FORM"].elements["cek[]"];
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll()
{
var field=document.forms["FORM"].elements["cek[]"];
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
<?php
function rupiah($data)
 {
$rupiah = "";
$jml = strlen($data);

 while($jml > 3)
 {
$rupiah = "," . substr($data,-3) . $rupiah;
$l = strlen($data) - 3;
$data = substr($data,0,$l);
$jml = strlen($data);
 }
 $rupiah = $data . $rupiah ;
 return $rupiah;
 }
 ?>
 <?
  if($print)
  {
  $tombol='frm_report_salary_status.php';
  }
  else if($cari2)
  {
  $tombol='frm_report_salary.php';
  }
?>
 </script>
<div align="right" class="style2"><font size="1" face="Arial, Helvetica, sans-serif"><font size="2">
    </font></font> </div></td>
  </tr>

		
    <tr bgcolor="#999999"><td height="477"> 
	<form name = "form" method = "post" action = "<? echo ("$tombol") ?>">
	 <table width="531" align = "center" >
    <tr > 
      <td colspan="6" bgcolor="#FFFFFF"> 
        <div align="center"><span class="header_tabel style6 style14">Search</span> </div></td>
    </tr>    
    <tr class="isi_form"> 
      <td width="144" bgcolor="#CCCCCC"><div align="center" class="style13">Search By Client </div></td>
      <td width="19" bgcolor="#CCCCCC"><div align="center" class="style13">: </div></td>
      <td width="167" bgcolor="#CCCCCC"><div align="left" class="style13"> 
          <select name="lst_bank" size="1" id="lst_bank" >
		  <option value="" selected>[PILIH]</option>    
        <?	
		include("koneksi.php");		
	   //$hidd_hub_kntr="$row6[Ker_Hub_Info]";	
	  		  	
						$qry = @mysql_query("select DISTINCT BANK from tm_bank where Status='1'",$conn);						
						while ($row = mysql_fetch_array($qry))
						{	
						//$cek = cmb($hidd_hub_kntr,$row[Ms_NM]);		
						echo "<option value = '$row[BANK]'$cek>$row[BANK]</option>";
						}
		 ?>
		 
      </select>
        </div></td>
      <td width="89" bgcolor="#CCCCCC"><div align="center" class="style13"> Keyword </div></td>
      <td width="16" bgcolor="#CCCCCC"><div align="center" class="style13">:</div></td>
      <td width="227" bgcolor="#CCCCCC"> <div align="left" class="style13"> 
          <input name="txt_kata_kunci" type="text" size="21" maxlength="20">
          &nbsp; </div></td>
    </tr>
    <tr > 
      <td colspan="6" bgcolor="#FFFFFF" class="header_table"> <div align="center">
          <input name="cari2" type="submit" class="header_tabel" id="cari2" onClick="return cek();" value="Search">
		  <input name="eksport" type="submit" class="header_tabel" id="eksport" onClick="return cek();" value="Eksport">
        </div></td>
    </tr>
  </table>
</form>

  <table width="1236" border="0" align="center">
    <tr class="header_tabel"> 
      <td width="47" rowspan="2"  bgcolor="#FFFFFF" class="style15"><div align="center" class="style6" >No </strong></div></td>
      <td width="56" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style6" >check</div></td>
      <td width="123" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style15" >Agent Name</div></td>
      <td width="97" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style15" >Professiion</div></td>
      <td width="99" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style15" >Client</div></td>
	  <td width="110" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style15" >Joint date</div></td>
      <td colspan="3" bgcolor="#FFFFFF" class="style15"><div align="center">Salary</div></td>
      <td colspan="2" align="center" bgcolor="#FFFFFF" class="style15"><span class="style16">Jamsostek</span></td>
	  <td width="88" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >Take Home Pay  </div></td>
	  <td width="121" rowspan="2" bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >Total Cost Company </div></td>
    </tr>
    <tr class="header_tabel"> 
	<td width="96"  bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >Salary</div></td>
	  <td width="88" bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >Additional</div></td>
	  <td width="94"  bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >Deduction </div></td>
      <td width="88" bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" >By MOC 4,24  </div></td>
	  <td width="75" bgcolor="#FFFFFF" class="style15"><div align="center" class="style16" ><p>By Own 2% </p>
	    </div></td>
    </tr>
<?

 
	include("koneksi.php");
	
	$sqltgl=mysql_query("SELECT * FROM `tm_periode` ");
	$rowtgl=mysql_fetch_array($sqltgl);
	
	$sqlsal=mysql_query("SELECT * FROM `salary` where USERID='$USERID' ");
	$rowsal=mysql_fetch_array($sqlsal);
	
	$tgl = $rowtgl[start_date];
	$tgl2= $rowtgl[finish_date];
	
	$sql53="select Tanggal from absen where Tanggal between '$tgl' and '$tgl2' group by tanggal";
	$res53=mysql_query($sql53);
	$row53=mysql_num_rows($res53);
		
	$sql54="select * from tbl_holiday where Tanggal between '$tgl' and '$tgl2'";
	$res54=mysql_query($sql54);
	$row54=mysql_num_rows($res54);
		
	$aktifday=$row53-row54;		
	
	$sql4 = " select A.USERID,A.USERNAME,A.BANK,
	case when b.total is null then 0 else b.total end total, 
	case when d.total is null then 0 else d.total end total_i, 
	case when e.total is null then 0 else e.total end total_a,  
	case when f.total is null then 0 else f.total end total_t,
	case when C.total_c is null then 0 else C.total_c end total_c from 
	(select * from users where (JOBDESC='USER' or JOBDESC='TEAMLEADER') and status='0' ORDER BY USERNAME)A left join 
	(select userid,count(*) as total  from permit where Keterangan='IZIN' and Tanggal between '$tgl' and '$tgl2' group by userid)b on a.userid=b.userid left join 
	(select userid,count(*) as total  from permit where Keterangan='SAKIT' and Tanggal between '$tgl' and '$tgl2' group by userid)d on a.userid=d.userid left join 
	(select userid,count(*) as total  from permit where Keterangan='ALPHA' and Tanggal between '$tgl' and '$tgl2' group by userid)e on a.userid=e.userid left join 
	(select userid,count(*) as total  from absen where JamMasuk>'08:00:00' and Tanggal between '$tgl' and '$tgl2' group by userid)f on a.userid=f.userid left join
    (select userid,count(*) as total_c from absen where Tanggal between '$tgl' and '$tgl2'group by userid)c on a.userid=c.userid  order by A.BANK ";
	
	$sql5 = " select A.USERID,A.USERNAME,A.BANK,
	case when b.total is null then 0 else b.total end total, 
	case when d.total is null then 0 else d.total end total_i, 
	case when e.total is null then 0 else e.total end total_a,  
	case when f.total is null then 0 else f.total end total_t,
	case when C.total_c is null then 0 else C.total_c end total_c from 
	(select * from users where (JOBDESC='USER' or JOBDESC='TEAMLEADER') and status='0' and BANK='$lst_bank' ORDER BY USERNAME)A left join 
	(select userid,count(*) as total  from permit where Keterangan='IZIN' and Tanggal between '$tgl' and '$tgl2' group by userid)b on a.userid=b.userid left join 
	(select userid,count(*) as total  from permit where Keterangan='SAKIT' and Tanggal between '$tgl' and '$tgl2' group by userid)d on a.userid=d.userid left join 
	(select userid,count(*) as total  from permit where Keterangan='ALPHA' and Tanggal between '$tgl' and '$tgl2' group by userid)e on a.userid=e.userid left join 
	(select userid,count(*) as total  from absen where JamMasuk>'08:00:00' and Tanggal between '$tgl' and '$tgl2' group by userid)f on a.userid=f.userid left join
    (select userid,count(*) as total_c from absen where Tanggal between '$tgl' and '$tgl2'group by userid)c on a.userid=c.userid  order by A.BANK ";
	
	$res4=mysql_query($sql4);
	 if($cari2){
	$res4=mysql_query($sql5);
	 };
	
	$start = 0;
	$c=$start+1;
	
	while ($row4 = mysql_fetch_array($res4)){
	
	$userid=$row4[0];
	$sqlsal=mysql_query("SELECT * FROM `salary` where USERID='$userid' ");
	$rowsal=mysql_fetch_array($sqlsal);
	
	$sqlde=mysql_query("SELECT * FROM `deduction`");
	$rowde=mysql_fetch_array($sqlde);
	
	$tgl = $rowtgl[start_date];
	$tgl2= $rowtgl[finish_date];
	
	$sql53="select Tanggal from absen where Tanggal between '$tgl' and '$tgl2' group by tanggal";
	$res53=mysql_query($sql53);
	$row53=mysql_num_rows($res53);
					
	$sql54="select * from tbl_holiday where Tanggal between '$tgl' and '$tgl2'";
	$res54=mysql_query($sql54);
	$row54=mysql_num_rows($res54);
		
	$aktifday=$row53-row54;	
?>
 <? ////////////////////////////////////////////////////////////////SALARY/////////////////////////////////////////?>       
        <tr id="">
          <td width="47" bgcolor="#CCCCCC" class="style13"><div align="center" class="style16"><span class="style1 style6 "> <?php echo $c++; ?></span></div></td>
          <td width="56"  align="center" bgcolor="#CCCCCC" class="isi_tabel"><input name="cek[]"
		   type="checkbox" value="<?php echo("$row4[name]");?>" /></td>
		  <td bgcolor="#CCCCCC" class="style13"><div align="left"><? echo ("$row4[1]") ?></strong></div></td>
		  <td bgcolor="#CCCCCC" class="style13"><div align="center" ><? echo ("$row4[ss]") ?></strong></div></td>
		  <td bgcolor="#CCCCCC" class="style13"><div align="center" ><? echo ("$row4[2]") ?></strong></div></td>
		  <td bgcolor="#CCCCCC" class="style13"><div align="center" ><? echo ("$row4[SS]") ?></strong></div></td>
            <td width="96" bgcolor="#CCCCCC" class="style2"><div align="center"><span class="style1 style6">
              <?php 
	$Sal=$rowsal[SALARY]+$rowsal[MEAL]+$rowsal[TRANSPORT];		
	echo Rupiah($Sal);?> 
              </a>
          </span></strong></div></td>
<? ////////////////////////////////////////////////////////////////ADDITIONAL/////////////////////////////////////////?>
            <td width="88" bgcolor="#CCCCCC" class="style2"><div align="center" class="style8"><span class="style1">	
            <?
	$additional=mysql_query("SELECT *FROM `aditional_salary` WHERE `USERID` ='$row4[0]' ");
	$rowadd=mysql_fetch_array($additional);
	
	  if($rowadd[Add_1]=='1'&&$rowadd[Add_2]<>'1'){
	  $adition=$rowsal[Add1];		
	  echo Rupiah($adition); 
	  }
	   else if($rowadd[Add_2]=='1'&&$rowadd[Add_1]<>'1'){
	   $adition=$rowsal[Add2];
	   echo Rupiah($adition); 
	  } 
	  else if ($rowadd[Add_2]=='1'&&$rowadd[Add_1]=='1')
	  {$adition=$rowsal[Add1]+$rowsal[Add2];
	  echo Rupiah($adition); 
	  
	  }
	  ?>	
          </span></strong></div></td>
<? ////////////////////////////////////////////////////////////////DEDUCTION/////////////////////////////////////////?>
            <td width="94" bgcolor="#CCCCCC" class="style2">
<div align="center" class="style8"><span class="style1">
<?php
	$userid=$row4[0];
	$sql10="select a.*,b.* from permit a, tbl_holiday b where a.Tanggal=b.Tanggal and USERID='$userid' and a.Keterangan='ALPHA' and a.Tanggal between '$tgl' and '$tgl2'";
	$res10=mysql_query($sql10) or die (mysql_error());
	$row10=mysql_num_rows($res10);
	$ab='ALPHA';
	$absens=$row4[total_a];
	$sabtua=$row10;
	$row18=$absens-$sabtua;
	$Alphatot=$row18*$rowde[Alpha];
	$sql11="select a.*,b.* from absen a, tbl_holiday b where a.Tanggal=b.Tanggal and a.USERID='$userid' and a.JamMasuk>'08:00:00' and a.Tanggal between '$tgl' and '$tgl2'";
	$res11=mysql_query($sql11) or die (mysql_error());
	$row11=mysql_num_rows($res11);	
	$telat=$row4[total_t];
	$sabtut=$row11;
	$row19=$telat-$sabtut;
	$Latetot=$row19*$rowde[Late];
	$deduction=$Alphatot+$Latetot;
	echo Rupiah($deduction);
	?>

</span></strong></div>	</td>
            
<? ///////////////////////////////////////////////////////////////JAMSOSTEK MOC/////////////////////////////////?>
<td width="88" bgcolor="#CCCCCC" class="style2">
    <div align="center" class="style8"><span class="style1">
    <? 
 if($rowadd[Jamsos]
 =='1'){
$JamsosMOC=$rowsal[Jamsostek_based]*$rowde[Jamsostek_MOC]/100;
echo Rupiah($JamsosMOC);}?> 
	</span></strong></div>	</td>
<? /////////////////////////////////////////////////////////////JAMSOSTEK OWN/////////////////////////////////////?>
            <td width="75" bgcolor="#CCCCCC" class="style2">           
              <div align="center" class="style8"><span class="style1">
              <?  if($rowadd[Jamsos]=='1'){
$JamsosOWN=$rowsal[Jamsostek_based]*$rowde[Jamsostek_own]/100;
echo Rupiah($JamsosOWN);}?> 
          </span></strong></div>	</td>
<? ////////////////////////////////////////////////////////////////TAKE HOME PAY/////////////////////////////////////////?>	
            <td width="88" bgcolor="#CCCCCC" class="style2">
	           
	           
              <div align="center" class="style8"><span class="style1">
              <?php 
	$takehomepay=$Sal+$adition-$deduction-$JamsosOWN;
	echo Rupiah($takehomepay);
	

	?>
          </span></strong></div>	</td>
<? ////////////////////////////////////////////////////////////////TOTAL COST COMPANY////////////////////////////////////////?>		
	 <td width="121" bgcolor="#CCCCCC" class="style2">
	           
	           
              <div align="center" class="style8"><span class="style1">
              <?php 
	$TOTALCOS=$Sal+$adition-$deduction-$JamsosOWN+$JamsosMOC;
	echo Rupiah($TOTALCOS);
	

	?>
          </span></strong></div>	</td>
        </tr>     
    <?
	?>
<tr> 

<td colspan="2%" bgcolor="#FFFFFF" class="m0l1oout"><div align="center" class="style13">
  <div align="center"><span class="style17"><a href="#" class="style15" onClick="javascript:return checkAll()">check all</a></span></div></td>
<td colspan="1%" bgcolor="#FFFFFF" class="m0l1oout"><div align="center" class="style13">
  <div align="center"><a href="#" class="style15" onClick="return uncheckAll()">uncheck all</a></div></td>
 <td colspan="1" bgcolor="#FFFFFF" class="m0l1oout"> <div align="center">
		  <input name="print" type="submit" class="style14" id="print" onClick="return checkall();" value="Print">
        </div></td>
	<?
	}
	?>

      </table>
	
    <tr class="header_tabel"> 
      <td height="12" colspan="10" bgcolor="#FFFFFF"></td>
    </tr>
	
</table>  
  
</form>

	 </td>
	
	
	
	<tr>			
    <td height="17" class='header' align="center"><span style="font-weight: bold"><FONT style="FONT-SIZE: 10pt" face=Tahoma > 
      <font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">Copryright 2011      </font></FONT></span><font size="1" face="Arial, Helvetica, sans-serif"><font size="1" face="Arial, Helvetica, sans-serif">&nbsp;</font><div>    </td>
	</tr>
	
</table>


</html>
begitu scriptnya,tolong dibantu ya mas,
terima kasih banyak sebelumnya :)
Silahkan login untuk menjawab!
0
Loading...
Ellyx Christian · Jul 7, 2012 · 0 Suka · 0 Tidak Suka
pake saja jquery
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
function checkAll()
{
$(':checkbox').attr('checked', 'checked');
}

function uncheckAll()
{
$(':checkbox').removeAttr('checked');
}