| Server IP : 104.21.21.239 / Your IP : 216.73.216.201 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/www/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_verification_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['delivered_qty'] = nz($_POST['delivered_qty'], '0');
$_POST['returned_qty'] = nz($_POST['returned_qty'], '0');
$_POST['old_qty'] = nz($_POST['old_qty'], '0');
$_POST['new_qty'] = nz($_POST['new_qty'], '0');
if (empty($_POST['spoke_to'])) :
$ar_err['spoke_to'] = 'Spoke to is required!';
$err_flag = true;
$err_tab = 'basic_info';
endif;
if (empty($_POST['verification_type'])) :
$ar_err['verification_type'] = 'Verification type is required!';
$err_flag = true;
$err_tab = 'basic_info';
endif;
if ($_POST['magazines_delivered'] <= ' ') :
$ar_err['magazines_delivered'] = 'Magazines delivered is required!';
$err_flag = true;
$err_tab = 'basic_info';
endif;
if (!$err_flag) :
$set = "location_id = ".nz($_POST['location_id'], '0').", ".
"verification_type = ".nz($_POST['verification_type'],'0').", ".
"magazines_delivered = ".nz($_POST['magazines_delivered'],'0').", ".
"all_distributed = ".nz($_POST['all_distributed'],'0').", ".
"change_draw = ".nz($_POST['change_draw'],'0').", ".
"delivered_qty = ".nz($_POST['delivered_qty'],'0').", ".
"returned_qty = ".nz($_POST['returned_qty'],'0').", ".
"old_qty = ".nz($_POST['old_qty'],'0').", ".
"new_qty = ".nz($_POST['new_qty'],'0').", ".
"spoke_to = ".$db->quote(trim($_POST['spoke_to'])).", ".
"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 verifications set ".$set.
"WHERE verification_id = ".nz($_REQUEST['id'], '0')." ";
$db->query($sql) or die('Database Error!');
//echo '==='.$sql.'===';
$_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 verifications SET ".
"create_date = '".date('Y-m-d H:i:s')."', ".
"create_by = ".nz($_SESSION['user_id'], '0').", ".
$set;
//echo '==='.$sql.'===';
$db->query($sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
$_POST['verification_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=verification_form&ref=".urlencode($_REQUEST['ref'])."&location_id=".$_GET['location_id']."'";
echo "</SCRIPT>";
endif;
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else:
if ($action == 'Edit') :
$sql = "SELECT * FROM verifications WHERE verification_id = ".nz($_REQUEST['id'], '0')." ";
$result = $db->query($sql) or die('Database Error!');
if ($result->rowCount() > 0) :
$row = $result->fetch(PDO::FETCH_OBJ);
$_POST['verification_id'] = $row->verification_id;
$_POST['location_id'] = $row->location_id;
$_POST['verification_type'] = $row->verification_type;
$_POST['magazines_delivered'] = $row->magazines_delivered;
$_POST['all_distributed'] = $row->all_distributed;
$_POST['change_draw'] = $row->change_draw;
$_POST['delivered_qty'] = $row->delivered_qty;
$_POST['returned_qty'] = $row->returned_qty;
$_POST['old_qty'] = $row->old_qty;
$_POST['new_qty'] = $row->new_qty;
$_POST['spoke_to'] = $row->spoke_to;
$_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_verification = $row->verification_id;
else :
echo form_fatal_error('Invalid Operation!');
return;
endif;
else :
endif;
endif;
?>
<script>
var active_page = '<?php echo $_REQUEST['IX']; ?>';
var active_tab = '';
check_draw = function()
{
if ($('input[name=change_draw').prop('checked'))
{
$('#old_qty').parent().show();
$('#new_qty').parent().show();
}
else
{
$('#old_qty').parent().hide();
$('#new_qty').parent().hide();
$('#new_qty').val('');
}
}
update_header = function()
{
/*
if ($("#first_name").val() > "" && $("#last_name").val() > "" )
{
$("#header_repeater").text(" - " + $("#first_name").val() + ' ' + $("#last_name").val());
}
*/
}
$(document).ready(function()
{
switch_tab('<?php echo $active_tab; ?>');
update_header();
$(':input:not(.search)').change(function() {sheet_dirty = true; } );
check_draw();
$('input[name=change_draw').change(function() { check_draw(); } );
}
)
</script>
<h1>Verification - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php echo form_message($form_message); ?>
<form style="" name="frm_verificaation" id="frm_verificaation" method="post" action="">
<input name="ajax_verification_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'); ?>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<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('verification_id', 'text', 10, 0, false, false, true, '', '', 'verification_id', 'Verification 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('verification_type', 'select', 50, 0, true, false, false, '', '', 'verification_type', 'Verification Type', array('1'=>'Phone', '2'=>'In Person'));
form_field('magazines_delivered', 'select', 50, 0, true, false, false, '', '', 'magazines_delivered', 'Magazines Delivered', array('1'=>'No', '2'=>'Yes', '3'=>'Not Reported'));
form_field('delivered_qty', 'text', 10, 0, false, false, false, '', '', 'delivered_qty', 'Delivered Qty');
form_field('returned_qty', 'text', 10, 0, false, false, false, '', '', 'returned_qty', 'Returned Qty');
form_field('all_distributed', 'checkbox', 50, 0, false, false, false, '', '', '', 'All Distributed');
form_field('change_draw', 'checkbox', 50, 0, false, false, false, '', '', '', 'Change Draw');
form_field('old_qty', 'text', 10, 0, false, false, false, '', '', 'old_qty', 'Old Qty');
form_field('new_qty', 'text', 10, 0, false, false, false, '', '', 'new_qty', 'New Qty');
form_field('spoke_to', 'text', 50, 0, true, false, false, '', '', 'spoke_to', 'Spoke To');
form_field('comments', 'textarea', 50, 7, false, false, false, '', '', 'comments', 'Comments');
?>
</div>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<?php form_button_strip('bottom'); ?>
</form>