137 lines
4.6 KiB
PHP
137 lines
4.6 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$CurrentTable = "supplier_products";
|
|
$FormFile = "supplier_products.dialog.php";
|
|
$JQueryFile = "supplier_products.js.php";
|
|
$DialogWidth = 750;
|
|
$DialogHeight = 600;
|
|
$TitleText = getLanguageText('TEXT-SUPPLIER-PRODUCTS');
|
|
$SequenceFlag = 'N';
|
|
$tableAction = "supplier-products-list";
|
|
$RequiredFields = array('product_name','package_qty','package_cost','standard_online_price','standard_offline_price');
|
|
|
|
|
|
// Ensure that only valid user types have access to this module
|
|
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
include "form.messages.php";
|
|
endTemplate();
|
|
exit();
|
|
}
|
|
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = getLanguageText('TEXT-SUPPLIER-PRODUCTS');
|
|
$headerArgs = "";
|
|
|
|
|
|
// Handle supplier_num
|
|
$supplier_num = 0;
|
|
$swhere = "";
|
|
if (array_key_exists('supplier_num', $_GET)) $supplier_num = intval($_GET['supplier_num']);
|
|
|
|
$CustomData = "&supplier_num=$supplier_num";
|
|
$JScustomVariables = " var supplier_num = $supplier_num;\n";
|
|
if ($supplier_num > 0) {
|
|
$JScustomInsertCode = " $('#dialog_supplier_num').val($supplier_num);\n";
|
|
$SequenceFlag = 'Y';
|
|
|
|
$swhere = "AND supplier_num = $supplier_num ";
|
|
|
|
$supplier_name = db_getVal("SELECT supplier_name FROM suppliers WHERE school_num = $school_num AND record_num = $supplier_num");
|
|
$templatePageTitle .= "<br>$supplier_name";
|
|
}
|
|
|
|
$numProducts = db_getVal("SELECT count(*) FROM supplier_products WHERE school_num = $school_num $swhere");
|
|
$numInactive = db_getVal("SELECT count(*) FROM supplier_products WHERE school_num = $school_num $swhere AND status = 'Inactive'");
|
|
|
|
$JSinitForm = "
|
|
var num_alt_prices = $('#dialog_number_of_alternate_prices').val();
|
|
$('.alt10').hide();
|
|
if (num_alt_prices > 0) $('.alt'+num_alt_prices).show();
|
|
|
|
$('#uploaded_file_name').val('');
|
|
";
|
|
|
|
$FieldDefaultValues = array(
|
|
'package_qty' => '1',
|
|
'package_cost' => '0.00',
|
|
'standard_online_price' => '0.00',
|
|
'standard_offline_price' => '0.00'
|
|
);
|
|
|
|
|
|
$JSafterUploadCode = "
|
|
reloadProductImages();
|
|
";
|
|
|
|
$JSafterDeleteCode = "
|
|
$('#inactive-button').show();
|
|
";
|
|
|
|
?>
|
|
<style>
|
|
#data-dialog-body {
|
|
max-height: 550px;
|
|
overflow: auto;
|
|
}
|
|
</style>
|
|
<?php
|
|
|
|
include "form.js.php";
|
|
|
|
?>
|
|
|
|
<?php
|
|
if ($numProducts > 0) {
|
|
$inactiveStyle = " style='visibility: hidden'";
|
|
if ($numInactive > 0) {
|
|
$inactiveStyle = "";
|
|
}
|
|
?>
|
|
<center>
|
|
<div>
|
|
<span><button id='view-active-products' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-VIEW-ACTIVE'); ?> </button></span>
|
|
<span id='inactive-button'><button id='view-all-products' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-VIEW-INACTIVE'); ?> </button></span>
|
|
<span><button id='edit-special-prices' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-EDIT-SPECIAL-PRICES'); ?> </button></span>
|
|
<span><button id='edit-description' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-EDIT-DESCRIPTION'); ?> </button></span>
|
|
<span><button id='post-to-menu' class='btn btn--outline btn--small'> <?php displayLanguageText('TEXT-POST-TO-MENU'); ?> </button></span>
|
|
</div>
|
|
</center>
|
|
|
|
<br>
|
|
<br>
|
|
<div style='float: right'>
|
|
<div><button id='supplier-products-report' class='btn btn--primary btn--xsmall'> <?php displayLanguageText('TEXT-SUPPLIER-PRODUCTS-REPORT'); ?> </button></div>
|
|
</div>
|
|
|
|
<div id='reset-summary-flag-dialog'>
|
|
<center>
|
|
<p><b><?php displayLanguageText('TEXT-UPDATE-ALL-SUPPLIER-PRODUCTS') ?></b></p>
|
|
<p><?php displayLanguageText('TEXT-SET-SUMMARY-FLAG-TO') ?></p>
|
|
<p><span class='resetSummaryBtn btn btn--primary btn--small btn--100' set='Y'><?php displayLanguageText('TEXT-YES') ?></span></p>
|
|
<p><span class='resetSummaryBtn btn btn--primary btn--small btn--100' set='N'><?php displayLanguageText('TEXT-NO') ?></span></p>
|
|
<br>
|
|
<p><span id='resetSummaryCloseBtn' class='btn btn--outline btn--small btn--100'><?php displayLanguageText('TEXT-CLOSE') ?></span></p>
|
|
<input type='hidden' id='supplier-num'>
|
|
</center>
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
<?php
|
|
endTemplate();
|
|
?>
|