<?php 
	$tgl_sekarang = date("Y-m-d");
	$bulan_sekarang = (int) date("m",time());
?>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/css/date-css.css" />
<div class="centering" style="width:550px;margin-top: 10%;">
	<div id='popup_cetak_jurnal' style="border: 1px solid #ffffff;">
    	<div class="detil" style="padding: 2px;background-color: white;">
			<form id="form_relaas" name="" class="templatepopform" target="_self" method="POST" action="<?php echo base_url().'jurnal_cetak/cetak_jurnal_harian';?>">
				<table id="tableDetilPerkara" style="background: #dedbdb;">
					<col width="97%">
					<tbody>
						<tr>
							<td style="font-size:15px;text-align:center;"><font color="#fff">CETAK JURNAL HARIAN</font></td>
						</tr>
						<tr>
							<td style="background:white;color:#111;" align="center">Pilih Tanggal :
								<span class="custom-dropdown custom-dropdown--emerald" style="width:150px">
									<input id="tgl_transaksi" name="tgl_transaksi" value="<?php echo (!empty($tgl_sekarang) ? $this->tanggalhelper->convertToInputDate($tgl_sekarang) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
								</span>	
								Pilih Transaksi :
								<span class="custom-dropdown custom-dropdown--emerald" style="width:150px;color:#111">
									<select style="width:150px;color:#111" name="pilih_transaksi" id="pilih_transaksi" class="custom-dropdown__select custom-dropdown__select--white">
								  <?php echo '<optgroup label="Cetak Semua Transaksi Harian">';
									 	echo '<option value="0">Semua Transaksi Harian</option>';
									  	echo '<optgroup label="Cetak Transaksi Per Kategori">';
										foreach($kategori_biaya->result() as $data){
											?><option value='<?php echo $data->id; ?>'><?php echo $data->keterangan; ?></option><?php
										}
										echo '<optgroup label="Cetak Transaksi PSP Lebih 6 Bulan">';
										echo '<option value="15"><p><font color=green>PSP lebih dari 6 Bulan </font></p></option>'; ?>
									</select>
								</span>	
							</td>
						</tr>
						<tr>
							<td style="background:white;padding:10px" align="center">
								<input type="button" id='close_form_jadwal' value="Kembali" class="btn btn-info">
								<input type="submit" id="simpan_btn" value="Cetak" class="btn btn-danger">	
								<input type="hidden" id="curr_date" name="curr_date" value="<?php echo $current_date;?>">					
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$('#close_form_jadwal').closingFormWin();
$('.datepicker').ValidateDateInput();
$('#tgl_transaksi').datepicker({
	inline: true,
	showOtherMonths: true,
	dateFormat: 'dd/mm/yy',
	dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
	beforeShowDay:$.datepicker.noWeekends,
	onSelect: function(dateText, inst) {
	    //var error = 0;
	    var date = $(this).datepicker('getDate');
	    var dayOfWeek = weekday[date.getDay()];
	    var error = 0;
	    var message ='';
	    if(dayOfWeek=='Sunday' || dayOfWeek=='Saturday'){
	        message ='Tidak Dapat Memilih diluar Hari Kerja (Sabtu & Minggu).';
	        error = 1;
	    }
	    
	    var tmp = $(this).val().split("/");
	    var tmp2 = $('#curr_date').val().split("/");
	    if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
	        message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
	        error = 1
	    }

	    if(error==1){
	        message_error_show(message);
	        $(this).css("background-color", "red");
	    }else{
	        $(this).css("background-color", "#dedbdb");
	    }
	    error = 0;
	}
});
</script>