LittleDemon WebShell


Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
Path : /NK-86972/reservations/
File Upload :
Command :
Current File : //NK-86972/reservations/tour_creator.php

<?php
error_reporting(0);
$vars = '?';

if(isset($_GET['PME_sys_pt_operation'])){

    foreach($_GET as $name=>$value)
    {

        $vars = $vars . $name .'='.$value.'&';

    }

    header("location: ../management/Providers_Tour.php".$vars);

    exit();

}



require_once('../login/auth.php');

require_once '../header.php';
require_once '../db.php';
//Array to store validation errors
include('../management/config.php');
    //Connect to mysql server
    $link = mysql_connect($opts['hn'], $opts['un'], $opts['pw']);
    if(!$link) {
        die('Failed to connect to server: ' . mysql_error());
    }


    //Select database
    $db = mysql_select_db($opts['db']);
    if(!$db) {
        die("Unable to select database");
    }

$display = 'yes';

if(!$_GET['PME_sys_operation'] == 'PME_op_Change' || !$_POST['PME_sys_operation'] != 'PME_op_Change'){

    $display = 'none';

}

?>

<script type="text/javascript">

  function sendcarrentalemail(){
	//alert($("select[name=temmplatestype]").val());
		//$(".mailsendingstatusbar").css("display","block");

		var attachedfiles=[];

		$(".attachedfiles").each(function(){
			if($(this).prop('checked')==true){
				attachedfiles.push($(this).val());
			}
		});
		attachedfiles = attachedfiles.join();
		//attachedfiles=implode(',',attachedfiles);
		//alert(attachedfiles);


		$.ajax({
			type:'post',
			data: "PME_sys_rec=<?php echo $_GET['PME_sys_rec']; ?>&file="+$("select[name=carrentaltemmplatestype1]").val()+"&subject="+$("input[name=carsubject]").attr("value")+"&body="+base64_encode($("textarea[name=body]").val())+"&email="+$("input[name=carprovider]").val()+"&attachment="+attachedfiles+"&car_provider_type="+$("select[name=PME_data_carrental_providers] option:selected").val(),
			url: '../reservations/carrentalemail.php',
			success: function (postResp) {
					$.unblockUI();
					var error=getBBcodeValue('error',postResp);
					if(error.length>0){
						alert(error);
					}else{
						var msg=getBBcodeValue('message',postResp);
						alert(msg);
					}
					//$(".mailsendingstatusbar").css("display","none");
					//var downloadlink=getBBcodeValue1('downloadlink',postResp);

					//$(".invoicelink").html('<a href="'+downloadlink+'">Download Invoice</a>');
			}
		});
	}
	function formatDate(date) {
    var d = new Date(date),
        month = '' + (d.getMonth() + 1),
        day = '' + d.getDate(),
        year = d.getFullYear();

    if (month.length < 2) month = '0' + month;
    if (day.length < 2) day = '0' + day;

    return [year, month, day].join('-');
}
function showcarrentaltemplate(){
		$.ajax({
			type:'post',
			data: "PME_sys_rec=<?php echo $_GET['PME_sys_rec']; ?>&file="+$("select[name=carrentaltemmplatestype1]").val()+"&show=set"+"&car_provider_type="+$("select[name=PME_data_carrental_providers] option:selected").val(),
			url: '../reservations/carrentalemail.php',
			success: function (postResp) {
					//alert(postResp);
				var error=getBBcodeValue('error',postResp);
					//	alert(getBBcodeValue('subject',postResp));
						if(error.length>0){
							alert(error);
						}else{

					var message='<table cellpadding="5" cellspacing="5" border="0"><tr><td colspan="2" align="center"><strong>Carrental Email Template</strong></td></tr><tr><td align="left">Provider: </td><td align="left"> <input type="text" value="'+getBBcodeValue('email',postResp)+'" name="carprovider" size="58"/> </td></tr><tr><td align="left">Subject: </td><td align="left"> <input type="text" name="carsubject" size="58" value="'+getBBcodeValue('subject',postResp)+'"/> </td></tr><tr><td align="left" valign="top">Body: </td><td align="left"> <textarea name="body" rows="7" cols="44">'+getBBcodeValue('bodytext',postResp)+'</textarea> </td></tr><tr><td align="left" valign="top">Attachment: </td><td align="left"> <div class="prova"></div> <div class="attachfiles"></div></td></tr><tr><td align="left" valign="top"></td><td align="left"> <input type="button" onclick="sendcarrentalemail()" name="carrental_mail_sent" value="Send Mail"/> <input type="button" onclick="javascript:$.unblockUI()" name="carrental_mail_cancel" value="Cancel"/> </td></tr></table>';

					$.blockUI({
						message:message
					});

					uploadattachfile();

					//setTimeout($.unblockUI, 2000);
				}

			}
		});

		/*$(document).ready(function() {

				$.blockUI({
					message:'<div>Hello</div>'
				});

				setTimeout($.unblockUI, 2000);

		});*/
	}

    $(document).ready(function (){
		  var dt2 = jQuery('#PME_dhtml_fld_create_date').val();
		   if(dt2 =='0000-00-00 00:00')
            {
				console.log('PME_dhtml_fld_create_date'+jQuery('#PME_dhtml_fld_create_date').val());

				dt2 = '';
			}
        var dt23 = jQuery('#PME_dhtml_fld_confirm_date').val();
			if(dt23 == '0000-00-00 00:00')
            {
				console.log('PME_dhtml_fld_create_date'+jQuery('#PME_dhtml_fld_confirm_date').val());
				dt23 = '';
			}
	 jQuery('#PME_dhtml_fld_confirm_date').datetimepicker({

        format:'Y-m-d',
          timepicker:false,

         // defaultDate: formatDate(new Date())
    });
		jQuery('#PME_dhtml_fld_create_date').datetimepicker({

          format:'Y-m-d',
            timepicker:false,
            //his.setOptions({
                    //value:formatDate(new Date())
                });
              if(dt2!='')
            {
             jQuery('#PME_dhtml_fld_create_date').val(formatDate(dt2));
            }
            else
            {
				var newdate  = new Date();
           jQuery('#PME_dhtml_fld_create_date').val(formatDate(newdate));


            }
            if(dt23!='' )
          {
           jQuery('#PME_dhtml_fld_confirm_date').val(formatDate(dt23));
          }
          else
          {

        // jQuery('#PME_dhtml_fld_confirm_date').val(formatDate(new Date()));
         jQuery('#PME_dhtml_fld_confirm_date').val('');


          }
            //       })



    //~ jQuery('select[name="PME_data_state"]').change(function() {
		//~ alert('dhfjgdfjg hdfjghdjf ');
	//~ });
    jQuery('select[name=PME_data_state]').change(function() {
      var selct = jQuery("select[name=PME_data_state] option:selected" ).text();
      var dt22 = jQuery('#PME_dhtml_fld_confirm_date').val();
//~ alert('selct= '+selct+' dt22 = '+dt22);
      if(selct=='DEPO' || selct=='PAID')
      {
		if(dt22!='')
		  {

		   jQuery('#PME_dhtml_fld_confirm_date').val(formatDate(dt22));
		  }
		  else
		  {
			var newdate  = new Date();
		 jQuery('#PME_dhtml_fld_confirm_date').val(formatDate(newdate));


		}
      }

      });

	var tour_id=0;

		if(($("#invoice input[name=tour_id]").attr("value")).length==0){
			tour_id=$("#PME_dhtml_tab0 input[name=PME_data_id]").attr("value");
		}else{
			tour_id=$("#invoice input[name=tour_id]").attr("value");
		}
		if(tour_id==0)
		{
			$('input[name=PME_data_pickuplocation]').val('Restaurant Rio Danta à Guapiles');
			$('input[name=PME_data_dropOffLocation]').val('Aéroport international à Alajuela');
		}
		if(tour_id!=0)
		{
	$.ajax({

			type:'post',

			data: "tour_id="+tour_id,

			url: '../management/updateprice.php',

			success: function (postResp) {
              $('#PME_dhtml_fld_total_rate_new').val(postResp);
			}

		});
		}

           var idTour = $('#addTours input=[name=PME_sys_rec]').val();
		if(idTour!='' || idTour!=0)
		{
           document.getElementById("save_c").value=3;
		}

        $('#addTours').find('.pme-tab').each(function(){

            $(this).hide();

        });

jQuery('#PME_dhtml_fld_in_date').datetimepicker({

  format:'Y-m-d H:i',
			defaultTime:'00:00',
  /*onShow:function( ct ){
    var dt = jQuery('#PME_dhtml_fld_in_date').val();
        dt1 = dt.split(" ");
        dt1 = dt1[0];
		//dt1 = dt1.replace("-", "/");
		//dt1 = dt1.replace("-", "/");
		dt1 = dt1 + " ".dt1[1];
	alert(dt1[0]);
   this.setOptions({

    value:'2015/01/11 22:30'
   })
  },*/

 });
 jQuery('#PME_dhtml_fld_out_date').datetimepicker({

  format:'Y-m-d H:i',
  defaultTime:'00:00',
// value:'2015-11-22 00:00',
  //maxDate:'+1970/01/2',
  //timepicker:false
  onShow:function( ct ){
   var dt2 = jQuery('#PME_dhtml_fld_out_date').val();
        dt3 = dt2.split(" ");
        dt3 = dt3[0];
		//dt3 = dt3.replace("-", "/");
		//dt3 = dt3.replace("-", "/");
		dt3 = dt2;
		//alert(dt2);
    var dt = jQuery('#PME_dhtml_fld_in_date').val();
        dt1 = dt.split(" ");
        dt1 = dt1[0];
		//dt1 = dt1.replace("-", "/");
		//dt1 = dt1.replace("-", "/");
		dt1 = dt1 + " 00:00";
		if(dt2){dt1=dt3;}
   this.setOptions({
    value:dt1
   })
  },

 });


        /*$('#PME_dhtml_fld_in_date').datetimepicker({

            format:'Y-m-d H:i',
			defaultTime:'00:00',

           // defaultDate: "+1w",

          //  changeMonth: true,

           // changeYear: true,

           // numberOfMonths: 3,

            //maxDate: $('#PME_dhtml_fld_out_date').val(),

           onSelect: function( selectedDate ) {

                $( "#PME_dhtml_fld_out_date" ).datetimepicker( "option", "minDate", selectedDate );

            }

        });  */

		/*$('#PME_dhtml_fld_in_date').datetimepicker({format:'Y-m-d H:i', maxDate: $('#PME_dhtml_fld_out_date').val(),

            onSelect: function( selectedDate ) {

                $( "#PME_dhtml_fld_out_date" ).datetimepicker( "option", "minDate", selectedDate );});
       //$('#PME_dhtml_fld_in_date').datetimepicker({value:'2015-04-15 05:03',step:10});


		*/

		$('input[name=PME_data_pickupdate]').datetimepicker({

            format:'Y-m-d H:i',
			defaultTime:'00:00',

            onSelect: function( selectedDate ) {

                $( "input[name=PME_data_dropOffDate]" ).datetimepicker( "option", "minDate", selectedDate );
				 $( "input[name=PME_data_pickupdate]" ).datetimepicker( "option", "minDate", selectedDate );

            }

        });



		$('input[name=PME_data_dropOffDate]').datetimepicker({

            format:'Y-m-d H:i',
			defaultTime:'00:00',

            minDate: $('input[name=PME_data_pickupdate]').val(),

            onSelect: function( selectedDate ) {

			//	$('input[name=PME_data_dropOffDate]').removeAttr("readonly");

                $("input[name=PME_data_pickupdate]" ).datetimepicker( "option", "maxDate", selectedDate );

            }

        });



       /* $('#PME_dhtml_fld_out_date').datetimepicker({

            format:'Y-m-d H:i',
			defaultTime:'00:00',

            //defaultDate: "+1w",

           // changeMonth: true,

           // changeYear: true,

           // numberOfMonths: 3,
			onGenerate:function( ct ){
			   this.setOptions({
			   minDate:jQuery('#PME_dhtml_fld_in_date').val()?jQuery('#PME_dhtml_fld_in_date').val():false,
			   startDate:jQuery('#PME_dhtml_fld_in_date').val()?jQuery('#PME_dhtml_fld_in_date').val():false,
			   defaultDate:jQuery('#PME_dhtml_fld_in_date').val()?jQuery('#PME_dhtml_fld_in_date').val():false
				})
			  },
            //minDate: $('#PME_dhtml_fld_in_date').val(),

            onSelect: function( selectedDate ) {

                $( "#PME_dhtml_fld_in_date" ).datetimepicker( "option", "maxDate", selectedDate );

            }

        });*/



       /* $('#PME_dhtml_fld_pay_date_1').datepicker({

            dateFormat: 'yy-mm-dd',

            changeMonth: true,

            changeYear: true

        });



        $('#PME_dhtml_fld_pay_date_2').datepicker({

            dateFormat: 'yy-mm-dd',

            changeMonth: true,

            changeYear: true

        });



        $('#PME_dhtml_fld_pay_date_3').datepicker({

            dateFormat: 'yy-mm-dd',

            changeMonth: true,

            changeYear: true

        });

        */

 //~ });
        function PME_js_trim(str)

        {

            while (str.substring(0, 1) == " "

                || str.substring(0, 1) == "\n"

                || str.substring(0, 1) == "\r")

            {

                str = str.substring(1, str.length);

            }

            while (str.substring(str.length - 1, str.length) == " "

                || str.substring(str.length - 1, str.length) == "\n"

                || str.substring(str.length - 1, str.length) == "\r")

            {

                str = str.substring(0, str.length - 1);

            }

            return str;

        }



        function PME_js_form_control_tour(theForm)

        {

            var s =document.getElementById("save_c").value;
			if(s==3){

            if (PME_js_trim(theForm.PME_data_short_description.value) == "") {

                alert("Please enter Short description.");

                theForm.PME_data_short_description.focus();

                return false;

            }

            if (PME_js_trim(theForm.PME_dhtml_fld_in_date.value) == "") {

                alert("Please enter In date.");

                theForm.PME_dhtml_fld_in_date.focus();

                return false;

            }



            if (PME_js_trim(theForm.PME_dhtml_fld_out_date.value) == "") {

                alert("Please enter out date.");

                theForm.PME_dhtml_fld_out_date.focus();

                return false;

            }

			document.getElementById("save_c").value=4;
            return true;
			}

        }



        function validateEmail(email) {

            var re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

            return re.test(email);

        }



        function PME_js_form_control_customer(theForm)

        {
            var s =document.getElementById("save_c").value;
			if(s==1){
            if (PME_js_trim(theForm.PME_data_first_name.value) == "") {

                alert("Please enter First name.");

                theForm.PME_data_first_name.focus();

                return false;

            }



            if (PME_js_trim(theForm.PME_data_last_name.value) == "") {

                alert("Please enter Last name.");

                theForm.PME_data_last_name.focus();

                return false;

            }





            if(!validateEmail(theForm.PME_data_email.value)){

                alert("Please enter valid Email.");

                theForm.PME_data_email.focus();

                return false;

            }


			document.getElementById("save_c").value=2;
            return true;
			}

        }



		function getBBcodeValue(id,postResp){

		    var postResp=postResp.split(' ').join();

			var str='['+id+']';





			var startPos=(postResp.indexOf(str)+str.length);

			var postResp=postResp.substring(startPos,postResp.length);



			str='[/'+id+']';



			var endPos=postResp.indexOf(str);



			var finalText=postResp.substring(0,endPos);

			return finalText;



		}



        $('.customer').live('click',function (){
		document.getElementById("redir_c").value=1;

            $('#addTours').hide();

            $('.tour').removeClass("current");

            $('#tour').show();

            $('#addProductsTour').hide();

            $('.products').removeClass("current");

            $('#products').hide();

            $('#addCustomers').show();

            $('.customer').addClass("current");

            $('#customer').hide();

            $('.payment').removeClass("current");

			$('#carrental').hide();

				$('.carrental').removeClass("current");

			$('#invoice').hide();

				$('.invoice').removeClass("current");

        });



       $('.carrental').live('click',function (){
	   document.getElementById("redir_c").value=1;

				$('#addTours').hide();

				$('.tour').removeClass("current");

				$('#tour').hide();

				$('#addProductsTour').hide();

				$('.products').removeClass("current");

				$('#products').hide();

				$('#addCustomers').hide();

				$('.customer').removeClass("current");

				$('#customer').hide();

				$('.payment').removeClass("current");

				$('#carrental').show();

				$('.carrental').addClass("current");

				$('#invoice').hide();

				$('.invoice').removeClass("current");

        });



        $('.tour').live('click',function (){
		document.getElementById("redir_c").value=2;

            $('#addCustomers').hide();

            $('.customer').removeClass("current");

            $('#customer').show();

            $('#addProductsTour').hide();

            $('.products').removeClass("current");

            $('#products').show();

            $('#addTours').show();

            $('.tour').addClass("current");

            $('#tour').hide();

            $('.payment').removeClass("current");

            $('#PME_dhtml_tab0').show();

            $('#PME_dhtml_tab1').hide();

			$('#carrental').hide();

				$('.carrental').removeClass("current");



				$('#invoice').hide();

				$('.invoice').removeClass("current");

        });



        $('.payment').live('click',function (){

			 document.getElementById("redir_c").value=1;

            $('#addCustomers').hide();

            $('.customer').removeClass("current");

            $('#customer').show();

            $('#addProductsTour').hide();

            $('.products').removeClass("current");

            $('#products').show();

            $('#addTours').show();

            $('.tour').removeClass("current");

            $('#tour').hide();

            $('#PME_dhtml_tab0').hide();

            $('#PME_dhtml_tab1').show();

            $('.payment').addClass("current");

			$('#carrental').hide();

				$('.carrental').removeClass("current");



				$('#invoice').hide();

				$('.invoice').removeClass("current");

        });



		$('.invoice').live('click',function (){
		document.getElementById("redir_c").value=1;

            $('#addTours').hide();

				$('.tour').removeClass("current");

				$('#tour').hide();

				$('#addProductsTour').hide();

				$('.products').removeClass("current");

				$('#products').hide();

				$('#addCustomers').hide();

				$('.customer').removeClass("current");

				$('#customer').hide();

				$('.payment').removeClass("current");

				$('#carrental').hide();

				$('.carrental').removeClass("current");



				$('#invoice').show();

				$('.invoice').addClass("current");

        });



        $('#cancel').live('click',function (){

            window.location.replace("main.php");

            return false;

        });



        $('#addTours input[name=PME_data_dir]').live('click',function (){

            var ajaxfilemanagerurl = "../../../../ajaxfilemanager/ajaxfilemanager/ajaxfilemanager.php?path_start=" + encodeURIComponent('Tours') + '/' + $('#addTours input=[name=PME_sys_rec]').val();

            $(this).val('Tours/' + $('#addTours input=[name=PME_sys_rec]').val());

            window.open(ajaxfilemanagerurl,'_blank','width=800,height=600');

        });



        $('#save').live('click',function (){


            var s =document.getElementById("save_c").value;
            $('#addCustomers').find('form').each(function(){

					if(!PME_js_form_control_customer(this) && s==1){

						$('#addTours').hide();

						$('.tour').removeClass("current");

						$('#tour').show();

						$('#addProductsTour').hide();

						$('.products').removeClass("current");

						$('#products').hide();

						$('#addCustomers').show();

						$('.customer').addClass("current");

						$('#customer').hide();

						$('.payment').removeClass("current");

						$('#carrental').hide();

						//$('.carrental').removeClass("current");

						return false;

					}

                else{

                    $('#addTours').find('form').each(function(){

                        if(PME_js_form_control_tour(this) && s==3){

							 var tour_di = document.getElementById("addTours").style.display;
	                         console.log(tour_di);

                            $('#addCustomers').find('form').each(function(){

                                var operacion = '';

                                if($('#addCustomers input=[name=PME_data_id]').val() == '0')

                                    operacion =  'PME_sys_saveadd';

                                else

                                    operacion =  'PME_sys_savechange';

                                waitingDialog({});

                                tinyMCE.triggerSave();


                                $.ajax({

                                    cache: false,

                                    dataType: 'html',

                                    type:'post',

                                    data: $(this).serialize()+ '&' + operacion + "=" + encodeURIComponent('Save'),

                                    url: '../management/customers.php',

                                    success: function (postResp) {

                                        var $response = $(postResp);

                                        $response.find("#lastInserted").each(function(){

                                            $('#addCustomers input=[name=PME_data_id]').val($(this).html());

                                            $('#addTours input=[name=PME_data_id_customer]').val($(this).html());

                                            $('#addCustomers input=[name=PME_sys_rec]').val($(this).html());



                                        });







                                        $('#addTours').find('form').each(function(){

                                            var operacion = '';

                                            if($('#addTours input=[name=PME_sys_rec]').val() == '0')

                                                operacion =  'PME_sys_saveadd';

                                            else

                                                operacion =  'PME_sys_savechange';
													var in_date11 = $('#PME_dhtml_fld_in_date').val();
												$.ajax({

												cache: false,

												dataType: 'html',
												type:'post',
												data: "tour_id="+tour_id+"&indt="+encodeURIComponent(in_date11),
												url: '../management/update_scheduling.php',
												success: function (postResp) {
												console.log(postResp);
												}
												});


                                            $.ajax({

                                                cache: false,

                                                dataType: 'html',

                                                type:'post',

                                                data: $(this).serialize() + '&' + operacion + "=" + encodeURIComponent('Save'),

                                                url: '../management/tours.php',

                                                success: function (postResp) {

                                                    var $response = $(postResp);

                                                    $response.find("#lastInserted").each(function(){

                                                        $('#addTours input=[name=PME_data_id]').val($(this).html());

                                                        $('#addTours input=[name=PME_sys_rec]').val($(this).html());

														$('#carrental input=[name=PME_data_id]').val($(this).html());

														$('#carrental input=[name=PME_sys_rec]').val($(this).html());



														//Save car sental

														$('#carrental').find('form').each(function(){

															var operacion = '';



															if($('#carrental input=[name=PME_sys_rec]').val() == '0')

																operacion =  'PME_sys_saveadd';

															else

																operacion =  'PME_sys_savechange';





																		$.ajax({

																			cache: false,

																			dataType: 'html',

																			type:'post',

																			data: $(this).serialize()+ '&' + operacion + "=" + encodeURIComponent('Save'),

																			 url: '../management/carrental.php',

																			success: function (postResp) {

																				$('#carrental').find('form').each(function(){

																					$.ajax({

																						cache: false,

																						dataType: 'html',

																						type:'post',

																						data: $(this).serialize()+ '&' + operacion + "=" + encodeURIComponent('Save'),

																						 url: './save_carrental.php',

																						success: function (postResp) {

																							var nbweeks=getBBcodeValue('nbWeeks',postResp);

																							var nbdays=getBBcodeValue('nbdays',postResp);

																							//alert(nbweeks);

																							//alert(nbdays);

																							$("#carrental input[name=PME_data_nbWeeks]").attr("value",nbweeks);

																							$("#carrental input[name=PME_data_nbDays]").attr("value",nbdays);
																							 var redir_s =document.getElementById("redir_c").value;
																							if(redir_s==2)
																							{
																							window.location="https://<?php echo $_SERVER['HTTP_HOST'];?>/reservations/tour_creator.php?PME_sys_operation=PME_op_Change&PME_sys_rec="+idTour
																							 }



																						}

																					});

																				});



																			}

																		});

														});

														//End



                                                        $('.products').show();

                                                        var idTour = $('#addTours input=[name=PME_sys_rec]').val();

                                                        var data1 = 'PME_sys_rec=' + encodeURIComponent(idTour);



                                                        $.ajax({

                                                            cache: false,

                                                            dataType: 'html',

                                                            type:'get',

                                                            url: '../management/directory.php?directory=' + encodeURIComponent('Tours') + '&id=' + idTour,

                                                            success: function (postResp) {

                                                                // alert("Updated Successfull")

                                                            }

                                                        });



                                                        var data3 = 'PME_sys_rec=' + encodeURIComponent(idTour) + '&PME_sys_operation=PME_op_Change';



                                                        $.ajax({

                                                            cache: false,

                                                            dataType: 'html',

                                                            type:'get',

                                                            data: data3,

                                                            url: 'update_products.php',

                                                            success: function (postResp) {



																var nights = getBBcodeValue('totalnights',postResp);



																$("#PME_dhtml_fld_NumberNights").attr("value",nights);



                                                                var $response = $(postResp);

																var $reserve=$response;

                                                                $('#addTours').find('#PME_dhtml_tab1').html($response.find('#PME_dhtml_tab1').html());



                                                                $.ajax({

                                                                    cache: false,

                                                                    dataType: 'html',

                                                                    type:'get',

                                                                    data: data3,

                                                                    url: '../management/tours.php',

                                                                    success: function (postResp) {

                                                                        var $response = $(postResp);

                                                                        $('#addTours').find('#PME_dhtml_tab1').html($response.find('#PME_dhtml_tab1').html());



                                                                        $.ajax({

                                                                            cache: false,

                                                                            dataType: 'html',

                                                                            type:'get',

                                                                            data: data1,

                                                                            url: '../management/providers_tour.php',

                                                                            success: function (postResp) {

                                                                                var $response = $(postResp);

                                                                                $('#addProductsTour').find('form').html($response.find('form').html());



																				updateTotalAmount($reserve);

                                                                                closeWaitingDialog();

                                                                            }

                                                                        });

                                                                    }

                                                                });

                                                            }

                                                        });


														//reschedule tour dates
														$.ajax({

                                                                    cache: false,

                                                                    dataType: 'html',

                                                                    type:'post',

                                                                    data: data3,

                                                                    url: '../management/schedulrearrangeaftersave.php',

                                                                    success: function (postResp) {}

                                                                });
														//End



                                                    });





                                                }

                                            });

                                        });





                                    }

                                });

                            });



                        }

                        else{

                            $('#addCustomers').hide();

                            $('.customer').removeClass("current");

                            $('#customer').show();

                            $('#addProductsTour').hide();

                            $('.products').removeClass("current");

                            $('#products').show();

                            $('#addTours').show();

                            $('.tour').addClass("current");

                            $('#tour').hide();

                            $('.payment').removeClass("current");



							$('#carrental').hide();

							$('.carrental').removeClass("current");



							$('#invoice').hide();

							$('.invoice').removeClass("current");
							document.getElementById("save_c").value=3;

                        }

                    });

                }

            });



        });



        $('.products').live('click',function (){

			document.getElementById("redir_c").value=1;
            $('#addCustomers').hide();

            $('.customer').removeClass("current");

            $('#customer').hide();

            $('#addTours').hide();

            $('.tour').removeClass("current");

            $('#addProductsTour').show();

            $('.products').addClass("current");

            $('#products').hide();

            $('.payment').removeClass("current");

			$('#carrental').hide();

				$('.carrental').removeClass("current");



			$('#invoice').hide();

				$('.invoice').removeClass("current");

        });

    });



	function updateTotalAmount($response){

		var tour_id=0;

		if(($("#invoice input[name=tour_id]").attr("value")).length==0){
			tour_id=$("#PME_dhtml_tab0 input[name=PME_data_id]").attr("value");
		}else{
			tour_id=$("#invoice input[name=tour_id]").attr("value");
		}



		$.ajax({

			type:'post',

			data: "tour_id="+tour_id,

			url: '../management/updatepricelist.php',

			success: function (postResp) {

					var obj = $.parseJSON(postResp);



				 $('#PME_dhtml_tab1 input[name=PME_data_admin_cost]').attr("value",obj.admin_cost);
				 $('#PME_dhtml_tab1 input[name=PME_data_bank_fees]').attr("value",obj.bank_fees);
				 $('#PME_dhtml_tab1 input[name=PME_data_total_net]').attr("value",obj.total_net);
				 $('#PME_dhtml_tab1 input[name=PME_data_ComRate]').attr("value",obj.ComRate);
				 $('#PME_dhtml_tab1 input[name=PME_data_total_rack]').attr("value",obj.total_rack);
				 $('#PME_dhtml_tab1 input[name=PME_data_commission_dollar]').attr("value",obj.commission_dollar);
				 $('#PME_dhtml_tab1 input[name=PME_data_euro_rate]').attr("value",obj.euro_rate);
				 $('#PME_dhtml_tab1 input[name=PME_data_euro_total_price]').attr("value",obj.euro_total_price);
				 $('#PME_dhtml_tab1 input[name=PME_data_pay_amount_1]').attr("value",obj.pay_amount_1);
				 $('#PME_dhtml_tab1 input[name=PME_data_pay_amount_2]').attr("value",obj.pay_amount_2);
				 $('#PME_dhtml_tab1 input[name=PME_data_total_paid]').attr("value",obj.total_paid);
				 $('#PME_dhtml_tab1 input[name=PME_data_balance]').attr("value",obj.balance);
				  $('#PME_dhtml_tab1 input[name=PME_data_total_rate_new]').attr("value",obj.total_rate_new);

				 $('#PME_dhtml_tab1 input[name=PME_data_payment_1_euros]').attr("value",obj.payment_1_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_payment_2_euros]').attr("value",obj.payment_2_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_payment_3_euros]').attr("value",obj.payment_3_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_payment_4_euros]').attr("value",obj.payment_4_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_payment_5_euros]').attr("value",obj.payment_5_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_payment_6_euros]').attr("value",obj.payment_6_euros);
				 $('#PME_dhtml_tab1 input[name=PME_data_balance_euros]').attr("value",obj.balance_euros);

			}

		});

	}





</script>
<?php
$id = $_GET['PME_sys_rec'];
     $sql1 = "Select last_name,in_date from Tours  T JOIN Customers  C ON T.id_customer=C.id where T.id = ". $id;
    $res1 = mysql_query($sql1);

    $myrow1 = mysql_fetch_object($res1);//exit();


    ?>
	<?php
	function normalize ($string) {
    $table = array(
        'Š'=>'S', 'š'=>'s', 'Ð'=>'D', 'd'=>'d', 'Ž'=>'Z', 'ž'=>'z', 'C'=>'C', 'c'=>'c', 'C'=>'C', 'c'=>'c',
        'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
        'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O',
        'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss',
        'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e',
        'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o',
        'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b',
        'ÿ'=>'y', 'R'=>'R', 'r'=>'r',
    );

    return strtr($string, $table);
	/*$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ', 'Ά', 'ά', 'Έ', 'έ', 'Ό', 'ό', 'Ώ', 'ώ', 'Ί', 'ί', 'ϊ', 'ΐ', 'Ύ', 'ύ', 'ϋ', 'ΰ', 'Ή', 'ή');
    $b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o', 'Α', 'α', 'Ε', 'ε', 'Ο', 'ο', 'Ω', 'ω', 'Ι', 'ι', 'ι', 'ι', 'Υ', 'υ', 'υ', 'υ', 'Η', 'η');
  	return str_replace($a, $b, $string);*/
}
	$rm_accents = normalize($myrow1->last_name);
	$trim_name = explode(" ",$myrow1->last_name);

	?>
<script>
$(document).ready(function (){
var indate ='<?php echo $myrow1->in_date; ?>';
var default_date =  new Date(indate);

$('#PME_dhtml_fld_pickupdate').click(function () {

$('#PME_dhtml_fld_pickupdate').datetimepicker({
   format: 'Y-m-d h:m',
    useCurrent:false,
    defaultDate: default_date
});

$('#PME_dhtml_fld_pickupdate').val(indate);

});
});
$(document).ready(function (){
$('#PME_dhtml_fld_dropOffDate').click(function () {

var indate = $('#PME_dhtml_fld_pickupdate').attr('value');
var default_date =  new Date(indate);

$('#PME_dhtml_fld_dropOffDate').datetimepicker({
   format: 'Y-m-d h:m',
    useCurrent:false,
    defaultDate: default_date
});
$('#PME_dhtml_fld_dropOffDate').val(default_date);

});
});
</script>
<p style="
    color: #99CC00;
    margin: 0px 0px 5px;
    padding: 0px 0px 3px;
    font: bold 18px Verdana, Arial, Helvetica, sans-serif;
    border-bottom: 1px dashed #E6E8ED;text-align:center;
">CRI-<?php echo date("Ymd", strtotime($myrow1->in_date)).'-'.str_replace(" ","",$rm_accents);  ?></p>

<!--
#COSTARICA 2017-07-30-FOLIE-DUPART
-->
<div id="tourNav">

    <ui>

        <li>

            <a class="customer current">Customer</a>

        </li>

        <li>

            <a class="tour">Info</a>

        </li>

        <li>

            <a class="carrental">Car Rental</a>

        </li>

                <li>

            <a class="products" style="display:<?php echo $display; ?>;">Scheduling</a>

        </li>

        <li>

            <a class="payment">Payment</a>

        </li>



		<li>

            <a class="invoice">Files</a>

        </li>

    </ui>

</div>

<?php



$_POST['PME_sys_operation'] = 'Add';

$opts['buttons']['C']['down'] = array();



if(isset($_GET['PME_sys_rec'])){

    $tour_id = $_GET['PME_sys_rec'];

    require_once('customer.php');

}

echo '<div id="addCustomers">';

require_once('../management/customers.php');
echo'<input type="hidden" value="1" id="save_c">';

echo'<input type="hidden" value="1" id="redir_c">';

echo'<input type="button" value="Save" id="save">';

echo'<input type="button" value="Cancel" id="cancel">';

echo '</div>';

$opts['fdd'] = '';

if(isset($_GET['PME_sys_rec'])){

    $_GET['PME_sys_rec'] = $tour_id;

}



echo '<div id="addTours" style="display:none">';

require_once('../management/tours.php');

echo'<input type="button" value="Save" id="save">';

echo'<input type="button" value="Cancel" id="cancel">';

echo '</div>';



if(isset($_GET['PME_sys_rec'])){

    $_GET['PME_sys_rec'] = $tour_id;

}

$opts['fdd'] = '';

echo '<div id="carrental" style="display:none">';

require_once('../management/carrental.php');

echo'<input type="button" value="Save" id="save">';

echo'<input type="button" value="Cancel" id="cancel">';

echo '</div>';



$_POST['PME_sys_operation'] = '';

$_GET['PME_sys_operation'] = '';

$opts['fdd'] = '';

echo '<div id="addProductsTour" style="display:none">';

require_once('products.php');

require_once('../management/providers_tour.php');

echo'<input type="button" value="Save" id="save">';

echo'<input type="button" value="Cancel" id="cancel">';

echo '</div>';



echo '<div id="invoice" style="display:none">';

require_once('../management/invoice.php');

echo '</div>';


?>
<script type="text/javascript">
	$(document).ready(function(){
		//$("#save").trigger('click');
	});

</script>
<?php


require_once '../footer.php';



?>


LittleDemon - FACEBOOK
[ KELUAR ]