include ($_SERVER['DOCUMENT_ROOT']."/config.inc.php");
//include ("config.inc.php");
//include ("seo-data/seodata.php");
//include ("seo-data/seodata.php");
include ($_SERVER['DOCUMENT_ROOT']."/seo-data/seodata.php");
?>
|
$100 Cash DISCOUNT!!
Yes, Per Person!
Select International Trips:
details >
|
|
14-30 Hours FREE Drinks
Cancun and Jamaica,
South Padre Island:
details >
|
MEAL PLANS
7-21 meals included
(select destinations):
details >
|
|
That's right, our campus
reps are eligible
for free travel, apply today.
more
info >> |
|
 |
|
|
// File: tripdetails.php
// Details: Contains the function definitions for getting various details of a trip
// Author: Manvir Singh
// Date: 20/11/04
// Get Destination
function getDestination($destid) {
$sql = "SELECT Name from destinations where id=$destid";
$result=mysql_query($sql) or die("error occurred getting destnation. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
// Get Airport
function getAirport($airportid) {
$sql = "SELECT Departure from tblairportscharges where id=$airportid";
$result=mysql_query($sql) or die("error occurred");
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
// Get Hotel
function getHotel($hotelid) {
$sql = "SELECT Hotel from hotels where id=$hotelid";
$result=mysql_query($sql) or die("error occurred");
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getHotelStayCount($destid, $weekid) {
$sql = "select stay from tblpeakweeks where destid=$destid and weekid=$weekid";
//$sql = "select stay from tblpeakweeks where weekid=$weekid";
$result=mysql_query($sql) or die("error occurred while getting stay count. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getDepartureWeekend($destid, $weekid) {
//$sql = "select weekend from tblpeakweeks where weekid=$weekid";
$sql = "select weekend from tblpeakweeks where destid=$destid and weekid=$weekid";
$result=mysql_query($sql) or die("error occurred while getting weekend. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
// Get the number of nights of stay
function getStayCount($destid, $weekid) {
//$sql = "SELECT week FROM tblpeakweeks where weekid=$weekid";
$sql = "SELECT week FROM tblpeakweeks where destid=$destid and weekid=$weekid";
$result = mysql_query($sql) or die("error occured: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
list($week1, $week2) = split("-", $res[0]);
list($month1,$day1,$year1) = split("/",$week1);
list($month2,$day2,$year2) = split("/",$week2);
if ((base_convert($month2, 10, 10) - base_convert($month1, 10, 10)) >= 1) {
$arr1 = array(1, 3, 5, 7, 8, 10, 12);
$arr2 = array(4, 6, 9, 11);
//echo (strpos("1,3,5,7,8,10,12", $month1));
if (in_array($month1, $arr1)) {
return (abs($day1-($day2+31))." br>");
} else if (in_array($month1, $arr2)) {
return (abs($day1-($day2+31))." ");
} else if ($month1 == "2") {
return (abs($day1-($day2+28))." ");
}
} else {
return (abs($day1-$day2)." ");
}
//echo($week1. " --- " . $week2);
}
}
function getDeluxCost($destid) {
$sql = "SELECT DeluxePartyPkg from destinations where id=$destid";
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getMealCost($destid) {
$sql = "SELECT MealPlan from destinations where id=$destid";
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getTripInsCost($destid) {
$sql = "SELECT TripIns from destinations where id=$destid";
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getDepositAmount($destid) {
$sql = "SELECT deposit from destinations where id=$destid";
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getSysParam($param_code) {
$sql = "SELECT param_value from tblsysparams where param_code='$param_code'";
//echo $sql;
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
//echo $res[0];
return ($res[0]);
}
}
function getMinDeposit($tripid) {
$sql = "select format(airMarkup+airportadjcharges+100.00,2) as deposit from trips where trip_id=$tripid";
//echo('');
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_assoc($result)) {
return ceil($res['deposit']);
}
}
function getReservationNumber($tripid) {
$sql = "select booking_id from tbltripbookings where trip_id=$tripid";
$result=mysql_query($sql) or die("error occurred".mysql_error());
if ($res = mysql_fetch_array($result)) {
return ($res[0]);
}
}
function getGroupNumber($contactid) {
$sql = "select trip_id from contacts where contact_id=$contactid";
$result=mysql_query($sql) or die("error occurred getting destnation. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
//echo $res[0];
return ($res[0]);
}
}
function getTravelerName($contactid) {
$sql = "select fname, lname from contacts where contact_id=$contactid";
$result=mysql_query($sql) or die("error occurred getting destnation. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
//echo $res[0];
return ($res[0]." ".$res[1]);
}
}
function formatCharges($value, $selection) {
//echo "Formating..".$value." = ".$selection;
if ($value == 0) {
return "N/A";
} else if ($value < 0) {
return "Free";
} else if ($selection == 1 & $value > 0) {
return $value;
} else if ($selection == 0 & $value > 0) {
return "-";
}
}
function getPrimaryContactInfo($contactid) {
//$sql="select "
$sql = "select a.address1 as add1, a.address2 as add2, a.city, a.zip, c.phone, c.alt_phone, c.email1, c.email2
from address as a, contacts as c
where a.contact_id=c.contact_id and c.contact_id=$contactid and a.address_type='P'";
$result = mysql_query($sql) or die("error occured getting primary information. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res;
}
}
function getStateName($contactid, $infotype) {
$sql = "select s.full_name
from states as s
left join address as a
on a.state=s.state_id
where a.address_type='$infotype' and a.contact_id=$contactid ";
//echo $sql;
$result = mysql_query($sql) or die("error ocurred getting state. ERROR:".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getSecondaryContactInfo($contactid) {
// $sql = "select a.address1 as add1, a.address2 as add2, a.city, s.full_name as state, a.zip, a.phone from address as a, states as s where a.contact_id=$contactid and a.address_type='S' and s.state_id=a.state;";
$sql = "select address1 as add1, address2 as add2, city, zip, phone from address where contact_id=$contactid and address_type='S'";// and s.state_id=a.state;";
//echo $sql ;
$result = mysql_query($sql) or die("error occured getting secondary information. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res;
}
}
function getOptions($contactid) {
$sql = "select isdeluxe, ismealplan, isinsured from tbltripbookings where contact_id=$contactid";
$result = mysql_query($sql) or die("error occured getting options. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res;
}
}
function getPaidAmount($tripid, $contactid) {
$sql = "select IFNULL(sum(p.amount), 0)
from payment_applied as p, tblpayments as ps
where p.payment_id=ps.payment_id and ps.trip_id = p.trip_id and p.trip_id=$tripid and p.contact_id=$contactid and ps.processed = 1";
$result = mysql_query($sql) or die("error occured getting payments. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getmisccharges($contid){
$result=mysql_query("select amount,ischarge from tblmisc_applied where contact_id=".$contid) or die(mysql_error());
$amt=0;
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if($row["ischarge"]==0){
$amt=$amt-$row["amount"];
}else if($row["ischarge"]==1){
$amt=$amt+$row["amount"];
}
}
return $amt;
}
function getTotalAmount($tripid, $contactid)
{
$options=0;
$query="select b.basecharges,b.airportcharge,b.peakweekcharge,b.taxes,b.partypackage,b.vippackage,b.mealplan,b.insurance,";
$query.=" b.isParty_Package, b.isdeluxe, b.ismealplan, b.isinsured, b.airMarkup";
$query.=" from contacts c,trips t,tbltripbookings b";
$query.=" where t.trip_id=$tripid and t.trip_id=c.trip_id and t.trip_id=b.trip_id";
$query.=" and c.contact_id=b.contact_id and c.contact_id=$contactid";
$result = mysql_query($query) or die("error occured getting total. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result))
{
if ($res['insurance']>0)
{
if ($res['isinsured']==1)
{
$options+=$res['insurance'];
}
}
if ($res['mealplan']>0)
{
if ($res['ismealplan']==1)
{
$options+=$res['mealplan'];
}
}
if ($res['vippackage']>0)
{
if ($res['isdeluxe']==1)
{
$options+=$res['vippackage'];
}
}
if ($res['partypackage']>0)
{
if ($res['isParty_Package']==1)
{
$options+=$res['partypackage'];
}
}
if ($res['basecharges']>0 || $options>0)
{
$total=$res['basecharges']+$res['airportcharge']+$res['peakweekcharge']+$options;
}
$airMarkup = $res['airMarkup'];
$misc = getMiscTotal($contactid);
return floor($total+$misc+$airMarkup);
}
}
function isAPISRecieved($contactid) {
$sql = "select apis_id from contacts where contact_id=$contactid";
$result = mysql_query($sql) or die("error occured getting payments. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function chkDate() {
$today = getdate();
$deposit_end_date = getSysParam("DND");
$deposit_start_date = getSysParam("DST");
//date_format(curdate(),'%Y/%m/%d')
$sql= "select if (date_format(curdate(),'%Y/%m/%d') between '$deposit_start_date' and '$deposit_end_date',1,0)";
//$sql = "select (dayofyear('".$today["year"]."/".$today["mon"]."/".$today["mday"]."') >= dayofyear('".$deposit_start_date."')) & (dayofyear('".$today["year"]."/".$today["mon"]."/".$today["mday"]."') <= dayofyear('".$deposit_end_date."'))";
//echo $sql;
$result = mysql_query($sql) or die("error occured while checking date.".mysql_error());
if($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getCCNumber($ccid) {
$sql = "select right(cc_number, 4) from credit_cards where cc_id=$ccid";
$result = mysql_query($sql) or die("Error occured while getting credit card number.".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getCheckNumber($checkid) {
$sql = "select check_number from checks where check_id=$checkid";
$result = mysql_query($sql) or die("Error occured while getting credit card number.".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getMiscTotal($contactid) {
$charges = NULL;
$discounts = NULL;
$sql = "select sum(amount) from tblmisc_applied where contact_id = $contactid and ischarge=1";
$result = mysql_query($sql) or die("error occured while getting misc charges. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
$charges = $res[0];
}
$sql = "select sum(amount) from tblmisc_applied where contact_id = $contactid and ischarge=0";
$result = mysql_query($sql) or die("error occured while getting misc charges. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
$discounts = $res[0];
}
return ($charges-$discounts);
}
function getTotalMessageCount($contactid, $tripid, $destid,$type) {
//echo "TripID:".$tripid;
//$travmsgs = getMessagesForType($contactid, "T");
//$groupmsgs = getMessagesForType($tripid, "G");
/*
There will be two cases. One for Rep and other for Traveler
In case of Rep
A-To All representative-ID-0 type-R
D-Destination-We will pass ID-Type R
S-School-We will pass ID-Type R
R-Specific Representative-ID-Type R
In case of Traveler
A-To all traveler-ID-0 -type T
D-Destination -ID-Type-T
S-Sprecific Traveller-ID -T
*/
$allmsgs=getMessagesForType(1,"A",$type);
$travmsgs=getMessagesForType($contactid, "T",$type);
$destmsgs = getMessagesForType($destid, "D",$type);
return ($travmsgs + $allmsgs + $destmsgs);
}
function getTotalRepMessageCount($repid,$schoolid,$type)
{
$allmsgs=getMessagesForType(1,"A",$type);
$schmsgs=getMessagesForType($schoolid, "S",$type);
$travmsgs=getMessagesForType($repid, "R",$type);
$destmsgs = getRepMessagesForDest($repid, "D",$type);
return ($travmsgs + $allmsgs + $destmsgs+$schmsgs);
}
function getMessagesForType($id, $to,$type) {
$sql = "select count(*) from tblimpmessages where msg_appliedid=$id and msg_appliedto='$to' and msg_type='$type'";
//echo $sql; return;
$result = mysql_query($sql) or die("Error occured while getting Messages For Traveler. ERROR: ".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getRepMessagesForDest($id,$to,$type)
{
$sql="select distinct(destid) from trips where flyercode=".$id;
$result=mysql_query($sql) or die(mysql_error());
$i=0;
while ($row=mysql_fetch_array($result))
{
$sql_dest="select count(*) from tblimpmessages where msg_appliedid=".$row["destid"]." and msg_appliedto='$to' and msg_type='$type'";
$result_dest=mysql_query($sql_dest) or die(mysql_error());
$row_dest=mysql_fetch_array($result_dest);
$i=$row_dest[0]+$i;
}
return $i;
}
function getReadRepMessageCount($repid,$type)
{
$sql = "select count(*) from tblrepmessage where rm_repid=$repid";
$result = mysql_query($sql) or die("Error occured while getting message count. ERROR:".mysql_error());
if ($res = mysql_fetch_array($result))
return $res[0];
}
function getReadMessageCount($contactid,$type) {
$sql = "select count(*) from tbltravelermessage where tm_travid=$contactid";
$result = mysql_query($sql) or die("Error occured while getting message count. ERROR:".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getAirportLink($airportid) {
$sql = "select airport_url from tblairportscharges where ID=$airportid";
$result = mysql_query($sql) or die("Error occured while getting airport link. ERROR:".mysql_error());
if ($res = mysql_fetch_array($result)) {
return $res[0];
}
}
function getrepname($replogin)
{
$sql="select fName,lName from reps where rep_id=".$replogin;
$result=mysql_query($sql) or die(mysql_error());
$row=mysql_fetch_array($result);
$name=$row["fName"]." ".$row["lName"];
return $name;
}
function show_eticket($trip_id,$apply_apis)
{
$bln_charge=1;
$sql = "select c.contact_id, tb.basecharges,tb.airportcharge,tb.peakweekcharge,tb.taxes,tb.partypackage,tb.vippackage,tb.mealplan,tb.insurance, tb.isdeluxe, tb.ismealplan, tb.isinsured,tb.isParty_Package, tb.isreserved,tb.istpa, c.apis_id from tbltripbookings tb inner join contacts c on tb.contact_id=c.contact_id where iscancelled=0 and isDeleted=0 and tb.trip_id=".$trip_id;
$booking = mysql_query($sql) or die("Error occured".mysql_error());
while($res = mysql_fetch_array($booking))
{
list($contactid, $basecharge,$airportcost,$peakweekcost,$tax,$partycost,$deluxcost,$mealcost,$inscost,$isdelux, $ismealplan, $isinsured, $isparty,$isreserved,$istpa,$apis_id) = $res;
$paid = getPaidAmount($trip_id, $contactid);
$misc = getMiscTotal($contactid);
$total = $basecharge+$airportcost+$peakweekcost+$tax+$misc;
if ($isparty && $partycost>0) {
$total += $partycost;
}
if ($isdelux && $deluxcost>0) {
$total += $deluxcost;
}
if ($ismealplan && $mealcost>0) {
$total += $mealcost;
}
if ($isinsured && $inscost>0) {
$total += $inscost;
}
$balance = $total - $paid;
if ($balance>0)
{
$bln_charge=0;
break;
}
if ($istpa==0)
{
$bln_charge=0;
break;
}
if ($apply_apis==1)
{
if (isAPISRecieved($contactid) == 0 || is_null(isAPISRecieved($contactid)))
{
$bln_charge=0;
break;
}
}
}
return $bln_charge;
}
function getdestination_type($destid)
{
$query="select Transportation from destinations where ID=$destid";
$result=mysql_query($query);
$row=mysql_fetch_array($result);
if($row["Transportation"]=='Air')
return 1;
else
return 0;
}
|