160 lines
5.9 KiB
PHP
160 lines
5.9 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
?>
|
|
|
|
<br>
|
|
<form method='post' action='/' name='updateform'>
|
|
<?php
|
|
|
|
$form_width = '80%';
|
|
$message_width = $form_width;
|
|
include "form.messages.php";
|
|
|
|
$numDataCols = 6;
|
|
if ($school_record['display_bc_food_guidelines'] == 'Y') $numDataCols = 7;
|
|
if (in_array($school_record['reseller'], array('esns','backpac'))) $numDataCols++;
|
|
|
|
?>
|
|
<table width='95%' class='content-table'>
|
|
<tr>
|
|
<td align='center' class='heading'>Supplier Product Price Update</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<br>
|
|
<table width='95%' cellpadding='1' cellspacing='1' border='0' class='content-table'>
|
|
<?php
|
|
// Get suppliers to process
|
|
$swhere = "and status = 'Active' ";
|
|
if (isset($selected_supplier)) $swhere = "and record_num = $selected_supplier ";
|
|
$query = "select * from suppliers " .
|
|
"where school_num = $supplier_school_num " .
|
|
"and status = 'Active' " .
|
|
$swhere .
|
|
"order by supplier_name";
|
|
$suppliers = db_query($query);
|
|
|
|
while ($supplier = db_fetch_array($suppliers)) {
|
|
$supplier_num = $supplier['record_num'];
|
|
$supplier_name = $supplier['supplier_name'];
|
|
|
|
// Get products for this supplier
|
|
$query = "select * from supplier_products " .
|
|
"where school_num = $supplier_school_num " .
|
|
"and supplier_num = $supplier_num " .
|
|
"AND status = 'Active' " .
|
|
"order by sequence,product_name";
|
|
$products = db_query($query);
|
|
|
|
if (db_num_rows($products) == 0) continue;
|
|
|
|
?>
|
|
<tr>
|
|
<td align='left' colspan='<?php echo($numDataCols) ?>' class='success'>
|
|
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
|
|
<tr>
|
|
<td align='left' class='success'><b><?php echo($supplier_name) ?></td>
|
|
</tr>
|
|
</td>
|
|
</table>
|
|
</tr>
|
|
<tr>
|
|
<td width='50%' align='left' class='oitem'><b>ITEM</b></td>
|
|
<td width='10%' align='center' class='oitem'><b>PKG QTY</b></td>
|
|
<td width='10%' align='right' class='oitem'><b>COST</b></td>
|
|
<?php if (in_array($school_record['reseller'], array('esns','backpac'))) { ?>
|
|
<td width='10%' align='right' class='oitem'><b>MARGIN</b></td>
|
|
<?php } ?>
|
|
<td width='10%' align='center' class='oitem'><b>TAXABLE</b></td>
|
|
<td width='10%' align='right' class='oitem'><b>ON-LINE</b></td>
|
|
<td width='10%' align='right' class='oitem'><b>PAPER</b></td>
|
|
<?php if ($school_record['display_bc_food_guidelines'] == 'Y') { ?>
|
|
<td width='10%' align='center' class='oitem'><b>Food Guidelines</b></td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
|
|
while ($product = db_fetch_array($products)) {
|
|
extract($product);
|
|
|
|
$product_num = $record_num;
|
|
|
|
// Setup field names
|
|
$qfield = "qty_$product_num";
|
|
$cfield = "cost_$product_num";
|
|
$afield = "margin_$product_num";
|
|
$tfield = "tax_$product_num";
|
|
$ofield = "oprice_$product_num";
|
|
$pfield = "pprice_$product_num";
|
|
|
|
$fpm = " size='6' style='text-align: right; float: right;'";
|
|
$fpmq = " size='3' style='text-align: center;'";
|
|
|
|
if (strlen($product_description)) $product_name .= " ($product_description)";
|
|
|
|
?>
|
|
<tr>
|
|
<td align='left' class='oitem'><?php echo($product_name) ?> ::</td>
|
|
<td align='center' class='oitem'><input type='text' name='<?php echo($qfield) ?>' value='<?php echo($package_qty) ?>'<?php echo($fpmq) ?>></td>
|
|
<td align='right' class='oitem'><input type='text' name='<?php echo($cfield) ?>' value='<?php echo($currencySymbol . sprintf($costFmt,$package_cost)) ?>'<?php echo($fpm) ?>></td>
|
|
<?php if (in_array($school_record['reseller'], array('esns','backpac'))) { ?>
|
|
<td align='right' class='oitem'><input type='text' name='<?php echo($afield) ?>' value='<?php echo($currencySymbol . sprintf($costFmt,$margin_cost)) ?>'<?php echo($fpm) ?>></td>
|
|
<?php } ?>
|
|
<td align='center' class='oitem'><nobr><?php BuildFileRadio("yn.txt",$tfield,$taxable_product) ?></nobr></td>
|
|
<td align='right' class='oitem'><input type='text' name='<?php echo($ofield) ?>' value='<?php echo($currencySymbol . number_format($standard_online_price,2)) ?>'<?php echo($fpm) ?>></td>
|
|
<td align='right' class='oitem'><input type='text' name='<?php echo($pfield) ?>' value='<?php echo($currencySymbol . number_format($standard_offline_price,2)) ?>'<?php echo($fpm) ?>></td>
|
|
<?php if ($school_record['display_bc_food_guidelines'] == 'Y') { ?>
|
|
<td align='center' class='oitem'>
|
|
<select name='bc_guideline_rating_<?php echo($product_num) ?>'>
|
|
<?php BuildFileList("bc_guideline_rating.txt",$bc_guideline_rating) ?>
|
|
</select>
|
|
</td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='center'>
|
|
<br>
|
|
<input type='submit' class='btn btn--primary' value='Update Prices'>
|
|
<input type='hidden' name='action' value='supplier-products-update'>
|
|
<input type='hidden' name='naction' value='update'>
|
|
<?php if (isset($selected_supplier)) { ?>
|
|
<input type='hidden' name='selected_supplier' value='<?php echo($selected_supplier) ?>'>
|
|
<?php } ?>
|
|
<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<?php
|
|
if (isset($selected_supplier)) {
|
|
$smode = 'secondary';
|
|
include "supplier_products.buttons.php";
|
|
}
|
|
?>
|
|
<table cellspacing='1' cellpadding='5' border='0'>
|
|
<tr>
|
|
<?php if (isset($selected_supplier)) { ?>
|
|
<td align='center'><a href='/?action=supplier-products&naction=list&supplier_num=<?php echo($selected_supplier) ?>' class='btn btn--primary>'>Supplier Products</a></td>
|
|
<?php } ?>
|
|
<td align='center'><a href='/?action=suppliers&naction=list' class='btn btn--primary>'>Suppliers List</a></td>
|
|
<td align='center'><a href='/?action=supplier-products-post&selected_supplier=<?php echo($selected_supplier) ?>' class='btn btn--primary>'>Post Products to Menu</a></td>
|
|
</tr>
|
|
</table>
|
|
|