<?php
$this->load->view('includes/header.php');
?>
<script type="text/javascript">

$(function() {
$( "#eta" ).datepicker({
changeMonth: true, // menampilkan dropdown untuk ganti bulan
changeYear: true // menampilkan dropdown untuk ganti Tahun
});
$( "#eta" ).datepicker({ altFormat: 'yy-mm-dd' });
$( "#eta" ).change(function() {
$( "#eta" ).datepicker( "option", "dateFormat","dd.mm.yy" );
});
});

</script>

<script type="text/javascript">

$(function() {
$( "#posting" ).datepicker({
changeMonth: true, // menampilkan dropdown untuk ganti bulan
changeYear: true // menampilkan dropdown untuk ganti Tahun
});
$( "#posting" ).datepicker({ altFormat: 'yy-mm-dd' });
$( "#posting" ).change(function() {
$( "#posting" ).datepicker( "option", "dateFormat","dd.mm.yy" );
});
});

</script>



<?php
if ( ! empty($prev))
	{
?>


<?php
	}
else
{
echo '<font class="title">'.$menu_path.'</font>';
echo '<br>';
			/* Display system message */
			$this->fungsi->disp_sys_msg();
			echo validation_errors('<p class="field_error">', '</p>');
?>
<script type="text/javascript" src="../sap/cal/cal.js"></script>
	<script type="text/javascript" src="../sap/tab-view/js/ajax.js"></script>
	<script type="text/javascript" src="../sap/tab-view/js/tab-view.js">
	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Updated:
		
		March, 14th, 2006 - Create new tabs dynamically
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/		
	</script>
     <form id="form1" name="form1" method="post" action="edit_ba_new.php">
  <table width="100%" border="0" cellspacing="1" cellpadding="1">
  <tr>
        <td colspan="4" align="center"><h2>ENTRY BERITA ACARA</h2></td>
      </tr>
      <tr>
        <td width="138">No. Berita Acara : </td>
        <td width="129"><span class="primary"><?php echo $row['id_ba']; ?>
            <input type="hidden" value="<?php echo $row['id']; ?>" name="id" />
        </span></td>
        <td width="168"><span class="primary">Volume Total :</span></td>
        <td width="174"><span class="primary"><?php echo number_format($row['vol_coll']); ?> </span>Ltr<span class="primary">
        <input name="vol_coll" type="hidden" id="vol_coll" value="<?php echo$row['vol_coll']; ?>" />
        <input name="harga" type="hidden" id="harga" value="<?php echo$row['harga']; ?>" />
        <input name="txt_air" type="hidden" id="txt_air" value="<?php echo $row['qc_air']; ?>" />
        </span></td>
      </tr>
      <tr>
        <td>Tanggal Buat BA :</td>
        <td><?php echo date("d-M-Y", strtotime($row['tgl_input'])) ; ?></td>
        <td><span class="primary">No Surat Jalan :</span></td>
        <td><?php echo $row['no_sj']; ?></td>
      </tr>
      <tr>
        <td>Nama Pengirim :</td>
        <td><?php if($_GET['pengirim']=='CABANG')
						{
								$sql1="SELECT id_cab, type FROM sj where no_sj ='".$row['no_sj']."'";
								$execute1 = mysql_query($sql1);
								$row_sj=mysql_fetch_array($execute1);
								
								$type = $row['type'];
								
								$sql2="SELECT nama_cab FROM kntr_cab where id_cab ='".$row_sj['id_cab']."'";
								$execute2 = mysql_query($sql2);
								$row_nama_cab=mysql_fetch_array($execute2);
								$pengirim = 	$row_nama_cab['nama_cab'];
						}
						else
						{
								$sql3="SELECT nama_supp FROM supp where id_sup ='".$row['id_supp']."'";
								$execute3 = mysql_query($sql3);
								$row_supp=mysql_fetch_array($execute3);
								$pengirim = 	$row_supp['nama_supp'];
								
								$type = $row['type'];
								//$type = $pengirim['type'];
								
						}
						
						?>
        <?php echo strtoupper($pengirim);?></td>
        <td>Tanggal Entry PPIC :</td>
        <td><?php if($row['tgl_entry_ppic']=='0000-00-00') { echo '-'; } else { echo date("d-M-Y", strtotime($row['tgl_entry_ppic'])); } ?></td>
      </tr>
      <tr>
        <td><span class="primary">No. Polisi : </span></td>
        <td><span class="primary"><?php echo $row['no_pol']; ?></span></td>
        <td>Harga Cabang :</td>
        <td><!--<?php echo number_format($row['harga']); ?>--></td>
      </tr>
      <tr>
        <td>Harga  :</td>
        <td><!--<?php echo number_format($row['harga_sup']); ?>--></td>
        <td>Sewa transport WGI :</td>
        <td><!--<?php echo number_format($row['sewa_trans']); ?>--></td>
      </tr>
      <tr>
        <td>Biaya Transport WGI :</td>
        <td><!--<?php echo number_format($row['wgi_trans']); ?>--></td>
        <td>Tipe :</td>
        <td><span class="primary"><?php echo $type; ?>
            <input name="txt_tot_ba" type="hidden" id="txt_tot_ba" value="<?php echo $row['harga'] + $row['sewa_trans'] + $row['harga_sup'] + $row['wgi_trans'] + $row['trans_sup']; ?>" />
            <input name="txt_tipe" type="hidden" id="txt_tipe" value="  <?php echo $type; ?>" />
        </span></td>
      </tr>
      <tr>
        <td>Transport Supplier :</td>
        <td><!--<?php echo number_format($row['trans_sup']); ?>--></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <table width="200" border="0" align="center" cellpadding="1" cellspacing="1">
      <tr>
        <td><div id="dhtmlgoodies_tabView1">
          <div class="dhtmlgoodies_aTab">
            <table width="722" border="0" cellpadding="1" cellspacing="1">
              <tr>
                <td><strong>Document date :</strong></td>
                <td><label for="txt_bldat"></label>
                  <input name="txt_bldat" type="text" class="txt_field2" id="txt_bldat" value="<?php if($row["bldat"]=='') { echo  date("d.m.Y"); } else { echo $row["bldat"];} ?>" size="10" maxlength="10" readonly="readonly" />
                  <input type="button" value=".." onclick="displayDatePicker('txt_bldat', false, 'dmy', '.');"  /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Doc. header text :</strong></td>
                <td><label for="txt_bktxt"></label>
                  <input name="txt_bktxt" type="text" class="txt_field2" id="txt_bktxt" value="<?php if($row['bktxt']!='') {echo $row['bktxt'];}else{ echo $row['id_ba']; } ?>" size="25" maxlength="25" readonly="readonly" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <th colspan="6" bgcolor="#CCCCCC"><em>Default for document items</em></th>
              </tr>
              <tr>
                <td><strong>Movement type :</strong></td>
                <td colspan="3"><input name="txt_bwartwa" type="text" class="txt_field" id="txt_bwartwa" 
                value="<?php if( $row['bwartwa']=='' ) { echo '501'; } else { echo $row['bwartwa']; } ?>" size="3" maxlength="3" />
                  <input type="button" name="button" id="button" value=".."  onclick="window.open('../sap/popup_mvt.php','popuppage','width=500,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');"/>
                  <label for="txt_bwartwa2"></label>
                  <input name="txt_bwartwa2" type="text" id="txt_bwartwa2" style="border:none" size="60" maxlength="60" readonly="readonly" value="<?php if( $row['txt_bwartwa']=='' ) { echo 'Receipt w/o purchase order into warehouse'; } else { echo $row['txt_bwartwa']; } ?>" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Plant :</strong></td>
                <td colspan="3"><input name="txt_werks" type="text" class="txt_field" id="txt_werks" value="<?php if( $row['werks']=='' ) { echo '1000'; } else { echo $row['werks']; } ?>" size="4" maxlength="4" />
                  <input type="button" name="button2" id="button2" value=".."  onclick="window.open('<?php echo base_url();?>index.php/popup/sap/popup_plant','popuppage','width=500,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" />
                  <label for="rb_cs">
                    <input name="txt_werks2" type="text" id="txt_werks2" style="border:none" size="50" maxlength="40" readonly="readonly" value="<?php if( $row['txt_werks']=='' ) { echo 'PT. WGI - Cibitung'; } else { echo $row['txt_werks']; } ?>" />
                  </label></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Storage location :</strong></td>
                <td colspan="3"><input name="txt_lgort" type="text" class="txt_field" id="txt_lgort" value="<?php echo $row['no_iso']; ?>" size="3" maxlength="3" />
                  <input type="button" name="button3" id="button3" value=".."  onclick="window.open('../sap/popup_storloc.php','popuppage','width=500,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" />
                  <input name="txt_lgort2" type="text" id="txt_lgort2" style="border:none" size="16" maxlength="16" readonly="readonly" value="<?php echo $row['txt_lgort']; ?>" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Vendor :</strong></td>
                <td colspan="3"><input name="txt_lifnr" type="text" class="txt_field2" id="txt_lifnr" value="<?php echo $row['id_vendor']; ?>" size="10" maxlength="10" readonly="readonly" />
                  <input name="txt_name2" type="text" id="txt_name2" style="border:none" value="<?php echo $row['nama_vendor']; ?>" size="40" maxlength="40" readonly="readonly" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Receipient :</strong></td>
                <td><input name="txt_wempf" type="text" class="txt_field" id="txt_wempf" value="<?php echo $row['wempf']; ?>" size="12" maxlength="12" /></td>
                <td><strong>Collective slip :</strong></td>
                <td><input name="rb_cs" type="radio" id="radio" value="3" checked="checked" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2"> <?php if($type == 'iso tank' || $type == 'truck') { ?> <strong>Sesuai Tera :</strong>                  <input name="txt_tera" type="checkbox" value="1" onchange="hitung_tera()"  <?php if($row['is_tera'] == 1) { echo 'checked="checked"';  }; ?> /> <?php } ?></td>
                <th>&nbsp;</th>
                <th>&nbsp;</th>
                <th>&nbsp;</th>
                <th>&nbsp;</th>
              </tr>
              <tr>
                <th colspan="6" bgcolor="#CCCCCC"><em>Items</em></th>
              </tr>
              <tr>
                <td colspan="6"><br />
                  <table width="702" border="1" cellpadding="1" cellspacing="1">
                    <tr>
                      <th bgcolor="#CCCCCC">Item</th>
                      <th bgcolor="#CCCCCC">Material</th>
                      <th bgcolor="#CCCCCC">Material description</th>
                      <th bgcolor="#CCCCCC"> Quantity</th>
                      <th bgcolor="#CCCCCC">UnE</th>
                    </tr>
                    <tr>
                      <th><input name="txt_zeile" type="text" id="txt_zeile" value="1" size="4" maxlength="4" class="txt_field"  /></th>
                      <td align="center"><label for="txt_matnr"></label>
                        <input name="txt_matnr" type="text"  class="txt_field" id="txt_matnr" value="<?php if($row['matnr']==''){ echo 'R101'; } else { echo $row['matnr']; } ?>" size="18" maxlength="18"   />
                        <input type="button" name="button4" id="button4" value=".." onclick="window.open('../sap/popup_matnum.php','popuppage','width=500,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');" /></td>
                      <td align="center"><input name="txt_matnr2" type="text" id="txt_matnr2" style="border:none" size="40" maxlength="40" readonly="readonly" value="<?php if($row['txt_maktx']==''){ echo 'Used oil feedstock'; } else { echo $row['txt_maktx']; } ?>" /></td>
                      <td align="center"><input name="txt_erfmg" type="text" class="txt_field" id="txt_erfmg"  onkeyup="hitung();" value="<?php echo $row['vol_ppic']; ?>" size="13" maxlength="13" /></td>
                      <td align="center"><input name="txt_erfme" type="text" class="txt_field" id="txt_erfme" value="<?php if($row['erfme']=='') { echo 'L'; } else { echo $row['erfme']; } ?>" size="3" maxlength="3"  />
                        <input type="button" name="button5" id="button5" value=".."  onclick="window.open('../sap/popup_uom.php','popuppage','width=500,height=600,scrollbar=yes,scrollbars=yes,top=100,left=100');"/></td>
                    </tr>
                  </table>
                  <br /></td>
              </tr>
              <tr>
                <th colspan="6" bgcolor="#CCCCCC"><em>Acct. assgt</em></th>
              </tr>
              <tr>
                <td><strong>Text :</strong></td>
                <td colspan="3"><label for="txt_sgtxt"></label>
                  <input name="txt_sgtxt" type="text" class="txt_field" id="txt_sgtxt" value="<?php if ($row['note3_ppic']=='') { echo $row['id_ba'].'-'.$row['no_pol'].'-'.$pengirim; } else { echo $row['note3_ppic']; } ?>" size="60" maxlength="50" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Loc. curr .amnt :</strong></td>
                <td colspan="3"><input name="txt_exbwr" type="text" class="txt_field2" id="txt_exbwr" value="<?php echo number_format($row['exbwr']); ?>" size="13" maxlength="13" readonly="readonly"  /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td colspan="6" align="center" bgcolor="#CCCCCC"><em><strong>Data. PPIC</strong></em></td>
                </tr>
              <tr>
                <td><strong>Jam ditransfer :</strong></td>
                <td><input name="txt_jamtrans" type="text" id="txt_jamtrans" value="<?php echo $row['jam_trans_ppic']; ?>" size="10" class="txt_field" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>Jam selesai :</strong></td>
                <td><input name="txt_jamselesai" type="text" id="txt_jamselesai" size="10" value="<?php echo $row['jam_selesai_ppic']; ?>" class="txt_field" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>No. slip timbangan :</strong></td>
                <td><input name="txt_slip" type="text" id="txt_slip" value="<?php echo $row['slip']; ?>" size="15"  class="txt_field"/></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td><input type="submit" name="button6" id="button6" value="DONE" />
                  <input name="action" type="hidden" id="action" value="add" />
                  <input type="hidden" readonly="readonly" value="<?php if($row['ppic_spv']==''){echo $_SESSION['username1'];}else{ echo $row['ppic_spv'];} ?>" name="txt_spv" id="txt_spv" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table>
          </div>
          
          
          <div id="dhtmlgoodies_tabView1">
          <div class="dhtmlgoodies_aTab">
            <table width="491" border="1" cellspacing="1" cellpadding="1">
              <tr>
                <td width="150"><strong>Status QC :</strong></td>
                <td colspan="3" align="center" valign="middle"><h2>
                 <u> <?php if($row['status_qc']== 1) { echo 'OK'; } else { echo 'TOLAK';} ?></u>
                </h2></td>
                </tr>
              <tr>
                <td><strong>No Sertifikat :</strong></td>
                <td colspan="3" align="center" valign="middle"><h2>
                  <?php  echo $row['no_sertifikat'];?></h2>
               </td>
                </tr>
              <tr>
                <td><strong>Potongan QC :</strong></td>
                <td colspan="3" align="center"><h2><?php echo qc_potong_persen($row['qc_air']); ?>
                  <input name="qc_persen" type="hidden" id="qc_persen" value="<?php echo qc_potong_persen($row['qc_air']); ?>" />
                </h2></td>
                </tr>
              <tr>
                <td><strong>Tanggal Approve :</strong></td>
                <td><?php echo   format_ddmmyy($row['tgl_app_qc']); ?></td>
                <td><strong>Jam Diserahkan :</strong></td>
                <td><?php echo  $row['jam_serah_qc']; ?></td>
              </tr>
              <tr>
                <td><strong>1. Test Bahan Kimia :</strong></td>
                <td width="127"><?php echo $row['qc_tbk']; ?></td>
                <td width="110"><strong>3. Berat Jenis :</strong></td>
                <td width="81">KG/I</td>
              </tr>
              <tr>
                <td><strong>2. kadar Pencemaran :</strong></td>
                <td>&nbsp;</td>
                <td><strong>- T :</strong></td>
                <td><?php echo $row['qc_t']; ?> &deg; C</td>
              </tr>
              <tr>
                <td><strong>- Air :</strong></td>
                <td> <?php echo $row['qc_air']; ?> %</td>
                <td><strong>- C :</strong></td>
                <td><?php echo $row['qc_c']; ?></td>
              </tr>
              <tr>
                <td><strong>- B. Bakar : </strong></td>
                <td> <?php echo $row['qc_bakar']; ?> %</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>- Residu :</strong></td>
                <td> <?php echo $row['qc_residu']; ?> %</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><strong>- MFO :</strong></td>
                <td><?php echo $row['qc_mfo']; ?> %</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
  </table>
</form>



 <?php
}
if ( ! empty($link))
	{
		echo '<p id="bottom_link">';
		foreach($link as $links)
		{
			echo $links . ' ';
		}
		echo '</p>';
	}
$this->load->view('includes/footer.php');
	?>

