| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/views/scripts/customer/ |
Upload File : |
<?php
$country = $this->countryList;
$leadDetail = $this->leadDetail;
$roominfojson = json_decode($leadDetail['RoomInfoJson'], true);
$arrcurrency = Zend_Controller_Action_HelperBroker::getStaticHelper('Currency')->getCurrencyTypes();
$sessionLogin_user = new Zend_Session_Namespace('sessionLogin_user');
$objaddforex = new Travel_Model_TblAddForex();
$baseCurrency = $sessionLogin_user->agencyDetails['TrxCurrency'];
$objCurrency = new Travel_Model_TblCurrency();
$BaseCurrencySymbol = $objCurrency->getCurrencySymbol($baseCurrency);
$agencySysId = $sessionLogin_user->intLoggedinUserAgencySysId;
$locatiolist = $objaddforex->getlocation($agencySysId);
$qidLink = isset($leadDetail['TPSysId']) ? "/qid/" . base64_encode($leadDetail['TPSysId']) : '';
$sidLink = !empty($leadDetail['EnqSupplierSysId']) ? "/sid/" . $leadDetail['EnqSupplierSysId'] : '';
$secureCode = Zend_Controller_Action_HelperBroker::getStaticHelper('SecureCode')->secureCode(trim(base64_encode($leadDetail['TPSysId'])), 1);
// echo "<pre>";
// print_r($arrcurrency);
$getCurrencyArr = array();
foreach ($arrcurrency as $CurrencyList) {
$getCurrencyArr[$CurrencyList['CurrencyType']]['Symbol'] = trim($CurrencyList['Symbol']) . ' ' . trim($CurrencyList['Title']);
}
?>
<style>
.redtxt {
color:red;
}
#matrial{
margin-top:3%;
}
</style>
<div id="onWay-tab">
<div class="col-md-12 no-padding">
<form name="ForexQueryForm" id="ForexQueryForm" method="post">
<div class="col-md-12 no-padding">
<div class="form-group1 col-md-6 mt_13" id="showqueryType">
<div class="mobile_scrolling mobilenewleads_radioalign">
<label> Forex Type : </label>
<input class="forexType Buy" type="radio" name="forexType" <?php echo (!isset($roominfojson['1']['forex_type']) || $roominfojson['1']['forex_type'] == 1) ? 'checked' : ''; ?> id="Buy" value="1">
<label for="Buy">Buy</label>
<input class="forexType Sell" type="radio" name="forexType" <?php echo ($roominfojson['1']['forex_type'] == 2) ? 'checked' : ''; ?> id="Sell" value="2">
<label for="Sell">Sell</label>
</div>
</div>
</div>
<div class="clear"></div>
<div id="matrial">
<div class="col-md-3">
<div class="form-group active">
<label for="city_id" class="form-control-placeholder-selectfilter">Select City <span class="redtxt">*</span></label>
<select name="city_id" id="city_id">
<option value="">Select City</option>
<?php foreach ($locatiolist as $c => $city) { ?>
<option value="<?php echo $city['CityId']; ?>" <?php echo ($roominfojson['1']['city_id'] == $city['CityId']) ? 'selected' : ''; ?> ><?php echo $city['CityName']; ?></option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group active">
<label for="selectProduct" class="form-control-placeholder-selectfilter">Select Product <span class="redtxt">*</span></label>
<select name="selectProduct" id="selectProduct" onchange="Ajaxgetrates()">
<option value="forex_card" <?php echo ($roominfojson['1']['forexProduct'] == 'forex_card') ? 'selected' : ''; ?>>Forex Card</option>
<option value="currency_notes" <?php echo ($roominfojson['1']['forexProduct'] == 'currency_notes') ? 'selected' : ''; ?>>Currency Notes</option>
</select>
</div>
</div>
<div id="buyhtml" style="<?php echo (!isset($roominfojson['1']['forex_type']) || $roominfojson['1']['forex_type'] == '1') ? 'display:block' : 'display:none'; ?>">
<div class="col-md-3">
<div class="form-group active">
<label>Currency You Have <span class="red">*</span></label>
<select id="buyfromcurrency" name="buyfromcurrency" class="form-control" placeholder=" " onchange="Ajaxgetrates()">
<?php
foreach ($arrcurrency as $key2 => $fromcurrency) {
if ($baseCurrency == $fromcurrency['CurrencyType']) {
if (trim($fromcurrency['Symbol']) === trim($fromcurrency['Title'])) {
$titleText = trim($fromcurrency['Symbol']);
} else {
$titleText = trim($fromcurrency['Symbol']);
}
?>
<option value="<?php echo $fromcurrency['CurrencyType'] ?>" <?php echo ($roominfojson['1']['fromCurrencyType'] == $fromcurrency['CurrencyType']) ? 'selected' : ''; ?>><?php echo $titleText; ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group active">
<label>Currency You Want <span class="red">*</span></label>
<select id="buytocurrency" name="buytocurrency" class="form-control" placeholder=" " onchange="Ajaxgetrates()">
<option value="">Select Currency</option>
<?php
foreach ($arrcurrency as $key2 => $tocurrency) {
if ($baseCurrency != $tocurrency['CurrencyType']) {
if (trim($tocurrency['Symbol']) === trim($tocurrency['Title'])) {
$titleText = trim($tocurrency['Symbol']);
} else {
$titleText = trim($tocurrency['Symbol']);
}
?>
<option value="<?php echo $tocurrency['CurrencyType'] ?>" <?php echo ($roominfojson['1']['toCurrencyType'] == $tocurrency['CurrencyType']) ? 'selected' : ''; ?>><?php echo $titleText; ?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div id="sellhtml" style="<?php echo ($roominfojson['1']['forex_type'] == "2") ? 'display:block' : 'display:none'; ?>">
<div class="col-md-3">
<div class="form-group active">
<label for="fromcurrency" class="form-control-placeholder-selectfilter">Currency You Have <span class="redtxt">*</span></label>
<select name="sellfromcurrency" id="sellfromcurrency" onchange="Ajaxgetrates()">
<option value="">Select Currency</option>
<?php
foreach ($arrcurrency as $key3 => $fromcurrency1) {
if ($baseCurrency != $fromcurrency1['CurrencyType']) {
if (trim($fromcurrency1['Symbol']) === trim($fromcurrency1['Title'])) {
$titleText = trim($fromcurrency1['Symbol']);
} else {
$titleText = trim($fromcurrency1['Symbol']);
}
?>
<option value="<?php echo $fromcurrency1['CurrencyType'] ?>" <?php echo ($roominfojson['1']['fromCurrencyType'] == $fromcurrency1['CurrencyType']) ? 'selected' : ''; ?>><?php echo $titleText; ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group active">
<label for="tocurrency" class="form-control-placeholder-selectfilter">Currency You Want <span class="redtxt">*</span></label>
<select name="selltocurrency" id="selltocurrency" onchange="Ajaxgetrates()">
<?php
foreach ($arrcurrency as $key4 => $tocurrency1) {
if ($baseCurrency == $tocurrency1['CurrencyType']) {
if (trim($tocurrency1['Symbol']) === trim($tocurrency1['Title'])) {
$titleText = trim($tocurrency1['Symbol']);
} else {
$titleText = trim($tocurrency1['Symbol']);
}
?>
<option value="<?php echo $tocurrency1['CurrencyType'] ?>" <?php echo ($roominfojson['1']['toCurrencyType'] == $tocurrency1['CurrencyType']) ? 'selected' : ''; ?>><?php echo $titleText; ?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="col-md-3">
<div class="form-group active">
<label for="forexAmount" class="form-control-placeholder-selectfilter">Forex Amount Needed<span class="redtxt">*</span></label>
<input class="forexAmount form-control" type="number" name="forexAmount" id="forexAmount" value="<?php echo $roominfojson['1']['forexAmount']; ?>" onkeyup="updatecost()" min="1" max="999999999">
</div>
</div>
<div class="col-md-3">
<div class="form-group active">
<label for="forexbaseAmount" class="form-control-placeholder-selectfilter">Rate</label>
<input type="text" class="form-control forexbaseAmount" id="forexbaseAmount" name="forexbaseAmount" onkeyup="updatecost()" value="<?php echo $roominfojson['1']['forexbaseAmount']; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group active full">
<label for="forexInrAmount" class="form-control-placeholder-selectfilter">Forex <?php echo $BaseCurrencySymbol; ?> Amount<span class="redtxt">*</span></label>
<input class="forexInrAmount form-control" type="text" name="forexInrAmount" id="forexInrAmount" value="<?php echo $roominfojson['1']['forexInrAmount']; ?>" readonly="true">
</div>
</div>
<div class="col-md-3">
<div class="form-group active full">
<label for="forexInrAmount" class="form-control-placeholder-selectfilter">GST<span class="redtxt">*</span></label>
<input class="forexInrAmount form-control" type="text" name="forexGSTAmount" id="forexGSTAmount" value="<?php echo $roominfojson['1']['forexGSTAmount']; ?>" readonly="true">
</div>
</div>
<div class="col-md-3">
<div class="form-group active full">
<label for="forexInrAmount" class="form-control-placeholder-selectfilter">Total Forex <?php echo $BaseCurrencySymbol; ?> Amount<span class="redtxt">*</span></label>
<input class="forexInrAmount form-control" type="text" name="TotalforexAmount" id="TotalforexAmount" value="<?php echo $roominfojson['1']['TotalforexAmount']; ?>" readonly="true">
</div>
</div>
<div class="col-md-12">
<div class="grand-total">
<h3>Total: <?php echo htmlspecialchars($BaseCurrencySymbol); ?>
<span id="grandTotal"></span>
</h3>
<script>
document.addEventListener("DOMContentLoaded", function () {
var totalAmount = parseFloat("<?php echo isset($roominfojson['1']['TotalforexAmount']) && !empty($roominfojson['1']['TotalforexAmount']) ? $roominfojson['1']['TotalforexAmount'] : 0; ?>") || 0;
var formattedAmount = totalAmount.toFixed(2);
if (typeof moneyFormatIndia === "function") {
formattedAmount = moneyFormatIndia(formattedAmount);
}
document.getElementById("grandTotal").textContent = formattedAmount;
});
</script>
</div>
</div>
<div class="col-md-12" align="right">
<span class="alert-danger queryForexCreated" style="display:none;">Query created</span>
<div class="form-group pull-right">
<input type="hidden" name="CustomerSysId" id="CustomerSysId" value="<?php echo $this->customerId; ?>" />
<input type="hidden" name="ForexEditLeadId" id="ForexEditLeadId" value="<?php echo isset($leadDetail['TPSysId']) ? base64_encode($leadDetail['TPSysId']) : ''; ?>" />
<?php if (@$leadDetail['TPSysId'] != '') {
?>
<!--<label><input type="checkbox" id="createNewQuery" <?php if (@$leadDetail['StatusType'] > 1) { ?> readonly="true" onclick="return false;" <?php } ?> name="createNewQuery" value="<?php echo $leadDetail['TPSysId']; ?>" /> <strong>Create a New Query : </strong>
<input type="hidden" name="NewQueryLeadHiddenId" id ="NewQueryLeadHiddenId" value="<?php echo $leadDetail['TPSysId']; ?>" />
</label>-->
<?php
}
$displaySaveButton = '';
$displayModifySaveButton = 'none';
$displayOtherButton = 'none';
if ($this->IsFromModified == true) {
$displaySaveButton = 'none';
$displayModifySaveButton = 'block';
$displayOtherButton = '';
}
if ($this->customerId == '') {
$displaySaveButton = 'none';
$displayModifySaveButton = 'none';
$displayOtherButton = '';
}
?>
<button type="submit" style="display:<?php echo $displayModifySaveButton; ?>; float: left; margin-right: 10px;" class="btn btn-primarygray btn-sm" id="saveForexQueryButtonModify" onclick="$('#savecontinue').show();" name="saveQuery" value="saveQuery"><span class="ladda-label">Modify & Save</span></button>
<button type="submit" style="display:<?php echo $displaySaveButton; ?>; float: left; margin-right: 10px;" class="btn btn-primary btn-sm" id="saveForexQueryButton" onclick="$('#savecontinue').show();" name="saveQuery" value="saveQuery"><span class="ladda-label">Save Query</span></button>
<button type="submit" class="btn btn-primary btn-sm searchForexButton" onclick="viewSendProposalForex()" name="" value="" style="display:<?php echo $displayOtherButton; ?>;"><span class="ladda-label">Send Forex Proposal</span></button>
<div class="clear"></div>
</div>
</div>
</form>
</div>
</div>
<div class="modal fade" id="myModaladdProposalSend" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
</div>
</div>
</div>
<script src="<?php echo $this->baseUrl('public/assets/js/bootstrap3-typeahead.js'); ?>"></script>
<script type="text/javascript">
// $('#sellhtml').hide();
$().ready(function () {
$("#forex_delivery_date").datetimepicker({
format: 'd/m/Y',
timepicker: false,
minDate: 0
});
});
$('.forexType').on('change', function () {
var forexType = $(this).val();
console.log(forexType);
if (forexType == 2) {
$('#sellhtml').show();
$('#buyhtml').hide();
} else {
$('#sellhtml').hide();
$('#buyhtml').show();
}
});
$(function () {
$("#city_id").selectize({
maxItems: 1,
create: false
});
$("#buyfromcurrency").selectize({
maxItems: 1,
create: false
});
$("#buytocurrency").selectize({
maxItems: 1,
create: false
});
$("#sellfromcurrency").selectize({
maxItems: 1,
create: false
});
$("#selltocurrency").selectize({
maxItems: 1,
create: false
});
});
</script>
<script>
function updateforexrates() {
var forexcityid = $('#city_id :selected').val();
var fromcurrency = $('#fromcurrency :selected').val();
var tocurrency = $('#tocurrency :selected').val();
var selectProduct = $('#selectProduct :selected').val();
if (forexcityid != '' && forexcityid != 0) {
Ajaxgetrates();
}
}
function Ajaxgetrates() {
$('#forexAmount').val('');
$('#forexInrAmount').val('');
$('#grandTotal').text('');
var formData = $("#ForexQueryForm").serialize();
$.ajax({
url: '/forex/index/get-rate',
type: 'POST',
data: formData,
dataType: 'json',
beforeSend: function () {
$('.forexbaseAmount').val('0');
$('#forexAmount').val(0);
$('#forexInrAmount').val(0);
$('#grandTotal').text(0);
$('#forexGSTAmount').val(0);
$('#TotalforexAmount').val(0);
},
success: function (result) {
if (result.status == true) {
$('.forexbaseAmount').val(result.Cost);
} else {
console.log(result.status);
$('.forexbaseAmount').val(result.Cost);
return false;
}
}
})
}
function updatecost() {
var Num = $('#forexAmount').val();
var forexbaseAmount = $('#forexbaseAmount').val();
if (Num > 0 && forexbaseAmount > 0) {
var grandTotal = parseFloat(Num * forexbaseAmount);
var forexGST = calculateForexGSTResult(grandTotal);
$('#forexInrAmount').val(grandTotal.toFixed(2));
$("#forexGSTAmount").val(forexGST);
var forexType = $('input[name="forexType"]:checked').val();
if (forexType == 2) {
var Totalwithgst = grandTotal - forexGST;
} else {
var Totalwithgst = grandTotal + forexGST;
}
$("#TotalforexAmount").val(Totalwithgst.toFixed(2));
$('#grandTotal').text(moneyFormatIndia(Totalwithgst.toFixed(2)));
}
}
function moneyFormatIndia(num) {
var number = Math.round(num).toString();
var formattedNumber = "";
if (number.length > 3) {
var lastThree = number.slice(-3);
var restUnits = number.slice(0, -3);
if (restUnits.length % 2 === 1) {
restUnits = "0" + restUnits;
}
var expUnit = restUnits.match(/.{1,2}/g);
for (var i = 0; i < expUnit.length; i++) {
if (i === 0 && expUnit[i][0] === "0") {
formattedNumber += expUnit[i].substring(1) + ",";
} else {
formattedNumber += expUnit[i] + ",";
}
}
formattedNumber += lastThree;
} else {
formattedNumber = number;
}
return formattedNumber;
}
// function SendProposalForex() {
// var is_currentowner = $("#currentOwner").prop("checked");
// var currentOwnerSysId = $.trim($("#currentOwner").val());
// requestUrl = '/forex/index/save-proposal-forex';
// var dataForm = $('#ForexQueryForm').serialize();
// var cityTxt = $('#city_id option:selected').text();
// jQuery.ajax({
// url: requestUrl,
// type: 'POST',
// dataType: 'json',
// data: dataForm + '¤tOwnerSysId=' + currentOwnerSysId + '&forex_delivery_city_text=' + cityTxt,
// beforeSend: function () {
// $(".searchForexButton").attr("disabled", true);
// $(".searchForexButton").html('Sending.Please wait...');
// },
// success: function (result) {
// $("#saveForexQueryButton").show();
// $("#saveForexQueryButton").html('modify query & Save');
// $(".searchForexButton").hide();
// $("#myModa1VisaEmail").modal('hide');
// alert(result.msg);
// }
// });
// }
function viewSendProposalForex() {
var is_currentowner = $("#currentOwner").prop("checked");
var currentOwnerSysId = $.trim($("#currentOwner").val());
var dataForm = $('#ForexQueryForm').serialize();
var cityTxt = $('#city_id option:selected').text();
$('#myModaladdProposalSend').removeData('bs.modal');
$("#myModaladdProposalSend").modal({
remote: '/forex/index/ajax-html2/data/' + dataForm + '/currentOwnerSysId/' + currentOwnerSysId + '/forex_delivery_city_text/' + cityTxt
});
}
function SendProposalForexmail(event) {
event.preventDefault();
var requestUrl = '/forex/index/send-proposal-forex';
var dataForm = $('#sendproposalforex').serialize();
$.ajax({
url: requestUrl,
type: 'POST',
dataType: 'json',
data: dataForm,
beforeSend: function () {
$(".sendForexButton").attr("disabled", true).text('Sending... Please wait');
},
success: function (result) {
if (result.Isclipboard == 1) {
var emailbody = result.copyclipboardbody;
copyToClipboard(emailbody);
} else {
var booknowUrl = result.booknowurl;
var getMessageBody = result.whatsapp;
var customerContact = result.contactno;
$('.booknowdiv').show();
document.getElementById("bookingLink").href = booknowUrl;
$('#customerContact').val(customerContact);
$('#getMessageBody').val(getMessageBody);
$('.sendForexButton').hide();
$('.shareWithWhatsapp').show();
}
alert(result.msg);
$(".sendForexButton").attr("disabled", false).text('Send');
// $("#myModaladdProposalSend").modal('hide');
},
error: function () {
alert('An error occurred while sending the proposal.');
$(".sendForexButton").attr("disabled", false).text('Send');
}
});
}
function onclickclipboardsubmit() {
$('#clipboardId').val(1);
if ($("#IsSendMail").prop("checked") == true) {
$("#IsSendMail").prop("checked", false);
}
$("#sendproposalforex").submit();
}
function copyToClipboard(text) {
var tempElement = document.createElement('div');
tempElement.innerHTML = text;
document.body.appendChild(tempElement);
var range = document.createRange();
range.selectNode(tempElement);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("copy");
document.body.removeChild(tempElement);
$('#clipboardId').val(0);
}
function calculateForexGSTResult(amount) {
let result = 0;
if (amount < 25000) {
result = 45;
} else if (amount <= 100000) {
result = amount * 0.0018;
} else if (amount <= 1000000) {
result = 180 + ((amount - 100000) * 0.0009);
} else {
result = 990 + ((amount - 1000000) * 0.00018);
}
return Number(result.toFixed(2));
}
</script>