| Server IP : 104.21.21.239 / 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/mitzvahm/planner/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
if (isset($_SESSION['user_id'])) :
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) :
$action = "Edit";
else :
$action = "Add New";
endif;
else :
exit();
endif;
if (empty($_REQUEST['ref'])) :
$_REQUEST['ref'] = 'vendors';
endif;
$show_new_proposal = 0;
//var_dump($_POST);
$sql = "SELECT * FROM events WHERE id = ".$_SESSION['active_event'];
$result_event = mysqli_query($GLOBALS['con'], $sql);
$row_event = mysqli_fetch_object($result_event);
$active_tab = 'general';
if ($_POST['ajax_event_submitted'] == '1') :
if (isset($_POST['active_tab'])) :
$active_tab = $_POST['active_tab'];
else :
$active_tab = 'general';
endif;
$ar_err = array();
if (!empty($_POST['cost_per_person'])) :
if (!is_numeric($_POST['cost_per_person'])) :
$ar_err['cost_per_person'] = 'Cost must be numeric!';
$err_flag = true;
$err_tab = 'performance';
endif;
endif;
if (!empty($_POST['cost_per_adult'])) :
if (!is_numeric($_POST['cost_per_adult'])) :
$ar_err['cost_per_adult'] = 'Cost must be numeric!';
$err_flag = true;
$err_tab = 'performance';
endif;
endif;
if (!empty($_POST['cost_per_child'])) :
if (!is_numeric($_POST['cost_per_child'])) :
$ar_err['cost_per_child'] = 'Cost must be numeric!';
$err_flag = true;
$err_tab = 'performance';
endif;
endif;
if (!empty($_POST['cost_per_table'])) :
if (!is_numeric($_POST['cost_per_table'])) :
$ar_err['cost_per_table'] = 'Cost must be numeric!';
$err_flag = true;
$err_tab = 'performance';
endif;
endif;
if (!empty($_POST['total_cost'])) :
if (!is_numeric($_POST['total_cost'])) :
$ar_err['total_cost'] = 'Cost must be numeric!';
$err_flag = true;
$err_tab = 'performance';
endif;
endif;
foreach($_POST as $key=>$value) :
if (substr($key, 0, 7) == 'pmt_id_') :
$pmt_id = substr($key, 7);
if (!empty($_POST['pmt_desc_'.$pmt_id]) || !empty($_POST['sched_date_'.$pmt_id]) || !empty($_POST['sched_amt_'.$pmt_id]) || !empty($_POST['paid_date_'.$pmt_id]) || !empty($_POST['paid_amt_'.$pmt_id])) :
if (empty($_POST['pmt_type_'.$pmt_id])) :
$ar_err['pmt_type_'.$pmt_id] = 'Payment type is required!';
$err_flag = true;
$err_tab = 'proposals';
endif;
endif;
if (!empty($_POST['sched_amt_'.$pmt_id])) :
if (!is_numeric(str_replace(',','',$_POST['sched_amt_'.$pmt_id]))) :
$ar_err['sched_amt_'.$pmt_id] = 'Amount must be numeric!';
$err_flag = true;
$err_tab = 'proposals';
endif;
endif;
if (!empty($_POST['paid_amt_'.$pmt_id])) :
if (!is_numeric(str_replace(',','',$_POST['paid_amt_'.$pmt_id]))) :
$ar_err['paid_amt_'.$pmt_id] = 'Amount must be numeric!';
$err_flag = true;
$err_tab = 'proposals';
endif;
endif;
endif;
endforeach;
foreach($_POST as $key=>$value) :
if (substr($key, 0, 7) == 'prp_id_') :
$prp_id = substr($key, 7);
if (!empty($_POST['fee_structure_'.$prp_id]) || !empty($_POST['proposer_'.$prp_id]) || !empty($_POST['comments_'.$prp_id]) || !empty($_POST['cost_per_person_'.$prp_id]) || !empty($_POST['cost_per_adult_'.$prp_id]) || !empty($_POST['cost_per_child_'.$prp_id]) || !empty($_POST['cost_per_table_'.$prp_id]) || !empty($_POST['fixed_cost_'.$prp_id]) || !empty($_POST['tips_total_amt_'.$prp_id]) || !empty($_POST['misc_cost_'.$prp_id])) :
if (empty($_POST['fee_structure_'.$prp_id])) :
$ar_err['fee_structure_'.$prp_id] = 'Fee structure required!';
$err_flag = true;
$err_tab = 'proposals';
$show_new_proposal = 1;
endif;
if (empty($_POST['venue_'.$prp_id])) :
$ar_err['venue_'.$prp_id] = 'Event required!';
$err_flag = true;
$err_tab = 'proposals';
$show_new_proposal = 1;
endif;
endif;
endif;
endforeach;
if (empty($_POST['vendor_name'])) :
$ar_err['vendor_name'] = 'Vendor name is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (empty($_POST['category_id'])) :
$ar_err['category_id'] = 'Category is required!';
$err_flag = true;
$err_tab = 'general';
endif;
if (!$err_flag) :
$set = "vendor_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['vendor_name']))."', ".
"category_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['category_id'])).", ".
"website = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['website']))."', ".
"main_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['main_phone']))."', ".
"street = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['street']))."', ".
"street2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['street2']))."', ".
"city = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['city']))."', ".
"state = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['state']))."', ".
"zip = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['zip']))."', ".
"country = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['country']))."', ".
"billing_street = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_street']))."', ".
"billing_street2 = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_street2']))."', ".
"billing_city = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_city']))."', ".
"billing_state = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_state']))."', ".
"billing_zip = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_zip']))."', ".
"billing_country = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['billing_country']))."', ".
"comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['comments']))."', ".
"contact_1_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_1_name']))."', ".
"contact_1_title = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_1_title']))."', ".
"contact_1_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_1_phone']))."', ".
"contact_1_mobile = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_1_mobile']))."', ".
"contact_1_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_1_email']))."', ".
"contact_2_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_2_name']))."', ".
"contact_2_title = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_2_title']))."', ".
"contact_2_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_2_phone']))."', ".
"contact_2_mobile = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_2_mobile']))."', ".
"contact_2_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_2_email']))."', ".
"contact_3_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_3_name']))."', ".
"contact_3_title = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_3_title']))."', ".
"contact_3_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_3_phone']))."', ".
"contact_3_mobile = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_3_mobile']))."', ".
"contact_3_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['contact_3_email']))."', ".
"rating = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['rating'])),'0').", ".
"referrer = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['referrer']))."', ".
"source = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['source']))."', ".
"ref_1_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_1_name']))."', ".
"ref_1_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_1_phone']))."', ".
"ref_1_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_1_email']))."', ".
"ref_1_comment = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_1_comment']))."', ".
"ref_2_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_2_name']))."', ".
"ref_2_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_2_phone']))."', ".
"ref_2_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_2_email']))."', ".
"ref_2_comment = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_2_comment']))."', ".
"ref_3_name = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_3_name']))."', ".
"ref_3_phone = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_3_phone']))."', ".
"ref_3_email = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_3_email']))."', ".
"ref_3_comment = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_3_comment']))."', ".
"mashgiach = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['mashgiach']))."', ".
"cost_per_person = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_person'])),'0').", ".
"cost_per_adult = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_adult'])),'0').", ".
"cost_per_child = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_child'])),'0').", ".
"cost_per_table = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_table'])),'0').", ".
"total_cost = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['total_cost'])),'0').", ".
"perf_comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['perf_comments']))."' ";
if ($action == 'Edit') :
$sql = "UPDATE vendors set ".
$set.
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
if ($action == 'Add New') :
$sql = "INSERT INTO vendors SET ".
"user_id = ".$_SESSION['user_id'].", ".
"event_id = ".$_SESSION['active_event'].", ".
$set;
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
$_REQUEST['id'] = last_id();
endif;
endif;
foreach($_POST as $key=>$value) :
if (substr($key, 0, 7) == 'pmt_id_') :
$pmt_id_key = substr($key, 7);
$pmt_array = explode('_',$pmt_id_key);
$pmt_id = $pmt_array[0];
$pmt_prp_id = $pmt_array[1];
if (substr($pmt_id,0,3) == 'new') :
if (!empty($_POST['pmt_desc_'.$pmt_id.'_'.$pmt_prp_id]) || !empty($_POST['sched_date_'.$pmt_id.'_'.$pmt_prp_id]) || !empty($_POST['sched_amt_'.$pmt_id.'_'.$pmt_prp_id]) || !empty($_POST['paid_date_'.$pmt_id.'_'.$pmt_prp_id]) || !empty($_POST['paid_amt_'.$pmt_id.'_'.$pmt_prp_id])) :
$sql = "INSERT INTO vendor_payments ".
"(user_id, event_id, vendor_id, proposal_id, pmt_type, pmt_desc, sched_date, sched_amt, paid_date, paid_amt) ".
" VALUES (".
$_SESSION['user_id'].", ".
$_SESSION['active_event'].", ".
mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id'])).", ".
mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_proposal_id_new_'.$pmt_prp_id])).", ".
"'".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_type_new_'.$pmt_prp_id]))."', ".
"'".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_desc_new_'.$pmt_prp_id]))."', ".
"".nzdate($_POST['sched_date_new_'.$pmt_prp_id]).", ".
"".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['sched_amt_new_'.$pmt_prp_id])),'0').", ".
"".nzdate($_POST['paid_date_new_'.$pmt_prp_id]).", ".
"".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['paid_amt_new_'.$pmt_prp_id])),'0')." ".
")";
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
else :
if (mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_del_'.$pmt_id.'_'.$pmt_prp_id])) == '1') :
$sql = "DELETE FROM vendor_payments WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_id_'.$pmt_id.'_'.$pmt_prp_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND proposal_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_proposal_id_'.$pmt_id.'_'.$pmt_prp_id]))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
$sql = "UPDATE vendor_payments SET ".
"pmt_type = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_type_'.$pmt_id.'_'.$pmt_prp_id]))."', ".
"pmt_desc = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_desc_'.$pmt_id.'_'.$pmt_prp_id]))."', ".
"sched_date = ".nzdate($_POST['sched_date_'.$pmt_id.'_'.$pmt_prp_id]).", ".
"sched_amt = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['sched_amt_'.$pmt_id.'_'.$pmt_prp_id])),'0').", ".
"paid_date = ".nzdate($_POST['paid_date_'.$pmt_id.'_'.$pmt_prp_id]).", ".
"paid_amt = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['paid_amt_'.$pmt_id.'_'.$pmt_prp_id])),'0')." ".
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_id_'.$pmt_id.'_'.$pmt_prp_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND proposal_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['pmt_proposal_id_'.$pmt_id.'_'.$pmt_prp_id]))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
endif;
endif;
if (substr($key, 0, 7) == 'prp_id_') :
$prp_id = substr($key, 7);
$set = " ".
"fee_structure = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['fee_structure_'.$prp_id]))."', ".
"proposer = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['proposer_'.$prp_id]))."', ".
"venue = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['venue_'.$prp_id]))."', ".
"comments = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['comments_'.$prp_id]))."', ".
"proposal_date = ".nzdate($_POST['proposal_date_'.$prp_id]).", ".
"ref_no = '".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['ref_no_'.$prp_id]))."', ".
"est_persons = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['est_persons_'.$prp_id])),'0').", ".
"est_adults = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['est_adults_'.$prp_id])),'0').", ".
"est_children = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['est_children_'.$prp_id])),'0').", ".
"est_tables = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['est_tables_'.$prp_id])),'0').", ".
"cost_per_person = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_person_'.$prp_id])),'0').", ".
"cost_per_adult = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_adult_'.$prp_id])),'0').", ".
"cost_per_child = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_child_'.$prp_id])),'0').", ".
"cost_per_table = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['cost_per_table_'.$prp_id])),'0').", ".
"total_cost = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['total_cost_'.$prp_id])),'0').", ".
"fixed_cost = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['fixed_cost_'.$prp_id])),'0').", ".
"tips_total_amt = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['tips_total_amt_'.$prp_id])),'0').", ".
"misc_cost = ".nzfloat(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['misc_cost_'.$prp_id])),'0').", ".
"hired = ".nz(mysqli_real_escape_string($GLOBALS['con'], trim($_POST['hired_'.$prp_id])),'0')." ";
if ($prp_id == 'new') :
if (!empty($_POST['fee_structure_'.$prp_id])) :
$sql = "INSERT INTO vendor_proposals SET ".
"user_id = ".$_SESSION['user_id'].", ".
"event_id = ".$_SESSION['active_event'].", ".
"vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id'])).", ".
$set;
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
else :
if (mysqli_real_escape_string($GLOBALS['con'], trim($_POST['prp_del_'.$prp_id])) == '1') :
$sql = "DELETE FROM vendor_proposals WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['prp_id_'.$prp_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
$sql = "UPDATE vendor_proposals SET ".
$set." ".
"WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['prp_id_'.$prp_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
endif;
endif;
endif;
if (substr($key, 0, 7) == 'doc_id_') :
$doc_id = substr($key, 7);
if ($doc_id == 'new') :
//var_dump($_FILES);
if (!empty($_FILES['doc_file_new']['name'])) :
$sql = "INSERT INTO vendor_documents ".
"(user_id, event_id, vendor_id, doc_desc, doc_file) ".
" VALUES (".
$_SESSION['user_id'].", ".
$_SESSION['active_event'].", ".
mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id'])).", ".
"'".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['doc_desc_new']))."', ".
"'".mysqli_real_escape_string($GLOBALS['con'], trim($_FILES['doc_file_new']['name']))."' ".
")";
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
$doc_last_id = last_id();
$uploaddir = $app_upload_dir.'/vendocs/'.str_pad($_REQUEST['id'], 10, '0', STR_PAD_LEFT);
if (!is_dir($uploaddir)) :
mkdir($uploaddir, 0777, true);
endif;
$uploadfile = $app_upload_dir.'/vendocs/'.str_pad($_REQUEST['id'], 10, '0', STR_PAD_LEFT).'/'.str_pad($doc_last_id, 10, '0', STR_PAD_LEFT).'_'.basename($_FILES['doc_file_new']['name']);
if (move_uploaded_file($_FILES['doc_file_new']['tmp_name'], $uploadfile)) :
//echo 'File upload successful!';
else :
//echo 'File upload failed!';
endif;
endif;
$_POST['doc_desc_new'] = '';
else :
if (mysqli_real_escape_string($GLOBALS['con'], trim($_POST['doc_del_'.$doc_id])) == '1') :
$sql = "SELECT * FROM vendor_documents WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['doc_id_'.$doc_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
$result_doc_del = mysqli_query($GLOBALS['con'], $sql);
if (mysqli_num_rows($result_doc_del) > 0) :
$row_doc_del = mysqli_fetch_object($result_doc_del);
$delfile = $app_upload_dir.'/vendocs/'.str_pad($_REQUEST['id'], 10, '0', STR_PAD_LEFT).'/'.str_pad($row_doc_del->id, 10, '0', STR_PAD_LEFT).'_'.$row_doc_del->doc_file;
if (unlink($delfile)) :
//echo 'File delete successful!';
else :
//echo 'File delete failed!';
endif;
/*
*/
endif;
$sql = "DELETE FROM vendor_documents WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_POST['doc_id_'.$doc_id]))." AND vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
else :
endif;
endif;
endif;
endforeach;
// ----- Reset vendor payments after successful update ----
$sql = "SELECT * FROM vendor_payments WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY sched_date ASC";
$result_pmt = mysqli_query($GLOBALS['con'], $sql);
while($row_pmt = mysqli_fetch_object($result_pmt)) :
$_POST['pmt_type_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = $row_pmt->pmt_type;
$_POST['pmt_desc_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = $row_pmt->pmt_desc;
$_POST['sched_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = nzdate_display($row_pmt->sched_date);
$_POST['sched_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = number_format($row_pmt->sched_amt,2,'.',',');
$_POST['paid_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = nzdate_display($row_pmt->paid_date);
$_POST['paid_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = number_format($row_pmt->paid_amt,2,'.',',');
endwhile;
// ----- Reset vendor propsals after successful update ----
$sql = "SELECT * FROM vendor_proposals WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY id ASC";
$result_prp = mysqli_query($GLOBALS['con'], $sql);
while($row_prp = mysqli_fetch_object($result_prp)) :
$_POST['fee_structure_'.$row_prp->id] = $row_prp->fee_structure;
$_POST['proposer_'.$row_prp->id] = $row_prp->proposer;
$_POST['venue_'.$row_prp->id] = $row_prp->venue;
$_POST['comments_'.$row_prp->id] = $row_prp->comments;
$_POST['proposal_date_'.$row_prp->id] = nzdate_display($row_prp->proposal_date);
$_POST['ref_no_'.$row_prp->id] = $row_prp->ref_no;
$_POST['est_persons_'.$row_prp->id] = number_format($row_prp->est_persons,0,'.',',');
$_POST['est_adults_'.$row_prp->id] = number_format($row_prp->est_adults,0,'.',',');
$_POST['est_children_'.$row_prp->id] = number_format($row_prp->est_children,0,'.',',');
$_POST['est_tables_'.$row_prp->id] = number_format($row_prp->est_tables,0,'.',',');
$_POST['cost_per_person_'.$row_prp->id] = number_format($row_prp->cost_per_person,2,'.',',');
$_POST['cost_per_adult_'.$row_prp->id] = number_format($row_prp->cost_per_adult,2,'.',',');
$_POST['cost_per_child_'.$row_prp->id] = number_format($row_prp->cost_per_child,2,'.',',');
$_POST['cost_per_table_'.$row_prp->id] = number_format($row_prp->cost_per_table,2,'.',',');
$_POST['total_cost_'.$row_prp->id] = number_format($row_prp->total_cost,2,'.',',');
$_POST['fixed_cost_'.$row_prp->id] = number_format($row_prp->fixed_cost,2,'.',',');
$_POST['tips_total_amt_'.$row_prp->id] = number_format($row_prp->tips_total_amt,2,'.',',');
$_POST['misc_cost_'.$row_prp->id] = number_format($row_prp->misc_cost,2,'.',',');
$_POST['hired_'.$row_prp->id] = $row_prp->hired;
unset($_POST['pmt_id_new_'.$row_prp->id]);
unset($_POST['pmt_type_new_'.$row_prp->id]);
unset($_POST['pmt_desc_new_'.$row_prp->id]);
unset($_POST['sched_date_new_'.$row_prp->id]);
unset($_POST['sched_amt_new_'.$row_prp->id]);
unset($_POST['paid_date_new_'.$row_prp->id]);
unset($_POST['paid_amt_new_'.$row_prp->id]);
endwhile;
unset($_POST['prp_id_new']);
unset($_POST['fee_structure_new']);
unset($_POST['proposer_new']);
unset($_POST['venue_new']);
unset($_POST['comments_new']);
unset($_POST['proposal_date_new']);
unset($_POST['ref_no_new']);
unset($_POST['est_persons_new']);
unset($_POST['est_adults_new']);
unset($_POST['est_children_new']);
unset($_POST['est_tables_new']);
unset($_POST['cost_per_person_new']);
unset($_POST['cost_per_adult_new']);
unset($_POST['cost_per_child_new']);
unset($_POST['cost_per_table_new']);
unset($_POST['total_cost_new']);
unset($_POST['fixed_cost_new']);
unset($_POST['tips_total_amt_new']);
unset($_POST['misc_cost_new']);
unset($_POST['hired_new']);
// ---------------------------------------------------------
$form_message = "Saved sucessfully!";
if ($_POST['xsubmit'] == 'Save & Close') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=".$_REQUEST['ref']."'";
echo "</SCRIPT>";
endif;
if ($_POST['xsubmit'] == 'Save & New') :
echo "<SCRIPT>";
echo "window.location.href = 'index.php?IX=vendor_form&ref=".$_REQUEST['ref']."'";
echo "</SCRIPT>";
endif;
else :
$active_tab = $err_tab;
$form_message = "Errors found!";
endif;
else:
if ($action == 'Edit') :
$sql = "SELECT * FROM vendors WHERE id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event'];
$result = mysqli_query($GLOBALS['con'], $sql) or die('Database Error!');
if (mysqli_num_rows($result) > 0) :
$row = mysqli_fetch_object($result);
$_POST['vendor_name'] = $row->vendor_name;
$_POST['category_id'] = $row->category_id;
$_POST['website'] = $row->website;
$_POST['main_phone'] = $row->main_phone;
$_POST['street'] = $row->street;
$_POST['street2'] = $row->street2;
$_POST['city'] = $row->city;
$_POST['state'] = $row->state;
$_POST['zip'] = $row->zip;
$_POST['country'] = $row->country;
$_POST['billing_street'] = $row->billing_street;
$_POST['billing_street2'] = $row->billing_street2;
$_POST['billing_city'] = $row->billing_city;
$_POST['billing_state'] = $row->billing_state;
$_POST['billing_zip'] = $row->billing_zip;
$_POST['billing_country'] = $row->billing_country;
$_POST['comments'] = $row->comments;
$_POST['contact_1_name'] = $row->contact_1_name;
$_POST['contact_1_title'] = $row->contact_1_title;
$_POST['contact_1_phone'] = $row->contact_1_phone;
$_POST['contact_1_mobile'] = $row->contact_1_mobile;
$_POST['contact_1_email'] = $row->contact_1_email;
$_POST['contact_2_name'] = $row->contact_2_name;
$_POST['contact_2_title'] = $row->contact_2_title;
$_POST['contact_2_phone'] = $row->contact_2_phone;
$_POST['contact_2_mobile'] = $row->contact_2_mobile;
$_POST['contact_2_email'] = $row->contact_2_email;
$_POST['contact_3_name'] = $row->contact_3_name;
$_POST['contact_3_title'] = $row->contact_3_title;
$_POST['contact_3_phone'] = $row->contact_3_phone;
$_POST['contact_3_mobile'] = $row->contact_3_mobile;
$_POST['contact_3_email'] = $row->contact_3_email;
$_POST['rating'] = $row->rating;
$_POST['referrer'] = $row->referrer;
$_POST['source'] = $row->source;
$_POST['ref_1_name'] = $row->ref_1_name;
$_POST['ref_1_phone'] = $row->ref_1_phone;
$_POST['ref_1_email'] = $row->ref_1_email;
$_POST['ref_1_comment'] = $row->ref_1_comment;
$_POST['ref_2_name'] = $row->ref_2_name;
$_POST['ref_2_phone'] = $row->ref_2_phone;
$_POST['ref_2_email'] = $row->ref_2_email;
$_POST['ref_2_comment'] = $row->ref_2_comment;
$_POST['ref_3_name'] = $row->ref_3_name;
$_POST['ref_3_phone'] = $row->ref_3_phone;
$_POST['ref_3_email'] = $row->ref_3_email;
$_POST['ref_3_comment'] = $row->ref_3_comment;
$_POST['mashgiach'] = $row->mashgiach;
$_POST['cost_per_person'] = $row->cost_per_person;
$_POST['cost_per_adult'] = $row->cost_per_adult;
$_POST['cost_per_child'] = $row->cost_per_child;
$_POST['cost_per_table'] = $row->cost_per_table;
$_POST['total_cost'] = $row->total_cost;
$_POST['perf_comments'] = $row->perf_comments;
$sql = "SELECT * FROM vendor_payments WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY sched_date ASC";
$result_pmt = mysqli_query($GLOBALS['con'], $sql);
while($row_pmt = mysqli_fetch_object($result_pmt)) :
$_POST['pmt_type_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = $row_pmt->pmt_type;
$_POST['pmt_desc_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = $row_pmt->pmt_desc;
$_POST['sched_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = nzdate_display($row_pmt->sched_date);
$_POST['sched_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = number_format($row_pmt->sched_amt,2,'.',',');
$_POST['paid_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = nzdate_display($row_pmt->paid_date);
$_POST['paid_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id] = number_format($row_pmt->paid_amt,2,'.',',');
endwhile;
$sql = "SELECT * FROM vendor_proposals WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY id ASC";
$result_prp = mysqli_query($GLOBALS['con'], $sql);
while($row_prp = mysqli_fetch_object($result_prp)) :
$_POST['fee_structure_'.$row_prp->id] = $row_prp->fee_structure;
$_POST['proposer_'.$row_prp->id] = $row_prp->proposer;
$_POST['venue_'.$row_prp->id] = $row_prp->venue;
$_POST['comments_'.$row_prp->id] = $row_prp->comments;
$_POST['proposal_date_'.$row_prp->id] = nzdate_display($row_prp->proposal_date);
$_POST['ref_no_'.$row_prp->id] = $row_prp->ref_no;
$_POST['est_persons_'.$row_prp->id] = number_format($row_prp->est_persons,0,'.',',');
$_POST['est_adults_'.$row_prp->id] = number_format($row_prp->est_adults,0,'.',',');
$_POST['est_children_'.$row_prp->id] = number_format($row_prp->est_children,0,'.',',');
$_POST['est_tables_'.$row_prp->id] = number_format($row_prp->est_tables,0,'.',',');
$_POST['cost_per_person_'.$row_prp->id] = number_format($row_prp->cost_per_person,2,'.',',');
$_POST['cost_per_adult_'.$row_prp->id] = number_format($row_prp->cost_per_adult,2,'.',',');
$_POST['cost_per_child_'.$row_prp->id] = number_format($row_prp->cost_per_child,2,'.',',');
$_POST['cost_per_table_'.$row_prp->id] = number_format($row_prp->cost_per_table,2,'.',',');
$_POST['total_cost_'.$row_prp->id] = number_format($row_prp->total_cost,2,'.',',');
$_POST['fixed_cost_'.$row_prp->id] = number_format($row_prp->fixed_cost,2,'.',',');
$_POST['tips_total_amt_'.$row_prp->id] = number_format($row_prp->tips_total_amt,2,'.',',');
$_POST['misc_cost_'.$row_prp->id] = number_format($row_prp->misc_cost,2,'.',',');
$_POST['hired_'.$row_prp->id] = $row_prp->hired;
endwhile;
//var_dump($_POST);
else :
echo form_fatal_error('Invalid Operation!');
return;
endif;
endif;
endif;
?>
<script>
var ar_est_people = [];
ar_est_people['temple'] = '<?php echo number_format($row_event->temple_est_people,0,'.',','); ?>';
ar_est_people['av'] = '<?php echo number_format($row_event->av_est_people,0,'.',','); ?>';
ar_est_people['kv'] = '<?php echo number_format($row_event->kv_est_people,0,'.',','); ?>';
ar_est_people['bv'] = '<?php echo number_format($row_event->bv_est_people,0,'.',','); ?>';
ar_est_people['dv'] = '<?php echo number_format($row_event->dv_est_people,0,'.',','); ?>';
var ar_est_adults = [];
ar_est_adults['temple'] = '<?php echo number_format($row_event->temple_est_adults,0,'.',','); ?>';
ar_est_adults['av'] = '<?php echo number_format($row_event->av_est_adults,0,'.',','); ?>';
ar_est_adults['kv'] = '<?php echo number_format($row_event->kv_est_adults,0,'.',','); ?>';
ar_est_adults['bv'] = '<?php echo number_format($row_event->bv_est_adults,0,'.',','); ?>';
ar_est_adults['dv'] = '<?php echo number_format($row_event->dv_est_adults,0,'.',','); ?>';
var ar_est_kids = [];
ar_est_kids['temple'] = '<?php echo number_format($row_event->temple_est_kids,0,'.',','); ?>';
ar_est_kids['av'] = '<?php echo number_format($row_event->av_est_kids,0,'.',','); ?>';
ar_est_kids['kv'] = '<?php echo number_format($row_event->kv_est_kids,0,'.',','); ?>';
ar_est_kids['bv'] = '<?php echo number_format($row_event->bv_est_kids,0,'.',','); ?>';
ar_est_kids['dv'] = '<?php echo number_format($row_event->dv_est_kids,0,'.',','); ?>';
var ar_est_tables = [];
ar_est_tables['temple'] = '<?php echo number_format($row_event->temple_est_tables,0,'.',','); ?>';
ar_est_tables['av'] = '<?php echo number_format($row_event->av_est_tables,0,'.',','); ?>';
ar_est_tables['kv'] = '<?php echo number_format($row_event->kv_est_tables,0,'.',','); ?>';
ar_est_tables['bv'] = '<?php echo number_format($row_event->bv_est_tables,0,'.',','); ?>';
ar_est_tables['dv'] = '<?php echo number_format($row_event->dv_est_tables,0,'.',','); ?>';
calc_total_cost = function(id)
{
//var total_cost = 0.00;
/*
var total_cost = (parseFloat(ar_est_people[$('#venue_' + id).val()]) || 0) * (parseFloat($('#cost_per_person_' + id).val()) || 0) +
(parseFloat(ar_est_adults[$('#venue_' + id).val()]) || 0) * (parseFloat($('#cost_per_adult_' + id).val()) || 0) +
(parseFloat(ar_est_kids[$('#venue_' + id).val()]) || 0) * (parseFloat($('#cost_per_child_' + id).val()) || 0) +
(parseFloat(ar_est_tables[$('#venue_' + id).val()]) || 0) * (parseFloat($('#cost_per_table_' + id).val()) || 0) +
(parseFloat($('#fixed_cost_' + id).val()) || 0) +
(parseFloat($('#tips_total_amt_' + id).val()) || 0) +
(parseFloat($('#misc_cost_' + id).val()) || 0);
*/
var total_cost = (parseFloat($('#est_persons_' + id).val().replace(/,/g,'')) || 0) * (parseFloat($('#cost_per_person_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#est_adults_' + id).val().replace(/,/g,'')) || 0) * (parseFloat($('#cost_per_adult_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#est_children_' + id).val().replace(/,/g,'')) || 0) * (parseFloat($('#cost_per_child_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#est_tables_' + id).val().replace(/,/g,'')) || 0) * (parseFloat($('#cost_per_table_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#fixed_cost_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#tips_total_amt_' + id).val().replace(/,/g,'')) || 0) +
(parseFloat($('#misc_cost_' + id).val().replace(/,/g,'')) || 0);
total_cost = total_cost.toFixed(2);
//alert(total_cost);
$('#total_cost_' + id).val(num2str(total_cost,2,",",0,"-",""));
//document.getElementById('total_cost_' + id).value = num2str(total_cost,2,",",0,"-","");
//live_field('total_cost_' + id);
//alert('x');
//val_dollar_field($('#total_cost_' + id));
}
switch_est = function(id)
{
/*
$('#prp_est_people_' + id).text(ar_est_people[$('#venue_' + id).val()]);
$('#prp_est_adults_' + id).text(ar_est_adults[$('#venue_' + id).val()]);
$('#prp_est_kids_' + id).text(ar_est_kids[$('#venue_' + id).val()]);
$('#prp_est_tables_' + id).text(ar_est_tables[$('#venue_' + id).val()]);
*/
$('#est_persons_' + id).val(ar_est_people[$('#venue_' + id).val()]);
$('#est_adults_' + id).val(ar_est_adults[$('#venue_' + id).val()]);
$('#est_children_' + id).val(ar_est_kids[$('#venue_' + id).val()]);
$('#est_tables_' + id).val(ar_est_tables[$('#venue_' + id).val()]);
calc_total_cost(id);
}
var active_page = '<?php echo $_REQUEST['IX']; ?>';
var active_tab = '';
var show_new_proposal = <?php echo $show_new_proposal; ?>;
toggle_new_proposal = function()
{
if (show_new_proposal == 0)
{
$("#prp_row_a_new").hide();
$("#prp_row_b_new").hide();
$("#prp_row_c_new").hide();
$("#prp_row_d_new").hide();
$("#prp_row_e_new").hide();
$("#prp_row_f_new").hide();
$("#prp_row_g_new").hide();
show_new_proposal = 1;
}
else
{
$("#prp_row_a_new").show();
$("#prp_row_b_new").show();
$("#prp_row_c_new").show();
$("#prp_row_d_new").show();
$("#prp_row_e_new").show();
$("#prp_row_f_new").show();
$("#prp_row_g_new").show();
show_new_proposal = 0;
}
}
prp_delete = function(prp_id)
{
var answer = confirm('Are you sure? Make sure to SAVE the record for the deletion to take effect!');
if (answer == true)
{
$("#prp_del_" + prp_id).val('1');
$("#prp_row_a_" + prp_id).hide();
$("#prp_row_b_" + prp_id).hide();
$("#prp_row_c_" + prp_id).hide();
$("#prp_row_d_" + prp_id).hide();
$("#prp_row_e_" + prp_id).hide();
}
}
pmt_delete = function(pmt_id, prp_id)
{
var answer = confirm('Are you sure? Make sure to SAVE the record for the deletion to take effect!');
if (answer == true)
{
$("#pmt_del_" + pmt_id + '_' + prp_id).val('1');
$("#pmt_row_" + pmt_id + '_' + prp_id).hide();
}
}
doc_delete = function(doc_id)
{
var answer = confirm('Are you sure? Make sure to SAVE the record for the deletion to take effect!');
if (answer == true)
{
$("#doc_del_" + doc_id).val('1');
$("#doc_row_" + doc_id).hide();
}
}
update_header = function()
{
if ($("#vendor_name").val() > "")
{
$("#header_repeater").text(" - " + $("#vendor_name").val());
}
}
$(document).ready(function()
{
switch_tab('<?php echo $active_tab; ?>');
update_header();
toggle_new_proposal();
$(':input').change(function() {sheet_dirty = true;} );
}
)
</script>
<h1>Vendor - <?php echo $action; ?><span id="header_repeater"></span></h1>
<?php get_notes(); ?>
<?php get_help_guide('help_vendor_form_'.$active_tab); ?>
<?php echo form_message($form_message); ?>
<form name="frm_vendor" id="frm_vendor" method="post" action="" enctype="multipart/form-data" onkeydown="//return prevent_enter_submit(event);" onsubmit="//return delay_submit(this);" >
<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="general" />
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="form_strip">
<input type="button" value="Save" onclick="sheet_dirty = false;this.form.submit();" />
<input type="button" value="Save & Close" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Save & New" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=<?php echo $_REQUEST['ref']; ?>'" />
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_strip">
<div class="tab_header" id="tab_general" onclick="switch_tab('general');">
General Information
</div>
<div class="tab_header" id="tab_proposals" onclick="switch_tab('proposals');">
Proposals
</div>
<div class="tab_header" id="tab_references" onclick="switch_tab('references');">
References
</div>
<div class="tab_header" id="tab_documents" onclick="switch_tab('documents');">
Documents
</div>
</div>
<div class="cleardiv">
</div>
<div class="tab_content" id="tab_content_general">
<div class="form_header">
General Vendor Information
</div>
<table class="input_block">
<tr>
<td>
Vendor Name
</td>
<td>
<input name="vendor_name" id="vendor_name" type="text" maxlength="150" tabindex="1" onblur="update_header();" value="<?php echo $_POST['vendor_name']; ?>" />
<?php show_form_error($ar_err['vendor_name']); ?>
</td>
<td>
Main Phone
</td>
<td>
<input name="main_phone" id="main_phone" type="text" maxlength="25" tabindex="3" value="<?php echo $_POST['main_phone']; ?>" />
<?php show_form_error($ar_err['website']); ?>
</td>
</tr>
<tr>
<td>
Category
</td>
<td>
<select name="category_id" id="category_id" tabindex="2" >
<option value="">Category...</option>
<?php
$sql_str = 'SELECT id, description FROM vendor_categories WHERE active = 1 ORDER BY description';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
while ($row = mysqli_fetch_object($result)) :
$selected = '';
if ($_POST['category_id'] == $row->id) :
$selected = 'selected="selected"';
endif;
echo '<option value="'.$row->id.'" '.$selected.'>'.$row->description.'</option>';
endwhile;
?>
</select>
<?php show_form_error($ar_err['category_id']); ?>
</td>
<td>
Website
</td>
<td>
<input name="website" id="website" type="text" class="link_field" maxlength="150" tabindex="4" value="<?php echo $_POST['website']; ?>" /><a id="linkout_website" target="_blank" href="<?php echo format_http($_POST['website']); ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['website']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
Street Address
</td>
<td>
</td>
<td>
Billing Address
</td>
</tr>
<tr>
<td>
Street
</td>
<td>
<input name="street" id="street" type="text" maxlength="100" tabindex="5" value="<?php echo $_POST['street']; ?>" />
<?php show_form_error($ar_err['street']); ?>
</td>
<td>
Street
</td>
<td>
<input name="billing_street" id="billing_street" type="text" maxlength="100" tabindex="11" value="<?php echo $_POST['billing_street']; ?>" />
<?php show_form_error($ar_err['billing_street']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input name="street2" id="street2" type="text" maxlength="100" tabindex="6" value="<?php echo $_POST['street2']; ?>" />
<?php show_form_error($ar_err['street2']); ?>
</td>
<td>
</td>
<td>
<input name="billing_street2" id="billing_street2" type="text" maxlength="100" tabindex="12" value="<?php echo $_POST['billing_street2']; ?>" />
<?php show_form_error($ar_err['billing_street2']); ?>
</td>
</tr>
<tr>
<td>
City
</td>
<td>
<input name="city" id="city" type="text" maxlength="100" tabindex="7" value="<?php echo $_POST['city']; ?>" />
<?php show_form_error($ar_err['city']); ?>
</td>
<td>
City
</td>
<td>
<input name="billing_city" id="billing_city" type="text" maxlength="100" tabindex="13" value="<?php echo $_POST['billing_city']; ?>" />
<?php show_form_error($ar_err['billing_city']); ?>
</td>
</tr>
<tr>
<td>
State
</td>
<td>
<?php
$sql_str = "SELECT DISTINCT country_sort_code, country FROM states order by country_sort_code";
$result_country = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$sql_union = '';
$str_union = '';
while ($row_country = mysqli_fetch_object($result_country)) :
$sql_union .= $str_union." (SELECT '__', '- - - - - - ".$row_country->country." - - - - - -') ".
"UNION (SELECT state, state_name FROM states WHERE country_sort_code = ".$row_country->country_sort_code." ORDER BY state_name) ";
$str_union = ' UNION ';
endwhile;
//echo $sql_union;
auto_complete('state', $_POST['state'], $_POST['state'], $sql_union, null, null, null, 8, "set_country('state', 'country');");
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
echo '<script> var ar_states = []; ';
while ($row = mysqli_fetch_object($result)) :
echo 'ar_states["'.$row->state.'"] = "'.$row->country.'";'.PHP_EOL;
endwhile;
echo '</script>';
?>
<?php /* ?>
<select name="state" id="state" tabindex="8" onchange="set_country('state', 'country');" >
<option value="">State/Province...</option>
<?php
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$hold_country = '';
while ($row = mysqli_fetch_object($result)) :
if ($hold_country != $row->country) :
echo '<option value="">- - - - - - '.$row->country.' - - - - - -</option>';
$hold_country = $row->country;
endif;
$selected = '';
if ($_POST['state'] == $row->state) :
$selected = 'selected="selected"';
endif;
echo '<option attr_country="'.$row->country.'" value="'.$row->state.'" '.$selected.'>'.$row->state_name.'</option>';
endwhile;
?>
</select>
<?php */ ?>
<?php show_form_error($ar_err['state']); ?>
</td>
<td>
State
</td>
<td>
<?php
$sql_str = "SELECT DISTINCT country_sort_code, country FROM states order by country_sort_code";
$result_country = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$sql_union = '';
$str_union = '';
while ($row_country = mysqli_fetch_object($result_country)) :
$sql_union .= $str_union." (SELECT '__', '- - - - - - ".$row_country->country." - - - - - -') ".
"UNION (SELECT state, state_name FROM states WHERE country_sort_code = ".$row_country->country_sort_code." ORDER BY state_name) ";
$str_union = ' UNION ';
endwhile;
//echo $sql_union;
auto_complete('billing_state', $_POST['billing_state'], $_POST['billing_state'], $sql_union, null, null, null, 8, "set_country('billing_state', 'billing_country');");
/*
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
echo '<script> var ar_states = []; ';
while ($row = mysqli_fetch_object($result)) :
echo 'ar_states["'.$row->state.'"] = "'.$row->country.'";'.PHP_EOL;
endwhile;
echo '</script>';
*/
?>
<?php /* ?>
<select name="billing_state" id="billing_state" tabindex="14" onchange="set_country('billing_state', 'billing_country');" >
<option value="">State...</option>
<?php
$sql_str = 'SELECT country, state, state_name FROM states ORDER BY country_sort_code, state_name';
$result = mysqli_query($GLOBALS['con'], $sql_str) or die('Database Error!');
$hold_country = '';
while ($row = mysqli_fetch_object($result)) :
if ($hold_country != $row->country) :
echo '<option value="">- - - - - - '.$row->country.' - - - - - -</option>';
$hold_country = $row->country;
endif;
$selected = '';
if ($_POST['billing_state'] == $row->state) :
$selected = 'selected="selected"';
endif;
echo '<option attr_country="'.$row->country.'" value="'.$row->state.'" '.$selected.'>'.$row->state_name.'</option>';
endwhile;
?>
</select>
<?php */ ?>
<?php show_form_error($ar_err['billing_state']); ?>
</td>
</tr>
<tr>
<td>
Zip Code
</td>
<td>
<input name="zip" id="zip" type="text" maxlength="15" tabindex="9" value="<?php echo $_POST['zip']; ?>" />
<?php show_form_error($ar_err['zip']); ?>
</td>
<td>
Zip Code
</td>
<td>
<input name="billing_zip" id="billing_zip" type="text" maxlength="15" tabindex="15" value="<?php echo $_POST['billing_zip']; ?>" />
<?php show_form_error($ar_err['billing_zip']); ?>
</td>
</tr>
<tr>
<td>
Country
</td>
<td>
<input name="country" id="country" type="text" maxlength="50" tabindex="10" value="<?php echo $_POST['country']; ?>" />
<?php show_form_error($ar_err['country']); ?>
</td>
<td>
Country
</td>
<td>
<input name="billing_country" id="billing_country" type="text" maxlength="50" tabindex="16" value="<?php echo $_POST['billing_country']; ?>" />
<?php show_form_error($ar_err['billing_country']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Contact Name
</td>
<td>
<input name="contact_1_name" id="contact_1_name" type="text" maxlength="150" tabindex="101" value="<?php echo $_POST['contact_1_name']; ?>" />
<?php show_form_error($ar_err['contact_1_name']); ?>
</td>
<td>
Phone
</td>
<td>
<input name="contact_1_phone" id="contact_1_phone" type="text" maxlength="20" tabindex="103" value="<?php echo $_POST['contact_1_phone']; ?>" />
<?php show_form_error($ar_err['contact_1_phone']); ?>
</td>
</tr>
<tr>
<td>
Title
</td>
<td>
<input name="contact_1_title" id="contact_1_title" type="text" maxlength="100" tabindex="102" value="<?php echo $_POST['contact_1_title']; ?>" />
<?php show_form_error($ar_err['contact_1_title']); ?>
</td>
<td>
Mobile
</td>
<td>
<input name="contact_1_mobile" id="contact_1_mobile" type="text" maxlength="20" tabindex="104" value="<?php echo $_POST['contact_1_mobile']; ?>" />
<?php show_form_error($ar_err['contact_1_mobile']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
Email
</td>
<td>
<input name="contact_1_email" id="contact_1_email" type="text" class="mail_field" maxlength="150" tabindex="105" value="<?php echo $_POST['contact_1_email']; ?>" /><a id="linkout_contact_1_email" href="mailto:<?php echo $_POST['contact_1_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['contact_1_email']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Contact Name
</td>
<td>
<input name="contact_2_name" id="contact_2_name" type="text" maxlength="150" tabindex="106" value="<?php echo $_POST['contact_2_name']; ?>" />
<?php show_form_error($ar_err['contact_2_name']); ?>
</td>
<td>
Phone
</td>
<td>
<input name="contact_2_phone" id="contact_2_phone" type="text" maxlength="20" tabindex="108" value="<?php echo $_POST['contact_2_phone']; ?>" />
<?php show_form_error($ar_err['contact_2_phone']); ?>
</td>
</tr>
<tr>
<td>
Title
</td>
<td>
<input name="contact_2_title" id="contact_2_title" type="text" maxlength="100" tabindex="107" value="<?php echo $_POST['contact_2_title']; ?>" />
<?php show_form_error($ar_err['contact_2_title']); ?>
</td>
<td>
Mobile
</td>
<td>
<input name="contact_2_mobile" id="contact_2_mobile" type="text" maxlength="20" tabindex="109" value="<?php echo $_POST['contact_2_mobile']; ?>" />
<?php show_form_error($ar_err['contact_2_mobile']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
Email
</td>
<td>
<input name="contact_2_email" id="contact_2_email" type="text" class="mail_field" maxlength="150" tabindex="110" value="<?php echo $_POST['contact_2_email']; ?>" /><a id="linkout_contact_2_email" href="mailto:<?php echo $_POST['contact_2_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['contact_2_email']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Contact Name
</td>
<td>
<input name="contact_3_name" id="contact_3_name" type="text" maxlength="150" tabindex="111" value="<?php echo $_POST['contact_3_name']; ?>" />
<?php show_form_error($ar_err['contact_3_name']); ?>
</td>
<td>
Phone
</td>
<td>
<input name="contact_3_phone" id="contact_3_phone" type="text" maxlength="20" tabindex="113" value="<?php echo $_POST['contact_3_phone']; ?>" />
<?php show_form_error($ar_err['contact_3_phone']); ?>
</td>
</tr>
<tr>
<td>
Title
</td>
<td>
<input name="contact_3_title" id="contact_3_title" type="text" maxlength="100" tabindex="112" value="<?php echo $_POST['contact_3_title']; ?>" />
<?php show_form_error($ar_err['contact_3_title']); ?>
</td>
<td>
Mobile
</td>
<td>
<input name="contact_3_mobile" id="contact_3_mobile" type="text" maxlength="20" tabindex="114" value="<?php echo $_POST['contact_3_mobile']; ?>" />
<?php show_form_error($ar_err['contact_3_mobile']); ?>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
Email
</td>
<td>
<input name="contact_3_email" id="contact_3_email" type="text" class="mail_field" maxlength="150" tabindex="115" value="<?php echo $_POST['contact_3_email']; ?>" /><a id="linkout_contact_3_email" href="mailto:<?php echo $_POST['contact_3_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['contact_3_email']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Comments
</td>
<td colspan="3">
<textarea name="comments" id="comments" tabindex="116" cols="80" rows="5"><?php echo $_POST['comments']; ?></textarea>
<?php show_form_error($ar_err['comments']); ?>
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_content" id="tab_content_references">
<div class="form_header">
Vendor References
</div>
<table class="input_block">
<tr>
<td>
Referrer
</td>
<td>
<input name="referrer" id="referrer" type="text" maxlength="100" tabindex="200" value="<?php echo $_POST['referrer']; ?>" />
<?php show_form_error($ar_err['referrer']); ?>
</td>
<td>
Rating
</td>
<td>
<?php echo graphic_rating_edit($_POST['rating'], 'rating'); ?>
<?php show_form_error($ar_err['rating']); ?>
</td>
</tr>
<tr>
<td>
Source
</td>
<td>
<input name="source" id="source" type="text" maxlength="100" tabindex="201" value="<?php echo $_POST['source']; ?>" />
<?php show_form_error($ar_err['source']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="4" align="center">
Vendor References
</td>
</tr>
<tr>
<td>
Name
</td>
<td>
<input name="ref_1_name" id="ref_1_name" type="text" maxlength="100" tabindex="202" value="<?php echo $_POST['ref_1_name']; ?>" />
<?php show_form_error($ar_err['ref_1_name']); ?>
</td>
<td rowspan="3">
Comment
</td>
<td rowspan="3">
<textarea class="comment_narrow" name="ref_1_comment" id="ref_1_comment" tabindex="205" cols="50" rows="3"><?php echo $_POST['ref_1_comment']; ?></textarea>
<?php show_form_error($ar_err['ref_1_comment']); ?>
</td>
</tr>
<tr>
<td>
Phone
</td>
<td>
<input name="ref_1_phone" id="ref_1_phone" type="text" maxlength="25" tabindex="203" value="<?php echo $_POST['ref_1_phone']; ?>" />
<?php show_form_error($ar_err['ref_1_phone']); ?>
</td>
</tr>
<tr>
<td>
Email
</td>
<td>
<input name="ref_1_email" id="ref_1_email" type="text" class="mail_field" maxlength="100" tabindex="204" value="<?php echo $_POST['ref_1_email']; ?>" /><a id="linkout_ref_1_email" href="mailto:<?php echo $_POST['ref_1_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['ref_1_email']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Name
</td>
<td>
<input name="ref_2_name" id="ref_2_name" type="text" maxlength="100" tabindex="206" value="<?php echo $_POST['ref_2_name']; ?>" />
<?php show_form_error($ar_err['ref_2_name']); ?>
</td>
<td rowspan="3">
Comment
</td>
<td rowspan="3">
<textarea class="comment_narrow" name="ref_2_comment" id="ref_2_comment" tabindex="209" cols="50" rows="3"><?php echo $_POST['ref_2_comment']; ?></textarea>
<?php show_form_error($ar_err['ref_2_comment']); ?>
</td>
</tr>
<tr>
<td>
Phone
</td>
<td>
<input name="ref_2_phone" id="ref_2_phone" type="text" maxlength="25" tabindex="207" value="<?php echo $_POST['ref_2_phone']; ?>" />
<?php show_form_error($ar_err['ref_2_phone']); ?>
</td>
</tr>
<tr>
<td>
Email
</td>
<td>
<input name="ref_2_email" id="ref_2_email" type="text" class="mail_field" maxlength="100" tabindex="208" value="<?php echo $_POST['ref_2_email']; ?>" /><a id="linkout_ref_2_email" href="mailto:<?php echo $_POST['ref_2_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['ref_2_email']); ?>
</td>
</tr>
<tr>
<td colspan="4">
</td>
</tr>
<tr>
<td>
Name
</td>
<td>
<input name="ref_3_name" id="ref_3_name" type="text" maxlength="100" tabindex="210" value="<?php echo $_POST['ref_3_name']; ?>" />
<?php show_form_error($ar_err['ref_3_name']); ?>
</td>
<td rowspan="3">
Comment
</td>
<td rowspan="3">
<textarea class="comment_narrow" name="ref_3_comment" id="ref_3_comment" tabindex="213" cols="50" rows="3"><?php echo $_POST['ref_3_comment']; ?></textarea>
<?php show_form_error($ar_err['ref_3_comment']); ?>
</td>
</tr>
<tr>
<td>
Phone
</td>
<td>
<input name="ref_3_phone" id="ref_3_phone" type="text" maxlength="25" tabindex="211" value="<?php echo $_POST['ref_3_phone']; ?>" />
<?php show_form_error($ar_err['ref_3_phone']); ?>
</td>
</tr>
<tr>
<td>
Email
</td>
<td>
<input name="ref_3_email" id="ref_3_email" type="text" class="mail_field" maxlength="100" tabindex="212" value="<?php echo $_POST['ref_3_email']; ?>" /><a id="linkout_ref_3_email" href="mailto:<?php echo $_POST['ref_3_email']; ?>"><img class="link_out" src="img/link_out_icon.png" /></a>
<?php show_form_error($ar_err['ref_3_email']); ?>
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_content" id="tab_content_proposals">
<div class="form_header">
Vendor Proposals
</div>
<table class="input_block_grid">
<?php
$sql = "SELECT * FROM vendor_proposals WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY id ASC";
$result_prp = mysqli_query($GLOBALS['con'], $sql);
while($row_prp = mysqli_fetch_object($result_prp)) :
?>
<tr>
<td colspan="2" class="data-grid-label">
Event
</td>
<td colspan="4" class="data-grid-label">
Fee Structure
</td>
<td colspan="4" class="data-grid-label">
Proposer
</td>
<td colspan="1" class="data-grid-label">
Hired
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
<tr id="prp_row_a_<?php echo $row_prp->id; ?>">
<td colspan="2">
<input type="hidden" name="prp_id_<?php echo $row_prp->id; ?>" id="prp_id_<?php echo $row_prp->id; ?>" value="<?php echo $row_prp->id; ?>" />
<input type="hidden" name="prp_del_<?php echo $row_prp->id; ?>" id="prp_del_<?php echo $row_prp->id; ?>" value="0" />
<select name="venue_<?php echo $row_prp->id; ?>" id="venue_<?php echo $row_prp->id; ?>" style="width:130px;" onchange="switch_est(<?php echo $row_prp->id; ?>);" >
<option value="">Event...</option>
<option value="temple" <?php if ($_POST['venue_'.$row_prp->id] == 'temple') {echo 'selected="selected"';} ?> ><?php echo venue_decode('temple'); ?></option>
<option value="av" <?php if ($_POST['venue_'.$row_prp->id] == 'av') {echo 'selected="selected"';} ?> ><?php echo venue_decode('av'); ?></option>
<option value="kv" <?php if ($_POST['venue_'.$row_prp->id] == 'kv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('kv'); ?></option>
<option value="bv" <?php if ($_POST['venue_'.$row_prp->id] == 'bv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('bv'); ?></option>
<option value="dv" <?php if ($_POST['venue_'.$row_prp->id] == 'dv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('dv'); ?></option>
</select>
<?php show_form_error($ar_err['venue_'.$row_prp->id]); ?>
</td>
<td colspan="4">
<input name="fee_structure_<?php echo $row_prp->id; ?>" id="fee_structure_<?php echo $row_prp->id; ?>" type="text" maxlength="100" style="width:250px;" value="<?php echo $_POST['fee_structure_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['fee_structure_'.$row_prp->id]); ?>
</td>
<td colspan="4">
<input name="proposer_<?php echo $row_prp->id; ?>" id="proposer_<?php echo $row_prp->id; ?>" type="text" maxlength="100" style="width:250px;" value="<?php echo $_POST['proposer_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['proposer_<?php echo $row_prp->id; ?>']); ?>
</td>
<td align="center">
<input name="hired_<?php echo $row_prp->id; ?>" id="hired_<?php echo $row_prp->id; ?>" type="checkbox" value="1" <?php if ($_POST['hired_'.$row_prp->id] == '1') : echo 'checked="checked"'; endif; ?> />
<?php show_form_error($ar_err['hired_'.$row_prp->id]); ?>
</td>
<td align="center">
<a href="javascript:prp_delete(<?php echo $row_prp->id; ?>);"><img src="img/delete_icon.gif" style="border:none;" /></a>
</td>
</tr>
<tr>
<td class="data-grid-label">
Est People
</td>
<td class="data-grid-label">
Cost p/person
</td>
<td class="data-grid-label">
Est Adults
</td>
<td class="data-grid-label">
Cost p/adult
</td>
<td class="data-grid-label">
Est Kids
</td>
<td class="data-grid-label">
Cost p/child
</td>
<td class="data-grid-label">
Est Tables
</td>
<td class="data-grid-label">
Cost p/table
</td>
<td class="data-grid-label">
Fixed cost
</td>
<td class="data-grid-label">
Tip total amt
</td>
<td class="data-grid-label">
Misc. cost
</td>
<td class="data-grid-label">
Total cost
</td>
</tr>
<tr id="prp_row_b_<?php echo $row_prp->id; ?>">
<td>
<input name="est_persons_<?php echo $row_prp->id; ?>" id="est_persons_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_persons_'.$row_prp->id]; ?>" onblur="val_int_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['est_persons_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="cost_per_person_<?php echo $row_prp->id; ?>" id="cost_per_person_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_person_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['cost_per_person_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="est_adults_<?php echo $row_prp->id; ?>" id="est_adults_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_adults_'.$row_prp->id]; ?>" onblur="val_int_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['est_adults_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="cost_per_adult_<?php echo $row_prp->id; ?>" id="cost_per_adult_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_adult_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['cost_per_adult_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="est_children_<?php echo $row_prp->id; ?>" id="est_children_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_children_'.$row_prp->id]; ?>" onblur="val_int_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['est_children_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="cost_per_child_<?php echo $row_prp->id; ?>" id="cost_per_child_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_child_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['cost_per_child_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="est_tables_<?php echo $row_prp->id; ?>" id="est_tables_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_tables_'.$row_prp->id]; ?>" onblur="val_int_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['est_tables_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="cost_per_table_<?php echo $row_prp->id; ?>" id="cost_per_table_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_table_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['cost_per_table_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="fixed_cost_<?php echo $row_prp->id; ?>" id="fixed_cost_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['fixed_cost_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['fixed_cost_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="tips_total_amt_<?php echo $row_prp->id; ?>" id="tips_total_amt_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['tips_total_amt_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['tips_total_amt_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="misc_cost_<?php echo $row_prp->id; ?>" id="misc_cost_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['misc_cost_'.$row_prp->id]; ?>" onblur="val_dollar_field(this); calc_total_cost(<?php echo $row_prp->id; ?>);" />
<?php show_form_error($ar_err['misc_cost_<?php echo $row_prp->id; ?>']); ?>
</td>
<td>
<input name="total_cost_<?php echo $row_prp->id; ?>" id="total_cost_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['total_cost_'.$row_prp->id]; ?>" readonly="readonly" />
<?php show_form_error($ar_err['total_cost_<?php echo $row_prp->id; ?>']); ?>
</td>
</tr>
<tr id="prp_row_c_<?php echo $row_prp->id; ?>">
<td colspan="2" class="data-grid-label">
Proposal Date
</td>
<td colspan="2" class="data-grid-label">
Ref #
</td>
<td colspan="8" class="data-grid-label">
Comment
</td>
</tr>
<tr id="prp_row_d_<?php echo $row_prp->id; ?>">
<td colspan="2">
<input name="proposal_date_<?php echo $row_prp->id; ?>" id="proposal_date_<?php echo $row_prp->id; ?>" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:130px;" value="<?php echo $_POST['proposal_date_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['proposal_date_'.$row_prp->id]); ?>
</td>
<td colspan="2">
<input name="ref_no_<?php echo $row_prp->id; ?>" id="ref_no_<?php echo $row_prp->id; ?>" type="text" maxlength="12" style="width:130px;" value="<?php echo $_POST['ref_no_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['ref_no_'.$row_prp->id]); ?>
</td>
<td colspan="8">
<input name="comments_<?php echo $row_prp->id; ?>" id="comments_<?php echo $row_prp->id; ?>" type="text" maxlength="255" style="width:550px;" value="<?php echo $_POST['comments_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['comments_<?php echo $row_prp->id; ?>']); ?>
</td>
</tr>
<?php
if ($row_prp->est_persons == 0 AND $row_prp->est_adults == 0 AND $row_prp->est_children == 0 AND $row_prp->est_tables == 0) :
?>
<script>
switch_est(<?php echo $row_prp->id; ?>);
</script>
<?php
endif;
?>
<!--- ******************* Payments ******************** --->
<?php
if ($_POST['hired_'.$row_prp->id] == '1') :
?>
<tr id="prp_row_e_<?php echo $row_prp->id; ?>">
<td colspan="12">
<table class="input_block_grid">
<?php
$sql = "SELECT * FROM vendor_payments WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND proposal_id = ".$row_prp->id." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY sched_date ASC";
$result_pmt = mysqli_query($GLOBALS['con'], $sql);
if (mysqli_num_rows($result_pmt) > 0) :
?>
<tr>
<td class="data-grid-label">
Payment Type
</td>
<td class="data-grid-label">
Description
</td>
<td class="data-grid-label">
Sched. Date
</td>
<td class="data-grid-label">
Sched. Amount
</td>
<td class="data-grid-label">
Paid Date
</td>
<td class="data-grid-label">
Paid Amount
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
<?php
endif;
$total_pmt_scheduled = 0.00;
$total_pmt_actual = 0.00;
while($row_pmt = mysqli_fetch_object($result_pmt)) :
$total_pmt_scheduled = $total_pmt_scheduled + $row_pmt->sched_amt;
$total_pmt_actual = $total_pmt_actual + $row_pmt->paid_amt;
?>
<tr id="pmt_row_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>">
<td>
<input type="hidden" name="pmt_id_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="pmt_id_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" value="<?php echo $row_pmt->id; ?>" />
<input type="hidden" name="pmt_proposal_id_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="pmt_id_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" value="<?php echo $row_pmt->proposal_id; ?>" />
<input type="hidden" name="pmt_del_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="pmt_del_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" value="0" />
<select name="pmt_type_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="pmt_type_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" style="width:125px;">
<option value="">Payment Type...</option>
<?php
$ar_pmt_type = array("Deposit", "Payment", "Final Payment");
foreach ($ar_pmt_type as $pmt_type) :
$selected = '';
$pmt_type_code = substr($pmt_type, 0, 1);
if ($_POST['pmt_type_'.$row_pmt->id.'_'.$row_pmt->proposal_id] == $pmt_type_code) :
$selected = 'selected="selected"';
endif;
echo '<option value="'.$pmt_type_code.'" '.$selected.'>'.$pmt_type.'</option>';
endforeach;
?>
</select>
<?php show_form_error($ar_err['pmt_type_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td>
<input name="pmt_desc_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="pmt_desc_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" type="text" maxlength="100" style="width:230px;" value="<?php echo $_POST['pmt_desc_'.$row_pmt->id.'_'.$row_pmt->proposal_id]; ?>" />
<?php show_form_error($ar_err['pmt_desc_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td>
<input name="sched_date_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="sched_date_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:90px;" value="<?php echo $_POST['sched_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id]; ?>" />
<?php show_form_error($ar_err['sched_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td>
<input name="sched_amt_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="sched_amt_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" type="text" maxlength="15" style="width:90px; text-align:right;" value="<?php echo $_POST['sched_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id]; ?>" onblur="val_dollar_field(this);" />
<?php show_form_error($ar_err['sched_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td>
<input name="paid_date_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="paid_date_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:90px;" value="<?php echo $_POST['paid_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id]; ?>" />
<?php show_form_error($ar_err['paid_date_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td>
<input name="paid_amt_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" id="paid_amt_<?php echo $row_pmt->id.'_'.$row_pmt->proposal_id; ?>" type="text" maxlength="15" style="width:90px; text-align:right;" value="<?php echo $_POST['paid_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id]; ?>" onblur="val_dollar_field(this);" />
<?php show_form_error($ar_err['paid_amt_'.$row_pmt->id.'_'.$row_pmt->proposal_id]); ?>
</td>
<td align="center">
<a href="javascript:pmt_delete(<?php echo $row_pmt->id; ?>, <?php echo $row_pmt->proposal_id; ?>);"><img src="img/delete_icon.gif" style="border:none;" /></a>
</td>
</tr>
<?php
endwhile;
if (mysqli_num_rows($result_pmt) > 0) :
?>
<tr>
<td colspan="3">
Totals:
</td>
<td align="right">
<?php echo number_format($total_pmt_scheduled,2,'.',','); ?>
</td>
<td>
</td>
<td align="right">
<?php echo number_format($total_pmt_actual,2,'.',','); ?>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="5">
Balance Due:
</td>
<td align="right">
<?php echo number_format($row_prp->total_cost - $total_pmt_actual,2,'.',','); ?>
</td>
<td>
</td>
</tr>
<?php
endif;
?>
<tr>
<td colspan="7">
Add new payment below ↓ ↓
</td>
</tr>
<tr>
<td class="data-grid-label">
Payment Type
</td>
<td class="data-grid-label">
Description
</td>
<td class="data-grid-label">
Sched. Date
</td>
<td class="data-grid-label">
Sched. Amount
</td>
<td class="data-grid-label">
Paid Date
</td>
<td class="data-grid-label">
Paid Amount
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
<tr>
<td>
<input type="hidden" name="pmt_id_new_<?php echo $row_prp->id; ?>" id="pmt_id_new_<?php echo $row_prp->id; ?>" value="new" />
<input type="hidden" name="pmt_proposal_id_new_<?php echo $row_prp->id; ?>" id="pmt_proposal_id_new_<?php echo $row_prp->id; ?>" value="<?php echo $row_prp->id; ?>" />
<select name="pmt_type_new_<?php echo $row_prp->id; ?>" id="pmt_type_new_<?php echo $row_prp->id; ?>" style="width:125px;">
<option value="">Payment Type...</option>
<?php
$ar_pmt_type = array("Deposit", "Payment", "Final Payment");
foreach ($ar_pmt_type as $pmt_type) :
$selected = '';
$pmt_type_code = substr($pmt_type, 0, 1);
if ($_POST['pmt_type_new_'.$row_prp->id] == $pmt_type_code) :
$selected = 'selected="selected"';
endif;
echo '<option value="'.$pmt_type_code.'" '.$selected.'>'.$pmt_type.'</option>';
endforeach;
?>
</select>
<?php show_form_error($ar_err['pmt_type_new_'.$row_prp->id]); ?>
</td>
<td>
<input name="pmt_desc_new_<?php echo $row_prp->id; ?>" id="pmt_desc_new_<?php echo $row_prp->id; ?>" type="text" maxlength="100" style="width:230px;" value="<?php echo $_POST['pmt_desc_new_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['pmt_desc_new_'.$row_prp->id]); ?>
</td>
<td>
<input name="sched_date_new_<?php echo $row_prp->id; ?>" id="sched_date_new_<?php echo $row_prp->id; ?>" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:90px;" value="<?php echo $_POST['sched_date_new_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['sched_date_new_'.$row_prp->id]); ?>
</td>
<td>
<input name="sched_amt_new_<?php echo $row_prp->id; ?>" id="sched_amt_new_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:90px; text-align:right;" value="<?php echo $_POST['sched_amt_new_'.$row_prp->id]; ?>" onblur="val_dollar_field(this);" />
<?php show_form_error($ar_err['sched_amt_new_'.$row_prp->id]); ?>
</td>
<td>
<input name="paid_date_new_<?php echo $row_prp->id; ?>" id="paid_date_new_<?php echo $row_prp->id; ?>" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:90px;" value="<?php echo $_POST['paid_date_new_'.$row_prp->id]; ?>" />
<?php show_form_error($ar_err['paid_date_new_'.$row_prp->id]); ?>
</td>
<td>
<input name="paid_amt_new_<?php echo $row_prp->id; ?>" id="paid_amt_new_<?php echo $row_prp->id; ?>" type="text" maxlength="15" style="width:90px; text-align:right;" value="<?php echo $_POST['paid_amt_new_'.$row_prp->id]; ?>" onblur="val_dollar_field(this);" />
<?php show_form_error($ar_err['paid_amt_new_'.$row_prp->id]); ?>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="7">
<br />
<input type="button" value="Save & Insert" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
</td>
</tr>
</table>
</td>
</tr>
<?php
endif;
?>
<!--- ******************* End of Payments ******************** --->
<tr>
<td colspan="12" >
</td>
</tr>
<?php
endwhile;
?>
<tr>
<td colspan="7">
<input type="button" value="Add New Proposal..." onclick="toggle_new_proposal();" style="width:125px;" />
<!--- Add new proposal below ↓ ↓ --->
</td>
</tr>
<tr id="prp_row_a_new">
<td colspan="2" class="data-grid-label">
Event
</td>
<td colspan="4" class="data-grid-label">
Fee Structure
</td>
<td colspan="4" class="data-grid-label">
Proposer
</td>
<td colspan="1" class="data-grid-label">
Hired
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
<tr id="prp_row_b_new">
<td colspan="2">
<input type="hidden" name="prp_id_new" id="prp_id_new" value="new" />
<select name="venue_new" id="venue_new" style="width:130px;" onchange="switch_est('new');" >
<option value="">Event...</option>
<option value="temple" <?php if ($_POST['venue_new'] == 'temple') {echo 'selected="selected"';} ?> ><?php echo venue_decode('temple'); ?></option>
<option value="av" <?php if ($_POST['venue_new'] == 'av') {echo 'selected="selected"';} ?> ><?php echo venue_decode('av'); ?></option>
<option value="kv" <?php if ($_POST['venue_new'] == 'kv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('kv'); ?></option>
<option value="bv" <?php if ($_POST['venue_new'] == 'bv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('bv'); ?></option>
<option value="dv" <?php if ($_POST['venue_new'] == 'dv') {echo 'selected="selected"';} ?> ><?php echo venue_decode('dv'); ?></option>
</select>
<?php show_form_error($ar_err['venue_new']); ?>
</td>
<td colspan="4">
<input name="fee_structure_new" id="fee_structure_new" type="text" maxlength="100" style="width:250px;" value="<?php echo $_POST['fee_structure_new']; ?>" />
<?php show_form_error($ar_err['fee_structure_new']); ?>
</td>
<td colspan="4">
<input name="proposer_new" id="proposer_new" type="text" maxlength="100" style="width:250px;" value="<?php echo $_POST['proposer_new']; ?>" />
<?php show_form_error($ar_err['proposer_new']); ?>
</td>
<td align="center">
<input name="hired_new" id="hired_new" type="checkbox" value="1" <?php if ($_POST['hired_new'] == '1') : echo 'checked="checked"'; endif; ?> />
<?php show_form_error($ar_err['hired_new']); ?>
</td>
<td colspan="1">
</td>
</tr>
<tr id="prp_row_c_new">
<td class="data-grid-label">
Est People
</td>
<td class="data-grid-label">
Cost p/person
</td>
<td class="data-grid-label">
Est Adults
</td>
<td class="data-grid-label">
Cost p/adult
</td>
<td class="data-grid-label">
Est Kids
</td>
<td class="data-grid-label">
Cost p/child
</td>
<td class="data-grid-label">
Est Tables
</td>
<td class="data-grid-label">
Cost p/table
</td>
<td class="data-grid-label">
Fixed cost
</td>
<td class="data-grid-label">
Tip total amt
</td>
<td class="data-grid-label">
Misc. cost
</td>
<td class="data-grid-label">
Total cost
</td>
</tr>
<tr id="prp_row_d_new">
<td>
<input name="est_persons_new" id="est_persons_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_persons_new']; ?>" onblur="val_int_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['est_persons_new']); ?>
</td>
<td>
<input name="cost_per_person_new" id="cost_per_person_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_person_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['cost_per_person_new']); ?>
</td>
<td>
<input name="est_adults_new" id="est_adults_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_adults_new']; ?>" onblur="val_int_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['est_adults_new']); ?>
</td>
<td>
<input name="cost_per_adult_new" id="cost_per_adult_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_adult_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['cost_per_adult_new']); ?>
</td>
<td>
<input name="est_children_new" id="est_children_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_children_new']; ?>" onblur="val_int_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['est_children_new']); ?>
</td>
<td>
<input name="cost_per_child_new" id="cost_per_child_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_child_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['cost_per_child_new']); ?>
</td>
<td>
<input name="est_tables_new" id="est_tables_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['est_tables_new']; ?>" onblur="val_int_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['est_tables_new']); ?>
</td>
<td>
<input name="cost_per_table_new" id="cost_per_table_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['cost_per_table_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['cost_per_table_new']); ?>
</td>
<td>
<input name="fixed_cost_new" id="fixed_cost_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['fixed_cost_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['fixed_cost_new']); ?>
</td>
<td>
<input name="tips_total_amt_new" id="tips_total_amt_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['tips_total_amt_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['tips_total_amt_new']); ?>
</td>
<td>
<input name="misc_cost_new" id="misc_cost_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['misc_cost_new']; ?>" onblur="val_dollar_field(this); calc_total_cost('new');" />
<?php show_form_error($ar_err['misc_cost_new']); ?>
</td>
<td>
<input name="total_cost_new" id="total_cost_new" type="text" maxlength="15" style="width:65px; text-align:right;" value="<?php echo $_POST['total_cost_new']; ?>" readonly="readonly" />
<?php show_form_error($ar_err['total_cost_new']); ?>
</td>
</tr>
<tr id="prp_row_e_new">
<td colspan="2" class="data-grid-label">
Proposal Date
</td>
<td colspan="2" class="data-grid-label">
Ref #
</td>
<td colspan="8" class="data-grid-label">
Comment
</td>
</tr>
<tr id="prp_row_f_new">
<td colspan="2">
<input name="proposal_date_new" id="proposal_date_new" class="date-pick dp-applied" readonly="readonly" type="text" maxlength="20" style="width:130px;" value="<?php echo $_POST['proposal_date_new']; ?>" />
<?php show_form_error($ar_err['proposal_date_new']); ?>
</td>
<td colspan="2">
<input name="ref_no_new" id="ref_no_new" type="text" maxlength="12" style="width:130px;" value="<?php echo $_POST['ref_no_new']; ?>" />
<?php show_form_error($ar_err['ref_no_new']); ?>
</td>
<td colspan="8">
<input name="comments_new" id="comments_new" type="text" maxlength="255" style="width:550px;" value="<?php echo $_POST['comments_new']; ?>" />
<?php show_form_error($ar_err['comments_new']); ?>
</td>
</tr>
<script>
switch_est('new');
</script>
<tr id="prp_row_g_new">
<td colspan="7">
<br />
<input type="button" value="Save & Insert" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="tab_content" id="tab_content_documents">
<div class="form_header">
Vendor Documents
</div>
<table class="input_block_grid">
<tr>
<td class="data-grid-label">
File Link
</td>
<td class="data-grid-label">
Description
</td>
<td class="data-grid-label">
Upload Date
</td>
<td class="data-grid-label">
Delete
</td>
</tr>
<?php
$sql = "SELECT * FROM vendor_documents WHERE vendor_id = ".mysqli_real_escape_string($GLOBALS['con'], trim($_REQUEST['id']))." AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ORDER BY upload_date DESC";
$result_doc = mysqli_query($GLOBALS['con'], $sql);
while($row_doc = mysqli_fetch_object($result_doc)) :
?>
<tr id="doc_row_<?php echo $row_doc->id; ?>">
<td>
<input type="hidden" name="doc_id_<?php echo $row_doc->id; ?>" id="doc_id_<?php echo $row_doc->id; ?>" value="<?php echo $row_doc->id; ?>" />
<input type="hidden" name="doc_del_<?php echo $row_doc->id; ?>" id="doc_del_<?php echo $row_doc->id; ?>" value="0" />
<a href="ajax.php?call=file_download&id=<?php echo $row_doc->id; ?>&type=vendor"><?php echo $row_doc->doc_file; ?></a>
</td>
<td>
<?php echo $row_doc->doc_desc; ?>
</td>
<td>
<?php echo $row_doc->upload_date; ?>
</td>
<td align="center">
<a href="javascript:doc_delete(<?php echo $row_doc->id; ?>);"><img src="img/delete_icon.gif" style="border:none;" /></a>
</td>
</tr>
<?php
endwhile;
?>
<tr>
<td colspan="7">
Add new document below ↓ ↓
</td>
</tr>
<tr>
<td>
<input type="hidden" name="doc_id_new" id="doc_id_new" value="new" />
<input name="doc_file_new" id="doc_file_new" type="file" size="100" style="width:280px;" value="<?php echo $_POST['doc_file_new']; ?>" />
<?php show_form_error($ar_err['doc_file_new']); ?>
</td>
<td>
<input name="doc_desc_new" id="doc_desc_new" type="text" maxlength="100" style="width:280px;" value="<?php echo $_POST['doc_desc_new']; ?>" />
<?php show_form_error($ar_err['doc_desc_new']); ?>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="7">
<br />
<input type="button" value="Save & Insert" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
</td>
</tr>
</table>
</div>
<!-- -------------------------------------------------------------------------------------------------------------- -->
<div class="form_strip">
<input type="button" value="Save" onclick="sheet_dirty = false;this.form.submit();" />
<input type="button" value="Save & Close" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Save & New" onclick="sheet_dirty = false; document.getElementById('xsubmit').value = this.value; this.form.submit();" />
<input type="button" value="Cancel" onclick="sheet_dirty = false; window.location.href = 'index.php?IX=<?php echo $_REQUEST['ref']; ?>'" />
<input type="hidden" name="xsubmit" id="xsubmit" />
</div>
</form>