Yii Framework Forum: [Ask] Tabel Kolom Untuk Report Absensi - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Ask] Tabel Kolom Untuk Report Absensi Rate Topic: -----

#1 User is offline   dst34m 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 07-November 12

Posted 26 July 2014 - 10:38 AM

need help masta..
ada yang pernah bikin tampilan report kyk di bawah ini g??

ane lg bikin kyk gtu, masih terkendala untuk menampilkan masing2 data absensi yang berdasarkan criteria tanggalnya,
untuk coding nya ane bikint kyk gini :

<h1>Rekap Absensi Bulanan</h1>

<hr>



<div class="row-fluid">
    <div class="span3">


    </div>

    <div class="span9">
        <form class="form" method="post" action="">
            <div class="row-fluid">
                <div class="span4">
                    <b>From</b><br>
                    <input type="date" name="start_date" value="<?php echo isset($_POST['ATT_DATE']) ? $_POST['ATT_DATE'] : ''; ?>"> 
                </div>
                <div class="span1">
                    <br>
                </div>
                <div class="span4">
                    <b>To</b><br>
                    <input type="date" name="end_date" value="<?php echo isset($_POST['ATT_END_DATE']) ? $_POST['ATT_END_DATE'] : ''; ?>"> 
                </div>
            </div>

<!--<select>
    <option value="<?php //CHtml::listData(OFFICE::model()->findAll(), 'OFFICE_ID', 'OFFICE_NAME'); ?>"></option>
</select>-->
            <div class="row-fluid">
                <b>Kantor</b><br>
<?php echo TbHtml::dropDownList('$model', 'ATT_OFFICE_ID', CHtml::listData(OFFICE::model()->findAll(), 'OFFICE_ID', 'OFFICE_NAME'), array('empty' => '--- Pilih Kantor ---')); ?>
            </div>
<?php echo TbHtml::submitButton('Rekap', array('color' => TbHtml::BUTTON_COLOR_PRIMARY)); ?>
        </form>
    </div>


</div>
<?php
	$no = 0;
    $link= Yii::app()->getDb();
    
    $start = isset($_POST['start_date']) ? date("d-m-y",strtotime($_POST['start_date'])) : date("d-m-y");
    
    $end = isset($_POST['end_date']) ? date("d-m-y",strtotime($_POST['end_date'])) : date("d-m-y");
	
	$office = isset($_POST['ATT_OFFICE_ID']) ;
    
    $date='Q.ATT_DATE';
    $rekap = 'ATT."QueryRekapAbsensi" Q';
    $sql = "SELECT * FROM ".$rekap." WHERE ".$date." BETWEEN '".$start."' AND '".$end."'";
	
	/*list($day, $month, $year)=explode ('-',$start);
	$dateStart = mktime($day,$month,$year,1,1,1);
	
	list($day, $month, $year)=explode ('-',$end);
	$dateEnd = mktime($day,$month,$year,1,1,1);*/
	
	$data1 = explode("-", $start);
	$tanggal_1=$data1[0];
	$bulan_1=$data1[1];
	$tahun_1=$data1[2];
	
	$data2 = explode("-", $end);
	$tanggal_2=$data2[0];
	$bulan_2=$data2[1];
	$tahun_2=$data2[2];
	
	$from= GregorianToJD ($bulan_1,$tanggal_1,$tahun_1);
	$to= GregorianToJD ($bulan_2,$tanggal_2,$tahun_2);
	
	$distance = ($to - $from)+1;
	
	$command = $link->createCommand($sql);
	$results = $command->queryAll();
	
	//echo $distance;
	?>
	
<p>Periode : <?php echo '$start'-'$end' ?>	</p>
<table class="table-bordered table-striped table-condensed">

    <tr rowspan="2">
        <td style="border: 1px solid; width: 20mm; text-align: center;" rowspan="2"><b>NIK</b></td>
        <td style="border: 1px solid; text-align: center; width: 50mm;" rowspan="2" ><b>Nama Karyawan</b></td>
        <td style="border: 1px solid; text-align: center;" colspan="<?php echo $distance; ?> " ><b>Tanggal Absen</b></td>

    </tr>
    <tr>
	
	<?php for($i=$tanggal_1; $i<=$tanggal_2; $i++){?>
        <td style="border: 1px solid; width: 5mm; text-align:center;" > 
			<?php echo $i ?>
		</td>
	<?php } ?>
	
    </tr>

<?php
	foreach ($results as $data)
	{
		$no++;
		
	
?>
    
	<tr>
		<td style="border: 1px solid; text-align: right;"><b> <?php echo $data['ATT_EMP_ID']; ?> </b></td>
		<td style="border: 1px solid;"> <?php echo $data['ATT_EMP_NAME']; ?> </td>
			<?php 
				$criteria=new CDbCriteria(array(
					'condition'=>'ATT_EMP_ID= '.$data['ATT_EMP_ID'].' AND ATT_DATE= '.$data['ATT_DATE'].'',
				));
				
				$att=ATTENDANCE::model()->findAll($criteria);
				foreach($att as $att)
				{
				
			?>
			
					<td style="border: 1px solid; text-align:center;"> 
						<?php if($att->ATT_LATE_STAT <= 0)
							{	
								echo "*";
							}else if($att->ATT_LATE_STAT > 0)
							{ 
								echo $att->ATT_LATE_STAT;
							}else if($att->ATT_CLOCK_IN && ATT_CLOCK_OUT == null)
							{
								echo $att->ATT_LATE_STAT;
							}
						; ?>
					</td>
			<?php } ?>
	</tr>
	
   
 <?php }?>

<br><br>

</table>



Error waktu di jalanin : CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 932 OCIStmtExecute: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
(ext\pdo_oci\oci_statement.c:148). The SQL statement executed was: SELECT * FROM "ATTENDANCE" "t" WHERE ATT_EMP_ID= 101 AND ATT_DATE= 03-01-2014

untuk kolom2 nomor di bawah absensi itu berdasarkan perhitungan jarak tanggal kemudian diincrement, ane takutnya klo itu berkaitan sama masing2 datanya.
untuk mengatasinya gmn ya?

Attached File(s)


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users