Advertisement
Guest User

viewnya

a guest
Oct 23rd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.98 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['simpan'])){
  3. $TxnQuotHdrID=$_POST['TxnQuotHdrID'];
  4. $TxnQuotHdrNo=$_POST['TxnQuotHdrNo'];
  5. $TxnQuotHdrNoRev=$_POST['TxnQuotHdrNoRev'];
  6. $TxnQuotHdrDate=$_POST['TxnQuotHdrDate'];
  7. $TxnQuotHdrRE=$_POST['TxnQuotHdrRE'];
  8. $TxnQuotHdrTermsTxt=$_POST['TxnQuotHdrTermsTxt'];
  9. $TxnQuotHdrDiscount=$_POST['TxnQuotHdrDiscount'];
  10. $TxnQuotHdrRemarks=$_POST['TxnQuotHdrRemarks'];
  11. $TxnDrawHdrID=$_POST['TxnDrawHdrID'];
  12. $MstCustID=$_POST['MstCustID'];
  13. $MstSalesPICID=$_POST['MstSalesPICID'];
  14. $MstApprID=$_POST['MstApprID'];
  15. $MstEmp=$_POST['MstEmp'];
  16.  
  17. $query=mysql_query("insert into txnquothdr
  18. (TxnQuotHdrNo,TxnQuotHdrNoRev,TxnQuotHdrDate,TxnQuotHdrRE,TxnQuotHdrTermsTxt,TxnQuotHdrDiscount,TxnQuotHdrRemarks,TxnDrawHdrID,MstCustID,MstSalesPICID,MstApprID,MstEmp)
  19. values
  20. ('$TxnQuotHdrNo','$TxnQuotHdrNoRev','$TxnQuotHdrDate','$TxnQuotHdrRE','$TxnQuotHdrTermsTxt','$TxnQuotHdrDiscount','$TxnQuotHdrRemarks','$TxnDrawHdrID','$MstCustID','$MstSalesPICID','$MstApprID','$MstEmp')");
  21.  
  22. $jml = $_POST['jml'];
  23. for ($x=0;$x<=$jml-1;$x++){
  24. $tmpKode = "kode_$x";
  25. $kode =$_POST[$tmpKode];
  26. $tmp1 = "MstProductID_$x";
  27. $k1 =$_POST[$tmp1];
  28. $tmp2 = "TxnQuotHdrNoRev_$x";
  29. $k2 =$_POST[$tmp2];
  30. $tmp4 = "TxnQuotDtlUnitPrice_$x";
  31. $k4 =$_POST[$tmp4];
  32. $tmp3 = "TxnQuotDtlQty_$x";
  33. $k3 =$_POST[$tmp3];
  34. $tmp5 = "TxnQuotDtlDiscount_$x";
  35. $k5 =$_POST[$tmp5];
  36. $tmp6 = "TxnQuotDtlDrawNo_$x";
  37. $k6 =$_POST[$tmp6];
  38. $tmp7 = "TxnQuotDtlDrawDate_$x";
  39. $k7 =$_POST[$tmp7];
  40. $tmp8 = "TxnQuotDtlRepair_$x";
  41. $k8 =$_POST[$tmp8];
  42. $tmp9 = "MstChasID_$x";
  43. $k9 =$_POST[$tmp9];
  44. $tmp10 = "MstTypeOrderID_$x";
  45. $k10 =$_POST[$tmp10];
  46. $tmp11 = "MstSatID_$x";
  47. $k11 =$_POST[$tmp11];
  48.  
  49. $sale = mysql_query("INSERT INTO txnquotdtl(TxnQuotDtlNo,TxnQuotHdrID,MstProductID,TxnQuotHdrNoRev,TxnQuotDtlQty,TxnQuotDtlUnitPrice,TxnQuotDtlDiscount,TxnQuotDtlDrawNo,TxnQuotDtlDrawDate,TxnQuotDtlRepair,MstChasID,MstTypeOrderID,MstSatID)
  50. values('$kode','$TxnQuotHdrID','$k1','$k2','$k3','$k4','$k5','$k6','$k7','$k8','$k9','$k10','$k11')");
  51. }
  52. }
  53. ?>
  54. <body>
  55. <form method="POST">
  56. <legend>
  57. <h3>Add New Transaction Quatation Header</h3></legend>
  58. <table align="left" width="400px">
  59. <tr>
  60. <?php
  61. $cek=mysql_query("select max(TxnQuotHdrID)as id from txnquothdr");
  62. $dap=mysql_fetch_array($cek);
  63. $r=$dap['id']+1;
  64. {
  65. ?>
  66. <input type="hidden" name="TxnQuotHdrID" value="<?php echo $r; ?>"/>
  67. <?php } ?>
  68. </tr>
  69. <tr>
  70. <td>No Quotation</td>
  71. <td><div class="col-lg-9"><input type="text" name="TxnQuotHdrNo" placeholder="No Quatation" class="form-control input-sm" /></td>
  72. </tr>
  73. <tr>
  74. <td>No Rev 1</td>
  75. <td><div class="col-lg-9"><input type="text" name="TxnQuotHdrNoRev" placeholder="No Rev" class="form-control input-sm"/></td>
  76. </tr>
  77. <tr>
  78. <td>Header Date 1</td>
  79. <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrDate" placeholder="Date" class="form-control input-sm"/></td>
  80. </tr>
  81. <tr>
  82. <td>Header RE 1</td>
  83. <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrRE" placeholder="R E" class="form-control input-sm"/></td>
  84. </tr>
  85. <tr>
  86. <td>Header Terms </td>
  87. <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrTermsTxt" placeholder="Terms" class="form-control input-sm"/></td>
  88. </tr><tr>
  89. <td>Header Discount 1</td>
  90. <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrDiscount" placeholder="Discount" class="form-control input-sm"/></td>
  91. </tr>
  92. </table>
  93. <table width="435">
  94. <tr>
  95. <td>Header Remarks</td>
  96. <td ><div class="col-lg-9"><input type="text" name="TxnQuotHdrRemarks" placeholder="Remarks" class="form-control input-sm"/></td>
  97. </tr>
  98. <tr>
  99. <td>Header ID 1</td>
  100. <td ><div class="col-lg-9"><input type="text" name="TxnDrawHdrID" placeholder="TxnDrawHdrID" class="form-control input-sm"/></td>
  101. </tr>
  102. <tr>
  103. <td>Customer</td>
  104. <td><div class="col-lg-9"><select class="form-control select-sm" name="MstCustID">
  105. <option value="" selected>--select Customer--</option>
  106. <?php
  107. if(empty($cs)){
  108. echo '<option value=""></option>';
  109. }else{
  110. foreach($cs as $row){
  111. echo '<option value="'.$row->MstCustID.'">'.$row->MstCustIDName.'</option>';
  112. }
  113. } ?>
  114. </select>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td>Seles PIC</td>
  119. <td><div class="col-lg-9">
  120. <select class="form-control select-sm" name="MstSalesPICID">
  121. <option value="" selected>--select sales PIC--</option>
  122. <?php
  123. if(empty($salespic)){
  124. echo '<option value=""></option>';
  125. }else{
  126. foreach($salespic as $row){
  127. echo '<option value="'.$row->MstSalesPICID.'">'.$row->MstSalesPICName.'</option>';
  128. }
  129. } ?>
  130. </select>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td>Master ApprId</td>
  135. <td ><div class="col-lg-9"><input type="text" name="MstApprID" placeholder="Appr ID" class="form-control input-sm"/></td>
  136. </tr>
  137. <tr>
  138. <td>Master Employee</td>
  139. <td ><div class="col-lg-9"><input type="text" name="MstEmp" placeholder="Employee" class="form-control input-sm"/></td>
  140. </tr>
  141. <td>&nbsp;</td>
  142. <td >&nbsp;</td>
  143. </tr>
  144. </table>
  145. <center>
  146. <h4>Detail Quotation</h4>
  147. </center>
  148. <div style=' overflow-y:scroll; overflow-x:scroll; padding:10px; height:150px;'>
  149.  
  150. <table width="90%" align="center" class="table table-striped table-bordered table-hover dataTable no-footer" id="module" style="width:98%">
  151. <thead>
  152. <tr>
  153. <td width="164">TxnQuotDtlNo</td>
  154. <td width="164">MstProductID</td>
  155. <td width="164">MstPriceUnitPrice</td>
  156. <td width="164">TxnQuotHdrNoRev </td>
  157. <td width="164">TxnQuotDtlQty</td>
  158. <td width="164">TxnQuotDtlUnitPrice 1</td>
  159. <td width="164">TxnQuotDtlDiscount 1</td>
  160. <td width="164">TxnQuotDtlDrawNo 1</td>
  161. <td width="164">TxnQuotDtlDrawDate</td>
  162. <td width="164">TxnQuotDtlRepair</td>
  163. <td width="164">MstChasID 1</td>
  164. <td width="164">MstTypeOrderID</td>
  165. <td width="164">MstSatID 1</td>
  166. </tr>
  167. </thead>
  168.  
  169. <tbody>
  170. <tr>
  171. <td>
  172. <input type="text" name="kode_0" id="kode_0" class="input-medium" style="width:150px">
  173. </td>
  174. <td>
  175. <input id="MstProductID" type="text" name="MstProductID_0" placeholder="MstProductID" readonly onClick="getData(this)" />
  176. </td>
  177. <td>
  178. <input id="MstPriceUnitPrice" type="text" name="MstPriceUnitPrice_0" placeholder="MstProductID" readonly />
  179. </td>
  180. <td>
  181. <input id="TxnQuotHdrNoRev_0" type="text" name="TxnQuotHdrNoRev_0" placeholder="TxnQuotHdrNoRev" class="form-control input-sm"/>
  182. </td>
  183. <td>
  184. <input id="TxnQuotDtlQty_0" type="text" name="TxnQuotDtlQty_0" placeholder="TxnQuotDtlQty" class="form-control input-sm"/>
  185. </td>
  186. <td>
  187. <input id="TxnQuotDtlUnitPrice_0" type="text" name="TxnQuotDtlUnitPrice_0" placeholder="TxnQuotDtlUnitPrice" class="form-control input-sm"/>
  188. </td>
  189. <td>
  190. <input id="TxnQuotDtlDiscount_0" type="text" name="TxnQuotDtlDiscount_0" placeholder="TxnQuotDtlDiscount" class="form-control input-sm"/>
  191. </td>
  192. <td>
  193. <input id="TxnQuotDtlDrawNo_0" type="text" name="TxnQuotDtlDrawNo_0" placeholder="TxnQuotDtlDrawNo" class="form-control input-sm"/>
  194. </td>
  195. <td>
  196. <input id="TxnQuotDtlDrawDate_0" type="text" name="TxnQuotDtlDrawDate_0" placeholder="TxnQuotDtlDrawDate" class="form-control input-sm"/>
  197. </td>
  198. <td>
  199. <input id="TxnQuotDtlRepair_0" type="text" name="TxnQuotDtlRepair_0" placeholder="TxnQuotDtlRepair" class="form-control input-sm"/>
  200. </td>
  201. <td>
  202. <select name="MstChasID_0" style="height:'28'">
  203. <option class="select-sm" selected>--select Chasis--</option>
  204. <?php
  205. if(empty($chasis)){
  206. echo '<option value=""></option>';
  207. }else{
  208. foreach($chasis as $row){
  209. echo '<option value="'.$row->MstChasID.'">'.$row->MStChasType.'</option>';
  210. }
  211. } ?>
  212. </select>
  213. </td>
  214. <td><div class="col-lg-9"><select id="qutrmst" class="form-control input-md" name="MstTypeOrderID_0">
  215. <option value="" selected>--select Type Order--</option>
  216. <?php
  217. if(empty($salespic)){
  218. echo '<option value=""></option>';
  219. }else{
  220. foreach($salespic as $row){
  221. echo '<option value="'.$row->MstSalesPICID.'">'.$row->MstSalesPICName.'</option>';
  222. }
  223. } ?>
  224. </select>
  225. </td>
  226. <td>
  227. <select id="qutrmst" class="form-control input-sm" name="MstSatID_0">
  228. <option value="" selected>--select Satuan--</option>
  229. <?php
  230. if(empty($satuan)){
  231. echo '<option value=""></option>';
  232. }else{
  233. foreach($satuan as $row){
  234. echo '<option value="'.$row->MstSatID.'">'.$row->MstSatAbbr.'</option>';
  235. }
  236. } ?>
  237. </select>
  238. </td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. </div>
  243. <br/>
  244. <input type="hidden" value="1" name="jml" id="jml">
  245. <a class="button" id="addRow"><input type="button" class="button" value="Add Row" /> </a>
  246. <a id="delete" class="button"><input type="button" class="button" value="Remove Row" /> </a><p>
  247. <br/>
  248. &nbsp;&nbsp; <input type="submit" name="simpan" id="simpan" class="btn btn-primary" value="simpan" >
  249. </p>
  250. </form>
  251.  
  252.  
  253. </body>
  254. </html>
  255.  
  256. <script>
  257. function getData(tmpObject) {
  258. var id=$("#suplier").val();
  259. var id_customer=$("#id_customer").val();
  260. var strNama = tmpObject.name;
  261. var x = strNama.split("_")[1];
  262. 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");
  263.  
  264. }
  265. </script>
  266.  
  267. <script>
  268. $(document).ready(function(){
  269. idrow = 2;
  270. $("#addRow").bind('click',function(){
  271. var rw=document.getElementById("jml").value;
  272.  
  273. var x=document.getElementById('module').insertRow(idrow);
  274. var tmpName="";
  275. var td1=x.insertCell(0);
  276. var td2=x.insertCell(1);
  277. var td3=x.insertCell(2);
  278. var td4=x.insertCell(3);
  279. var td5=x.insertCell(4);
  280. var td6=x.insertCell(5);
  281. var td7=x.insertCell(6);
  282. var td8=x.insertCell(7);
  283. var td9=x.insertCell(8);
  284. var td10=x.insertCell(9);
  285. var td11=x.insertCell(10);
  286. var td12=x.insertCell(11);
  287. var td13=x.insertCell(12);
  288. var td14=x.insertCell(13);
  289.  
  290. tmpName = 'kode_' + (idrow-1);
  291. td1.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " style='width:100px'>";
  292.  
  293. tmpName = "MstProductID_"+(idrow-1);
  294. td2.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " onclick='getData(this)' class='"+tmpName+" ' style='width:100px'>";
  295.  
  296. tmpName = "MstPriceUnitPrice_"+(idrow-1);
  297. td3.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  298.  
  299. tmpName = "TxnQuotHdrNoRev_"+(idrow-1);
  300. td4.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  301.  
  302. tmpName="TxnQuotDtlQty_"+(idrow-1);
  303. td5.innerHTML="<input type='text' id="+tmpName+" name="+tmpName + " class='"+tmpName+" 'style='width:100px'>";
  304.  
  305. tmpName="TxnQuotDtlUnitPrice_"+(idrow-1);
  306. td6.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  307.  
  308. tmpName="TxnQuotDtlDiscount_"+(idrow-1);
  309. td7.innerHTML="<input type='text' id="+tmpName+" name="+tmpName + " class='"+tmpName+" 'style='width:100px'>";
  310.  
  311. tmpName="TxnQuotDtlDrawNo_"+(idrow-1);
  312. td8.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  313.  
  314. tmpName="TxnQuotDtlDrawDate_"+(idrow-1);
  315. td9.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  316.  
  317. tmpName="TxnQuotDtlRepair_"+(idrow-1);
  318. td10.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  319.  
  320. tmpName="MstChasID_"+(idrow-1);
  321. td11.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  322.  
  323. tmpName="MstTypeOrderID_"+(idrow-1);
  324. td13.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  325.  
  326. tmpName="MstSatID_"+(idrow-1);
  327. td14.innerHTML="<input type='text' id="+tmpName+ " name="+tmpName + " class='"+tmpName+" ' style='width:100px'>";
  328.  
  329. idrow++;
  330. document.getElementById("jml").value = idrow-1;
  331. });
  332.  
  333.  
  334.  
  335. // Remove row when clicked
  336. $("#delete").live('click',function(){
  337. if(idrow>2) {
  338. var x=document.getElementById('module').deleteRow(idrow-1);
  339. idrow--;
  340. document.getElementById("jml").value = idrow-1;
  341.  
  342. }
  343.  
  344. });
  345.  
  346. });
  347.  
  348. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement