<?php if(get_fild_data('tbl_setting','8','sval')==0){?>
<?php require_once('axe_chat.php');?>
<?php } ?>
<?php require_once('axe_glsearch.php');?>
<?php include('../layout/rfree.php'); ?> 
<footer class="main-footer">
<?php if(get_fild_data('tbl_setting','1','sval')==0){echo '&copy; 2010 - '.date('Y');}else{echo '&copy;'.bn_num(2010).' - '.bn_num(date('Y'));}?>. <a href="http://axesgl.com" target="_blank"><?php if(get_fild_data('tbl_setting','1','sval')==0){echo 'Axes Global Technology';}else{echo 'এক্সেস গ্লোবাল টেকনোলজি';}?></a> - <?php if(get_fild_data('tbl_setting','1','sval')==0){echo 'All Rights Reserved.';}else{echo 'সর্বস্বত্ব স্বত্বাধিকার সংরক্ষিত।';}?><span class="footright"><i class="fa fa-heart" style="color: red;"></i> Cloud Software Suite by True Engineers</span>
</footer>
<?php include('page_default.php'); ?>
</div>
<!-- ./wrapper -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery-ui.min.js"></script>
<script src="../js/bootstrap-datepicker.js?V=1.0"></script>
<script src="../plugins/checkedit/ckeditor.js"></script>
<script src="../js/bootbox.min.js"></script>
<script src="../plugins/piker/spectrum.js"></script>
<script src="../plugins/datatable/jquery.dataTables.js"></script>
<script src="../plugins/datatable/dataTables.bootstrap.js"></script>
<script src="../plugins/treetable/js/jquery.treetable.js"></script>
<script src="../plugins/select/select2.js"></script>
<script src="../js/axes.js?V=1.0"></script>
<script src="../js/common.js?V=1.0"></script>
<script src="../js/jquery.PrintArea.js"></script>
<script src="../js/axes-scanner.js"></script>
<script src="../plugins/notify/notify.js"></script>
<script src="../plugins/list/list.min.js"></script>
<script src="../plugins/list/list.pagination.min.js"></script>
<script src="../plugins/toastr/toastr.min.js"></script>
<script src="../plugins/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="../plugins/livevalidation/live_validation.js"></script>
<script src="../js/parsley.js"></script>
<?php if(get_fild_data('tbl_setting','8','sval')==0){?>
<script type="text/javascript">
var siteurl = '';
var chatmod = '<?php if(isset($_SESSION['chatmod'])){echo $_SESSION['chatmod'];}else{echo 'off';} ?>';
var chat;
var chatlist;    
var session_uname = '<?php echo $_SESSION['uid']; ?>';
var session_img = '<?php echo $_SESSION['uimage']; ?>';
</script>
<!-- Media Uploader -->
<script type="text/javascript" src="../chat/smiley/js/emojione.min.js"></script>
<script type="text/javascript" src="../chat/smiley/smiley.js"></script>
<script type="text/javascript" src="../chat/chatjs/lightbox.js"></script>
<script type="text/javascript" src="../chat/chatjs/chat.js"></script>
<script type="text/javascript" src="../chat/chatjs/custom.js"></script>
<script type="text/javascript" src="../chat/uploader/plupload.full.min.js"></script>
<script type="text/javascript" src="../chat/uploader/jquery.ui.plupload/jquery.ui.plupload.js"></script>
<?php } ?> 
<script type="text/javascript">
var AXES_PAGE_TITLE = document.title;
$(document).ready(function () {

$('body').on("click", ".notifi_delete", function () {
delete_notification(this, 1);
});
$('body').on("click", ".notifi_clear_all", function () {
delete_notification(this, 2);
});

$('body').on("click", ".notifications-menu .dropdown-menu", function (e) {
e.stopPropagation();
});
$('.notifications-menu').on('show.bs.dropdown', function () {
$(this).find('.dropdown-menu').first().stop(true, true).slideDown();
});
$('.notifications-menu').on('hide.bs.dropdown', function () {
$(this).find('.dropdown-menu').first().stop(true, true).slideUp();
});

$('body').on("click", ".delete_confirm", function () {
var msg = $(this).data("msg");
var url = $(this).prop('href');

confirmbox(msg, url);
return false;
});
$('body').on("click", ".popup", function () {
popup(this);
return false;
});

$("#modal-default").on("hidden.bs.modal", function () {
var callback = $('#callback').val();
if (callback)
excecute_callback(callback);
$('#callback').val('');
});

check_window_is_child();
        
toggle_sidebar_menu();
    
document.getElementById('modal_default_iframe').onload = function () {
$('.holds-the-iframe .modal-body').addClass('hideBg');
};

$("#txtMenuEval").keypress(function(e) {
    if(e.which == 13) {
        var result = eval($('#txtMenuEval').val());
        result = parseFloat(result);
        $('#txtMenuEvalResult').val( result.toFixed(2) );
        // $('#txtEvalResult').text().toFixed(2);

    }
});

$("#txtMenuEval").focus(function () {
    $(this).select();
}); 

});




   
    

    
setTimeout(function() {
$('#mymsg').fadeOut('fast');
$.ajax({
url: 'msg.php',
type: 'post',
data: {shows:1},
//dataType: 'json',
success:function(data) {
}
});    
}, 3000); // <-- time in milliseconds
    
function check_window_is_child() {
if (window.self !== window.top) {
$('.main-header,.main-sidebar,.main-footer').hide();
$('.content-wrapper, .main-footer').css({'margin-left': '0'});
$('.skin-purple .wrapper, .skin-purple .main-sidebar, .skin-purple .left-side').css({'background-color': '#ecf0f5'});
} else {
           
}   
}
    
function popup(obj) {
$('.holds-the-iframe .modal-body').removeClass('hideBg');
var modal_title = $(obj).data('title');
$('#modal-default .modal-title').text(modal_title);
$('#modal-default .modal-body iframe').prop('src', '');
$('#modal-default .modal-body iframe').contents().find("body").html("");
var urllink = $(obj).prop('href');
$('#modal_default_iframe').hide();
$('#modal-default .modal-body iframe').prop('src', urllink);
var callback = $(obj).data("callback");
$('#callback').val(callback);
$("#modal-default").modal();
setTimeout(function () {
$('#modal_default_iframe').show();

}, 1500);
return false;
}
    
function popup_open(data) {
$('.holds-the-iframe .modal-body').removeClass('hideBg');
$('#modal-default .modal-body iframe').prop('src', '');
$('#modal-default .modal-body iframe').contents().find("body").html("");
$('#modal_default_iframe').hide();

$('#modal-default .modal-body iframe').prop('src', data['src']);
$('#modal-default .modal-title').text(data['title']);
$('#callback').val(data['callback']);
$("#modal-default").modal();
setTimeout(function () {
$('#modal_default_iframe').show();

}, 1500);

}

function toaster(msg) {
$('.modal-msg .modal-body').html(msg);
$('.modal-msg').modal({backdrop: 'static', keyboard: false});
}
   
function toaster2(msg, url) {
$('.modal-msg .modal-msg-url').text('');
if (url)
$('.modal-msg .modal-msg-url').text(url);
$('.modal-msg .modal-body').html(msg);
$('.modal-msg').modal({backdrop: 'static', keyboard: false});
}
    
function close_toaster() {
try {
var modal_msg_url = $('.modal-msg .modal-msg-url').text();

$('.modal-msg').modal('hide');
if (modal_msg_url && modal_msg_url != '' && modal_msg_url != null) {
window.location.href = modal_msg_url;
}
} catch (exception) {
alert(exception);
}

}
    
function confirmbox(msg, url, obj) {
if (obj) {
url = $('.modal-confirm #urlpath').val();
if (url && url != 'undefined') {
window.location = url;
}
} else {

$('.modal-confirm .modal-body p').text(msg);
$('.modal-confirm #urlpath').val(url);
$('.modal-confirm').modal({backdrop: 'static', keyboard: false});
}
}
    
var myFunction = function () {
window.focus();
};

function toggle_sidebar_menu(key)
{
if (key == 1) {
$('.sidebar-mini').addClass('sidebar-collapse');
} else {
$('.sidebar-mini').removeClass('sidebar-collapse');
}
}
    
function CheckEmailVal(email, check_val) {
try {
var result = true;
if (email) {
email = email.split(",");
for (var i = 0; i < email.length; i++) {
var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,8}|[0-9]{1,3})(\]?)$/;
result = expr.test(email[i]);
}

} else if (check_val > 0 && !email) {
var result = false;
}
return result;
} catch (exception) {
return false;
}

}
    
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
    
$('.datetimepicker').datepicker({format: "yyyy-mm-dd", autoclose: true, clearBtn: true, orientation: 'auto bottom'});    
/* Select2 Init*/
$(".select2").select2();

<?php 
$parray = array('porcreate','pinvcreate','precreate','sescreate','sinvcreate','srecreate','bratra','whotra'); 
if(strlen(array_search($phead,$parray))<1){
?>    
//Barcode
var bscode='';    
$(document).scannerDetection({
timeBeforeScanTest: 200, 
//startChar: [120],
endChar: [13],
avgTimeByChar: 30,
onComplete: function(barcode,event){ 
bscode = barcode;   
$.ajax({
url: 'axe_globalview.php',
method: "POST",
data:{sbcode: bscode},
success: function(data){
var foundSomething = false;
for(var i=0; i<data.length; ++i) {
if(data[i] !== null) foundSomething = true;
break;
}    
if(foundSomething){
$('#datacon').html(data);   
$('.right-side-free').toggle('slide', { direction: 'right' }, 300);
}
}
});    
},
onKeyDetect: function(event){
if(event.keyCode === 13 || event.keyCode === 17 || event.keyCode === 74 ){
if (event.target.tagName == "INPUT" || event.target.tagName == "TEXTAREA") {
if(bscode.length>1){
event.preventDefault();    
}    
}else{
event.preventDefault();    
}  
}
}
});   
<?php } ?>

$(document).on('keydown', '#glsearch', function() {
$('#glsearch' ).autocomplete({
source: function( request, response ) {
$.ajax({
url: 'axe_cart.php',
type: 'post',
dataType: 'json',
data: {
search: request.term,glsearch:1
},
success: function(data) {
response(data);
}
});
},
select: function (event, ui) {
var te='';
$(this).val(te); // display the selected text
var glval = ui.item.value; // selected id to input

$.ajax({
url: 'axe_globalview.php',
method: "POST",
data:{sbcode: glval},
success: function(data){
var foundSomething = false;
for(var i=0; i<data.length; ++i) {
if(data[i] !== null) foundSomething = true;
break;
}    
if(foundSomething){
$('#datacon').html(data);   
$('.right-side-free').toggle('slide', { direction: 'right' }, 300);
}
}
});
return false;
}
});    
});   

$(document).on('click', '#glbox', function() {
if($('.glslide').hasClass('glslide-open')){
$('.glslide').removeClass('glslide-open');
$('#prodetails').html('');    
}else{
$('.glslide').addClass('glslide-open');     
}        
}); 
    
<?php if(get_fild_data('tbl_setting','8','sval')==0){?>

$(document).on('click', '#kchat', function() {
if($('.kchatslide').hasClass('kchatslide-open')){
$('.kchatslide').removeClass('kchatslide-open');    
}else{
$('.kchatslide').addClass('kchatslide-open');     
}        
});
    
$(document).on('change', '#chaton', function () {
var chkid = 0;	
$('#chaton').not(this).prop('checked', false);
if ($('#chaton').is(":checked")){
chkid = 1;
}else{
chkid = 0;	
}

$.ajax({
url: 'axe_chatcart.php',
method: "POST",
data: {
check: chkid
},
dataType: 'json',    
success: function(data) {
chatmod=data.status;
if(chatmod==='on'){
chatclientlist();    
startChatSession();   
}else{
for (i=0;i<chatBoxes.length;i++) {
chatboxtitle = chatBoxes[i];
closeChatBox(chatboxtitle);    
}
clearTimeout(chatlist);
$('#chat_list').html('');    
clearTimeout(chat);
}    
}
});
});
<?php } ?>    

$(document).on('click', '#glprosearch', function () {
var gdata = $('#gltextsearch').val();
if(gdata == '') return;
    
$.ajax({
url: 'axe_cart.php',
method: "POST",
data: {
proserarch:1, serdata: gdata
},   
success: function(data) {
$('#prodetails').html(data);    
}
});
    
}); 
    
$(document).on('click', '#closefree', function() {    
$('#datacon').html('');
if($('.right-side-free').is(':visible')) {
$('.right-side-free').toggle('slide', { direction: 'right' }, 300);
}    
});    
</script>
<?php if(isset($print)){ ?>
<script type="text/javascript">

$("#print").click(function() {    
var mode = 'iframe'; //popup
var close = mode == "popup";
var options = {
mode: mode,
popClose: close
};
$("div.printableArea").printArea(options);
});
    
function pagelist(){    
var perPage = 10;

new List("test-list", {
valueNames: ["pino","name"],
page: perPage,
plugins: [

ListPagination({
paginationClass: "pagination-layout",
left: 2,
right: 2
})
]
}).on("updated", function(list) {
var isFirst = list.i == 1;
var isLast = list.i > list.matchingItems.length - list.page;

// make the Prev and Nex buttons disabled on first and last pages accordingly
$(".pagination-prev.disabled, .pagination-next.disabled").removeClass(
"disabled"
);
if (isFirst) {
$(".pagination-prev").addClass("disabled");
}
if (isLast) {
$(".pagination-next").addClass("disabled");
}

// hide pagination if there one or less pages to show
if (list.matchingItems.length <= perPage) {
$(".pagination-wrap").hide();
} else {
$(".pagination-wrap").show();
}
});
}
    
$(".pagination-next").click(function(e) {
$(".pagination-layout .active")
.next()
.trigger("click");
e.preventDefault();    
});
    
$(".pagination-prev").click(function(e) {
$(".pagination-layout .active")
.prev()
.trigger("click");
e.preventDefault();    
});    
    
$("#print").click(function() {    
var mode = 'iframe'; //popup
var close = mode == "popup";
var options = {
mode: mode,
popClose: close
};
$("div.printableArea").printArea(options);
});    
        
function setPrinterConfig(){
resolution = $('#resolution').val()!=undefined?$('#resolution').val():"A4";
rotate = $('#rotate').val()!=undefined?$('#rotate').val():"portrait";

$('.page').removeClass('A2 A4 A5 Letter Legal');
$('.page').addClass(resolution);
$('.page').removeClass('portrait landscape');
$('.page').addClass(rotate);

w = "21cm"; h = "29.7cm";
if( resolution == "A4" ){
w = "21cm"; h = "29.7cm";     
}else if( resolution == "A5" ){
w = "14.8cm"; h = "21cm";
}else if( resolution == "Letter" ){
w = "21.6cm"; h = "27.9cm";
}else if( resolution == "Legal" ){
w = "21.6cm"; h = "35.6cm";
}
if( rotate == "landscape" ){
$('#pageInit').html("@page{size: "+h+" "+w+"}");
}else{
$('#pageInit').html("@page{size: "+w+" "+h+"}");
}
scaleTemplate();
};

function getPageHeight(){
resolution = $('#resolution').val()!=undefined?$('#resolution').val():"A4";
rotate = $('#rotate').val()!=undefined?$('#rotate').val():"portrait";

w = 21; h = 29.7;
if( resolution == "A4" ){
w = 21; h = 29.7;      
}else if( resolution == "A5" ){
w = 14.8; h = 21;
}else if( resolution == "Letter" ){
w = 21.6; h = 27.9;
}else if( resolution == "Legal" ){
w = 21.6; h = 35.6;
}
if( rotate == "landscape" ){
return w;
}else{
return h;
}
};

function getPageWidth(){
resolution = $('#resolution').val()!=undefined?$('#resolution').val():"A4";
rotate = $('#rotate').val()!=undefined?$('#rotate').val():"portrait";

w = 21; h = 29.7;
if( resolution == "A4" ){
w = 21; h = 29.7;      
}else if( resolution == "A5" ){
w = 14.8; h = 21;
}else if( resolution == "Letter" ){
w = 21.6; h = 27.9;
}else if( resolution == "Legal" ){
w = 21.6; h = 35.6;
}
if( rotate == "landscape" ){
return h;
}else{
return w;
}
};

function scaleTemplate(){
$.each($('[id=wrap_invoice]'), function(i, wrap_invoice){
var scale = 1;
if( $(wrap_invoice).parent().is(".wrapper") ){
$(wrap_invoice).unwrap();
}
var parent = $(wrap_invoice).parent();
var padding = $(parent).outerWidth()-$(parent).width();
var outer_height = $(parent).height();
var inner_height = $(wrap_invoice).outerHeight();
var outer_width = $(parent).width();
var inner_width = $(wrap_invoice).outerWidth();
if( outer_width < inner_width ){
if( padding == 0 ){
scale = parseFloat(outer_width/(inner_width+20));
padding = 20;
}else{
scale = parseFloat(outer_width/inner_width);
padding = 0;
}
var x = padding/2;
var origin = x.toFixed(2)+"px 0px 0px";
$(wrap_invoice).css({'-webkit-transform': 'scale('+(scale.toFixed(2))+')', '-webkit-transform-origin': origin});
var wrapper = $("<div class='wrapper'></div>");
$(wrapper).css({'width': inner_width*scale, 'height': inner_height*scale, "overflow": "hidden"});
$(wrap_invoice).wrap(wrapper);
}else{
$(wrap_invoice).css({'-webkit-transform': '', '-webkit-transform-origin': ""});
}
});
};

document.table_border = false;
document.table_strip = false;
document.table_border = true;
document.table_strip = true;

$(document).ready(function(){
$('#wrap_invoice table').removeClass();
$('#wrap_invoice table').addClass('table_invoice table_invoice-condensed');

$('#wrap_invoice table').addClass('table_invoice-bordered');
  
$('#wrap_invoice table').addClass('table_invoice-striped');
  
  

setPrinterConfig();
$('body').on('keyup', function(ev){
if( ev.keyCode == 27 ){
$('#close_page').click();
}
});

$('#close_page').click(function(){
window.close();
window.parent.window.close();
return false;
});
window.onresize = function() {
scaleTemplate();
}
scaleTemplate();
});
    
setTimeout(function() {
$(window).trigger("resize");
}, 100);
    
function sethead(){
var maxh = 0;
var ahe = $("#adheight").height();
var ihe = $("#inheight").height();

if(ahe>ihe){
maxh=ahe;   
}else{
maxh=ihe;    
}
if(maxh>ahe){
 $("#adheight").height(maxh);    
}else if(maxh>ihe){
 $("#inheight").height(maxh);        
}    
};
sethead();    
</script>
<?php } ?>

