| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/nymp/wwwdev/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
//var_dump($_POST);
form_prep('locations', 'basic_info');
if ($action == 'Add New' && empty($_POST['location_id']) && !empty($_GET['location_id'])) :
$_POST['location_id'] = $_GET['location_id'];
endif;
if ($_POST['ajax_event_submitted'] == '1') :
form_reload_check();
if (isset($_POST['active_tab'])) :
$active_tab = $_POST['active_tab'];
else :
$active_tab = 'basic_info';
endif;
$ar_err = array();
$_POST['qty'] = nz($_POST['qty'], '0');
$_POST['return_qty'] = nz($_POST['return_qty'], '0');
$_POST['restock_qty'] = nz($_POST['restock_qty'], '0');
if (empty($_POST['location_id'])) :
$ar_err['location_id'] = 'Location is required!';
$err_flag = true;
$err_tab = 'basic_info';
endif;
if ($_POST['qty'] <= 0) :
$ar_err['qty'] = 'Qty is required!';
$err_flag = true;
$err_tab = 'basic_info';
endif;
if (!$err_flag) :
$set = "location_id = ".nz($_POST['location_id'], '0').", ".
"qty = ".nz($_POST['qty'], '0').", ".
"return_qty = ".nz($_POST['return_qty'], '0').", ".
"restock_qty = ".nz($_POST['restock_qty'], '0').", ".
"comments = ".$db->quote(trim($_POST['comments'])).", ".
"update_by = ".nz(trim($_SESSION['user_id'])).", ".
"update_date = '".date('Y-m-d H:i:s')."' ";
if ($action == 'Edit') :
$sql = "UPDATE deliveries set ".$set.
"WHERE delivery_id = ".nz($_REQUEST['id'], '0')." ";
$db->query($sql) or die('Database Error!');
$_POST['update_by'] = trim($_SESSION['user_id']);
$_POST['update_date'] = date('m/d/Y h:i:s a');
else :
if ($action == 'Add New') :
$sql = "INSERT INTO deliveries SET ".
"create_date = '".date('Y-m-d H:i:s')."', ".
"create_by = ".nz($_SESSION['user_id'], '0').", ".
$set;
$db->query($sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
$_POST['delivery_id'] = $_REQUEST['id'];
$_POST['create_by'] = trim($_SESSION['user_id']);
$_POST['create_date'] = date('m/d/Y h:i:s a');
$_POST['update_by'] = trim($_SESSION['user_id']);
$_POST['update_date'] = date('m/d/Y h:i:s a');
endif;
endif;
$form_message = "Saved sucessfully!";
form_uid_reset();
if ($_POST['xsubmit'] == 'Save & Close') :
echo "<SCRIPT>";
//echo "window.location.href = 'index.php?IX=".$_REQUEST['ref']."'";
echo "appstack_pop()";
echo "</SCRIPT>";
endif;
if ($_POST['xsubmit'] == 'Save & New') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=delivery_form&ref=".urlencode($_REQUEST['ref'])."'";
echo "</SCRIPT>";
endif;
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else:
if ($action == 'Edit') :
$sql = "SELECT * FROM deliveries WHERE delivery_id = ".nz($_REQUEST['id'], '0')." ";
$result = $db->query($sql) or die('Database Error!');
if ($result->rowCount() > 0) :
$row = $result->fetch(PDO::FETCH_OBJ);
$_POST['delivery_id'] = $row->delivery_id;
$_POST['location_id'] = $row->location_id;
$_POST['qty'] = $row->qty;
$_POST['return_qty'] = $row->return_qty;
$_POST['restock_qty'] = $row->restock_qty;
$_POST['comments'] = $row->comments;
$_POST['create_by'] = $row->create_by;
$_POST['create_date'] = nzdate_display_datetime($row->create_date);
$_POST['update_by'] = $row->update_by;
$_POST['update_date'] = nzdate_display_datetime($row->update_date);
$current_delivery = $row->delivery_id;
else :
echo form_fatal_error('Invalid Operation!');
return;
endif;
else :
endif;
endif;
?>
<script>
var active_page = '<?php echo $_REQUEST['IX']; ?>';
var active_tab = '';
update_header = function()
{
if ($("#category_name").val() > "" )
{
$("#header_repeater").text(" - " + $("#category_name").val());
}
}
$(document).ready(function()
{
switch_tab('<?php echo $active_tab; ?>');
update_header();
$(':input:not(.search)').change(function() {sheet_dirty = true; } );
}
)
</script>
<h1>Delivery - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>
<form style="" name="frm_category" id="frm_category" method="post" action="">
<input name="ajax_event_submitted" type="hidden" value="1" />
<input name="id" type="hidden" value="<?php echo $_REQUEST['id']; ?>" />
<input name="active_tab" id="active_tab" type="hidden" value="basic_info" />
<?php form_button_strip('top', array('save_new' => array('show' => false))); ?>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_strip">
<div class="tab_header" id="tab_basic_info" onclick="switch_tab('basic_info');">
Basic Info
</div>
</div>
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_basic_info">
<div class="form_header">
Basic Info
</div>
<div class="input_column">
<?php
form_field('delivery_id', 'text', 10, 0, false, false, true, '', '', 'delivery_id', 'Delivery ID');
$sql = "SELECT location_id, location_name FROM locations WHERE location_id = ".nz($_POST['location_id'], '0')." ORDER BY location_name ";
$result = $db->query($sql) or die('Database Error!');
$ar_locations = $result->fetchAll(PDO::FETCH_KEY_PAIR);
form_field('location_id', 'select', 50, 0, true, false, true, '', '', 'location_id', 'Location', $ar_locations);
form_field('qty', 'text', 10, 0, true, false, false, '', '', 'qty', 'Qty');
form_field('return_qty', 'text', 10, 0, false, false, false, '', '', 'return_qty', 'Return Qty');
form_field('restock_qty', 'text', 10, 0, false, false, false, '', '', 'restock_qty', 'Restock Qty');
form_field('comments', 'textarea', 50, 7, false, false, false, '', '', 'comments', 'Comments');
?>
</div>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<?php form_button_strip('bottom', array('save_new' => array('show' => false))); ?>
</form>