Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['simpan'])){
- $TxnQuotHdrID=$_POST['TxnQuotHdrID'];
- $TxnQuotHdrNo=$_POST['TxnQuotHdrNo'];
- $TxnQuotHdrNoRev=$_POST['TxnQuotHdrNoRev'];
- $TxnQuotHdrDate=$_POST['TxnQuotHdrDate'];
- $TxnQuotHdrRE=$_POST['TxnQuotHdrRE'];
- $TxnQuotHdrTermsTxt=$_POST['TxnQuotHdrTermsTxt'];
- $TxnQuotHdrDiscount=$_POST['TxnQuotHdrDiscount'];
- $TxnQuotHdrRemarks=$_POST['TxnQuotHdrRemarks'];
- $TxnDrawHdrID=$_POST['TxnDrawHdrID'];
- $MstCustID=$_POST['MstCustID'];
- $MstSalesPICID=$_POST['MstSalesPICID'];
- $MstApprID=$_POST['MstApprID'];
- $MstEmp=$_POST['MstEmp'];
- $query=mysql_query("insert into txnquothdr
- (TxnQuotHdrNo,TxnQuotHdrNoRev,TxnQuotHdrDate,TxnQuotHdrRE,TxnQuotHdrTermsTxt,TxnQuotHdrDiscount,TxnQuotHdrRemarks,TxnDrawHdrID,MstCustID,MstSalesPICID,MstApprID,MstEmp)
- values
- ('$TxnQuotHdrNo','$TxnQuotHdrNoRev','$TxnQuotHdrDate','$TxnQuotHdrRE','$TxnQuotHdrTermsTxt','$TxnQuotHdrDiscount','$TxnQuotHdrRemarks','$TxnDrawHdrID','$MstCustID','$MstSalesPICID','$MstApprID','$MstEmp')");
- $jml = $_POST['jml'];
- for ($x=0;$x<=$jml-1;$x++){
- $tmpKode = "kode_$x";
- $kode =$_POST[$tmpKode];
- $tmp1 = "MstProductID_$x";
- $k1 =$_POST[$tmp1];
- $tmp2 = "TxnQuotHdrNoRev_$x";
- $k2 =$_POST[$tmp2];
- $tmp4 = "TxnQuotDtlUnitPrice_$x";
- $k4 =$_POST[$tmp4];
- $tmp3 = "TxnQuotDtlQty_$x";
- $k3 =$_POST[$tmp3];
- $tmp5 = "TxnQuotDtlDiscount_$x";
- $k5 =$_POST[$tmp5];
- $tmp6 = "TxnQuotDtlDrawNo_$x";
- $k6 =$_POST[$tmp6];
- $tmp7 = "TxnQuotDtlDrawDate_$x";
- $k7 =$_POST[$tmp7];
- $tmp8 = "TxnQuotDtlRepair_$x";
- $k8 =$_POST[$tmp8];
- $tmp9 = "MstChasID_$x";
- $k9 =$_POST[$tmp9];
- $tmp10 = "MstTypeOrderID_$x";
- $k10 =$_POST[$tmp10];
- $tmp11 = "MstSatID_$x";
- $k11 =$_POST[$tmp11];
- $sale = mysql_query("INSERT INTO txnquotdtl(TxnQuotDtlNo,TxnQuotHdrID,MstProductID,TxnQuotHdrNoRev,TxnQuotDtlQty,TxnQuotDtlUnitPrice,TxnQuotDtlDiscount,TxnQuotDtlDrawNo,TxnQuotDtlDrawDate,TxnQuotDtlRepair,MstChasID,MstTypeOrderID,MstSatID)
- values('$kode','$TxnQuotHdrID','$k1','$k2','$k3','$k4','$k5','$k6','$k7','$k8','$k9','$k10','$k11')");
- }
- }
- ?>
- <body>
- <form method="POST">
- <legend>
- <h3>Add New Transaction Quatation Header</h3></legend>
- <table align="left" width="400px">
- <tr>
- <?php
- $cek=mysql_query("select max(TxnQuotHdrID)as id from txnquothdr");
- $dap=mysql_fetch_array($cek);
- $r=$dap['id']+1;
- {
- ?>
- <input type="hidden" name="TxnQuotHdrID" value="<?php echo $r; ?>"/>
- <?php } ?>
- </tr>
- <tr>
- <td>No Quotation</td>
- <td><div class="col-lg-9"><input type="text" name="TxnQuotHdrNo" placeholder="No Quatation" class="form-control input-sm" /></td>
- </tr>
- <tr>
- <td>No Rev 1</td>
- <td><div class="col-lg-9"><input type="text" name="TxnQuotHdrNoRev" placeholder="No Rev" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Header Date 1</td>
- <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrDate" placeholder="Date" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Header RE 1</td>
- <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrRE" placeholder="R E" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Header Terms </td>
- <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrTermsTxt" placeholder="Terms" class="form-control input-sm"/></td>
- </tr><tr>
- <td>Header Discount 1</td>
- <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrDiscount" placeholder="Discount" class="form-control input-sm"/></td>
- </tr>
- </table>
- <table width="435">
- <tr>
- <td>Header Remarks</td>
- <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrRemarks" placeholder="Remarks" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Header ID 1</td>
- <td ><div class="col-lg-9"><input type="text" name="TxnDrawHdrID" placeholder="TxnDrawHdrID" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Customer</td>
- <td><div class="col-lg-9"><select class="form-control select-sm" name="MstCustID">
- <option value="" selected>--select Customer--</option>
- <?php
- if(empty($cs)){
- echo '<option value=""></option>';
- }else{
- foreach($cs as $row){
- echo '<option value="'.$row->MstCustID.'">'.$row->MstCustIDName.'</option>';
- }
- } ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Seles PIC</td>
- <td><div class="col-lg-9">
- <select class="form-control select-sm" name="MstSalesPICID">
- <option value="" selected>--select sales PIC--</option>
- <?php
- if(empty($salespic)){
- echo '<option value=""></option>';
- }else{
- foreach($salespic as $row){
- echo '<option value="'.$row->MstSalesPICID.'">'.$row->MstSalesPICName.'</option>';
- }
- } ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Master ApprId</td>
- <td ><div class="col-lg-9"><input type="text" name="MstApprID" placeholder="Appr ID" class="form-control input-sm"/></td>
- </tr>
- <tr>
- <td>Master Employee</td>
- <td ><div class="col-lg-9"><input type="text" name="MstEmp" placeholder="Employee" class="form-control input-sm"/></td>
- </tr>
- <td> </td>
- <td > </td>
- </tr>
- </table>
- <center>
- <h4>Detail Quotation</h4>
- </center>
- <div style=' overflow-y:scroll; overflow-x:scroll; padding:10px; height:150px;'>
- <table width="90%" align="center" class="table table-striped table-bordered table-hover dataTable no-footer" id="module" style="width:98%">
- <thead>
- <tr>
- <td width="164">TxnQuotDtlNo</td>
- <td width="164">MstProductID</td>
- <td width="164">MstPriceUnitPrice</td>
- <td width="164">TxnQuotHdrNoRev </td>
- <td width="164">TxnQuotDtlQty</td>
- <td width="164">TxnQuotDtlUnitPrice 1</td>
- <td width="164">TxnQuotDtlDiscount 1</td>
- <td width="164">TxnQuotDtlDrawNo 1</td>
- <td width="164">TxnQuotDtlDrawDate</td>
- <td width="164">TxnQuotDtlRepair</td>
- <td width="164">MstChasID 1</td>
- <td width="164">MstTypeOrderID</td>
- <td width="164">MstSatID 1</td>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <input type="text" name="kode_0" id="kode_0" class="input-medium" style="width:150px">
- </td>
- <td>
- <input id="MstProductID" type="text" name="MstProductID_0" placeholder="MstProductID" readonly onClick="getData(this)" />
- </td>
- <td>
- <input id="MstPriceUnitPrice" type="text" name="MstPriceUnitPrice_0" placeholder="MstProductID" readonly />
- </td>
- <td>
- <input id="TxnQuotHdrNoRev_0" type="text" name="TxnQuotHdrNoRev_0" placeholder="TxnQuotHdrNoRev" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlQty_0" type="text" name="TxnQuotDtlQty_0" placeholder="TxnQuotDtlQty" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlUnitPrice_0" type="text" name="TxnQuotDtlUnitPrice_0" placeholder="TxnQuotDtlUnitPrice" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlDiscount_0" type="text" name="TxnQuotDtlDiscount_0" placeholder="TxnQuotDtlDiscount" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlDrawNo_0" type="text" name="TxnQuotDtlDrawNo_0" placeholder="TxnQuotDtlDrawNo" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlDrawDate_0" type="text" name="TxnQuotDtlDrawDate_0" placeholder="TxnQuotDtlDrawDate" class="form-control input-sm"/>
- </td>
- <td>
- <input id="TxnQuotDtlRepair_0" type="text" name="TxnQuotDtlRepair_0" placeholder="TxnQuotDtlRepair" class="form-control input-sm"/>
- </td>
- <td>
- <select name="MstChasID_0" style="height:'28'">
- <option class="select-sm" selected>--select Chasis--</option>
- <?php
- if(empty($chasis)){
- echo '<option value=""></option>';
- }else{
- foreach($chasis as $row){
- echo '<option value="'.$row->MstChasID.'">'.$row->MStChasType.'</option>';
- }
- } ?>
- </select>
- </td>
- <td><div class="col-lg-9"><select id="qutrmst" class="form-control input-md" name="MstTypeOrderID_0">
- <option value="" selected>--select Type Order--</option>
- <?php
- if(empty($salespic)){
- echo '<option value=""></option>';
- }else{
- foreach($salespic as $row){
- echo '<option value="'.$row->MstSalesPICID.'">'.$row->MstSalesPICName.'</option>';
- }
- } ?>
- </select>
- </td>
- <td>
- <select id="qutrmst" class="form-control input-sm" name="MstSatID_0">
- <option value="" selected>--select Satuan--</option>
- <?php
- if(empty($satuan)){
- echo '<option value=""></option>';
- }else{
- foreach($satuan as $row){
- echo '<option value="'.$row->MstSatID.'">'.$row->MstSatAbbr.'</option>';
- }
- } ?>
- </select>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <br/>
- <input type="hidden" value="1" name="jml" id="jml">
- <a class="button" id="addRow"><input type="button" class="button" value="Add Row" /> </a>
- <a id="delete" class="button"><input type="button" class="button" value="Remove Row" /> </a><p>
- <br/>
- <input type="submit" name="simpan" id="simpan" class="btn btn-primary" value="simpan" >
- </p>
- </form>
- </body>
- </html>
- <script>
- function getData(tmpObject) {
- var id=$("#suplier").val();
- var id_customer=$("#id_customer").val();
- var strNama = tmpObject.name;
- var x = strNama.split("_")[1];
- window.open('<?php echo site_url ('mstproduk/getp/'); ?>?var=' + strNama+'&id='+id_customer,"mywindow","menubar=no,url=no,width=1000,height=500,left=300,top=200");
- }
- </script>
- <script>
- $(document).ready(function(){
- idrow = 2;
- $("#addRow").bind('click',function(){
- var rw=document.getElementById("jml").value;
- var x=document.getElementById('module').insertRow(idrow);
- var tmpName="";
- var td1=x.insertCell(0);
- var td2=x.insertCell(1);
- var td3=x.insertCell(2);
- var td4=x.insertCell(3);
- var td5=x.insertCell(4);
- var td6=x.insertCell(5);
- var td7=x.insertCell(6);
- var td8=x.insertCell(7);
- var td9=x.insertCell(8);
- var td10=x.insertCell(9);
- var td11=x.insertCell(10);
- var td12=x.insertCell(11);
- var td13=x.insertCell(12);
- var td14=x.insertCell(13);
- tmpName = 'kode_' + (idrow-1);
- td1.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " style='width:100px'>";
- tmpName = "MstProductID_"+(idrow-1);
- td2.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " onclick='getData(this)' class='"+tmpName+" ' style='width:100px'>";
- tmpName = "MstPriceUnitPrice_"+(idrow-1);
- td3.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName = "TxnQuotHdrNoRev_"+(idrow-1);
- td4.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="TxnQuotDtlQty_"+(idrow-1);
- td5.innerHTML="<input type='text' id="+tmpName+" name="+tmpName + " class='"+tmpName+" 'style='width:100px'>";
- tmpName="TxnQuotDtlUnitPrice_"+(idrow-1);
- td6.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="TxnQuotDtlDiscount_"+(idrow-1);
- td7.innerHTML="<input type='text' id="+tmpName+" name="+tmpName + " class='"+tmpName+" 'style='width:100px'>";
- tmpName="TxnQuotDtlDrawNo_"+(idrow-1);
- td8.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="TxnQuotDtlDrawDate_"+(idrow-1);
- td9.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="TxnQuotDtlRepair_"+(idrow-1);
- td10.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="MstChasID_"+(idrow-1);
- td11.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="MstTypeOrderID_"+(idrow-1);
- td13.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- tmpName="MstSatID_"+(idrow-1);
- td14.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
- idrow++;
- document.getElementById("jml").value = idrow-1;
- });
- // Remove row when clicked
- $("#delete").live('click',function(){
- if(idrow>2) {
- var x=document.getElementById('module').deleteRow(idrow-1);
- idrow--;
- document.getElementById("jml").value = idrow-1;
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement