<?php
if (isset($_POST['productName']))
{
$txtMemberId = $_POST['MemberId'];
$txtproductName = $_POST['productName'];
$txtCategory = $_POST['Category'];
$txtproductKeyword = $_POST['productKeyword'];
$txtsummary = $_POST['summary'];
$txtBrandName = $_POST['BrandName'];
$txtModel = $_POST['Model'];
$txtpackagingDesc = $_POST['packagingDesc'];
$txtDetailDesc = $_POST['DetailDesc'];
$images = "./img/auction/kucing2.jpg";
$txtRFQType = $_POST['RFQType'];
$txtcurrencies_id = $_POST['currencies_id'];
$txtrad = $_POST['rad'];
$txtprice_mask = $_POST['price_mask'];
$txtStartDate = $_POST['StartDate'];
$txtStartTime = $_POST['StartTime'];
$txtCloseDate = $_POST['CloseDate'];
$txtClosetTime = $_POST['ClosetTime'];
$txtTimeEx = $_POST['TimeEx'];
$txtDeliDate = $_POST['DeliDate'];
$txtpayment_tems = $_POST['payment_tems'];
$txtDTDT = $_POST['DTDT'];
$txtReceive = $_POST['Receive'];
$txtDataSheet = "./img/auction/kucing2.jpg";
// // koneksi ke mysql server hosting
mysql_connect('localhost', 'root', '');
mysql_select_db('db_blog');
$q1 = "INSERT INTO product(member_id, product_name, category_id, product_Keyword, product_des, product_poto, product_brand, product_model, product_packaging, product_detdes, approv, c_date)
VALUES ('$txtMemberId','$txtproductName','$txtCategory','$txtproductKeyword','$txt summary','$images','$txtBrandName','$txtModel','$txtpackagingDesc','$txtDet ailDesc','0',now())";
echo $q1 ;
mysql_query($q1);
$productId = mysql_insert_id();
$q2 = "INSERT INTO products(product_id, member_id, rfq_type, currency, R_TypeStart, price_marking, str_date, str_time, ex_date, ex_time, R_AutoEx, delivery_date, pay_terms, delivery_to, ket, data_sheet)
VALUES ('$productId','$txtMemberId','$txtRFQType','$txtcurrencies_id','$txtrad','$ txtprice_mask','$txtStartDate','$txtStartTime','$txtCloseDate','$txtClosetT ime','$txtTimeEx','$txtDeliDate','$txtpayment_tems','$txtDTDT','$txtReceive ','$txtDataSheet')";
echo '<br/>';
echo $q2;
if($txtTimeEx == '2'){
$q4 = "INSERT INTO timeex(product_id, ex_margin, et_day, ex_hours, ex_minute, ex_freq)
VALUES ('$productId','4','1','3','30','5')";
}
echo '<br/>';
echo $q4;
if ($txtrad == '1'){
$q3 = "INSERT INTO pricebasic(product_id, price) VALUES ('$productId','20000')";
}else{
$q3 ="INSERT INTO pricedua(product_id, name, qty, price, total) VALUES ('$productId','test wawan','100','10000','1000000')";
}
echo '<br/>';
echo $q3;
$hasil = mysql_query($q1 and $q2 and $q3);
if($hasil) {
echo "[removed]alert('Permintaan Anda berhasil disimpan.');[removed]";
} else {
echo "[removed]alert('Permintaan Anda tidak berhasil disimpan.');[removed]";
}
}
else
{
unset($_POST['email']);
}
?>
tabel_bonus :
-----------------------------------------------------------------
| id | id_account | bonus | tanggal_bonus | nama |
-----------------------------------------------------------------
| 100 | 123 | 100 | 2014-01-03 11:04:00 | budi |
| 99 | 647 | 400 | 2014-01-06 11:04:00 | ina |
| 98 | 232 | 350 | 2014-01-07 11:04:00 | nani |
| 97 | 123 | 800 | 2014-01-04 11:04:00 | budi |
| 96 | 647 | 700 | 2014-01-03 11:04:00 | ina |
| 95 | 123 | 450 | 2014-01-04 11:04:00 | budi |
| 94 | 123 | 250 | 2014-01-03 11:04:00 | budi |
dan tabel_tujuan :
----------------------------------------
| id | nomor_id | tujuan_bonus |
----------------------------------------
| 234 | 123 | bank |
| 233 | 647 | cash |
| 232 | 232 | bank |
| 231 | 238 | bank |
| 230 | 124 | bank |
| 229 | 948 | cash |
| 228 | 748 | bank |
| 227 | 467 | cash |
------------------------------------------------------------------
| id_account | nama | tujuan_bonus | bonus bulan ini | |
------------------------------------------------------------------
| 123 | budi | bank | 15000 |
| 647 | ina | cash | 20000 |
| 232 | nani | bank | 30000 |
<html>
<head></head>
<body>
<form method="POST" action="">
<table>
<tr>
<td >No.Spk</td>
<td><input type="text" name="no_spk" ></td>
</tr>
<tr>
<td>Lokasi Storing</td>
<td><input type="password" name="lokasi"></td>
</tr>
<tr>
<td>TANGGAL Spk</td>
<td><input font="13px" type="date" name="tgl_spk"></td>
</tr>
<tr>
<td>No.Unit</td>
<td><?php
include 'connection.php';
$connection1 =mysql_connect ($server,$user,$pass);
$db1 = mysql_select_db($db);
$result1 = mysql_query("select * from kendaraan");
$jsArray1 = "var a = new Array();";
echo '<select name="nounit" onchange="changeValue(this.value)">';
echo '<option>-------</option>';
while ($row1 = mysql_fetch_array($result1)) {
echo '<option value="' . $row1['nounit'] . '">' . $row1['nounit'] . '</option>';
$jsArray1 .= "a['" . $row1['nounit'] . "'] = {
smr:'" . addslashes($row1['smr']) . "',
model:'" . addslashes($row1['model']) . "',
noserie:'".addslashes($row1['noserie'])."'};"; }
echo '</select>';
?>
</td>
</tr>
<tr>
<td>SMR</td>
<td><input type="text" name="smr" id="z_smr" readonly="true"/></td>
</tr>
<tr>
<td>Model</td>
<td><input type="text" name="model" id="z_model" readonly="true"/></td>
</tr>
<tr>
<td>No Serie</td>
<td><input type="text" name="noserie" id="z_noserie" readonly="true"/></td>
</tr>
<script type="text/javascript">
<?php echo $jsArray1; ?>
function changeValue(id){
document.getElementById('z_smr').value = a[id].smr;
document.getElementById('z_model').value = a[id].model;
document.getElementById('z_noserie').value = a[id].noserie;
};
</script>
<tr>
<td>Jenis Part/Material</td>
<td><select name="jmaterial">
<option >pilih</option>
<option name="Suku Cadang/Parts">Suku Cadang/Parts</option>
<option name="Bahan Habis Pakai">Bahan Habis Pakai</option>
<option name="Consumable Goods">Consumable Goods</option>
<option name="Pelumas/Oil &Grease">Pelumas/Oil &Grease </option>
<option name="Ban /tyre">Ban /tyre</option>
<option name="Bahan Lain/Others">Bahan Lain/Others</option>
</select>
</td>
</tr>
<tr>
<td>Pesanan Untuk</td>
<td><select name="pu">
<option >pilih</option>
<option name="Repair(B/D)">Repair(B/D)</option>
<option name="Overhaul(O/H)">Overhaul(O/H)</option>
<option name="Maintenance">Maintenance</option>
<option name="Others">Others</option>
</select>
</td>
</tr>
<tr>
<td>Kelompok Komponen</td>
<td><select name="kk">
<option >pilih</option>
<option name="Engine&Accssories">Engine&Accssories</option>
<option name="Undercarriage/Tyre">Undercarriage/Tyre</option>
<option name="Pneumatic System">Pneumatic System</option>
<option name="T/M & Torque Converter">T/M & Torque Converter</option>
<option name="Hydraulic System">Hydraulic System</option>
<option name="General(Attachment,Chasis&Others)">General(Attachment,Chasis&Others)</option>
<option name="Differentional&Final Drive">Differentional&Final Drive</option>
<option name="Electrial System">Electrial System</option>
</select>
</td>
</tr>
</table >
<table border="1" cellpadding="5" cellspacing="0">
<p> </p>
<tr>
<td>S/N Catalog</td>
<td>FIGN No.</td>
<td>Index No.</td>
<td>Part Number</td>
<td>Interchange</td>
<td>Interchange</td>
<td>Interchange</td>
<td>Uraian/Deskription</td>
<td>Jumlah</td>
<td>Keterangan</td>
</tr>
<tr>
<td><input type="text" name="sncatalog" size="5"></td>
<td><input type="text" name="fignno" size="5"></td>
<td><input type="text" name="indexno" size="5"></td>
<td><?php
include 'connection.php';
$connection =mysql_connect ($server,$user,$pass);
$db = mysql_select_db($db);
$result = mysql_query("select * from sparepart");
$jsArray = "var prdName = new Array();\n";
echo '<select name="partnumber" onchange="changeValue(this.value)">';
echo '<option>-------</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['partnumber'] . '">' . $row['partnumber'] . '</option>';
$jsArray .= "prdName['" . $row['partnumber'] . "'] = {
ic1:'" . addslashes($row['ic1']) . "',
ic2:'" . addslashes($row['ic2']) . "',
ic3:'" . addslashes($row['ic3']) . "',
partname:'".addslashes($row['partname'])."'};"; }
echo '</select>';
?> </select></td>
<td><input type="text" name="ic1" id="prd_ic1" readonly="true"/></td>
<td><input type="text" name="ic2" id="prd_ic2" readonly="true"/></td>
<td><input type="text" name="ic3" id="prd_ic3" readonly="true"/></td>
<td><input type="text" name="partname" id="prd_partname" readonly="true"/></td>
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('prd_ic1').value = prdName[id].ic1;
document.getElementById('prd_ic2').value = prdName[id].ic2;
document.getElementById('prd_ic3').value = prdName[id].ic3;
document.getElementById('prd_partname').value = prdName[id].partname;
};
</script>
<td><input type="text" name="jumlah" size="5"></td>
<td><textarea rows="3" cols="15" name="keterangan"></textarea></td>
</tr>
</table>
</form>
<input type="reset" name="reset" value="RESET"/>
<input type="submit" name="save" value="SAVE"/>
</body>
</html>