<?
//session_start();
//include"ses.php";
include"plg/kon.php";
$id = $_GET['id'];
//$inv = $_GET['inv'];

$sql = "select * from invoiceout where id='$id' ";
$res = $conn->query($sql);
while($a = $res->fetch_assoc()){
  $invo = $a['id'];
  $tglc = $a['tglc'];
  $tgls = $a['tgls'];
  $snd = $a['snd'];
  $tglt = $a['tglt'];
  $rcv = $a['rcv'];
  $pri = $a['pri'];
  $noinv = $a['noinv'];
  $nokon = $a['nokon'];
  $deb = $a['deb'];
  $debalm = $a['debalm'];
  $job = $a['job'];
  $jobby = $a['jobby'];
  $ket = $a['ket'];
  $dpp = $a['dpp'];
  $dp = $a['dp'];
  $tgldp = $a['tgldp'];
  $ppn = $a['ppn'];
  $nilppn = $a['nilppn'];
  $totppn = $a['totppn'];
  $total = $a['total'];
  $pph = $a['pph'];
  $pphval = $a['pphval'];
  $totpph = $a['nilpph'];
  $dued = $a['tgldue'];
}

?>
<center>
<div class="w3-card-2" style="display:">
  <form action="updateinvout.php" method="post" id="newinvout" target="ipack" style="">
    <table class="w3-table w3-border w3-card-4 w3-light-gray" style="width:800px;">
      <input type="hidden" name="xdeb" id="sdeb" value="<?=$xdeb?>"/>
      <input type="hidden" name="xjob" id="sjob" value="<?=$xjob?>"/>
      <input type="hidden" name="xjobby" id="sjobby" value="<?=$xjobby?>"/>
      <input type="hidden" name="xinv" id="snoinv" value="<?=$xinv?>"/>
      <input type="hidden" name="xkon" id="snokon" value="<?=$xkon?>"/>
      <input type="hidden" name="id" value="<?=$invo?>"/>
      <tr>
        <th colspan="5" class="w3-pale-green w3-small w3-center">
          UPDATE DATA INVOICE (OUT/PIUTANG) | ID <?=$invo?>
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="keluar">&times;</button>
        </th>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>TANGGAL INVOICE DIBUAT</b><br/>
          <input type="date" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;"
          value="<?=$tglc?>" name="tglc" id="tglc" min="" max="<?=$maks?>" class="w3-small w3-light-gray w3-border w3-center w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>TANGGAL INVOICE DIKIRIM KE DEBITUR</b><br/>
          <input type="date" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;"
          value="<?=$tgls?>" name="tgls" id="tgls" min="" max="<?=$maks?>" class="w3-small w3-light-gray w3-border w3-center w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>INVOICE DIKIRIMKAN KE DEBITUR OLEH</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold"
          value="<?=$snd?>" name="snd" id="snd" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>TANGGAL DITERIMA DEBITUR</b><br/>
          <input type="date" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;"
          value="<?=$tglt?>" name="tglt" id="tglt" min="" max="<?=$maks?>" class="w3-small w3-light-gray w3-border w3-center w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>PENERIMA DI PIHAK DEBITUR OLEH</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold"
          value="<?=$rcv?>" name="rcv" id="rcv" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>DEBITUR</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px solid;font-weight:bold"
          value="<?=$deb?>" name="deb" id="deb" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>ALAMAT DEBITUR</b><br/>
          <textarea style="width:600px;padding-top:5px;padding-bottom:5px;padding-left:10px;border:0px;font-weight:bold" rows="2"
          name="debalm" id="debalm" class="w3-small w3-light-gray w3-card-2"><?=$debalm?></textarea>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>PEKERJAAN</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px solid;font-weight:bold"
          value="<?=$job?>" name="job" id="job" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>PEMBERI KERJA</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px solid;font-weight:bold"
          value="<?=$jobby?>" name="jobby" id="jobby" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
        <td class="w3-border w3-center w3-small">
          <b>PRIHAL INVOICE</b><br/>
          <input type="text" style="width:600px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold"
          value="<?=$pri?>" name="pri" id="pri" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>NOMOR INVOICE</b><br/>
          <input type="text" style="width:300px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold"
          value="<?=$noinv?>" name="noinv" id="noinv" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>NOMOR KONTRAK</b><br/>
          <input type="text" style="width:300px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold"
          value="<?=$nokon?>" name="nokon" id="nokon" class="w3-small w3-light-gray w3-card-2"/>
        </td>
      </tr>

      <tr class="w3-pale-blue" style="cursor:pointer"
      onclick="getElementById('dpp').style='width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px solid;'">
        <td class="w3-border w3-center w3-small">
          <b>DPP (DASAR PENGENAAN PAJAK / HARGA POKOK)</b><br/>
          <b>NILAI TAGIHAN </b><b id="txtdpp" class="">Rp <?=number_format($dpp)?></b><br/>
          <input type="number"
          style="width:300px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;display:none;"
          value="<?=$dpp?>" name="dpp" id="dpp" onkeyup="dppkoma()" onblur="totalppn()" onchange="bukappnpph()" class="w3-pale-blue w3-card-2"/>
        </td>
      </tr>

      <tr class="w3-pale-blue" style="cursor:pointer"
      onclick="getElementById('dp').style='width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px solid;'">
        <td class="w3-border w3-center w3-small">
          <b>PEMBAYARAN DI MUKA (DP)</b><br/>
          <b>NILAI DP </b><b id="txtdp" class="">Rp <?=number_format($dp)?></b><br/>
          <input type="number"
          style="width:300px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;display:none;"
          value="<?=$dp?>" name="dp" id="dp" onkeyup="dpkoma()" onblur="totalppn()" onchange="bukappnpph()" class="w3-pale-blue w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>TANGGAL PEMBAYARAN DIMUKA (DP)</b><br/>
          <input type="date" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;"
          value="<?=$tgldp?>" name="tgldp" id="tgldp" min="" max="" class="w3-small w3-light-gray w3-border w3-center w3-card-2"/>
        </td>
      </tr>

      <tr class="w3-pale-blue" id="fppn" onmousemove="getElementById('dpp').style='display:none';getElementById('dp').style='display:none';">
        <td class="w3-border w3-center w3-small">
          <b>PPN ( <i class="w3-text-red w3-tiny">DEFAULT 11 &#37;</i> )</b><br/>
          <input type="number" style="width:60px;padding-top:5px;padding-bottom:5px;text-align:center;font-weight:bold;border:0px"
          value="<?=$ppn?>" name="ppn" id="ppn" min="0" max="100" onblur="cekppn()" class="w3-pale-blue w3-small w3-card-2"
          onchange="totalppn()"/> <b>&#37;</b>
          &nbsp;<b>=</b>&nbsp;
          <input type="hidden" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;"
          value="<?=$nilppn?>" name="nilppn" id="totppn" onclick="totalppn()"/>
          <b id="txttotppn">Rp <?=number_format($nilppn)?></b>
        </td>
      </tr>
      <tr class="w3-pale-blue" id="fpph"  onclick="totalpph()">
        <td class="w3-border w3-center w3-small">
          <b>PILIH PPH ( <i class="w3-text-red w3-tiny">OPTIONAL</i> )</b><br/>
          <select class="w3-small w3-pale-blue w3-card-2"
          style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;font-weight:bold;border:0px;"
          name="pph" id="pph" onchange="cekpph()">
            <option><?=$pph?></option>
            <option>PPH PASAL 23</option>
            <option>PPH PASAL 15</option>
            <option>PPH PASAL 4 AYAT (2)</option>
            <option>PPH PASAL 21</option>
            <option></option>
          </select>
          <input type="number" style="width:50px;padding-top:5px;padding-bottom:5px;text-align:center;font-weight:bold;border:0px;"
          value="<?=$pphval?>" name="pphval" id="pphval" min="0" max="100" onchange="totalpph()" class="w3-pale-blue w3-card-2"/> <b>&#37;</b>
          &nbsp;<b>=</b>&nbsp;
          <input type="hidden" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;"
          value="<?=$totpph?>" name="nilpph" id="totpph"/>
          <b id="txtpph">Rp <?=number_format($totpph)?></b>
        </td>
      </tr>
      <tr class="w3-pale-blue" id="ftotal">
        <td class="w3-border w3-center w3-small">
          <b>TOTAL TAGIHAN</b><br/>
          <input type="hidden" value="<?=$total?>" name="total" id="total"/>
          <b id="txttotal" class="w3-text-red">Rp <?=number_format($total)?></b>
        </td>
      </tr>
      <tr class="w3-pale-blue" id="">
        <td class="w3-border w3-center w3-small">
          <b>TANGGAL INVOICE JATUH TEMPO (DUE DATE)</b><br/>
          <input type="date" style="width:200px;padding-top:5px;padding-bottom:5px;text-align:center;border:0px;font-weight:bold;"
          value="<?=$dued?>" name="dued" id="dued" min="" max="<?=$maks?>" class="w3-small w3-pale-blue w3-border w3-center w3-card-2"/>
        </td>
      </tr>
      <tr>
        <td class="w3-border w3-center w3-small">
          <b>KETERANGAN</b><br/>
          <textarea style="width:600px;padding-top:5px;padding-bottom:5px;padding-left:10px;border:0px;font-weight:bold" rows="3"
          name="ket" id="ket" class="w3-small w3-light-gray w3-card-2"><?=$ket?></textarea>
        </td>
      </tr>
      <tr>
        <td colspan="5"><?include'listdoc2.php';?></td>
      </tr>
      <tr>
        <th colspan="5" class="w3-pale-green w3-small w3-center">
          <div id="ad" class="w3-pale-green w3-btn w3-border w3-small w3-round-large w3-card-2" onclick="updateinvout()">SAVE INVOICE (OUT)</div>
          <div id="ad" class="w3-pale-green w3-btn w3-border w3-small w3-round-large w3-card-2" onclick="difilter()">LIST</div>
          &nbsp;&nbsp;&nbsp;
          &nbsp;&nbsp;&nbsp;
          <div id="ad" class="w3-blue-gray w3-btn w3-border w3-small w3-round-large w3-card-2"
          onclick="showformupl2('<?=$invo?>','<?=$xdeb?>','<?=$xjob?>','<?=$xjobby?>','<?=$xinv?>','<?=$xkon?>')">UPLOAD DOCUMENT</div>
        </th>
      </tr>
    </table>
  </form>
</div>
</center>
