Pino1990
Gebruiker
- Lid geworden
- 5 aug 2006
- Berichten
- 93
Ik ben het script aan het schrijven om de voorraadveranderingen te registreren.
Om een mutatie toe te voegen (inkoop, defect product etc) en tevens te bewerken, heb ik het volgende geschreven. Het om de volgende lap code (dit is een deel van het script, maar tot hiertoe werkt alles). Het formulier is gevuld met gegevens uit het vorige deel van het script, dus die doet het. Als ik op verzenden klik, komt er een wit scherm... Wat doe ik fout?
Om een mutatie toe te voegen (inkoop, defect product etc) en tevens te bewerken, heb ik het volgende geschreven. Het om de volgende lap code (dit is een deel van het script, maar tot hiertoe werkt alles). Het formulier is gevuld met gegevens uit het vorige deel van het script, dus die doet het. Als ik op verzenden klik, komt er een wit scherm... Wat doe ik fout?
PHP:
<?php
} elseif(isset($_GET[ 'action']) && ($_GET['action'] == "productselected")) {
?>
<table width="100%">
<tr>
<td class="main" valign="top">
<?php
$newmutation_query_raw = ("SELECT p.products_id, p.products_quantity, p.manufacturers_id, pd.products_name, p.products_model, p.products_weight, p.products_costprice, p.products_price, p.products_tax_class_id, p.products_warranty, pr.manufacturers_name from " . TABLE_PRODUCTS . " p inner join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id left outer join " . TABLE_MANUFACTURERS . " pr ON (p.manufacturers_id = pr.manufacturers_id) WHERE p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");
$newmutation_query = tep_db_query($newmutation_query_raw);
while ($newmutation = tep_db_fetch_array($newmutation_query)) {
$products_id = $newmutation['products_id'];
$products_model = $newmutation['products_model'];
$products_name = $newmutation['products_name'];
$products_manufacturer = $newmutation['manufacturers_name'];
$products_price = $newmutation['products_price'];
$products_costprice = $newmutation['products_costprice'];
$products_tax_class_id = $newmutation['products_tax_class_id'];
$tax_query = tep_db_query("SELECT tax_rate from " . TABLE_TAX_RATES . " WHERE tax_class_id = '" . $products_tax_class_id . "'");
while ($tax = tep_db_fetch_array($tax_query)) {
$products_tax = $tax['tax_rate'];
?>
<form action="<?php echo FILENAME_PREFIXES_NEW; ?>?pID=<?php echo (int)$HTTP_GET_VARS['pID']; ?>&action=productselected" method="post" name="action" value="productselected">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td valign="top"><table border="0" width="500" cellspacing="0" cellpadding="2">
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_REGISTRATION_DATE; ?></td>
<td class="main" align="left">
<?php
if(isset($_GET[ 'date']) && ($_GET['date'] == "today")) {
?>
<input name="mutation_date" type="text" value="<?php echo date("Y-m-d") ?>" size="35">
<?php
} else {
?>
<SELECT name="mutation_date_day">
<?php echo OPTIONS_MUTATION_DATE_DAY_NEW; ?>
</SELECT>
<SELECT name="mutation_date_month">
<?php echo OPTIONS_MUTATION_DATE_MONTH_NEW; ?>
</SELECT>
<SELECT name="mutation_date_year">
<?php echo OPTIONS_MUTATION_DATE_YEAR_NEW; ?>
</SELECT>
<input name="" type="button" onClick="location.href='<?php tep_href_link(FILENAME_MUTATION_MANAGER_NEW, '', 'NONSSL'); ?>?action=productselected&pID=<?php echo $products_id; ?>&date=today'" value="<?php echo BUTTON_TODAY; ?>">
<?php
}
?>
</td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_ID; ?></td>
<td class="main" align="left"><input name="products_id" type="text" disabled value="<?php echo $products_id; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_MODEL; ?></td>
<td class="main" align="left"><input name="products_model" type="text" disabled value="<?php echo $products_model; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_MANUFACTURER; ?></td>
<td class="main" align="left"><input name="products_manufacturer" type="text" disabled value="<?php echo $products_manufacturer; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_NAME; ?></td>
<td class="main" align="left"><input name="products_name" type="text" disabled value="<?php echo $products_name; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_COSTPRICE; ?></td>
<td class="main" align="left"><input name="products_costprice" type="text" disabled value="<?php echo $products_costprice; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_PRICE; ?></td>
<td class="main" align="left"><input name="products_price" type="text" disabled value="<?php echo $products_price; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_PRODUCT_TAX; ?></td>
<td class="main" align="left"><input name="products_tax" type="text" disabled value="<?php echo $products_tax; ?>" size="35" readonly="true"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"> </td>
<td class="main" align="left"> </td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_MUTATION_REASON; ?></td>
<td class="main" align="left"><input name="mutation_id" type="text" size="35" maxlength="2"></td>
</tr>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_MUTATION_QUANTITY; ?></td>
<td class="main" align="left">
<table><tr><td class="main">
<p>
<label><input name="mutation_prefix" type="radio" value="+" checked> +</label>
<br>
<label><input name="mutation_prefix" type="radio" value="-"> -</label>
<br>
</p>
</td><td class="main" rowspan="2">
<input name="mutation_quantity" type="text" size="27">
</td></tr></table>
</td>
</tr>
<?php
if (isset($admin['id'])){
$cs_id=$admin['id'].'-'. $admin['username'];
}else{
$cs_id = $_SERVER['REMOTE_USER'];
}
?>
<tr class="main">
<td class="main" width="160" align="left"><?php echo TEXT_TABLE_HEADING_USER_ID; ?></td>
<td class="main" align="left"><input name="user_id" type="text" disabled value="<?php echo $cs_id; ?>" size="35" readonly="true"></td>
</tr>
<tr>
<td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
</tr>
<tr>
<td colspan="2" class="main">
<input type="hidden" name="action" value="productselected">
<input name="<?php echo SEND_FORM; ?>" type="submit" value="<?php echo SEND_FORM; ?>">
</form>
<?php
if ($_POST['action'] == "productselected"){
if(isset($_GET[ 'date']) && ($_GET['date'] == "today")) {
$reg_date = $_POST['mutation_date'];
} else {
$reg_date = $_POST['mutation_date_year'] . '-' . $_POST['mutation_date_month'] . '-' . $_POST['mutation_date_day'];
}
$products_id = $_POST['products_id'];
$products_model = $_POST['products_model'];
$products_name = $_POST['products_name'];
$products_manufacturer = $_POST['products_manufacturer'];
$products_price = $_POST['products_price'];
$products_costprice = $_POST['products_costprice'];
$products_tax = $_POST['products_tax'];
$mutation_id = $_POST['mutation_id'];
$mutation_prefix = $_POST['mutation_prefix'];
$mutation_quantity = $_POST['mutation_quantity'];
$user_id = $_POST['user_id'];
$sql = "INSERT INTO " . TABLE_MANAGESTOCK . " (reg_date, products_id, products_model, products_name, products_manufacturer, products_price, products_costprice, products_tax, mutation_id, mutation_prefix, mutation_quantity, user_id)
VALUES ('" . $reg_date . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_manufacturer . "', '" . $products_price . "', '" . $products_costprice . "', '" . $products_tax . "', '" . $mutation_id . "', '" . $mutation_prefix . "', '" . $mutation_quantity . "', '" . $user_id . "')";
$result = mysql_query($sql) or die(mysql_error());
echo '<meta http-equiv="refresh" content="0;url=mutationmanager.php">';
} }
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table></td>