add local backups
This commit is contained in:
parent
461b1b7060
commit
318d2e578f
99
libs/html/_FromProd/401.pm
Normal file
99
libs/html/_FromProd/401.pm
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link href='http://fonts.googleapis.com/css?family=Creepster|Audiowide' rel='stylesheet' type='text/css'>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: arial, helvetica, sans-serif;
|
||||||
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAUElEQVQYV2NkYGAwBuKzQAwDID4IoIgxIikAMZE1oRiArBDdZBSNMIXoJiFbDZYDKcSmCOYimDuNSVKIzRNYrUYOFuQgweoZbIoxgoeoAAcAEckW11HVTfcAAAAASUVORK5CYII=) repeat;
|
||||||
|
background-color: #212121;
|
||||||
|
color: white;
|
||||||
|
font-size: 28px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-code {
|
||||||
|
font-family: 'Creepster', cursive, arial, helvetica, sans-serif;
|
||||||
|
font-size: 200px;
|
||||||
|
color: white;
|
||||||
|
color: rgba(255, 255, 255, 0.98);
|
||||||
|
width: 50%;
|
||||||
|
text-align: right;
|
||||||
|
margin-top: 5%;
|
||||||
|
text-shadow: 5px 5px hsl(0, 0%, 25%);
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-found {
|
||||||
|
font-family: 'Audiowide', cursive, arial, helvetica, sans-serif;
|
||||||
|
width: 45%;
|
||||||
|
float: right;
|
||||||
|
margin-top: 5%;
|
||||||
|
font-size: 50px;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 2px 2px 5px hsl(0, 0%, 61%);
|
||||||
|
padding-top: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
float: none;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
text-align: center;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text] {
|
||||||
|
border: hsl(247, 89%, 72%) solid 1px;
|
||||||
|
outline: none;
|
||||||
|
padding: 5px 3px;
|
||||||
|
font-size: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #9ECDFF;
|
||||||
|
text-shadow: 0px 0px 2px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<title>Error</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p class="error-code">
|
||||||
|
401
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="not-found">Unauthorised</p>
|
||||||
|
|
||||||
|
<div class="clear"></div>
|
||||||
|
<div class="content">
|
||||||
|
You are not authorised to view this page
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="/">Click here to go back to your Dashboard</a>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
42
libs/html/_FromProd/_blank.pm
Normal file
42
libs/html/_FromProd/_blank.pm
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-$glyphicon"></i> $page_title</h2>
|
||||||
|
$box_icon
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
$print_box_content_rows
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!--/row-->
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
32
libs/html/_FromProd/_blank_3.pm
Normal file
32
libs/html/_FromProd/_blank_3.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_box_content_rows
|
||||||
|
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
88
libs/html/_FromProd/_blank_4.pm
Normal file
88
libs/html/_FromProd/_blank_4.pm
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
# require header ;
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- The styles -->
|
||||||
|
<link href="$useropts{'css'}/bootstrap-itv.min.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/custom-itv.css" rel="stylesheet">
|
||||||
|
$extra_css
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.print.css" rel='stylesheet' media='print'>
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/bootstrap-tour/build/css/bootstrap-tour.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.noty.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/noty_theme_default.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.iphone.toggle.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/uploadify.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/animate.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-dialog.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-datetimepicker.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
$typeahead_css
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- The fav icon -->
|
||||||
|
<link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$fullcalendar_events
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body $onload>
|
||||||
|
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_box_content_rows
|
||||||
|
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
26
libs/html/_FromProd/_return.pm
Normal file
26
libs/html/_FromProd/_return.pm
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
unless ($goaction) { $goaction = 'list' ; }
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#list-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="listform" id="list-form" method="post" action="admin-$goaction-$lcpage\s">
|
||||||
|
<input type="hidden" name="iaction" value="$goaction">
|
||||||
|
<input type="hidden" name="isaved" value="$success">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
95
libs/html/_FromProd/archive.pm
Normal file
95
libs/html/_FromProd/archive.pm
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_usage
|
||||||
|
|
||||||
|
$print_download
|
||||||
|
|
||||||
|
$print_delete_uploads_form
|
||||||
|
|
||||||
|
$print_buttons
|
||||||
|
|
||||||
|
<!-- content ends -->
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<style>
|
||||||
|
.progress { height: 30px; }
|
||||||
|
.progress .progress-bar {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function zipDelete ()
|
||||||
|
{
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'Confirm Delete',
|
||||||
|
message: 'Are you sure you want to delete <b>' + \$("#selectZip").val() + '</b> uploads?',
|
||||||
|
type: BootstrapDialog.TYPE_WARNING,
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
\$('#delete-uploads-selection').val(\$("#selectZip").val());
|
||||||
|
\$('#delete-uploads-form').submit();
|
||||||
|
BootstrapDialog.closeAll() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function zipUploads ()
|
||||||
|
{
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'Confirm Zip',
|
||||||
|
message: 'Are you sure you want to ZIP and send <b>' + \$("#selectZip").val() + '</b>!',
|
||||||
|
type: BootstrapDialog.TYPE_WARNING,
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
\$('#zip-uploads-selection').val(\$("#selectZip").val());
|
||||||
|
\$('#zip-form').submit();
|
||||||
|
BootstrapDialog.closeAll() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$download_zip_after_delete
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form role="form" id="delete-uploads-form" method="post">
|
||||||
|
<input type="hidden" name="iaction" value="deluploads">
|
||||||
|
<input type="hidden" name="izip" value="" id="delete-uploads-selection">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" name="zip" id="zip-form" method="post">
|
||||||
|
<input type="hidden" name="iaction" value="zip">
|
||||||
|
<input type="hidden" name="izip" value="" id="zip-uploads-selection">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" id="open-zip" action="$g_archiveziplink" target="_blank">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
37
libs/html/_FromProd/calendar.pm
Normal file
37
libs/html/_FromProd/calendar.pm
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-calendar"></i> Calendar</h2>
|
||||||
|
$box_icon
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
<div id="calendar" class="fc fc-ltr"></div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/fixedsystems.pm
Normal file
23
libs/html/_FromProd/fixedsystems.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/fixed-systems-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
103
libs/html/_FromProd/footer.pm
Normal file
103
libs/html/_FromProd/footer.pm
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<footer class="row">
|
||||||
|
<p class="col-md-9 col-sm-9 col-xs-12 copyright">© <a href="http://itvadmin.co.za" target="_blank">$useropts{short}</a></p>
|
||||||
|
|
||||||
|
<p class="col-md-3 col-sm-3 col-xs-12 powered-by"><a href="http://kre8it.co.za" target="_blank">Kre8IT Programming (Pty) Ltd</a><br>062 133 6754<br><a href="mailto:info\@kre8it.co.za">info\@kre8it.co.za</a></p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div><!--/.fluid-container-->
|
||||||
|
|
||||||
|
<!-- external javascript -->
|
||||||
|
|
||||||
|
<script src="$useropts{'bower_components'}/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- library for cookie management -->
|
||||||
|
<script src="$useropts{'js'}/jquery.cookie.js"></script>
|
||||||
|
<!-- calender plugin -->
|
||||||
|
<script src="$useropts{'bower_components'}/moment/min/moment.min.js"></script>
|
||||||
|
<script src="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.min.js"></script>
|
||||||
|
<!-- data table plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.dataTables.min.js"></script>
|
||||||
|
<!-- select or dropdown enhancer -->
|
||||||
|
<script src="$useropts{'bower_components'}/chosen/chosen.jquery.min.js"></script>
|
||||||
|
<!-- plugin for gallery image view -->
|
||||||
|
<script src="$useropts{'bower_components'}/colorbox/jquery.colorbox-min.js"></script>
|
||||||
|
<!-- notification plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.noty.js"></script>
|
||||||
|
<!-- library for making tables responsive -->
|
||||||
|
<script src="$useropts{'bower_components'}/responsive-tables/responsive-tables.js"></script>
|
||||||
|
<!-- tour plugin -->
|
||||||
|
<script src="$useropts{'bower_components'}/bootstrap-tour/build/js/bootstrap-tour.min.js"></script>
|
||||||
|
<!-- star rating plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.raty.min.js"></script>
|
||||||
|
<!-- for iOS style toggle switch -->
|
||||||
|
<script src="$useropts{'js'}/jquery.iphone.toggle.js"></script>
|
||||||
|
<!-- autogrowing textarea plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.autogrow-textarea.js"></script>
|
||||||
|
<!-- history.js for cross-browser state change on ajax -->
|
||||||
|
<script src="$useropts{'js'}/jquery.history.js"></script>
|
||||||
|
<!-- application script for Charisma demo -->
|
||||||
|
<script src="$useropts{'js'}/charisma.js"></script>
|
||||||
|
<!-- application script for bootstrap dialog customisation -->
|
||||||
|
<script src="$useropts{'js'}/bootstrap-dialog.js"></script>
|
||||||
|
<script src="$useropts{'js'}/bootstrap-datetimepicker.min.js"></script>
|
||||||
|
<script src="$useropts{'js'}/bootstrap-datepicker.js"></script>
|
||||||
|
<script src="$useropts{'js'}/jquery.form-validator.min.js"></script>
|
||||||
|
$extra_js
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$.validate();
|
||||||
|
|
||||||
|
function dlgMdl(url,titl,cssfh,csscl){
|
||||||
|
// if (!cssfh) { cssfh = 'height:' + (screen.height - (screen.height / 3) - 30) + 'px' }
|
||||||
|
if (!cssfh) { cssfh = 'height:' + (\$(window).height() * 0.87) + 'px' }
|
||||||
|
BootstrapDialog.show({
|
||||||
|
title: titl,
|
||||||
|
message: \$('<iframe src="' + url + '" style="position:relative;background-color:transparent;border:0px;width:100%;' + cssfh + ';" frameborder="0"></iframe>') ,
|
||||||
|
cssClass: csscl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function editQuote (id)
|
||||||
|
{
|
||||||
|
\$('#quote-edit-id').val(id);
|
||||||
|
\$('#quote-edit-form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editEventQuote (id)
|
||||||
|
{
|
||||||
|
\$('#event-quote-edit-id').val(id);
|
||||||
|
\$('#event-quote-edit-form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
\$('[data-toggle="tooltip"]').tooltip({html:true}) ;
|
||||||
|
|
||||||
|
\$(document).ready(function(){ $trigger_jquery });
|
||||||
|
|
||||||
|
$trigger_jquery_raw
|
||||||
|
|
||||||
|
function sendEmail(inv,mnid) {
|
||||||
|
dlgMdl("$useropts{'scripts'}/dialog/email.pl?"+inv+"&"+mnid,"Pre-alert",'height:550px;','') ;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form role="form" id="quote-edit-form" method="post" action="$useropts{'folder'}/edit-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="edit">
|
||||||
|
<input type="hidden" name="id" id="quote-edit-id" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" id="event-quote-edit-form" method="post" action="$useropts{'folder'}/edit-event-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="edit">
|
||||||
|
<input type="hidden" name="id" id="event-quote-edit-id" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
$extra_form_footer
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
||||||
|
# <!-- multiple file upload plugin -->
|
||||||
|
# <script src="$useropts{'js'}/jquery.uploadify-3.1.min.js"></script>
|
||||||
618
libs/html/_FromProd/header.pm
Normal file
618
libs/html/_FromProd/header.pm
Normal file
|
|
@ -0,0 +1,618 @@
|
||||||
|
|
||||||
|
my $manage_quote_defaults_menu = '' ;
|
||||||
|
my $manage_price_list_menu = '' ;
|
||||||
|
|
||||||
|
my $rma_list_menu = ($usertype eq 'it' || $usertype eq 'senior_manager' || $usertype eq 'manager' || $usertype eq 'support' || $usertype eq 'casual_c') ? qq~<li><a href="$useropts{'folder'}/list-rma">RMA List</a></li>~ : '' ;
|
||||||
|
|
||||||
|
my $manage_price_list_menu_top = '' ;
|
||||||
|
|
||||||
|
my $manage_logistics_report_menu_top = qq~<li><a href="$useropts{'folder'}/logistics-report"><i class="glyphicons glyphicons-transfer"></i>Logistics</a></li>~ ;
|
||||||
|
my $manage_leave_menu = '' ;
|
||||||
|
my $reports_menu_top = '' ;
|
||||||
|
my $accounts_menu_top = '' ;
|
||||||
|
|
||||||
|
my $analytics_reports = ($glod_user_level >= 5) ? qq~
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Analytics</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/fixtures-report">Fixtures Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
my $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
my $fixedsystem_menu_top = qq~<li><a href="$useropts{'folder'}/fixed-systems-report"><i class="glyphicon glyphicon-indent-left"></i>Fixed System</a></li>~ ;
|
||||||
|
my $home_menu_top = '' ;
|
||||||
|
my $search_menu_top = '' ;
|
||||||
|
my $quotes_menu_top = '' ;
|
||||||
|
my $events_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
# my $analytics_menu_top = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/filter-analytics-event-bookings"><i class="glyphicon glyphicon-th-list"></i> Analytics</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
|
||||||
|
my $analytics_menu_top = ($glod_user_level >= 5) ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Analytics <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/filter-analytics-event-credits">Credits</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# my $events_filter = qq~<li><a href="$useropts{'folder'}/filter-event-quotes">Search Events</a></li>~;
|
||||||
|
# my $events_systems = '' ;
|
||||||
|
my $cameras_menu_top = qq~<li><a href="$useropts{'folder'}/search-cameras"><i class="glyphicon glyphicon-camera"></i> Cameras</a></li>~;
|
||||||
|
my $documents_menu_top = '' ;
|
||||||
|
my $calendar_menu_top = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
|
||||||
|
my $manage_camera_systems_menu = '' ;
|
||||||
|
my $manage_users_menu = '' ;
|
||||||
|
my $manage_operators_menu = '' ;
|
||||||
|
my $manage_installation_partners_menu = '' ;
|
||||||
|
my $manage_analytics_client_menu = '' ;
|
||||||
|
my $manage_coding_providers_menu = '' ;
|
||||||
|
my $manage_customers_menu = '' ;
|
||||||
|
my $manage_archive_menu = '' ;
|
||||||
|
my $manage_event_systems = '' ;
|
||||||
|
my $manage_logistics_suppliers = '' ;
|
||||||
|
my $manage_logistics_locations = '' ;
|
||||||
|
my $manage_logistics_items = '' ;
|
||||||
|
my $manage_sport_types = '' ;
|
||||||
|
my $manage_cities = '' ;
|
||||||
|
my $manage_organisations = '' ;
|
||||||
|
my $manage_regions = '' ;
|
||||||
|
my $manage_teams = '' ;
|
||||||
|
my $manage_operator_payments = '' ;
|
||||||
|
my $manage_monitor_payments = '' ;
|
||||||
|
my $manage_troubleshoot_monitor_payments = '' ;
|
||||||
|
my $manage_temp_calibrator_payments = '' ;
|
||||||
|
my $manage_event_invoicing = '' ;
|
||||||
|
my $manage_logistics_report = '' ;
|
||||||
|
|
||||||
|
my $manage_logistics_payments_report = '' ;
|
||||||
|
my $manage_logistics_shipment_costs_report = '' ;
|
||||||
|
|
||||||
|
my $quote_search_menu_top = '' ;
|
||||||
|
my $reports_event_quotes = qq~<li><a href="$useropts{'folder'}/event-quotes-report">Event Quotes Report</a></li>~;
|
||||||
|
my $reports_management_report = '' ;
|
||||||
|
my $logistics_costs_report = '' ;
|
||||||
|
my $events_reports = '' ;
|
||||||
|
my $reports_active_camera = '' ;
|
||||||
|
my $reports_active_camera = qq~<li><a href="$useropts{'folder'}/cameras-report">Active Cameras Report</a></li>~;
|
||||||
|
# my $reports_stock_report = '' ;
|
||||||
|
my $reports_delivered_report = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
|
||||||
|
# my $reports_delivered_report = '' ;
|
||||||
|
my $reports_warranty_report = '' ;
|
||||||
|
my $reports_match_credits = '' ;
|
||||||
|
my $manage_fixedsystem = '' ;
|
||||||
|
# my $monitor_report_menu_top = qq~<li><a href="$useropts{'folder'}/monitor-report"><i class="glyphicons glyphicons-eye"></i>Monitor Report</a></li>~ ;
|
||||||
|
|
||||||
|
my $schedule_menu_top = '' ;
|
||||||
|
my $reports_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/monitoring-report">Monitor Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_temp_calibration = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/temp-calibrator-report">Temp Calibrator Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_troubleshoot_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/troubleshoot-monitoring-report">Troubleshoot Monitor Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_site_surveys = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-site-surveys-report">Mobile Site Surveys</a></li>~ : '' ;
|
||||||
|
my $reports_set_up_groups = ($glod_user_level >= 2) ? qq~<li><a href="$useropts{'folder'}/set-up-groups-report">Set Up Groups</a></li>~ : '' ;
|
||||||
|
my $mobile_tracking_system = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-system-tracking-report">Mobile System Tracking</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
my $report_audit_trial = ($glod_user_level > 3) ? qq~<li><a href="$useropts{'folder'}/search-audit-trial">Audit Trial</a></li>~ : '' ;
|
||||||
|
|
||||||
|
if ($useropts{super}{$username} and $pixellot_limit{$username}!=1 and $events_limit{$username}!=1) {
|
||||||
|
# $manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-defaults">Quote Defaults</a></li>~ ;
|
||||||
|
$manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-notes">Quote Defaults</a></li>~ ;
|
||||||
|
$manage_price_list_menu = qq~<li><a href="$useropts{'folder'}/summary-price-list">Price List</a></li>~ ;
|
||||||
|
$manage_price_list_menu_top = qq~<li><a href="$useropts{'folder'}/summary-price-list"><i class="glyphicon glyphicon-list"></i> Price List</a></li>~ ;
|
||||||
|
# $manage_leave_menu = qq~<li class="divider"></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/list-leave">List Leave</a></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/list-leave-settings">Leave Settings</a></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/leave-report">Leave Report</a></li>~ ;
|
||||||
|
|
||||||
|
# $events_systems = qq~<li><a href="$useropts{'folder'}/list-event-systems"> Event Systems</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
# unless ($pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager') {
|
||||||
|
if ($glod_user_level >= 4) {
|
||||||
|
$reports_stock_report = qq~<li><a href="$useropts{'folder'}/stock-report">Stock Report</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level >= 5) {
|
||||||
|
# $reports_delivered_report = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
|
||||||
|
$reports_warranty_report = qq~<li><a href="$useropts{'folder'}/warranty-report">Extended Warranty Report</a></li>~;
|
||||||
|
$reports_match_credits = qq~<li><a href="$useropts{'folder'}/match-credits-report">Match Credits Report</a></li>~;
|
||||||
|
$reports_management_report = qq~<li><a href="$useropts{'folder'}/management-report">Management Report</a></li>~;
|
||||||
|
$logistics_costs_report = qq~<li><a href="$useropts{'folder'}/logistics-costs-report">Logistics Costs Report</a></li>~;
|
||||||
|
# $reports_operators_report = qq~<li><a href="$useropts{'folder'}/operators-report">Operators Report</a></li>~;
|
||||||
|
$events_reports = qq~<li class="divider"></li>
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Events Reports</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-report">Operators Payments Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
$home_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-home"></i></a></li>~;
|
||||||
|
# $search_menu_top = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-search"></i> Search</a></li>~;
|
||||||
|
$quotes_menu_top = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-th-large"></i> Quotes</a></li>~ unless $usertype eq 'manager' ;
|
||||||
|
# $documents_menu_top = qq~<li><a href="$useropts{'folder'}/search-documents"><i class="glyphicon glyphicon-list-alt"></i> Documents</a></li>~;
|
||||||
|
# $calendar_menu_top = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
|
||||||
|
|
||||||
|
$manage_camera_systems_menu = qq~<li><a href="$useropts{'folder'}/list-camera-systems">Camera Systems</a></li>~;
|
||||||
|
$manage_users_menu = qq~<li><a href="$useropts{'folder'}/list-users">All Users</a></li>~;
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
$manage_school_managers_menu = qq~<li><a href="$useropts{'folder'}/list-school-managers">School Managers</a></li>~;
|
||||||
|
|
||||||
|
$manage_installation_partners_menu = qq~<li><a href="$useropts{'folder'}/list-installation-partners">Installation Partners</a></li>~;
|
||||||
|
$manage_analytics_client_menu = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-analytics-clients">Analytics Clients</a></li>~ : qq~~ ;
|
||||||
|
$manage_coding_providers_menu = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-coding-providers">Coding Providers</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
# $manage_logistics_shipment_costs_report = qq~<li><a href="$useropts{'folder'}/list-logistics-shipment-costs">Logistics Shipment Costs</a></li>~ ;
|
||||||
|
|
||||||
|
$manage_customers_menu = qq~<li><a href="$useropts{'folder'}/list-customers">Customers</a></li>~;
|
||||||
|
$manage_archive_menu = qq~<li class="divider"></li><li><a href="/archive">Archive</a></li><li class="divider"></li>~;
|
||||||
|
$manage_event_systems = qq~<li><a href="$useropts{'folder'}/list-event-systems">Event Systems</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-event-types">Event Types</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-event-cost-items">Event Cost Items</a></li>
|
||||||
|
$manage_logistics_shipment_costs_report
|
||||||
|
<li class="divider"></li>~;
|
||||||
|
|
||||||
|
# $manage_logistics_report = qq~<li><a href="$useropts{'folder'}/logistics-report">Logistics Report</a></li>~ ;
|
||||||
|
$manage_event_invoicing = qq~<li><a href="$useropts{'folder'}/event-invoicing-report">Event Invoicing</a></li>~ ;
|
||||||
|
$manage_operator_payments = qq~<li><a href="$useropts{'folder'}/operator-payments">Operator Payments</a></li>~ ;
|
||||||
|
$manage_monitor_payments = qq~<li><a href="$useropts{'folder'}/monitor-payments-report">Monitor Payments</a></li>~ ;
|
||||||
|
$manage_troubleshoot_monitor_payments = qq~<li><a href="$useropts{'folder'}/troubleshoot-monitor-payments-report">Troubleshoot Monitor Payments</a></li>~ ;
|
||||||
|
$manage_temp_calibrator_payments = qq~<li><a href="$useropts{'folder'}/temp-calibrator-payments-report">Temp Calibrator Payments</a></li>~ ;
|
||||||
|
|
||||||
|
$manage_logistics_payments_report = qq~<li><a href="$useropts{'folder'}/logistics-payments">Logistics Payments</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
$manage_regions = qq~<li><a href="$useropts{'folder'}/list-regions">Regions</a></li>~ ;
|
||||||
|
$manage_teams = qq~<li><a href="$useropts{'folder'}/list-teams">Teams</a></li>~ if $glod_user_level >= 5 ;
|
||||||
|
$manage_cities = qq~<li><a href="$useropts{'folder'}/list-cities">Cities</a></li>~ ;
|
||||||
|
$manage_organisations = qq~<li><a href="$useropts{'folder'}/list-venue">Venue</a></li>~ ;
|
||||||
|
$manage_sport_types = qq~<li><a href="$useropts{'folder'}/list-sport-types">Sport Types</a></li> ~;
|
||||||
|
$manage_logistics_suppliers = qq~<li><a href="$useropts{'folder'}/list-logistics-suppliers">Logistics Suppliers</a></li>~ ;
|
||||||
|
$manage_logistics_items = qq~<li><a href="$useropts{'folder'}/list-logistics-items">Logistics Items</a></li> ~;
|
||||||
|
$manage_logistics_locations = qq~<li><a href="$useropts{'folder'}/list-logistics-locations">Logistics Locations</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
# $manage_fixedsystem = qq~<li><a href="$useropts{'folder'}/fixed-systems-report">Fixed System</a></li><li class="divider"></li>~ ;
|
||||||
|
|
||||||
|
$quote_search_menu_top = qq~<li>
|
||||||
|
<form class="navbar-search pull-left" method="post" action="/search-event-quotes">
|
||||||
|
<input placeholder="Event Nr Search" class="search-query form-control col-md-10" name="quote_nr" type="text">
|
||||||
|
<input name="iaction" type="hidden" value="report">
|
||||||
|
</form>
|
||||||
|
</li>~;
|
||||||
|
|
||||||
|
# $reports_monitor_report = qq~<li><a href="$useropts{'folder'}/monitor-report">Monitor Report</a></li>~ ;
|
||||||
|
# $reports_temp_calibration = qq~<li><a href="$useropts{'folder'}/temp-calibration-report">Temp Calibration Report</a></li>~ ;
|
||||||
|
|
||||||
|
# $accounts_menu_top = qq~<li class="dropdown">
|
||||||
|
# <a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-bank"></span>Accounts <span class="caret"></span></a>
|
||||||
|
# <ul class="dropdown-menu" role="menu">
|
||||||
|
# $manage_event_invoicing
|
||||||
|
# $manage_operator_payments
|
||||||
|
# $manage_monitor_payments
|
||||||
|
# $manage_temp_calibrator_payments
|
||||||
|
# $manage_logistics_payments_report
|
||||||
|
# $manage_logistics_shipment_costs_report
|
||||||
|
# </ul>
|
||||||
|
# </li>~;
|
||||||
|
$accounts_menu_top = qq~
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Accounts</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$manage_event_invoicing
|
||||||
|
$manage_operator_payments
|
||||||
|
$manage_monitor_payments
|
||||||
|
$manage_troubleshoot_monitor_payments
|
||||||
|
$manage_temp_calibrator_payments
|
||||||
|
$manage_logistics_payments_report
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($events_limit{$username}) {
|
||||||
|
$events_reports = qq~<li class="divider"></li>
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Events Reports</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($pixellot_limit{$username} || $usertype eq 'external') {
|
||||||
|
$events_filter = '' ;
|
||||||
|
$reports_event_quotes = '' ;
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$reports_management_report = '' ;
|
||||||
|
$logistics_costs_report = '' ;
|
||||||
|
$events_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($events_limit{$username}) {
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level < 5) {
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reports_menu_top = qq~<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-charts"></span>Reports <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$report_audit_trial
|
||||||
|
$reports_active_camera
|
||||||
|
$reports_stock_report
|
||||||
|
$reports_delivered_report
|
||||||
|
$reports_warranty_report
|
||||||
|
$reports_match_credits
|
||||||
|
$reports_event_quotes
|
||||||
|
$reports_management_report
|
||||||
|
$logistics_costs_report
|
||||||
|
$events_reports
|
||||||
|
$accounts_menu_top
|
||||||
|
$analytics_reports
|
||||||
|
</ul>
|
||||||
|
</li>~;
|
||||||
|
|
||||||
|
$schedule_menu_top = qq~<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-list-numbered"></span>Allocations <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$reports_monitor_report
|
||||||
|
$reports_temp_calibration
|
||||||
|
$reports_troubleshoot_monitor_report
|
||||||
|
$reports_site_surveys
|
||||||
|
$reports_set_up_groups
|
||||||
|
$mobile_tracking_system
|
||||||
|
</ul>
|
||||||
|
</li>~;
|
||||||
|
#
|
||||||
|
|
||||||
|
# $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
my $pre_sales_and_sales_menu_top = ($glod_user_level >= 5 || $usertype eq 'support') ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-money"></span>Pre-Sales & Sales <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/filter-demos">Demos</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
# $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
# # if ($useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} || $useropts{tickets}{$username}) {
|
||||||
|
# my $msgtxt = ($activetickets > 1) ? 'messages' : 'message' ;
|
||||||
|
# my $notif = ($activetickets > 0) ? qq~<span class="notification red" style="font-size:11px;">$activetickets</span>~ : '' ;
|
||||||
|
# my $tooltip = ($activetickets > 0) ? qq~data-toggle="tooltip" data-title="$activetickets new $msgtxt" data-placement="left"~ : '' ;
|
||||||
|
# my $top = ($activetickets > 0) ? '10px' : '6px' ;
|
||||||
|
# $tickets_menu_top = qq~<div class="fleft top-block" style="margin:$top 15px 0 0;padding-bottom:2px;" $tooltip>
|
||||||
|
# <a href="/active-tickets">
|
||||||
|
# <i class="glyphicon glyphicon-envelope" style="font-size:18px;"></i>
|
||||||
|
# $notif
|
||||||
|
# </a>
|
||||||
|
# </div>~ ;
|
||||||
|
# # }
|
||||||
|
|
||||||
|
if ($useropts{tickets}{$username} || $usertype eq 'nonquotes') {
|
||||||
|
$search_menu_top = '' ;
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
$manage_price_list_menu = '' ;
|
||||||
|
$manage_price_list_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($usertype eq 'schools_manager') {
|
||||||
|
if ($glod_user_level < 3) {
|
||||||
|
$home_menu_top = '' ;
|
||||||
|
$search_menu_top = '' ;
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$documents_menu_top = '' ;
|
||||||
|
# $calendar_menu_top = '' ;
|
||||||
|
$reports_menu_top = '' ;
|
||||||
|
$schedule_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
$manage_price_list_menu_top = '' ;
|
||||||
|
# $manage_logistics_report_menu_top = '' ;
|
||||||
|
$quote_search_menu_top = '' ;
|
||||||
|
# unless ($usertype eq 'support') {
|
||||||
|
if (($usertype eq 'schools_manager' || $glod_user_level < 2) && !$is_temp_calibrator) {
|
||||||
|
$calibration_menu_top = '' ;
|
||||||
|
# $fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_operator) {
|
||||||
|
$events_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
$reports_event_quotes = '' ;
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$reports_menu_top = '' ;
|
||||||
|
# $schedule_menu_top = '' ;
|
||||||
|
$reports_management_report = '' ;
|
||||||
|
$logistics_costs_report = '' ;
|
||||||
|
# $calibration_menu_top = '' ;
|
||||||
|
|
||||||
|
if ($glod_user_level == 3) {
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_installation_partner) {
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$events_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_temp_calibrator) {
|
||||||
|
$fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_dcb_partner) {
|
||||||
|
$events_menu_top = '' ;
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $section_1 = ($manage_camera_systems_menu || $manage_customers_menu || $manage_quote_defaults_menu || $manage_price_list_menu || $rma_list_menu || $manage_leave_menu) ? qq~
|
||||||
|
$manage_camera_systems_menu
|
||||||
|
$manage_customers_menu
|
||||||
|
$manage_quote_defaults_menu
|
||||||
|
$manage_price_list_menu
|
||||||
|
$rma_list_menu
|
||||||
|
$manage_leave_menu
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $users_section = ($manage_users_menu || $manage_analytics_client_menu || $manage_coding_providers_menu || $manage_installation_partners_menu || $manage_operators_menu || $manage_school_managers_menu) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Users</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$manage_users_menu
|
||||||
|
$manage_analytics_client_menu
|
||||||
|
$manage_coding_providers_menu
|
||||||
|
$manage_installation_partners_menu
|
||||||
|
$manage_operators_menu
|
||||||
|
$manage_school_managers_menu
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $credits_section = ($glod_user_level >= 5) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Credits</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/list-allocate-credits">Allocate Credits</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-credits-bought">Credits Bought</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-live-reacon">Live Reacon</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $section4 = ($manage_regions || $manage_cities || $manage_organisations || $manage_teams || $manage_sport_types) ? qq~
|
||||||
|
$manage_regions
|
||||||
|
$manage_cities
|
||||||
|
$manage_organisations
|
||||||
|
$manage_teams
|
||||||
|
$manage_sport_types
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $event_specifics = ($username eq 'handre' || $username eq 'rory' || $username eq 'vivian' || $usertype eq 'schools_manager' || $usertype eq 'manager' || $usertype eq 'senior_manager') ? qq~
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Event Specifics</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/list-pocs">POCs</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-recipients">Recipients</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
my $logistics_sub_menu = ($manage_logistics_suppliers || $manage_logistics_items || $manage_logistics_locations) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Logistics</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$manage_logistics_suppliers
|
||||||
|
$manage_logistics_items
|
||||||
|
$manage_logistics_locations
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $calibration_status_report = ($calibration_menu_top || $usertype eq 'support') ? qq~<li><a href="$useropts{'folder'}/calibration-status-report">Calibration Status Report</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
$calibration_menu_top = qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/calibration-report">Calibration Report</a></li>
|
||||||
|
$calibration_status_report
|
||||||
|
</ul>
|
||||||
|
</li>~ if $calibration_menu_top ;
|
||||||
|
|
||||||
|
$calibration_menu_top = qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$calibration_status_report
|
||||||
|
</ul>
|
||||||
|
</li>~ if $calibration_status_report && !$calibration_menu_top ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- The styles -->
|
||||||
|
<link href="$useropts{'css'}/bootstrap-itv.min.css?1.0" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/custom-itv.css" rel="stylesheet">
|
||||||
|
$extra_css
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.print.css" rel='stylesheet' media='print'>
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/bootstrap-tour/build/css/bootstrap-tour.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.noty.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/noty_theme_default.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.iphone.toggle.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/uploadify.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/animate.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-dialog.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-datetimepicker.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
$typeahead_css
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- The fav icon -->
|
||||||
|
<link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$fullcalendar_events
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body $onload>
|
||||||
|
<!-- topbar starts -->
|
||||||
|
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<button type="button" class="navbar-toggle pull-left animated flip">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="/"> <img class="logfav" alt="ITV Logo" src="$useropts{'img'}/50_ITV.png" class="hidden-xs"/>
|
||||||
|
<!-- <span><img class="logotext" alt="ITV Admin Text" src="$useropts{'img'}/headerFinal.png" class="hidden-xs"/></span></a> -->
|
||||||
|
</a>
|
||||||
|
<!-- user dropdown starts -->
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
$tickets_menu_top
|
||||||
|
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<i class="glyphicon glyphicon-user"></i><span class="hidden-sm hidden-xs"> admin</span>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$section_1
|
||||||
|
$users_section
|
||||||
|
$credits_section
|
||||||
|
$manage_event_systems
|
||||||
|
$section4
|
||||||
|
$logistics_sub_menu
|
||||||
|
$event_specifics
|
||||||
|
<li><a href="/logout">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- user dropdown ends -->
|
||||||
|
|
||||||
|
<ul class="collapse navbar-collapse nav navbar-nav top-menu">
|
||||||
|
$home_menu_top
|
||||||
|
$search_menu_top
|
||||||
|
$quotes_menu_top
|
||||||
|
$events_menu_top
|
||||||
|
$analytics_menu_top
|
||||||
|
$cameras_menu_top
|
||||||
|
$documents_menu_top
|
||||||
|
$calendar_menu_top
|
||||||
|
$reports_menu_top
|
||||||
|
$calibration_menu_top
|
||||||
|
$fixedsystem_menu_top
|
||||||
|
$manage_logistics_report_menu_top
|
||||||
|
$schedule_menu_top
|
||||||
|
$pre_sales_and_sales_menu_top
|
||||||
|
$quote_search_menu_top
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="height:69px;"></div>
|
||||||
|
<!-- topbar ends -->
|
||||||
|
<div class="ch-container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<!-- left menu starts -->
|
||||||
|
<div class="col-sm-2 col-lg-2" id="leftsidebar">
|
||||||
|
<div class="sidebar-nav">
|
||||||
|
<div class="nav-canvas">
|
||||||
|
<div class="nav-sm nav nav-stacked">
|
||||||
|
</div>
|
||||||
|
<ul class="nav nav-pills nav-stacked main-menu">
|
||||||
|
<li class="nav-header"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/span-->
|
||||||
|
<!-- left menu ends -->
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<div class="alert alert-block col-md-12">
|
||||||
|
<h4 class="alert-heading">Warning!</h4>
|
||||||
|
|
||||||
|
<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
|
||||||
|
enabled to use this site.</p>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
65
libs/html/_FromProd/index.pm
Normal file
65
libs/html/_FromProd/index.pm
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
local $index_menu = qq~<div class="col-md-8">
|
||||||
|
<div class="dash-tray">
|
||||||
|
<a href="$useropts{'folder'}/search-cameras">
|
||||||
|
<div><i class="glyphicons glyphicons-security-camera" title="Cameras" data-toggle="tooltip" data-placement="left"></i></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>~ ;
|
||||||
|
|
||||||
|
if (substr($usertype,0,6) eq 'casual') {
|
||||||
|
$index_menu = qq~<div class="col-md-8">
|
||||||
|
<div class="dash-tray">
|
||||||
|
<a href="$useropts{'folder'}/calendar">
|
||||||
|
<div><i class="glyphicons glyphicons-calendar" title="Calendar" data-toggle="tooltip" data-placement="left"></i></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-home"></i> Dashboard</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="row"><div class="col-md-12"> </div></div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2"> </div>
|
||||||
|
$index_menu
|
||||||
|
<div class="col-md-2"> </div>
|
||||||
|
</div>
|
||||||
|
<div class="row"><div class="col-md-12"> </div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!--/row-->
|
||||||
|
|
||||||
|
<!-- content ends -->
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$chart_js
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
@ -63,16 +63,18 @@ print <<ENDOFTEXT;
|
||||||
</div><!--/.fluid-container-->
|
</div><!--/.fluid-container-->
|
||||||
|
|
||||||
<script src="$useropts{'js'}/jquery-1.4.4.min.js"></script>
|
<script src="$useropts{'js'}/jquery-1.4.4.min.js"></script>
|
||||||
<script type="text/javascript" src="$useropts{'js'}/login.js"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
try {
|
try {
|
||||||
parent.reloadForLogin();
|
parent.reloadForLogin();
|
||||||
parent.BootstrapDialog.closeAll();
|
parent.BootstrapDialog.closeAll();
|
||||||
}
|
}
|
||||||
catch(err) { // do nothing
|
catch(err) { // do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var scripts = '$useropts{'scripts'}' ;
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/javascript" src="$useropts{'js'}/login.js"></script>
|
||||||
|
|
||||||
<div style="position:absolute;right:10px;bottom:10px;"><a href="https://kre8it.co.za" target="_blank" style="color:#ded6d6;">Built by Kre8IT Programming</a></div>
|
<div style="position:absolute;right:10px;bottom:10px;"><a href="https://kre8it.co.za" target="_blank" style="color:#ded6d6;">Built by Kre8IT Programming</a></div>
|
||||||
|
|
||||||
|
|
|
||||||
23
libs/html/_FromProd/redirect.pm
Normal file
23
libs/html/_FromProd/redirect.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#quotelist').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="listquotes" id="quotelist" method="post" action="/list-event-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="list">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/redirectcalibrator.pm
Normal file
23
libs/html/_FromProd/redirectcalibrator.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/calibration-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/redirectfixed.pm
Normal file
23
libs/html/_FromProd/redirectfixed.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/fixed-systems-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/redirectlogistics.pm
Normal file
23
libs/html/_FromProd/redirectlogistics.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/logistics-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/tickets.pm
Normal file
23
libs/html/_FromProd/tickets.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#activetickets').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" id="activetickets" method="post" action="/active-tickets">
|
||||||
|
<input type="hidden" name="iaction" value="active">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
99
libs/html/_FromProd/v1.0/401.pm
Normal file
99
libs/html/_FromProd/v1.0/401.pm
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link href='http://fonts.googleapis.com/css?family=Creepster|Audiowide' rel='stylesheet' type='text/css'>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: arial, helvetica, sans-serif;
|
||||||
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAUElEQVQYV2NkYGAwBuKzQAwDID4IoIgxIikAMZE1oRiArBDdZBSNMIXoJiFbDZYDKcSmCOYimDuNSVKIzRNYrUYOFuQgweoZbIoxgoeoAAcAEckW11HVTfcAAAAASUVORK5CYII=) repeat;
|
||||||
|
background-color: #212121;
|
||||||
|
color: white;
|
||||||
|
font-size: 28px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-code {
|
||||||
|
font-family: 'Creepster', cursive, arial, helvetica, sans-serif;
|
||||||
|
font-size: 200px;
|
||||||
|
color: white;
|
||||||
|
color: rgba(255, 255, 255, 0.98);
|
||||||
|
width: 50%;
|
||||||
|
text-align: right;
|
||||||
|
margin-top: 5%;
|
||||||
|
text-shadow: 5px 5px hsl(0, 0%, 25%);
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-found {
|
||||||
|
font-family: 'Audiowide', cursive, arial, helvetica, sans-serif;
|
||||||
|
width: 45%;
|
||||||
|
float: right;
|
||||||
|
margin-top: 5%;
|
||||||
|
font-size: 50px;
|
||||||
|
color: white;
|
||||||
|
text-shadow: 2px 2px 5px hsl(0, 0%, 61%);
|
||||||
|
padding-top: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear {
|
||||||
|
float: none;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
text-align: center;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=text] {
|
||||||
|
border: hsl(247, 89%, 72%) solid 1px;
|
||||||
|
outline: none;
|
||||||
|
padding: 5px 3px;
|
||||||
|
font-size: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #9ECDFF;
|
||||||
|
text-shadow: 0px 0px 2px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<title>Error</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p class="error-code">
|
||||||
|
401
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="not-found">Unauthorised</p>
|
||||||
|
|
||||||
|
<div class="clear"></div>
|
||||||
|
<div class="content">
|
||||||
|
You are not authorised to view this page
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<a href="/">Click here to go back to your Dashboard</a>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
42
libs/html/_FromProd/v1.0/_blank.pm
Normal file
42
libs/html/_FromProd/v1.0/_blank.pm
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-$glyphicon"></i> $page_title</h2>
|
||||||
|
$box_icon
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
$print_box_content_rows
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!--/row-->
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
32
libs/html/_FromProd/v1.0/_blank_3.pm
Normal file
32
libs/html/_FromProd/v1.0/_blank_3.pm
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_box_content_rows
|
||||||
|
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
88
libs/html/_FromProd/v1.0/_blank_4.pm
Normal file
88
libs/html/_FromProd/v1.0/_blank_4.pm
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
# require header ;
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- The styles -->
|
||||||
|
<link href="$useropts{'css'}/bootstrap-itv.min.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/custom-itv.css" rel="stylesheet">
|
||||||
|
$extra_css
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.print.css" rel='stylesheet' media='print'>
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/bootstrap-tour/build/css/bootstrap-tour.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.noty.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/noty_theme_default.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.iphone.toggle.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/uploadify.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/animate.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-dialog.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-datetimepicker.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
$typeahead_css
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- The fav icon -->
|
||||||
|
<link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$fullcalendar_events
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body $onload>
|
||||||
|
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_box_content_rows
|
||||||
|
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
|
||||||
|
$print_more_boxes
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$print_footer_jscript
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
$print_footer_forms
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
26
libs/html/_FromProd/v1.0/_return.pm
Normal file
26
libs/html/_FromProd/v1.0/_return.pm
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
unless ($goaction) { $goaction = 'list' ; }
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#list-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="listform" id="list-form" method="post" action="admin-$goaction-$lcpage\s">
|
||||||
|
<input type="hidden" name="iaction" value="$goaction">
|
||||||
|
<input type="hidden" name="isaved" value="$success">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
95
libs/html/_FromProd/v1.0/archive.pm
Normal file
95
libs/html/_FromProd/v1.0/archive.pm
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
$alert
|
||||||
|
|
||||||
|
$print_usage
|
||||||
|
|
||||||
|
$print_download
|
||||||
|
|
||||||
|
$print_delete_uploads_form
|
||||||
|
|
||||||
|
$print_buttons
|
||||||
|
|
||||||
|
<!-- content ends -->
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<style>
|
||||||
|
.progress { height: 30px; }
|
||||||
|
.progress .progress-bar {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function zipDelete ()
|
||||||
|
{
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'Confirm Delete',
|
||||||
|
message: 'Are you sure you want to delete <b>' + \$("#selectZip").val() + '</b> uploads?',
|
||||||
|
type: BootstrapDialog.TYPE_WARNING,
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
\$('#delete-uploads-selection').val(\$("#selectZip").val());
|
||||||
|
\$('#delete-uploads-form').submit();
|
||||||
|
BootstrapDialog.closeAll() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function zipUploads ()
|
||||||
|
{
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'Confirm Zip',
|
||||||
|
message: 'Are you sure you want to ZIP and send <b>' + \$("#selectZip").val() + '</b>!',
|
||||||
|
type: BootstrapDialog.TYPE_WARNING,
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
\$('#zip-uploads-selection').val(\$("#selectZip").val());
|
||||||
|
\$('#zip-form').submit();
|
||||||
|
BootstrapDialog.closeAll() ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$download_zip_after_delete
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form role="form" id="delete-uploads-form" method="post">
|
||||||
|
<input type="hidden" name="iaction" value="deluploads">
|
||||||
|
<input type="hidden" name="izip" value="" id="delete-uploads-selection">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" name="zip" id="zip-form" method="post">
|
||||||
|
<input type="hidden" name="iaction" value="zip">
|
||||||
|
<input type="hidden" name="izip" value="" id="zip-uploads-selection">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" id="open-zip" action="$g_archiveziplink" target="_blank">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
37
libs/html/_FromProd/v1.0/calendar.pm
Normal file
37
libs/html/_FromProd/v1.0/calendar.pm
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-calendar"></i> Calendar</h2>
|
||||||
|
$box_icon
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
<div id="calendar" class="fc fc-ltr"></div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/fixedsystems.pm
Normal file
23
libs/html/_FromProd/v1.0/fixedsystems.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/fixed-systems-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
103
libs/html/_FromProd/v1.0/footer.pm
Normal file
103
libs/html/_FromProd/v1.0/footer.pm
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<footer class="row">
|
||||||
|
<p class="col-md-9 col-sm-9 col-xs-12 copyright">© <a href="http://itvadmin.co.za" target="_blank">$useropts{short}</a></p>
|
||||||
|
|
||||||
|
<p class="col-md-3 col-sm-3 col-xs-12 powered-by"><a href="http://kre8it.co.za" target="_blank">Kre8IT Programming (Pty) Ltd</a><br>062 133 6754<br><a href="mailto:info\@kre8it.co.za">info\@kre8it.co.za</a></p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div><!--/.fluid-container-->
|
||||||
|
|
||||||
|
<!-- external javascript -->
|
||||||
|
|
||||||
|
<script src="$useropts{'bower_components'}/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- library for cookie management -->
|
||||||
|
<script src="$useropts{'js'}/jquery.cookie.js"></script>
|
||||||
|
<!-- calender plugin -->
|
||||||
|
<script src="$useropts{'bower_components'}/moment/min/moment.min.js"></script>
|
||||||
|
<script src="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.min.js"></script>
|
||||||
|
<!-- data table plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.dataTables.min.js"></script>
|
||||||
|
<!-- select or dropdown enhancer -->
|
||||||
|
<script src="$useropts{'bower_components'}/chosen/chosen.jquery.min.js"></script>
|
||||||
|
<!-- plugin for gallery image view -->
|
||||||
|
<script src="$useropts{'bower_components'}/colorbox/jquery.colorbox-min.js"></script>
|
||||||
|
<!-- notification plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.noty.js"></script>
|
||||||
|
<!-- library for making tables responsive -->
|
||||||
|
<script src="$useropts{'bower_components'}/responsive-tables/responsive-tables.js"></script>
|
||||||
|
<!-- tour plugin -->
|
||||||
|
<script src="$useropts{'bower_components'}/bootstrap-tour/build/js/bootstrap-tour.min.js"></script>
|
||||||
|
<!-- star rating plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.raty.min.js"></script>
|
||||||
|
<!-- for iOS style toggle switch -->
|
||||||
|
<script src="$useropts{'js'}/jquery.iphone.toggle.js"></script>
|
||||||
|
<!-- autogrowing textarea plugin -->
|
||||||
|
<script src="$useropts{'js'}/jquery.autogrow-textarea.js"></script>
|
||||||
|
<!-- history.js for cross-browser state change on ajax -->
|
||||||
|
<script src="$useropts{'js'}/jquery.history.js"></script>
|
||||||
|
<!-- application script for Charisma demo -->
|
||||||
|
<script src="$useropts{'js'}/charisma.js"></script>
|
||||||
|
<!-- application script for bootstrap dialog customisation -->
|
||||||
|
<script src="$useropts{'js'}/bootstrap-dialog.js"></script>
|
||||||
|
<script src="$useropts{'js'}/bootstrap-datetimepicker.min.js"></script>
|
||||||
|
<script src="$useropts{'js'}/bootstrap-datepicker.js"></script>
|
||||||
|
<script src="$useropts{'js'}/jquery.form-validator.min.js"></script>
|
||||||
|
$extra_js
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$.validate();
|
||||||
|
|
||||||
|
function dlgMdl(url,titl,cssfh,csscl){
|
||||||
|
// if (!cssfh) { cssfh = 'height:' + (screen.height - (screen.height / 3) - 30) + 'px' }
|
||||||
|
if (!cssfh) { cssfh = 'height:' + (\$(window).height() * 0.87) + 'px' }
|
||||||
|
BootstrapDialog.show({
|
||||||
|
title: titl,
|
||||||
|
message: \$('<iframe src="' + url + '" style="position:relative;background-color:transparent;border:0px;width:100%;' + cssfh + ';" frameborder="0"></iframe>') ,
|
||||||
|
cssClass: csscl
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function editQuote (id)
|
||||||
|
{
|
||||||
|
\$('#quote-edit-id').val(id);
|
||||||
|
\$('#quote-edit-form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
function editEventQuote (id)
|
||||||
|
{
|
||||||
|
\$('#event-quote-edit-id').val(id);
|
||||||
|
\$('#event-quote-edit-form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
\$('[data-toggle="tooltip"]').tooltip({html:true}) ;
|
||||||
|
|
||||||
|
\$(document).ready(function(){ $trigger_jquery });
|
||||||
|
|
||||||
|
$trigger_jquery_raw
|
||||||
|
|
||||||
|
function sendEmail(inv,mnid) {
|
||||||
|
dlgMdl("$useropts{'scripts'}/dialog/email.pl?"+inv+"&"+mnid,"Pre-alert",'height:550px;','') ;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form role="form" id="quote-edit-form" method="post" action="$useropts{'folder'}/edit-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="edit">
|
||||||
|
<input type="hidden" name="id" id="quote-edit-id" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form role="form" id="event-quote-edit-form" method="post" action="$useropts{'folder'}/edit-event-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="edit">
|
||||||
|
<input type="hidden" name="id" id="event-quote-edit-id" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
$extra_form_footer
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
||||||
|
# <!-- multiple file upload plugin -->
|
||||||
|
# <script src="$useropts{'js'}/jquery.uploadify-3.1.min.js"></script>
|
||||||
618
libs/html/_FromProd/v1.0/header.pm
Normal file
618
libs/html/_FromProd/v1.0/header.pm
Normal file
|
|
@ -0,0 +1,618 @@
|
||||||
|
|
||||||
|
my $manage_quote_defaults_menu = '' ;
|
||||||
|
my $manage_price_list_menu = '' ;
|
||||||
|
|
||||||
|
my $rma_list_menu = ($usertype eq 'it' || $usertype eq 'senior_manager' || $usertype eq 'manager' || $usertype eq 'support' || $usertype eq 'casual_c') ? qq~<li><a href="$useropts{'folder'}/list-rma">RMA List</a></li>~ : '' ;
|
||||||
|
|
||||||
|
my $manage_price_list_menu_top = '' ;
|
||||||
|
|
||||||
|
my $manage_logistics_report_menu_top = qq~<li><a href="$useropts{'folder'}/logistics-report"><i class="glyphicons glyphicons-transfer"></i>Logistics</a></li>~ ;
|
||||||
|
my $manage_leave_menu = '' ;
|
||||||
|
my $reports_menu_top = '' ;
|
||||||
|
my $accounts_menu_top = '' ;
|
||||||
|
|
||||||
|
my $analytics_reports = ($glod_user_level >= 5) ? qq~
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Analytics</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/fixtures-report">Fixtures Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
my $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
my $fixedsystem_menu_top = qq~<li><a href="$useropts{'folder'}/fixed-systems-report"><i class="glyphicon glyphicon-indent-left"></i>Fixed System</a></li>~ ;
|
||||||
|
my $home_menu_top = '' ;
|
||||||
|
my $search_menu_top = '' ;
|
||||||
|
my $quotes_menu_top = '' ;
|
||||||
|
my $events_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
# my $analytics_menu_top = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/filter-analytics-event-bookings"><i class="glyphicon glyphicon-th-list"></i> Analytics</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
|
||||||
|
my $analytics_menu_top = ($glod_user_level >= 5) ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Analytics <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/filter-analytics-event-credits">Credits</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# my $events_filter = qq~<li><a href="$useropts{'folder'}/filter-event-quotes">Search Events</a></li>~;
|
||||||
|
# my $events_systems = '' ;
|
||||||
|
my $cameras_menu_top = qq~<li><a href="$useropts{'folder'}/search-cameras"><i class="glyphicon glyphicon-camera"></i> Cameras</a></li>~;
|
||||||
|
my $documents_menu_top = '' ;
|
||||||
|
my $calendar_menu_top = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
|
||||||
|
my $manage_camera_systems_menu = '' ;
|
||||||
|
my $manage_users_menu = '' ;
|
||||||
|
my $manage_operators_menu = '' ;
|
||||||
|
my $manage_installation_partners_menu = '' ;
|
||||||
|
my $manage_analytics_client_menu = '' ;
|
||||||
|
my $manage_coding_providers_menu = '' ;
|
||||||
|
my $manage_customers_menu = '' ;
|
||||||
|
my $manage_archive_menu = '' ;
|
||||||
|
my $manage_event_systems = '' ;
|
||||||
|
my $manage_logistics_suppliers = '' ;
|
||||||
|
my $manage_logistics_locations = '' ;
|
||||||
|
my $manage_logistics_items = '' ;
|
||||||
|
my $manage_sport_types = '' ;
|
||||||
|
my $manage_cities = '' ;
|
||||||
|
my $manage_organisations = '' ;
|
||||||
|
my $manage_regions = '' ;
|
||||||
|
my $manage_teams = '' ;
|
||||||
|
my $manage_operator_payments = '' ;
|
||||||
|
my $manage_monitor_payments = '' ;
|
||||||
|
my $manage_troubleshoot_monitor_payments = '' ;
|
||||||
|
my $manage_temp_calibrator_payments = '' ;
|
||||||
|
my $manage_event_invoicing = '' ;
|
||||||
|
my $manage_logistics_report = '' ;
|
||||||
|
|
||||||
|
my $manage_logistics_payments_report = '' ;
|
||||||
|
my $manage_logistics_shipment_costs_report = '' ;
|
||||||
|
|
||||||
|
my $quote_search_menu_top = '' ;
|
||||||
|
my $reports_event_quotes = qq~<li><a href="$useropts{'folder'}/event-quotes-report">Event Quotes Report</a></li>~;
|
||||||
|
my $reports_management_report = '' ;
|
||||||
|
my $logistics_costs_report = '' ;
|
||||||
|
my $events_reports = '' ;
|
||||||
|
my $reports_active_camera = '' ;
|
||||||
|
my $reports_active_camera = qq~<li><a href="$useropts{'folder'}/cameras-report">Active Cameras Report</a></li>~;
|
||||||
|
# my $reports_stock_report = '' ;
|
||||||
|
my $reports_delivered_report = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
|
||||||
|
# my $reports_delivered_report = '' ;
|
||||||
|
my $reports_warranty_report = '' ;
|
||||||
|
my $reports_match_credits = '' ;
|
||||||
|
my $manage_fixedsystem = '' ;
|
||||||
|
# my $monitor_report_menu_top = qq~<li><a href="$useropts{'folder'}/monitor-report"><i class="glyphicons glyphicons-eye"></i>Monitor Report</a></li>~ ;
|
||||||
|
|
||||||
|
my $schedule_menu_top = '' ;
|
||||||
|
my $reports_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/monitoring-report">Monitor Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_temp_calibration = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/temp-calibrator-report">Temp Calibrator Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_troubleshoot_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/troubleshoot-monitoring-report">Troubleshoot Monitor Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_site_surveys = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-site-surveys-report">Mobile Site Surveys</a></li>~ : '' ;
|
||||||
|
my $reports_set_up_groups = ($glod_user_level >= 2) ? qq~<li><a href="$useropts{'folder'}/set-up-groups-report">Set Up Groups</a></li>~ : '' ;
|
||||||
|
my $mobile_tracking_system = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-system-tracking-report">Mobile System Tracking</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
my $report_audit_trial = ($glod_user_level > 3) ? qq~<li><a href="$useropts{'folder'}/search-audit-trial">Audit Trial</a></li>~ : '' ;
|
||||||
|
|
||||||
|
if ($useropts{super}{$username} and $pixellot_limit{$username}!=1 and $events_limit{$username}!=1) {
|
||||||
|
# $manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-defaults">Quote Defaults</a></li>~ ;
|
||||||
|
$manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-notes">Quote Defaults</a></li>~ ;
|
||||||
|
$manage_price_list_menu = qq~<li><a href="$useropts{'folder'}/summary-price-list">Price List</a></li>~ ;
|
||||||
|
$manage_price_list_menu_top = qq~<li><a href="$useropts{'folder'}/summary-price-list"><i class="glyphicon glyphicon-list"></i> Price List</a></li>~ ;
|
||||||
|
# $manage_leave_menu = qq~<li class="divider"></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/list-leave">List Leave</a></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/list-leave-settings">Leave Settings</a></li>
|
||||||
|
# <li><a href="$useropts{'folder'}/leave-report">Leave Report</a></li>~ ;
|
||||||
|
|
||||||
|
# $events_systems = qq~<li><a href="$useropts{'folder'}/list-event-systems"> Event Systems</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
# unless ($pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager') {
|
||||||
|
if ($glod_user_level >= 4) {
|
||||||
|
$reports_stock_report = qq~<li><a href="$useropts{'folder'}/stock-report">Stock Report</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level >= 5) {
|
||||||
|
# $reports_delivered_report = qq~<li><a href="$useropts{'folder'}/delivered-report">Delivered Report</a></li>~;
|
||||||
|
$reports_warranty_report = qq~<li><a href="$useropts{'folder'}/warranty-report">Extended Warranty Report</a></li>~;
|
||||||
|
$reports_match_credits = qq~<li><a href="$useropts{'folder'}/match-credits-report">Match Credits Report</a></li>~;
|
||||||
|
$reports_management_report = qq~<li><a href="$useropts{'folder'}/management-report">Management Report</a></li>~;
|
||||||
|
$logistics_costs_report = qq~<li><a href="$useropts{'folder'}/logistics-costs-report">Logistics Costs Report</a></li>~;
|
||||||
|
# $reports_operators_report = qq~<li><a href="$useropts{'folder'}/operators-report">Operators Report</a></li>~;
|
||||||
|
$events_reports = qq~<li class="divider"></li>
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Events Reports</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-report">Operators Payments Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
$home_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-home"></i></a></li>~;
|
||||||
|
# $search_menu_top = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-search"></i> Search</a></li>~;
|
||||||
|
$quotes_menu_top = qq~<li><a href="$useropts{'folder'}/search-quotes"><i class="glyphicon glyphicon-th-large"></i> Quotes</a></li>~ unless $usertype eq 'manager' ;
|
||||||
|
# $documents_menu_top = qq~<li><a href="$useropts{'folder'}/search-documents"><i class="glyphicon glyphicon-list-alt"></i> Documents</a></li>~;
|
||||||
|
# $calendar_menu_top = qq~<li><a href="$useropts{'folder'}/calendar"><i class="glyphicon glyphicon-calendar"></i> Calendar</a></li>~;
|
||||||
|
|
||||||
|
$manage_camera_systems_menu = qq~<li><a href="$useropts{'folder'}/list-camera-systems">Camera Systems</a></li>~;
|
||||||
|
$manage_users_menu = qq~<li><a href="$useropts{'folder'}/list-users">All Users</a></li>~;
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
$manage_school_managers_menu = qq~<li><a href="$useropts{'folder'}/list-school-managers">School Managers</a></li>~;
|
||||||
|
|
||||||
|
$manage_installation_partners_menu = qq~<li><a href="$useropts{'folder'}/list-installation-partners">Installation Partners</a></li>~;
|
||||||
|
$manage_analytics_client_menu = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-analytics-clients">Analytics Clients</a></li>~ : qq~~ ;
|
||||||
|
$manage_coding_providers_menu = ($glod_user_level >= 5) ? qq~<li><a href="$useropts{'folder'}/list-coding-providers">Coding Providers</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
# $manage_logistics_shipment_costs_report = qq~<li><a href="$useropts{'folder'}/list-logistics-shipment-costs">Logistics Shipment Costs</a></li>~ ;
|
||||||
|
|
||||||
|
$manage_customers_menu = qq~<li><a href="$useropts{'folder'}/list-customers">Customers</a></li>~;
|
||||||
|
$manage_archive_menu = qq~<li class="divider"></li><li><a href="/archive">Archive</a></li><li class="divider"></li>~;
|
||||||
|
$manage_event_systems = qq~<li><a href="$useropts{'folder'}/list-event-systems">Event Systems</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-event-types">Event Types</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-event-cost-items">Event Cost Items</a></li>
|
||||||
|
$manage_logistics_shipment_costs_report
|
||||||
|
<li class="divider"></li>~;
|
||||||
|
|
||||||
|
# $manage_logistics_report = qq~<li><a href="$useropts{'folder'}/logistics-report">Logistics Report</a></li>~ ;
|
||||||
|
$manage_event_invoicing = qq~<li><a href="$useropts{'folder'}/event-invoicing-report">Event Invoicing</a></li>~ ;
|
||||||
|
$manage_operator_payments = qq~<li><a href="$useropts{'folder'}/operator-payments">Operator Payments</a></li>~ ;
|
||||||
|
$manage_monitor_payments = qq~<li><a href="$useropts{'folder'}/monitor-payments-report">Monitor Payments</a></li>~ ;
|
||||||
|
$manage_troubleshoot_monitor_payments = qq~<li><a href="$useropts{'folder'}/troubleshoot-monitor-payments-report">Troubleshoot Monitor Payments</a></li>~ ;
|
||||||
|
$manage_temp_calibrator_payments = qq~<li><a href="$useropts{'folder'}/temp-calibrator-payments-report">Temp Calibrator Payments</a></li>~ ;
|
||||||
|
|
||||||
|
$manage_logistics_payments_report = qq~<li><a href="$useropts{'folder'}/logistics-payments">Logistics Payments</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
$manage_regions = qq~<li><a href="$useropts{'folder'}/list-regions">Regions</a></li>~ ;
|
||||||
|
$manage_teams = qq~<li><a href="$useropts{'folder'}/list-teams">Teams</a></li>~ if $glod_user_level >= 5 ;
|
||||||
|
$manage_cities = qq~<li><a href="$useropts{'folder'}/list-cities">Cities</a></li>~ ;
|
||||||
|
$manage_organisations = qq~<li><a href="$useropts{'folder'}/list-venue">Venue</a></li>~ ;
|
||||||
|
$manage_sport_types = qq~<li><a href="$useropts{'folder'}/list-sport-types">Sport Types</a></li> ~;
|
||||||
|
$manage_logistics_suppliers = qq~<li><a href="$useropts{'folder'}/list-logistics-suppliers">Logistics Suppliers</a></li>~ ;
|
||||||
|
$manage_logistics_items = qq~<li><a href="$useropts{'folder'}/list-logistics-items">Logistics Items</a></li> ~;
|
||||||
|
$manage_logistics_locations = qq~<li><a href="$useropts{'folder'}/list-logistics-locations">Logistics Locations</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
# $manage_fixedsystem = qq~<li><a href="$useropts{'folder'}/fixed-systems-report">Fixed System</a></li><li class="divider"></li>~ ;
|
||||||
|
|
||||||
|
$quote_search_menu_top = qq~<li>
|
||||||
|
<form class="navbar-search pull-left" method="post" action="/search-event-quotes">
|
||||||
|
<input placeholder="Event Nr Search" class="search-query form-control col-md-10" name="quote_nr" type="text">
|
||||||
|
<input name="iaction" type="hidden" value="report">
|
||||||
|
</form>
|
||||||
|
</li>~;
|
||||||
|
|
||||||
|
# $reports_monitor_report = qq~<li><a href="$useropts{'folder'}/monitor-report">Monitor Report</a></li>~ ;
|
||||||
|
# $reports_temp_calibration = qq~<li><a href="$useropts{'folder'}/temp-calibration-report">Temp Calibration Report</a></li>~ ;
|
||||||
|
|
||||||
|
# $accounts_menu_top = qq~<li class="dropdown">
|
||||||
|
# <a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-bank"></span>Accounts <span class="caret"></span></a>
|
||||||
|
# <ul class="dropdown-menu" role="menu">
|
||||||
|
# $manage_event_invoicing
|
||||||
|
# $manage_operator_payments
|
||||||
|
# $manage_monitor_payments
|
||||||
|
# $manage_temp_calibrator_payments
|
||||||
|
# $manage_logistics_payments_report
|
||||||
|
# $manage_logistics_shipment_costs_report
|
||||||
|
# </ul>
|
||||||
|
# </li>~;
|
||||||
|
$accounts_menu_top = qq~
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Accounts</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$manage_event_invoicing
|
||||||
|
$manage_operator_payments
|
||||||
|
$manage_monitor_payments
|
||||||
|
$manage_troubleshoot_monitor_payments
|
||||||
|
$manage_temp_calibrator_payments
|
||||||
|
$manage_logistics_payments_report
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($events_limit{$username}) {
|
||||||
|
$events_reports = qq~<li class="divider"></li>
|
||||||
|
<li class="dropdown-submenu">
|
||||||
|
<a tabindex="-1" href="#">Events Reports</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/events-summary-report">Event Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-booking-summary-report">Operators Booking Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-detailed-report">Costings Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/costings-summary-report">Costings Summary</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/events-detailed-report">Events Detailed</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/operators-summary-report">Operators Report</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
~;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($pixellot_limit{$username} || $usertype eq 'external') {
|
||||||
|
$events_filter = '' ;
|
||||||
|
$reports_event_quotes = '' ;
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$reports_management_report = '' ;
|
||||||
|
$logistics_costs_report = '' ;
|
||||||
|
$events_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($events_limit{$username}) {
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level < 5) {
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$reports_menu_top = qq~<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-charts"></span>Reports <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$report_audit_trial
|
||||||
|
$reports_active_camera
|
||||||
|
$reports_stock_report
|
||||||
|
$reports_delivered_report
|
||||||
|
$reports_warranty_report
|
||||||
|
$reports_match_credits
|
||||||
|
$reports_event_quotes
|
||||||
|
$reports_management_report
|
||||||
|
$logistics_costs_report
|
||||||
|
$events_reports
|
||||||
|
$accounts_menu_top
|
||||||
|
$analytics_reports
|
||||||
|
</ul>
|
||||||
|
</li>~;
|
||||||
|
|
||||||
|
$schedule_menu_top = qq~<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-list-numbered"></span>Allocations <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$reports_monitor_report
|
||||||
|
$reports_temp_calibration
|
||||||
|
$reports_troubleshoot_monitor_report
|
||||||
|
$reports_site_surveys
|
||||||
|
$reports_set_up_groups
|
||||||
|
$mobile_tracking_system
|
||||||
|
</ul>
|
||||||
|
</li>~;
|
||||||
|
#
|
||||||
|
|
||||||
|
# $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
|
||||||
|
my $pre_sales_and_sales_menu_top = ($glod_user_level >= 5 || $usertype eq 'support') ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicons glyphicons-money"></span>Pre-Sales & Sales <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/filter-demos">Demos</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
# $calibration_menu_top = qq~<li><a href="$useropts{'folder'}/calibration-report"><i class="glyphicon glyphicon-signal"></i> Calibration</a></li>~ ;
|
||||||
|
|
||||||
|
# # if ($useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} || $useropts{tickets}{$username}) {
|
||||||
|
# my $msgtxt = ($activetickets > 1) ? 'messages' : 'message' ;
|
||||||
|
# my $notif = ($activetickets > 0) ? qq~<span class="notification red" style="font-size:11px;">$activetickets</span>~ : '' ;
|
||||||
|
# my $tooltip = ($activetickets > 0) ? qq~data-toggle="tooltip" data-title="$activetickets new $msgtxt" data-placement="left"~ : '' ;
|
||||||
|
# my $top = ($activetickets > 0) ? '10px' : '6px' ;
|
||||||
|
# $tickets_menu_top = qq~<div class="fleft top-block" style="margin:$top 15px 0 0;padding-bottom:2px;" $tooltip>
|
||||||
|
# <a href="/active-tickets">
|
||||||
|
# <i class="glyphicon glyphicon-envelope" style="font-size:18px;"></i>
|
||||||
|
# $notif
|
||||||
|
# </a>
|
||||||
|
# </div>~ ;
|
||||||
|
# # }
|
||||||
|
|
||||||
|
if ($useropts{tickets}{$username} || $usertype eq 'nonquotes') {
|
||||||
|
$search_menu_top = '' ;
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
$manage_price_list_menu = '' ;
|
||||||
|
$manage_price_list_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($usertype eq 'schools_manager') {
|
||||||
|
if ($glod_user_level < 3) {
|
||||||
|
$home_menu_top = '' ;
|
||||||
|
$search_menu_top = '' ;
|
||||||
|
$quotes_menu_top = '' ;
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$documents_menu_top = '' ;
|
||||||
|
# $calendar_menu_top = '' ;
|
||||||
|
$reports_menu_top = '' ;
|
||||||
|
$schedule_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
$manage_price_list_menu_top = '' ;
|
||||||
|
# $manage_logistics_report_menu_top = '' ;
|
||||||
|
$quote_search_menu_top = '' ;
|
||||||
|
# unless ($usertype eq 'support') {
|
||||||
|
if (($usertype eq 'schools_manager' || $glod_user_level < 2) && !$is_temp_calibrator) {
|
||||||
|
$calibration_menu_top = '' ;
|
||||||
|
# $fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/list-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_operator) {
|
||||||
|
$events_menu_top = '' if $glod_user_level < 2 ;
|
||||||
|
$reports_event_quotes = '' ;
|
||||||
|
$cameras_menu_top = '' ;
|
||||||
|
$reports_menu_top = '' ;
|
||||||
|
# $schedule_menu_top = '' ;
|
||||||
|
$reports_management_report = '' ;
|
||||||
|
$logistics_costs_report = '' ;
|
||||||
|
# $calibration_menu_top = '' ;
|
||||||
|
|
||||||
|
if ($glod_user_level == 3) {
|
||||||
|
$manage_operators_menu = qq~<li><a href="$useropts{'folder'}/list-operators">Operators</a></li>~;
|
||||||
|
$events_menu_top = qq~<li><a href="$useropts{'folder'}/filter-event-quotes"><i class="glyphicon glyphicon-th"></i> Events</a></li>~;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_installation_partner) {
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$events_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_temp_calibrator) {
|
||||||
|
$fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_dcb_partner) {
|
||||||
|
$events_menu_top = '' ;
|
||||||
|
$calendar_menu_top = '' ;
|
||||||
|
$fixedsystem_menu_top = '' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $section_1 = ($manage_camera_systems_menu || $manage_customers_menu || $manage_quote_defaults_menu || $manage_price_list_menu || $rma_list_menu || $manage_leave_menu) ? qq~
|
||||||
|
$manage_camera_systems_menu
|
||||||
|
$manage_customers_menu
|
||||||
|
$manage_quote_defaults_menu
|
||||||
|
$manage_price_list_menu
|
||||||
|
$rma_list_menu
|
||||||
|
$manage_leave_menu
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $users_section = ($manage_users_menu || $manage_analytics_client_menu || $manage_coding_providers_menu || $manage_installation_partners_menu || $manage_operators_menu || $manage_school_managers_menu) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Users</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$manage_users_menu
|
||||||
|
$manage_analytics_client_menu
|
||||||
|
$manage_coding_providers_menu
|
||||||
|
$manage_installation_partners_menu
|
||||||
|
$manage_operators_menu
|
||||||
|
$manage_school_managers_menu
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $credits_section = ($glod_user_level >= 5) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Credits</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/list-allocate-credits">Allocate Credits</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-credits-bought">Credits Bought</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-live-reacon">Live Reacon</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $section4 = ($manage_regions || $manage_cities || $manage_organisations || $manage_teams || $manage_sport_types) ? qq~
|
||||||
|
$manage_regions
|
||||||
|
$manage_cities
|
||||||
|
$manage_organisations
|
||||||
|
$manage_teams
|
||||||
|
$manage_sport_types
|
||||||
|
<li class="divider"></li>
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $event_specifics = ($username eq 'handre' || $username eq 'rory' || $username eq 'vivian' || $usertype eq 'schools_manager' || $usertype eq 'manager' || $usertype eq 'senior_manager') ? qq~
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Event Specifics</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="$useropts{'folder'}/list-pocs">POCs</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/list-recipients">Recipients</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
my $logistics_sub_menu = ($manage_logistics_suppliers || $manage_logistics_items || $manage_logistics_locations) ? qq~
|
||||||
|
|
||||||
|
<li class="dropdown-submenu open-left">
|
||||||
|
<a tabindex="-1" href="#">Logistics</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$manage_logistics_suppliers
|
||||||
|
$manage_logistics_items
|
||||||
|
$manage_logistics_locations
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
|
||||||
|
~ : qq~~ ;
|
||||||
|
|
||||||
|
my $calibration_status_report = ($calibration_menu_top || $usertype eq 'support') ? qq~<li><a href="$useropts{'folder'}/calibration-status-report">Calibration Status Report</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
|
$calibration_menu_top = qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/calibration-report">Calibration Report</a></li>
|
||||||
|
$calibration_status_report
|
||||||
|
</ul>
|
||||||
|
</li>~ if $calibration_menu_top ;
|
||||||
|
|
||||||
|
$calibration_menu_top = qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-signal"></span> Calibration <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
$calibration_status_report
|
||||||
|
</ul>
|
||||||
|
</li>~ if $calibration_status_report && !$calibration_menu_top ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- The styles -->
|
||||||
|
<link href="$useropts{'css'}/bootstrap-itv.min.css?1.0" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/custom-itv.css" rel="stylesheet">
|
||||||
|
$extra_css
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/fullcalendar/dist/fullcalendar.print.css" rel='stylesheet' media='print'>
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/bootstrap-tour/build/css/bootstrap-tour.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.noty.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/noty_theme_default.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/jquery.iphone.toggle.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/uploadify.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/animate.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-dialog.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/bootstrap-datetimepicker.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
$typeahead_css
|
||||||
|
|
||||||
|
<!-- jQuery -->
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<!-- The fav icon -->
|
||||||
|
<link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$fullcalendar_events
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body $onload>
|
||||||
|
<!-- topbar starts -->
|
||||||
|
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
|
||||||
|
<div class="navbar-inner">
|
||||||
|
<button type="button" class="navbar-toggle pull-left animated flip">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="/"> <img class="logfav" alt="ITV Logo" src="$useropts{'img'}/50_ITV.png" class="hidden-xs"/>
|
||||||
|
<!-- <span><img class="logotext" alt="ITV Admin Text" src="$useropts{'img'}/headerFinal.png" class="hidden-xs"/></span></a> -->
|
||||||
|
</a>
|
||||||
|
<!-- user dropdown starts -->
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
$tickets_menu_top
|
||||||
|
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<i class="glyphicon glyphicon-user"></i><span class="hidden-sm hidden-xs"> admin</span>
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
$section_1
|
||||||
|
$users_section
|
||||||
|
$credits_section
|
||||||
|
$manage_event_systems
|
||||||
|
$section4
|
||||||
|
$logistics_sub_menu
|
||||||
|
$event_specifics
|
||||||
|
<li><a href="/logout">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- user dropdown ends -->
|
||||||
|
|
||||||
|
<ul class="collapse navbar-collapse nav navbar-nav top-menu">
|
||||||
|
$home_menu_top
|
||||||
|
$search_menu_top
|
||||||
|
$quotes_menu_top
|
||||||
|
$events_menu_top
|
||||||
|
$analytics_menu_top
|
||||||
|
$cameras_menu_top
|
||||||
|
$documents_menu_top
|
||||||
|
$calendar_menu_top
|
||||||
|
$reports_menu_top
|
||||||
|
$calibration_menu_top
|
||||||
|
$fixedsystem_menu_top
|
||||||
|
$manage_logistics_report_menu_top
|
||||||
|
$schedule_menu_top
|
||||||
|
$pre_sales_and_sales_menu_top
|
||||||
|
$quote_search_menu_top
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="height:69px;"></div>
|
||||||
|
<!-- topbar ends -->
|
||||||
|
<div class="ch-container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<!-- left menu starts -->
|
||||||
|
<div class="col-sm-2 col-lg-2" id="leftsidebar">
|
||||||
|
<div class="sidebar-nav">
|
||||||
|
<div class="nav-canvas">
|
||||||
|
<div class="nav-sm nav nav-stacked">
|
||||||
|
</div>
|
||||||
|
<ul class="nav nav-pills nav-stacked main-menu">
|
||||||
|
<li class="nav-header"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--/span-->
|
||||||
|
<!-- left menu ends -->
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<div class="alert alert-block col-md-12">
|
||||||
|
<h4 class="alert-heading">Warning!</h4>
|
||||||
|
|
||||||
|
<p>You need to have <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">JavaScript</a>
|
||||||
|
enabled to use this site.</p>
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
65
libs/html/_FromProd/v1.0/index.pm
Normal file
65
libs/html/_FromProd/v1.0/index.pm
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
require header ;
|
||||||
|
|
||||||
|
local $index_menu = qq~<div class="col-md-8">
|
||||||
|
<div class="dash-tray">
|
||||||
|
<a href="$useropts{'folder'}/search-cameras">
|
||||||
|
<div><i class="glyphicons glyphicons-security-camera" title="Cameras" data-toggle="tooltip" data-placement="left"></i></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>~ ;
|
||||||
|
|
||||||
|
if (substr($usertype,0,6) eq 'casual') {
|
||||||
|
$index_menu = qq~<div class="col-md-8">
|
||||||
|
<div class="dash-tray">
|
||||||
|
<a href="$useropts{'folder'}/calendar">
|
||||||
|
<div><i class="glyphicons glyphicons-calendar" title="Calendar" data-toggle="tooltip" data-placement="left"></i></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
<div id="content" class="col-lg-12 col-sm-12">
|
||||||
|
<!-- content starts -->
|
||||||
|
$useropts{'breadcrumbs'}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="box col-md-12">
|
||||||
|
<div class="box-inner">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="glyphicon glyphicon-home"></i> Dashboard</h2>
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="row"><div class="col-md-12"> </div></div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-2"> </div>
|
||||||
|
$index_menu
|
||||||
|
<div class="col-md-2"> </div>
|
||||||
|
</div>
|
||||||
|
<div class="row"><div class="col-md-12"> </div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div><!--/row-->
|
||||||
|
|
||||||
|
<!-- content ends -->
|
||||||
|
</div><!--/#content.col-md-0-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
ENDOFTEXT
|
||||||
|
|
||||||
|
require footer ;
|
||||||
|
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
|
||||||
|
$chart_js
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
84
libs/html/_FromProd/v1.0/login.pm
Normal file
84
libs/html/_FromProd/v1.0/login.pm
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="$useropts{'css'}/bootstrap-itv.min.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/login_screen.css" rel="stylesheet">
|
||||||
|
<link rel="shortcut icon" href="$useropts{'img'}/favicon.ico">
|
||||||
|
<style>
|
||||||
|
body { background-color:#ffffff; color:#222222; }
|
||||||
|
.well { background-color: #e5e4e6; }
|
||||||
|
.input-group-addon { background-color: #c6c1c1; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="bg-container bg-colour"style="overflow:hidden;">
|
||||||
|
<div class="ch-container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 center login-header">
|
||||||
|
<img src="$useropts{'img'}/$useropts{logo}" style="height:76px;">
|
||||||
|
</div>
|
||||||
|
<!--/span-->
|
||||||
|
</div><!--/row-->
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="well col-md-5 center login-box">
|
||||||
|
<div id="loginResult" class="alert alert-info" style="margin-bottom:20px;">
|
||||||
|
Please login with your Username and Password.
|
||||||
|
</div>
|
||||||
|
<!-- <form class="form-horizontal" action="index.html" method="post"> -->
|
||||||
|
<form class="form-horizontal" id="loginForm" name="loginForm" method="post" action="" style="margin-top:12px;">
|
||||||
|
<fieldset>
|
||||||
|
<div class="input-group input-group">
|
||||||
|
<span class="input-group-addon"><i class="glyphicon glyphicon-user red"></i></span>
|
||||||
|
<input type="text" name="username" id="username" class="form-control" placeholder="Username">
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div><br>
|
||||||
|
|
||||||
|
<div class="input-group input-group">
|
||||||
|
<span class="input-group-addon"><i class="glyphicon glyphicon-lock red"></i></span>
|
||||||
|
<input type="password" name="password" id="password" class="form-control" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
<!-- <div class="input-prepend">
|
||||||
|
<label class="remember" for="remember"><input type="checkbox" id="remember"> Remember me</label>
|
||||||
|
</div> <div class="clearfix"></div> -->
|
||||||
|
|
||||||
|
<p class="center col-md-5">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm">Login</button>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<!--/span-->
|
||||||
|
</div><!--/row-->
|
||||||
|
</div><!--/fluid-row-->
|
||||||
|
|
||||||
|
</div><!--/.fluid-container-->
|
||||||
|
|
||||||
|
<script src="$useropts{'js'}/jquery-1.4.4.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
try {
|
||||||
|
parent.reloadForLogin();
|
||||||
|
parent.BootstrapDialog.closeAll();
|
||||||
|
}
|
||||||
|
catch(err) { // do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
var scripts = '$useropts{'scripts'}' ;
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="$useropts{'js'}/login.js?no_cache=1.0"></script>
|
||||||
|
|
||||||
|
<div style="position:absolute;right:10px;bottom:10px;"><a href="https://kre8it.co.za" target="_blank" style="color:#ded6d6;">Built by Kre8IT Programming</a></div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/redirect.pm
Normal file
23
libs/html/_FromProd/v1.0/redirect.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#quotelist').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="listquotes" id="quotelist" method="post" action="/list-event-quotes">
|
||||||
|
<input type="hidden" name="iaction" value="list">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/redirectcalibrator.pm
Normal file
23
libs/html/_FromProd/v1.0/redirectcalibrator.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/calibration-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/redirectfixed.pm
Normal file
23
libs/html/_FromProd/v1.0/redirectfixed.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/fixed-systems-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/redirectlogistics.pm
Normal file
23
libs/html/_FromProd/v1.0/redirectlogistics.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/logistics-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/_FromProd/v1.0/tickets.pm
Normal file
23
libs/html/_FromProd/v1.0/tickets.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#activetickets').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" id="activetickets" method="post" action="/active-tickets">
|
||||||
|
<input type="hidden" name="iaction" value="active">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
|
|
@ -40,6 +40,21 @@
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
|
<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
|
||||||
<li><a href="$useropts{'folder'}/filter-analytics-event-credits">Credits</a></li>
|
<li><a href="$useropts{'folder'}/filter-analytics-event-credits">Credits</a></li>
|
||||||
|
<li><a href="$useropts{'folder'}/all-fixtures-report">All Fixtures</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : ($usertype eq 'coding_provider') ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Analytics <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/all-fixtures-report">All Fixtures</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
~ : ($usertype eq 'analytics_client') ? qq~
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" data-toggle="dropdown"><span class="glyphicon glyphicon-th-list"></span> Analytics <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><a href="$useropts{'folder'}/filter-analytics-event-bookings">Bookings</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
~ : qq~~ ;
|
~ : qq~~ ;
|
||||||
|
|
@ -94,14 +109,16 @@
|
||||||
# my $monitor_report_menu_top = qq~<li><a href="$useropts{'folder'}/monitor-report"><i class="glyphicons glyphicons-eye"></i>Monitor Report</a></li>~ ;
|
# my $monitor_report_menu_top = qq~<li><a href="$useropts{'folder'}/monitor-report"><i class="glyphicons glyphicons-eye"></i>Monitor Report</a></li>~ ;
|
||||||
|
|
||||||
my $schedule_menu_top = '' ;
|
my $schedule_menu_top = '' ;
|
||||||
my $reports_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/monitoring-report">Monitor Allocations</a></li>~ : '' ;
|
# my $reports_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/monitoring-report">Monitor Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/sss-event-feedback">SSS Event Feedback</a></li>~ : '' ;
|
||||||
my $reports_temp_calibration = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/temp-calibrator-report">Temp Calibrator Allocations</a></li>~ : '' ;
|
my $reports_temp_calibration = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/temp-calibrator-report">Temp Calibrator Allocations</a></li>~ : '' ;
|
||||||
my $reports_troubleshoot_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/troubleshoot-monitoring-report">Troubleshoot Monitor Allocations</a></li>~ : '' ;
|
# my $reports_troubleshoot_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/troubleshoot-report">Troubleshoot Allocations</a></li>~ : '' ;
|
||||||
|
my $reports_troubleshoot_monitor_report = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/aisa-event-feedback">AISA Event Feedback</a></li>~ : '' ;
|
||||||
my $reports_site_surveys = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-site-surveys-report">Mobile Site Surveys</a></li>~ : '' ;
|
my $reports_site_surveys = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-site-surveys-report">Mobile Site Surveys</a></li>~ : '' ;
|
||||||
my $reports_set_up_groups = ($glod_user_level >= 2) ? qq~<li><a href="$useropts{'folder'}/set-up-groups-report">Set Up Groups</a></li>~ : '' ;
|
my $reports_set_up_groups = ($glod_user_level >= 2) ? qq~<li><a href="$useropts{'folder'}/set-up-groups-report">Set Up Groups</a></li>~ : '' ;
|
||||||
my $mobile_tracking_system = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-system-tracking-report">Mobile System Tracking</a></li>~ : qq~~ ;
|
my $mobile_tracking_system = ($glod_user_level >= 3) ? qq~<li><a href="$useropts{'folder'}/mobile-system-tracking-report">Mobile System Tracking</a></li>~ : qq~~ ;
|
||||||
|
|
||||||
my $report_audit_trial = ($glod_user_level > 3) ? qq~<li><a href="$useropts{'folder'}/search-audit-trial">Audit Trial</a></li>~ : '' ;
|
my $report_audit_trial = ($glod_user_level > 3) ? qq~<li><a href="$useropts{'folder'}/search-audit-trail">Audit Trail</a></li>~ : '' ;
|
||||||
|
|
||||||
if ($useropts{super}{$username} and $pixellot_limit{$username}!=1 and $events_limit{$username}!=1) {
|
if ($useropts{super}{$username} and $pixellot_limit{$username}!=1 and $events_limit{$username}!=1) {
|
||||||
# $manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-defaults">Quote Defaults</a></li>~ ;
|
# $manage_quote_defaults_menu = qq~<li><a href="$useropts{'folder'}/list-quote-defaults">Quote Defaults</a></li>~ ;
|
||||||
|
|
@ -419,7 +436,7 @@
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="$useropts{'folder'}/list-allocate-credits">Allocate Credits</a></li>
|
<li><a href="$useropts{'folder'}/list-allocate-credits">Allocate Credits</a></li>
|
||||||
<li><a href="$useropts{'folder'}/list-credits-bought">Credits Bought</a></li>
|
<li><a href="$useropts{'folder'}/list-credits-bought">Credits Bought</a></li>
|
||||||
<li><a href="$useropts{'folder'}/list-live-reacon">Live Reacon</a></li>
|
<li><a href="$useropts{'folder'}/list-live-recon">Live Recon</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
|
|
@ -478,6 +495,13 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>~ if $calibration_status_report && !$calibration_menu_top ;
|
</li>~ if $calibration_status_report && !$calibration_menu_top ;
|
||||||
|
|
||||||
|
if ($usertype eq 'coding_provider' || $usertype eq 'analytics_client') {
|
||||||
|
$events_menu_top = qq~~ ;
|
||||||
|
$calendar_menu_top = qq~~ ;
|
||||||
|
$fixedsystem_menu_top = qq~~ ;
|
||||||
|
$manage_logistics_report_menu_top = qq~~ ;
|
||||||
|
}
|
||||||
|
|
||||||
print <<ENDOFTEXT;
|
print <<ENDOFTEXT;
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
|
||||||
23
libs/html/redirectallfixtures.pm
Normal file
23
libs/html/redirectallfixtures.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/all-fixtures-report">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
23
libs/html/redirectanalytics.pm
Normal file
23
libs/html/redirectanalytics.pm
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
print <<ENDOFTEXT;
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{title}</title>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
\$(document).ready(function(){ \$('#redirect-form').submit(); })
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<form role="form" name="redirectform" id="redirect-form" method="post" action="/filter-analytics-event-bookings">
|
||||||
|
<input type="hidden" name="iaction" value="">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
ENDOFTEXT
|
||||||
|
#
|
||||||
2029
libs/modules/_FromProd/analytics_event_booking_tabs.pm
Normal file
2029
libs/modules/_FromProd/analytics_event_booking_tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
797
libs/modules/_FromProd/calibration.pm
Normal file
797
libs/modules/_FromProd/calibration.pm
Normal file
|
|
@ -0,0 +1,797 @@
|
||||||
|
sub calibration_load_list_vars {
|
||||||
|
|
||||||
|
my ($where) = @_ ;
|
||||||
|
|
||||||
|
our %quote_status = () ;
|
||||||
|
|
||||||
|
our %calibrator_users = () ;
|
||||||
|
|
||||||
|
# &db_min_ro('users','id,name,user_type',"",'','') ;
|
||||||
|
# &db_min_ro('users','id,name,user_type,username',"(user_type = 'support' OR user_type = 'manager' OR user_type = 'casual_calibrator') AND name NOT LIKE 'Rory%'",'','') ;
|
||||||
|
&db_min_ro('regions','*','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('users','id,name,user_type,username,region_ids',"name NOT LIKE 'Rory%' AND name NOT LIKE 'Handre%'",'','') ;
|
||||||
|
$opts{calibrator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
$opts{head_operator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
foreach my $_uid (sort {$db{users}{$a}{name} cmp $db{users}{$b}{name}} keys %{$db{users}}) {
|
||||||
|
next if $useropts{it}{$db{users}{$_uid}{username}} ;
|
||||||
|
next if $db{users}{$_uid}{username} =~ m/test/i ;
|
||||||
|
next if $db{users}{$_uid}{username} =~ m/handre/i ;
|
||||||
|
|
||||||
|
my $regions = join(",",map{"$db{regions}{$_}{code}"} split(/\,/,$db{users}{$_uid}{region_ids})) ;
|
||||||
|
|
||||||
|
$regions = "[" . $regions . "]" if $regions ;
|
||||||
|
|
||||||
|
# if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator' || $monitoring_report) {
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator') {
|
||||||
|
$calibrator_users{$_uid} = $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if lc $db{users}{$_uid}{username} eq lc $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name} [$db{users}{$_uid}{username}]</option>~ if lc $db{users}{$_uid}{username} ne lc $db{users}{$_uid}{name} ;
|
||||||
|
# $opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if !$regions ;
|
||||||
|
}
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'casual_c' || ($db{users}{$_uid}{user_type} eq 'casual_b' && $lcpage eq 'set-up-groups-report')) {
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if lc $db{users}{$_uid}{username} eq lc $db{users}{$_uid}{name} ;
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name} [$db{users}{$_uid}{username}]</option>~ if lc $db{users}{$_uid}{username} ne lc $db{users}{$_uid}{name} ;
|
||||||
|
# $opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if !$regions ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $event_systems_sql_where = ($monitoring_report) ? "" : "system_type = 'mobile'" ;
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile' OR system_type = 'solo'",'','') if $set_up_groups;
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile'",'','') if !$set_up_groups;
|
||||||
|
|
||||||
|
my @event_quote_ids = () ;
|
||||||
|
|
||||||
|
# &db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,if(date_from < '$now_year-$now_mm-$now_dd 00:00:00',0,1) AS 'after_start_date',event_system_calibration_ids,event_system_calibration_status","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
&db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,event_system_calibration_ids,event_system_calibration_status,event_system_head_operator_ids,times_from,times_to,daily_operator_ids,days_active,monitor_ids,temp_calibrator_ids,set_up_groups_status_ids,set_up_groups_head_operator_ids","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
|
||||||
|
unless ($set_up_group) {
|
||||||
|
|
||||||
|
my $calibration_status_report_where = join(" OR ", map { "event_quote_id='$_'" } grep { $_ } keys %{$db{$table}});
|
||||||
|
&db_min_ro('calibration_status_report','event_quote_id,request_sent',$calibration_status_report_where,'','') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# calibration_status_report
|
||||||
|
|
||||||
|
my $min_id = 0 ; my $max_id = 0 ; my @all_event_ids = () ;
|
||||||
|
|
||||||
|
our %event_system_calibration_ids = () ; our %event_system_calibration_status = () ; our %event_system_head_operator_id = () ; our %default_vaules = () ; our %event_system_request_sent = () ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 1. [$id] $db{$table}{$id}{ref}") ;
|
||||||
|
|
||||||
|
next unless $id ; my $cnt = 0 ;
|
||||||
|
|
||||||
|
push @all_event_ids,"`id` = '$id'" ;
|
||||||
|
|
||||||
|
my @ed_from = &common_split_sql_time($db{$table}{$id}{date_from}) ;
|
||||||
|
my @ed_to = &common_split_sql_time($db{$table}{$id}{date_to}) ;
|
||||||
|
|
||||||
|
&common_date_array("$ed_from[0]$ed_from[1]$ed_from[2]","$ed_to[0]$ed_to[1]$ed_to[2]") ;
|
||||||
|
|
||||||
|
# $sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$db{$table}{$id}{ref}"} = $id ;
|
||||||
|
$sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$id"} = $id ;
|
||||||
|
|
||||||
|
# my @event_sys_calibration_status = split(";",$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_sys_calibration_status = ($set_up_groups) ? split(/\;/,$db{$table}{$id}{set_up_groups_status_ids}) : split(/\;/,$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_system_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @calibration_ids = split(/\;/,$db{$table}{$id}{event_system_calibration_ids}) ;
|
||||||
|
my @head_operator_ids = ($set_up_groups) ? split(/\;/,$db{$table}{$id}{set_up_groups_head_operator_ids}) : split(/\;/,$db{$table}{$id}{event_system_head_operator_ids}) ;
|
||||||
|
my @request_sent = ($set_up_groups) ? () : split(/\|/,$db{calibration_status_report}{$id}{request_sent}) ;
|
||||||
|
|
||||||
|
my $evntday = 0 ; my $evntsys = 0 ; my $system_id = 0 ;
|
||||||
|
|
||||||
|
foreach my $_cid (@calibration_ids) {
|
||||||
|
|
||||||
|
if ($_cid =~ /~/) {
|
||||||
|
($system_id,$_cid) = split(/\~/,$_cid) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++ ;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@calibrator_ids_per_event_day) = split(/\-/,$_cid);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cid_pd (@calibrator_ids_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cid_pd ;
|
||||||
|
$event_system_calibration_ids{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
$default_vaules{calibrator}{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_ids{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@event_sys_calibration_status) {
|
||||||
|
|
||||||
|
if ($_cstatus =~ /~/) {
|
||||||
|
($system_id,$_cstatus) = split(/\~/,$_cstatus) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@calibrator_status_per_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@calibrator_status_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_calibration_status{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{status}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@head_operator_ids) {
|
||||||
|
|
||||||
|
if ($_cstatus =~ /~/) {
|
||||||
|
($system_id,$_cstatus) = split(/\~/,$_cstatus) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++ ;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@head_operator_id_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@head_operator_id_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_head_operator_id{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{head_operator}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $data_per_system (@request_sent) {
|
||||||
|
|
||||||
|
($system_id,$data_per_system) = split(/\~/,$data_per_system) ;
|
||||||
|
next unless $system_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my @request_sent_event_day = split(/\;/,$data_per_system) ;
|
||||||
|
$evntday = 0 ;
|
||||||
|
foreach my $_cstatus_pd (@request_sent_event_day) {
|
||||||
|
$evntday++ ;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_request_sent{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{request_sent}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# &db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
# &calibration_check_for_overlapping_dates('event_systems',"event_system_id_multiple") ;
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
$min_id = $id if not $min_id or $min_id > $id ;
|
||||||
|
$max_id = $id if $max_id < $id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_sql = qq~(`id` <= '$max_id' AND `id` >= '$min_id')~ ;
|
||||||
|
# $id_sql = qq~ AND $id_sql~ if $where_2 or $where_3 ;
|
||||||
|
|
||||||
|
|
||||||
|
# my $id_sql = join (" OR " ,@all_event_ids) ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$where_2$where_3$id_sql",'','') ;
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$id_sql",'','') ;
|
||||||
|
# &db_min_ro('event_cost_items','id,name','','','') ;
|
||||||
|
&db_min_ro('event_cost_items','id,name',"excl_from_expenses < 1",'','') ;
|
||||||
|
&db_min_ro('calibration_status',"id,status",'','','') unless $calibration_status ;
|
||||||
|
|
||||||
|
foreach (sort {$db{calibration_status}{$a}{status} cmp $db{calibration_status}{$b}{status}} keys %{$db{calibration_status}}) {
|
||||||
|
$db{calibration_status}{$_}{name} = $db{calibration_status}{$_}{status} ;
|
||||||
|
$opts{status} .= qq~<option value="$_">$db{calibration_status}{$_}{status}</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','id,name','','','') ;
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
# our @sql_col_display = ($monitoring_report) ? ("event_nr","event","date","day","start_date","start_time","end_time","venue","region","type","system","sport","operator") : ($temp_calibrator_report) ? ("count","event","date","day","start_date","start_time","end_time","venue","region","type","system","sport","operator","shift_1_(07:00-10:00)","shift_2_(10:00-13:00)","shift_3_(13:00-16:00)","shift_4_(16:00-19:00)") : ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
# our @sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("count","event","calib_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","request_sent","calibrator","status","frames") ;
|
||||||
|
|
||||||
|
@sql_col_display = grep { $_ ne "calibrator" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "request_sent" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "frames" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "head_operator" } @sql_col_display if $calibration_report ;
|
||||||
|
|
||||||
|
$custom_column_styles{calibrator} = qq~style="min-width:150px;"~ ;
|
||||||
|
$custom_column_styles{head_operator} = qq~style="min-width:150px;"~ ;
|
||||||
|
$custom_column_styles{status} = qq~style="min-width:150px;"~ ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
push @sql_col_display,"update" ;
|
||||||
|
|
||||||
|
my $nr_of_cols = scalar @sql_col_display ;
|
||||||
|
|
||||||
|
my @rev_sql_col_display = reverse @sql_col_display ;
|
||||||
|
|
||||||
|
foreach (@rev_sql_col_display) { $lastchild++ ; $last_child{$_} = $lastchild ; } # &common_debug("last-child : $_ [$last_child{$_}]");
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $cali_cnt = 0 ; my $found_editable = 0 ; my @all_select_ids = () ;
|
||||||
|
|
||||||
|
$format84 -> set_align("center") ;
|
||||||
|
|
||||||
|
my $found_editable_status = 0 ;
|
||||||
|
|
||||||
|
our $max_frame_width = 0 ;
|
||||||
|
|
||||||
|
my %default_val_id = () ;
|
||||||
|
|
||||||
|
# foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
foreach my $date_ref (sort {$sort_calibration_by_time_ref{$b} <=> $sort_calibration_by_time_ref{$a}} keys %sort_calibration_by_time_ref) {
|
||||||
|
|
||||||
|
my $id = $sort_calibration_by_time_ref{$date_ref} ;
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
my $system_count = 0 ; my $system_day_cnt = 0 ;
|
||||||
|
|
||||||
|
my %system_has_daily_op = () ; my %default_op_ids = () ;
|
||||||
|
|
||||||
|
foreach my $system_row (split(/\|/,$db{$table}{$id}{daily_operator_ids})) {
|
||||||
|
$system_count++ ;
|
||||||
|
next unless $system_row ;
|
||||||
|
$system_day_cnt = 0 ;
|
||||||
|
foreach my $col (split(/\;/,$system_row)) {
|
||||||
|
$system_day_cnt++ ;
|
||||||
|
next unless $col ;
|
||||||
|
$default_op_ids{$system_count}{$system_day_cnt} = $col if $col ;
|
||||||
|
$system_has_daily_op{$system_count} = 1 if $col ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$system_count = 0 ;
|
||||||
|
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";none;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @club_ids = split(/\;/,$db{$table}{$id}{club_ids}) ;
|
||||||
|
my @op_ids = ($db{$table}{$id}{operator_ids} =~ /,/) ? split(/\,/,$db{$table}{$id}{operator_ids}) : ($db{$table}{$id}{operator_ids} =~ /;/) ? split(/\;/,$db{$table}{$id}{operator_ids}) : $db{$table}{$id}{operator_ids} ;
|
||||||
|
my @start_times = split(/\;/,";".$db{$table}{$id}{times_from}) ;
|
||||||
|
my @end_times = split(/\;/,$db{$table}{$id}{times_to}.";") ;
|
||||||
|
my @days_active = split(/\;/,$db{$table}{$id}{days_active}) ;
|
||||||
|
|
||||||
|
my $cnt_rows = 0 ;
|
||||||
|
for (1 .. 50) {
|
||||||
|
$cnt_rows = $_ if $system_name_ids[$_ - 1] or $club_ids[$_ - 1] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$system_count = 0 ;
|
||||||
|
|
||||||
|
$colname_to_id{head_operator} = "head_operator" ;
|
||||||
|
$colname_to_id{calibrator} = "calibrator_id" ;
|
||||||
|
$colname_to_id{status} = "calibration_status" ;
|
||||||
|
$colname_to_id{request_sent} = "request_sent" ;
|
||||||
|
|
||||||
|
$preferred_title{head_operator} = "Head Operator" ;
|
||||||
|
$preferred_title{calibrator} = "Calibrator" ;
|
||||||
|
$preferred_title{status} = "Calibration Status" ;
|
||||||
|
|
||||||
|
$default_val_table{head_operator} = 'users' ;
|
||||||
|
$default_val_table{calibrator} = 'users' ;
|
||||||
|
$default_val_table{status} = 'calibration_status' ;
|
||||||
|
# $default_val_table{request_sent} = 'calibration_status_report' ;
|
||||||
|
|
||||||
|
&calibration_get_status_frames($id) ;
|
||||||
|
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$system_count++ ;
|
||||||
|
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
|
||||||
|
$system_day_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $cal_date (sort keys %day_of_week) {
|
||||||
|
|
||||||
|
my $srch_date_from_comp = $i{date_from} ; $srch_date_from_comp =~ s/\-//g ;
|
||||||
|
my $srch_date_to_comp = $i{date_to} ; $srch_date_to_comp =~ s/\-//g ;
|
||||||
|
my $date_from_comp = substr($db{$table}{$id}{date_from},0,10) ; $date_from_comp =~ s/\-//g ;
|
||||||
|
my $date_to_comp = substr($db{$table}{$id}{date_to},0,10) ; $date_to_comp =~ s/\-//g ;
|
||||||
|
my $cal_date_comp = $cal_date ; # $cal_date_comp =~ s/\-//g ;
|
||||||
|
$cal_date = substr($cal_date,0,4) . '-' . substr($cal_date,4,2) . '-' . substr($cal_date,6,2) ;
|
||||||
|
my $date_from = substr($db{$table}{$id}{date_from},0,10) ;
|
||||||
|
$system_day_cnt++ ;
|
||||||
|
|
||||||
|
next if $cal_date_comp < $date_from_comp ;
|
||||||
|
|
||||||
|
next if $cal_date_comp > $date_to_comp ;
|
||||||
|
|
||||||
|
$cnt{$event_sys_id}{$id}++ ;
|
||||||
|
|
||||||
|
next if $db{$table}{$id}{days_active} && !$days_active[$cnt{$event_sys_id}{$id}-1] ;
|
||||||
|
|
||||||
|
next if $cal_date_comp > $srch_date_to_comp ;
|
||||||
|
|
||||||
|
next if $cal_date_comp < $srch_date_from_comp ;
|
||||||
|
|
||||||
|
next if $i{calibration_status} && $i{calibration_status} ne 'all' && $i{calibration_status} ne $default_vaules{status}{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}} ;
|
||||||
|
|
||||||
|
$cali_cnt++;
|
||||||
|
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id$dow">~ if $report ;
|
||||||
|
|
||||||
|
my $nr_of_cols_cnt = $nr_of_cols + 1 ;
|
||||||
|
|
||||||
|
our $default_javascript = qq~~ ;
|
||||||
|
|
||||||
|
my $contains_select = 0 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
$nr_of_cols_cnt-- ;
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
our $val_min = $val ;
|
||||||
|
my $align = qq~ class="dt-center"~ ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
my $sys_day_cnt = $cnt{$event_sys_id}{$id} ;
|
||||||
|
|
||||||
|
my $field = "" ; my $default_val = $default_vaules{$_}{$id}{$event_sys_id}{$sys_day_cnt} ; my $only_display_val = 0 ; my $background_color ="#424949" ; my $default_val_is_saved = ($default_val) ? 1 : 0 ;
|
||||||
|
|
||||||
|
if ($_ eq 'head_operator' || $_ eq 'calibrator' || $_ eq 'status' || $_ eq 'request_sent') {
|
||||||
|
|
||||||
|
$val_min = '' ;
|
||||||
|
|
||||||
|
$formatting = $format91 ;
|
||||||
|
|
||||||
|
if ($report) {
|
||||||
|
|
||||||
|
$field = "$colname_to_id{$_}\_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
|
||||||
|
if (($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") || (!$default_val)) {
|
||||||
|
$preferred_title{$field} = $preferred_title{$_} ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
# $useropts{'common'}{'css'} .= qq~.$_ { min-width:180px; } ~ ; ????
|
||||||
|
$val_min = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
if ($_ eq 'status') {
|
||||||
|
if ($default_val) {
|
||||||
|
if ($default_val eq '1') { #calibrating
|
||||||
|
$background_color = "#FFA500" ;
|
||||||
|
$formatting = $format89 ;
|
||||||
|
} elsif ($default_val eq '2') { #cancelled
|
||||||
|
$background_color = "#AD0502" ;
|
||||||
|
$formatting = $format90 ;
|
||||||
|
} elsif ($default_val eq '3') { #done
|
||||||
|
$background_color = "#2ECC71" ;
|
||||||
|
$formatting = $format88 ;
|
||||||
|
} elsif ($default_val eq '4') {
|
||||||
|
$background_color = "#424949" ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_val = 4 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$contains_select = 1 ;
|
||||||
|
} else {
|
||||||
|
$default_val_id{$_}{$db{$default_val_table{$_}}{$default_val}{name}} = $default_val if $default_val_table{$_} ;
|
||||||
|
$default_val = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
$default_val = "None" if $default_val eq 'none' ;
|
||||||
|
$only_display_val = 1 ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_val_id{$_}{$db{$default_val_table{$_}}{$default_val}{name}} = $default_val if $default_val_table{$_} ;
|
||||||
|
$default_val = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
$default_val = "None" if $default_val eq 'none' ;
|
||||||
|
$only_display_val = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_ eq 'count') {
|
||||||
|
$val = $cali_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} [$id]" ;
|
||||||
|
} elsif ($_ eq 'calib_date' || $_ eq 'date') {
|
||||||
|
# $val = "$cal_date [$day_of_week{$cal_date}]" ;
|
||||||
|
$val = "$cal_date" ;
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'day') {
|
||||||
|
$val = "$sys_day_cnt" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val = $date_from ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
# $nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ;
|
||||||
|
} elsif ($_ eq 'type') {
|
||||||
|
$val = (lc $db{event_systems}{$event_sys_id}{description} =~ /cricket/) ? "C" :
|
||||||
|
($db{event_systems}{$event_sys_id}{system_type} eq 'mobile') ? "M" :
|
||||||
|
($db{event_systems}{$event_sys_id}{system_type} eq 'fixed') ? "F" : "";
|
||||||
|
} elsif ($_ eq 'system') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_sys_id}{description})~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
# $nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val = '' ;
|
||||||
|
# $val = $db{users}{$table_op_ids[$system_count - 1]}{name} if $table_op_ids[$system_count - 1] ;
|
||||||
|
$val = ($default_op_ids{$system_count}{$cnt{$event_sys_id}{$id}}) ? $db{users}{$default_op_ids{$system_count}{$cnt{$event_sys_id}{$id}}}{name} : (!$default_op_ids{$system_count}{$system_day_cnt} && $system_has_daily_op{$system_count}) ? "None" : $db{users}{$op_ids[$system_count - 1]}{name} ;
|
||||||
|
# $formatting = $format92 if $event_cnt == 2 ;
|
||||||
|
$formatting = $format92 if $cali_cnt == 2 ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
if ($sys_day_cnt == 1 or ($sys_day_cnt > 1 and not $start_times[$sys_day_cnt-1])) {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($start_times[$sys_day_cnt-1],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'end_time') {
|
||||||
|
if ($start_times[$sys_day_cnt-1] && !$end_times[$sys_day_cnt-1]) {
|
||||||
|
$val = substr($db{$table}{$id}{date_to},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($end_times[$sys_day_cnt-1],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'head_operator') {
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'request_sent') {
|
||||||
|
$val_min = $default_val ;
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val' type='hidden'>~ : qq~~ ;
|
||||||
|
$default_val = "$now_hour:$now_min:$now_sec" unless $default_val ;
|
||||||
|
$val .= &common_min_table_timepicker($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'calibrator') {
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'status') {
|
||||||
|
$found_editable_status = 1 if !$only_display_val ;
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
$val_min = '' if $val_min == 4 ;
|
||||||
|
} elsif ($_ eq 'frames') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val .= &calibration_get_frames($id,$event_sys_id,$sys_day_cnt) ;
|
||||||
|
} elsif ($_ eq 'update') {
|
||||||
|
if (($report && $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") || $contains_select) {
|
||||||
|
$val = &common_min_table_checkbox("update_$id\_$event_sys_id\_$sys_day_cnt") ;
|
||||||
|
chop $default_javascript if $default_javascript ;
|
||||||
|
if ($default_javascript) {
|
||||||
|
push @default_javascript_by_id, qq~"$id\_$event_sys_id\_$sys_day_cnt":{$default_javascript}~ ;
|
||||||
|
push @all_update_field_ids,"#selectHead_operator\_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibrator_id\_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibration_status\_$id\_$event_sys_id\_$sys_day_cnt,#timepickerRequest_sent\_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$val = '' ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_ ne 'frames' && $_ ne 'request_sent' && $_ ne 'head_operator' && $_ ne 'status' && $_ ne 'calibrator' && substr($_,0,5) ne 'shift' && $_ ne 'update') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~<td $align $nowrap>$val</td>~ if $report ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) if $val_min && $_ ne 'update' ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,"",$format84) if !$val_min && ($_ eq 'head_operator' || $_ eq 'calibrator' || $_ eq 'status' || $_ eq 'request_sent') ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $all_select_ids_string = join(",",@all_select_ids) ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("$all_select_ids_string").chosen({allow_single_deselect:true});~ ;
|
||||||
|
|
||||||
|
if (!$found_editable) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} ").find("th:last").remove() ;
|
||||||
|
\$("#$useropts{table_id} tr").each(function() {
|
||||||
|
\$(this).find("td:last").remove() ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
} elsif ($set_up_groups) {
|
||||||
|
&common_min_table_select_jquery("#$useropts{table_id} td:nth-last-child(3),#$useropts{table_id} td:nth-last-child(2)") ;
|
||||||
|
&common_min_table_update_checkbox_col("3") ;
|
||||||
|
} else {
|
||||||
|
&common_min_table_select_jquery("#$useropts{table_id} td:nth-last-child(4),#$useropts{table_id} td:nth-last-child(3)") ;
|
||||||
|
&common_min_table_update_checkbox_col("3") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_editable) {
|
||||||
|
$trigger_jquery .= qq~\$("#$useropts{table_id} td:nth-last-child(3)").css("width","12.5%"); ~ ;
|
||||||
|
$trigger_jquery .= ($set_up_groups) ? qq~\$("#$useropts{table_id} td:nth-last-child(2)").css("width","12.5%");~ : qq~\$("#$useropts{table_id} td:nth-last-child(4)").css("width","12.5%");~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found_editable_status) {
|
||||||
|
$trigger_jquery .= qq~\$("#$useropts{table_id} td:nth-last-child(3)").css("width","");~ if !$set_up_groups ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10) ;
|
||||||
|
$worksheet{$ws}->set_column(1,1,30) ;
|
||||||
|
$worksheet{$ws}->set_column(2,2,15) ;
|
||||||
|
$worksheet{$ws}->set_column(3,3,5) ;
|
||||||
|
$worksheet{$ws}->set_column(4,5,13) ;
|
||||||
|
$worksheet{$ws}->set_column(6,6,30) ;
|
||||||
|
$worksheet{$ws}->set_column(7,7,8 );
|
||||||
|
$worksheet{$ws}->set_column(8,12,30) ;
|
||||||
|
$worksheet{$ws}->set_column(13,13,30) unless $set_up_groups ;
|
||||||
|
$worksheet{$ws}->set_column(14,14,$max_frame_width/7) unless $set_up_groups ;
|
||||||
|
|
||||||
|
&common_min_table_timepicker_jquery("[id^='timepickerRequest_sent_']") ;
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('L',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{none} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{none} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_frames {
|
||||||
|
|
||||||
|
my ($id,$event_sys_id,$sys_day_cnt) = @_ ;
|
||||||
|
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
my $attachments = "" ; my $attach_butt = "" ;
|
||||||
|
|
||||||
|
if ($gallery{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
|
||||||
|
my $margin = 5 ; my $scaled_height = 100 ; my $total_width = 0 ; my $max_height = 350 ; my $max_image_height = 0 ;
|
||||||
|
|
||||||
|
foreach my $img_name (split(/\;/,$gallery{$id}{$event_sys_id}{$sys_day_cnt})) {
|
||||||
|
|
||||||
|
my $file_path = "$htmlpath/uploads/calibration_status_uploads/$id/$img_name";
|
||||||
|
|
||||||
|
my ($width, $height) = imgsize($file_path);
|
||||||
|
|
||||||
|
if ($height && -f $file_path) {
|
||||||
|
|
||||||
|
my $final_file = $file_path; # default: use original
|
||||||
|
# my $scaled_width = $width;
|
||||||
|
# my $scaled_height = $height;
|
||||||
|
|
||||||
|
if ($height > $max_height) {
|
||||||
|
|
||||||
|
$max_image_height = $max_height if $max_image_height < $height ;
|
||||||
|
|
||||||
|
# Load and resize with fixed height = 500
|
||||||
|
my $img = Image::Magick->new ;
|
||||||
|
$img->Read($file_path) ;
|
||||||
|
|
||||||
|
my $scale = $max_height / $height;
|
||||||
|
$width = int($width * $scale);
|
||||||
|
$height = $max_height;
|
||||||
|
|
||||||
|
$img->Resize(geometry => "${width}x${height}");
|
||||||
|
|
||||||
|
# Write to temporary file
|
||||||
|
my ($fh, $tempfile) = tempfile(SUFFIX => '.jpg');
|
||||||
|
$img->Write(filename => $tempfile, quality => 70);
|
||||||
|
|
||||||
|
$final_file = $tempfile;
|
||||||
|
$temp_files{$tempfile} = 1; # track temp file for cleanup
|
||||||
|
} else {
|
||||||
|
$max_image_height = $height if $max_image_height < $height ;
|
||||||
|
}
|
||||||
|
|
||||||
|
($width,$height) = imgsize($final_file);
|
||||||
|
|
||||||
|
$total_width += $margin;
|
||||||
|
|
||||||
|
&xlsxcreator_insert_image($ws,$xlsxrow,$xlsxcol,$final_file,$total_width,$margin,150/$height,150/$height) if $height > 150 ;
|
||||||
|
&xlsxcreator_insert_image($ws,$xlsxrow,$xlsxcol,$final_file,$total_width,$margin) if $height <= 150 ;
|
||||||
|
|
||||||
|
$total_width += $width*150/$height;
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_width += $margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_row($xlsxrow,(2*$margin+150)*(83/110)) if $max_image_height ;
|
||||||
|
|
||||||
|
$max_frame_width = $total_width if $total_width && $max_frame_width < $total_width ;
|
||||||
|
|
||||||
|
$attachments .= &calibration_get_uploads_list($db{calibration_status_report}{$id}{event_quote_id},$gallery{$id}{$event_sys_id}{$sys_day_cnt}) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($attachments) {
|
||||||
|
|
||||||
|
$attach_butt = qq~
|
||||||
|
|
||||||
|
<a href="#" data-toggle="popover" data-placement="left" data-content="$attachments" title="Uploads" data-html="true" data-trigger="focus" class="btn btn-round btn-default">
|
||||||
|
<i class="glyphicon glyphicon-paperclip" style="top:4px;"></i>
|
||||||
|
</a>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
my $val_return = qq~
|
||||||
|
$attach_butt
|
||||||
|
<a href="javascript:dlgMdl('$useropts{scripts}/dialog/calibration_status_report_uploads.pl?$id&$event_sys_id&$sys_day_cnt','Edit Images','','medium-dialog');" class="btn btn-round btn-info" data-toggle="tooltip" data-placement="left" title="" data-original-title="Edit Images">
|
||||||
|
<i class="glyphicon glyphicon-edit" style="top:4px;">
|
||||||
|
</i>
|
||||||
|
</a>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
return $val_return ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_status_frames {
|
||||||
|
|
||||||
|
my ($event_id) = @_ ;
|
||||||
|
|
||||||
|
return unless $event_id ;
|
||||||
|
|
||||||
|
my %frames_hash = () ;
|
||||||
|
|
||||||
|
foreach my $system_frames (split(/\|/,$db{calibration_status_report}{$event_id}{upload_names})) {
|
||||||
|
|
||||||
|
next unless $system_frames ;
|
||||||
|
my ($system_id,$system_frames_2) = split(/\~/,$system_frames) ;
|
||||||
|
my $day_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $day_frames (split(/\:/,$system_frames_2)) {
|
||||||
|
$day_cnt++ ;
|
||||||
|
next unless $day_frames ;
|
||||||
|
$gallery{$event_id}{$system_id}{$day_cnt} = $day_frames ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_uploads_list {
|
||||||
|
|
||||||
|
my ($id,$uploads) = @_ ;
|
||||||
|
|
||||||
|
my $attachments = '' ;
|
||||||
|
|
||||||
|
return '' unless $id ;
|
||||||
|
|
||||||
|
my @uploads_arr = split(/\;/,$uploads) ;
|
||||||
|
|
||||||
|
my $uploads_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach (@uploads_arr) {
|
||||||
|
|
||||||
|
$uploads_cnt++ ;
|
||||||
|
|
||||||
|
next unless $_ ;
|
||||||
|
|
||||||
|
my $url_prefix = qq~/uploads/calibration_status_uploads/$id~ ;
|
||||||
|
|
||||||
|
my ($width,$height) = imgsize("$htmlpath/$url_prefix/$_");
|
||||||
|
|
||||||
|
next unless $height ;
|
||||||
|
|
||||||
|
$width = 100*($width/$height) ;
|
||||||
|
$height = 100 ;
|
||||||
|
$attachments .= qq~<a target='_blank' href='$url_prefix/$_'><img src='$url_prefix/$_' style='width:$width\px;height:$height\px;border:1px solid #ccc;margin:2px;max-width:100%;display:block;'></a>~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attachments ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
1 ;
|
||||||
688
libs/modules/_FromProd/calibrator_payments.pm
Normal file
688
libs/modules/_FromProd/calibrator_payments.pm
Normal file
|
|
@ -0,0 +1,688 @@
|
||||||
|
sub calibration_load_list_vars {
|
||||||
|
|
||||||
|
my ($where,$for_payments) = @_ ;
|
||||||
|
|
||||||
|
our %quote_status = () ;
|
||||||
|
|
||||||
|
our %calibrator_users = () ;
|
||||||
|
|
||||||
|
# &db_min_ro('users','id,name,user_type',"",'','') ;
|
||||||
|
# &db_min_ro('users','id,name,user_type,username',"(user_type = 'support' OR user_type = 'manager' OR user_type = 'casual_calibrator') AND name NOT LIKE 'Rory%'",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('users','id,name,user_type,username',"`name` NOT LIKE 'Rory%'",'','') ;
|
||||||
|
|
||||||
|
if (!$for_payments) {
|
||||||
|
$opts{calibration_users} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
$opts{head_operator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
foreach my $_uid (sort {$db{users}{$a}{name} cmp $db{users}{$b}{name}} keys %{$db{users}}) {
|
||||||
|
next if $useropts{it}{$db{users}{$_uid}{username}} ;
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator') {
|
||||||
|
$calibrator_users{$_uid} = $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibration_users} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ ;
|
||||||
|
}
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'casual_c') {
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
my @event_quote_ids = () ;
|
||||||
|
|
||||||
|
# &db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,if(date_from < '$now_year-$now_mm-$now_dd 00:00:00',0,1) AS 'after_start_date',event_system_calibration_ids,event_system_calibration_status","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
&db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,event_system_calibration_ids,event_system_calibration_status,event_system_head_operator_ids,times_from","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
|
||||||
|
my $min_id = 0 ; my $max_id = 0 ;
|
||||||
|
|
||||||
|
our %event_system_calibration_ids = () ; our %event_system_calibration_status = () ; our %event_system_head_operator_id = () ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 1. [$id] $db{$table}{$id}{ref}") ;
|
||||||
|
|
||||||
|
next unless $id ; my $cnt = 0 ;
|
||||||
|
|
||||||
|
my @ed_from = &common_split_sql_time($db{$table}{$id}{date_from}) ;
|
||||||
|
my @ed_to = &common_split_sql_time($db{$table}{$id}{date_to}) ;
|
||||||
|
|
||||||
|
&common_date_array("$ed_from[0]$ed_from[1]$ed_from[2]","$ed_to[0]$ed_to[1]$ed_to[2]") ;
|
||||||
|
|
||||||
|
# $sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$db{$table}{$id}{ref}"} = $id ;
|
||||||
|
$sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$id"} = $id ;
|
||||||
|
|
||||||
|
# my @event_sys_calibration_status = split(";",$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_sys_calibration_status = split(/\;/,$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_system_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @calibration_ids = split(/\;/,$db{$table}{$id}{event_system_calibration_ids}) ;
|
||||||
|
my @head_operator_ids = split(/\;/,$db{$table}{$id}{event_system_head_operator_ids}) ;
|
||||||
|
|
||||||
|
my $evntday=0; my $evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cid (@calibration_ids) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@calibrator_ids_per_event_day) = split(/\-/,$_cid);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
|
||||||
|
foreach my $_cid_pd (@calibrator_ids_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cid_pd ;;
|
||||||
|
$event_system_calibration_ids{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_ids{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@event_sys_calibration_status) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
|
||||||
|
my (@calibrator_status_per_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@calibrator_status_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_calibration_status{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@head_operator_ids) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@head_operator_id_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@head_operator_id_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_head_operator_id{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
if ($for_payments) {
|
||||||
|
|
||||||
|
my @calibrator_amounts_paid = split(/\;/,$db{$table}{$id}{calibrator_amounts_paid}) ;
|
||||||
|
my @calibrator_dates_paid = split(/\;/,$db{$table}{$id}{calibrator_dates_paid}) ;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@calibrator_amounts_paid) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@amounts_paid_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@amounts_paid_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$calibrator_amounts_paid_hash{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@calibrator_dates_paid) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@dates_paid_event_day) = split(/\:/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@dates_paid_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$calibrator_dates_paid_hash{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# &db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
&calibration_check_for_overlapping_dates('event_systems',"event_system_id_multiple") ;
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
$min_id = $id if not $min_id or $min_id > $id ;
|
||||||
|
$max_id = $id if $max_id < $id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_sql = qq~(`id` <= '$max_id' AND `id` >= '$min_id')~ ;
|
||||||
|
# $id_sql = qq~ AND $id_sql~ if $where_2 or $where_3 ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$where_2$where_3$id_sql",'','') ;
|
||||||
|
&db_min_ro('event_quotes_min','*',"$id_sql",'','') ;
|
||||||
|
&db_min_ro('event_cost_items','id,name',"excl_from_expenses < 1",'','') ;
|
||||||
|
&db_min_ro('calibration_status','id,status','','','') unless $calibration_status ;
|
||||||
|
|
||||||
|
foreach (sort {$db{calibration_status}{$a}{status} cmp $db{calibration_status}{$b}{status}} keys %{$db{calibration_status}}) {
|
||||||
|
$opts{calibration_status} .= qq~<option value="$_">$db{calibration_status}{$_}{status}</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
&db_min_ro('regions','*','','','') ;
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report,$for_payments) = @_ ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
|
||||||
|
@sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","date_payable","amount_payable","paid") if $for_payments ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $cali_cnt = 0 ; our $found_after_date = 0 ; my $found_editable = 0 ;
|
||||||
|
|
||||||
|
# foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
foreach my $date_ref (sort keys %sort_calibration_by_time_ref) {
|
||||||
|
|
||||||
|
my $id = $sort_calibration_by_time_ref{$date_ref} ;
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";none;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my @system_name_ids = split(";",$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @club_ids = split(/\;/,$db{$table}{$id}{club_ids}) ;
|
||||||
|
my @op_ids = split(/\,/,$db{$table}{$id}{operator_ids}) ;
|
||||||
|
my @start_times = split(/\;/,$db{$table}{$id}{times_from}) ;
|
||||||
|
|
||||||
|
my $cnt_rows = 0 ;
|
||||||
|
for (1 .. 50) {
|
||||||
|
$cnt_rows = $_ if $system_name_ids[$_ - 1] or $club_ids[$_ - 1] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my @table_op_ids = () ;
|
||||||
|
|
||||||
|
# for (1 .. $cnt_rows) {
|
||||||
|
# push @table_op_ids,$op_ids[$_ - 1] if $op_ids[$_ - 1] ;
|
||||||
|
# push @table_op_ids,0 unless $op_ids[$_ - 1] ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
my $system_count = 0 ;
|
||||||
|
|
||||||
|
# foreach my $event_sys_id (split(";",$db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
# foreach my $event_sys_id (sort { $a <=> $b } @system_name_ids) {
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$system_count++ ;
|
||||||
|
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 2. $system_count [$id] $db{$table}{$id}{ref} [$db{event_systems}{$event_sys_id}{system_type}]") ;
|
||||||
|
|
||||||
|
# $event_cnt++ ;
|
||||||
|
|
||||||
|
# foreach my $cal_date (sort {$day_of_week{$a} cmp $day_of_week{$b}} keys %day_of_week) {
|
||||||
|
foreach my $cal_date (sort keys %day_of_week) {
|
||||||
|
|
||||||
|
|
||||||
|
my $srch_date_from_comp = $i{date_from} ; $srch_date_from_comp =~ s/\-//g ;
|
||||||
|
my $srch_date_to_comp = $i{date_to} ; $srch_date_to_comp =~ s/\-//g ;
|
||||||
|
my $date_from_comp = substr($db{$table}{$id}{date_from},0,10) ; $date_from_comp =~ s/\-//g ;
|
||||||
|
my $date_to_comp = substr($db{$table}{$id}{date_to},0,10) ; $date_to_comp =~ s/\-//g ;
|
||||||
|
my $cal_date_comp = $cal_date ; # $cal_date_comp =~ s/\-//g ;
|
||||||
|
$cal_date = substr($cal_date,0,4) . '-' . substr($cal_date,4,2) . '-' . substr($cal_date,6,2) ;
|
||||||
|
my $date_from = substr($db{$table}{$id}{date_from},0,10) ;
|
||||||
|
|
||||||
|
# &common_debug("[$cnt{$event_sys_id}{$id}] : $event_sys_id [$id] $cal_date") ;
|
||||||
|
|
||||||
|
# &common_debug("1. DATE >>> $cal_date_comp < $date_from_comp") if !$report ;
|
||||||
|
next if $cal_date_comp < $date_from_comp ;
|
||||||
|
# &common_debug("2. DATE >>> $cal_date_comp > $date_to_comp") if !$report ;
|
||||||
|
next if $cal_date_comp > $date_to_comp ;
|
||||||
|
|
||||||
|
$cnt{$event_sys_id}{$id}++ ; ## WHY HERE???????????????
|
||||||
|
next if $for_payments && ($db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}}}{user_type} ne 'casual_calibrator' || $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}}}{status} ne 'Done' || ($i{paid_status} eq 'paid' && !$calibrator_amounts_paid_hash{$id}{$system_id}{$evntday}) || ($i{paid_status} eq 'outstanding' && $calibrator_amounts_paid_hash{$id}{$system_id}{$evntday})) ;
|
||||||
|
|
||||||
|
|
||||||
|
# &common_debug("3. DATE >>> $cal_date_comp > $srch_date_to_comp") if !$report ;
|
||||||
|
next if $cal_date_comp > $srch_date_to_comp ;
|
||||||
|
# &common_debug("4. DATE >>> $cal_date_comp < $srch_date_from_comp") if !$report ;
|
||||||
|
next if $cal_date_comp < $srch_date_from_comp ;
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 3. $system_count [$id] $db{$table}{$id}{ref} [$db{event_systems}{$event_sys_id}{system_type}]") ;
|
||||||
|
|
||||||
|
# &common_debug("[$cnt{$event_sys_id}{$id}] : $event_sys_id [$id] $cal_date [$cal_date_comp > $srch_date_to_comp]") ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$cali_cnt++;
|
||||||
|
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id$dow">~ if $report ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
# &common_debug("1. XLSX >>> $_") if !$report ;
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
my $val_min = $val ;
|
||||||
|
my $align = qq~ class="dt-center"~ ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
# &common_debug("2. XLSX >>> val_min=$val_min") if !$report ;
|
||||||
|
|
||||||
|
my $sys_day_cnt = $cnt{$event_sys_id}{$id} ;
|
||||||
|
|
||||||
|
if ($_ eq 'count') {
|
||||||
|
# $val = $event_cnt ;
|
||||||
|
$val = $cali_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} ($id)" ;
|
||||||
|
} elsif ($_ eq 'calibration_date') {
|
||||||
|
# $val = "$cal_date [$day_of_week{$cal_date}]" ;
|
||||||
|
$val = "$cal_date" ;
|
||||||
|
} elsif ($_ eq 'day') {
|
||||||
|
$val = "$sys_day_cnt" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$val = $date_from ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ;
|
||||||
|
} elsif ($_ eq 'system') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_sys_id}{description})~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$val = '' ;
|
||||||
|
# $val = $db{users}{$table_op_ids[$system_count - 1]}{name} if $table_op_ids[$system_count - 1] ;
|
||||||
|
$val = $db{users}{$op_ids[$system_count - 1]}{name} if $op_ids[$system_count - 1] ;
|
||||||
|
# $formatting = $format92 if $event_cnt == 2 ;
|
||||||
|
$formatting = $format92 if $cali_cnt == 2 ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
if ($sys_day_cnt == 1 or ($sys_day_cnt > 1 and not $start_times[$sys_day_cnt-2])) {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($start_times[$sys_day_cnt-2],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'head_operator') {
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
# &common_debug("=== $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne -1") ;
|
||||||
|
|
||||||
|
my $field = "head_operator_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
|
||||||
|
$preferred_title{$field} = "Head Operator" ;
|
||||||
|
$opts{$field} = $opts{head_operator} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("2. >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
|
||||||
|
if ($event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(4)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%") ;~ ;
|
||||||
|
# $val_min = $db{users}{$db{event_systems}{$event_sys_id}{calibrator_id}}{name} ;
|
||||||
|
$val_min = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
} else {
|
||||||
|
$val = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# # $val = "$db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} [$sys_day_cnt]" ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# $val = $db{users}{$db{event_systems}{$id}{calibrator_id}}{name} ;
|
||||||
|
$val = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'calibrator') {
|
||||||
|
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
# &common_debug("=== $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne -1") ;
|
||||||
|
|
||||||
|
my $field = "calibrator_id_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
|
||||||
|
$preferred_title{$field} = "Calibrator" ;
|
||||||
|
$opts{$field} = $opts{calibration_users} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("2. >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
if ($event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(3)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%") ;~ ;
|
||||||
|
# $val_min = $db{users}{$db{event_systems}{$event_sys_id}{calibrator_id}}{name} ;
|
||||||
|
$val_min = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
} else {
|
||||||
|
$val = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# # $val = "$db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} [$sys_day_cnt]" ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{users}{$db{event_systems}{$id}{calibrator_id}}{name} ;
|
||||||
|
|
||||||
|
$val = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'status') {
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
my $field = "calibration_status_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$opts{$field} = $opts{calibration_status} ;
|
||||||
|
$preferred_title{$field} = "Calibration Status" ;
|
||||||
|
$allow_deselect{$field} = 1;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("STATUS >>> $event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
if ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}") ;~ ;
|
||||||
|
if ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '1') { #calibrating
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#FFA500");~ ;
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '2') { #cancelled
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#AD0502");~ ;
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '3') { #done
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#2ECC71");~ ; #D5EDBB
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '4') { #done
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#424949");~ ; #D5D8DC
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").val("4") ;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%");
|
||||||
|
~ ;
|
||||||
|
$val_min = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
$val = "None" if !$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$db{event_systems}{$event_sys_id}{calibration_status}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
$val = "None" if !$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# if ($db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} eq "Calibrating") {
|
||||||
|
if ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Calibrating") {
|
||||||
|
$formatting = $format89 ;
|
||||||
|
} elsif ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Cancelled") {
|
||||||
|
$formatting = $format90 ;
|
||||||
|
} elsif ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Done") {
|
||||||
|
$formatting = $format88 ;
|
||||||
|
} else {
|
||||||
|
$formatting = $format91 ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'update') {
|
||||||
|
|
||||||
|
if ($report && $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $field = "update_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
$val = &common_min_form_checkbox_col($field,'') ;
|
||||||
|
# $val .= qq~<span id="update_history_$id\_$event_sys_id\_$sys_day_cnt" style="display:none;"></span>~ ; #
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt,#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").change(function () {
|
||||||
|
\$("#checkboxUpdate_$id\_$event_sys_id\_$sys_day_cnt").prop("checked",true) ;
|
||||||
|
// \$("#update_history_$id\_$event_sys_id\_$sys_day_cnt").text("1") ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$val = '' ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'date_payable') {
|
||||||
|
my $field = "date_payable_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
|
||||||
|
if ($calibrator_dates_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = $calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
$val = &common_min_form_input_col($field,"$calibrator_dates_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
} else {
|
||||||
|
$val = &common_min_form_input_col($field,"$cal_date") ;
|
||||||
|
$val_min = $cal_date ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ($_ eq 'amount_payable') {
|
||||||
|
my $field = "amount_payable_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = "Paid" ;
|
||||||
|
$val_min = "None" ;
|
||||||
|
} else {
|
||||||
|
$val = &common_min_form_input_col($field,'500.00') ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("input[name='$field']").change( function () {
|
||||||
|
let input = \$(this).val() ;
|
||||||
|
input = parseFloat(input) ;
|
||||||
|
if (!input) { input = 0 ; }
|
||||||
|
\$(this).val(input.toFixed(2)) ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
$val_min = "500.00" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ($_ eq 'paid') {
|
||||||
|
if ($calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = '<i class="glyphicons glyphicons-tick"></i>' ;
|
||||||
|
$val_min = "Paid" ;
|
||||||
|
} else {
|
||||||
|
$paid_fields .= qq~$id\_$event_sys_id\_$sys_day_cnt:$cali_cnt,~ ;
|
||||||
|
my $field = "paid_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
$val = &common_min_form_checkbox_col($field,'') ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_ ne 'status' and $_ ne 'calibrator' and $_ ne 'update' and $_ ne 'date_payable' and $_ ne 'amount_payable') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $align>$val</td>~ if $report ;
|
||||||
|
|
||||||
|
# &common_debug("XLSX >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# next if $i{calibration_status} ne 'all' and $i{calibration_status} and $i{calibration_status} ne $db{event_systems}{$event_sys_id}{calibration_status} ;
|
||||||
|
# next if $i{calibrator_id} ne 'all' and $i{calibrator_id} and $i{calibrator_id} ne $db{event_systems}{$event_sys_id}{calibrator_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# \$("#itv-table tr th:nth-last-child(1)").css("width","0%") ;
|
||||||
|
# \$("#itv-table tr th:nth-last-child(1)").css("display","none") ;
|
||||||
|
|
||||||
|
if (!$found_editable && !$for_payments) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#itv-table").find("th:last").remove() ;
|
||||||
|
\$("#itv-table tr").each(function() {
|
||||||
|
\$(this).find("td:last").remove() ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10);
|
||||||
|
$worksheet{$ws}->set_column(1,1,30);
|
||||||
|
$worksheet{$ws}->set_column(2,2,15);
|
||||||
|
$worksheet{$ws}->set_column(3,3,5);
|
||||||
|
$worksheet{$ws}->set_column(4,5,13);
|
||||||
|
$worksheet{$ws}->set_column(6,6,30);
|
||||||
|
$worksheet{$ws}->set_column(7,7,8);
|
||||||
|
$worksheet{$ws}->set_column(8,10,30);
|
||||||
|
$worksheet{$ws}->set_column(11,12,15);
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('L',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{none} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{none} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
159
libs/modules/_FromProd/cfg.pm
Normal file
159
libs/modules/_FromProd/cfg.pm
Normal file
|
|
@ -0,0 +1,159 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
require cfg_paths ;
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$useropts{domain} = "https://$ENV{SERVER_NAME}" ;
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
use session ;
|
||||||
|
&check_session ;
|
||||||
|
&session_state ;
|
||||||
|
&config_set_vars;
|
||||||
|
&check_access;
|
||||||
|
&config_set_paths ;
|
||||||
|
&config_set_breadcrumbs ;
|
||||||
|
&config_common_html ;
|
||||||
|
# &check_ticket_inbox ;
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub check_ticket_inbox {
|
||||||
|
|
||||||
|
# return unless $useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} ;
|
||||||
|
|
||||||
|
my $xtra_sql_where = (!$useropts{super}{$username} && !$useropts{boss}{$username} && !$useropts{it}{$username} && !$useropts{tickets}{$username}) ? " AND staff_id = '$userid'" : '' ;
|
||||||
|
|
||||||
|
&db_min_ro('tickets','COUNT(unique_id) AS ActiveTickets',"completed = '0' AND responded = '0'$xtra_sql_where",'','') ;
|
||||||
|
|
||||||
|
foreach my $count (keys %{$db{tickets}}) {
|
||||||
|
our $activetickets = "$db{tickets}{$count}{ActiveTickets}" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub session_state {
|
||||||
|
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/index.pl/gi) { return ; }
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/cron/gi) { return ; }
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/get/gi) { return ; }
|
||||||
|
|
||||||
|
unless ($session_state eq 'active') { print 'Status: 302 Moved', "\r\n", "Location: https://$ENV{SERVER_NAME}/", "\r\n\r\n" ; }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub config_session_state {
|
||||||
|
|
||||||
|
# if ($ENV{SCRIPT_NAME} eq '/index.pl') { return ; }
|
||||||
|
# if (($ENV{SCRIPT_NAME} =~ m/admin/g) or ($skip_relocate)) { $skip_relocate = 1 ; return ; }
|
||||||
|
|
||||||
|
# if (($session_state eq 'expired') or ($session_state eq 'empty')) {
|
||||||
|
# print 'Status: 302 Moved', "\r\n", "Location: http://$ENV{SERVER_NAME}/", "\r\n\r\n" ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub check_access {
|
||||||
|
|
||||||
|
# return unless $pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager' ;
|
||||||
|
return if $glod_user_level >= 5 ;
|
||||||
|
|
||||||
|
# my $path_prefix_ = '/cgi-bin/scripts/' ;
|
||||||
|
my $path_prefix_ = $useropts{'scripts'} . '/' ;
|
||||||
|
|
||||||
|
if ($events_limit{$username} || $glod_user_level >= 4){
|
||||||
|
$exempt_script{$path_prefix_ . 'costings_detailed_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'costings_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'events_detailed_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'events_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'operators_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'operators_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'pdf/event_quote_pdf.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'stock_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'cameras.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
$exempt_script{$path_prefix_ . 'cameras_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
$exempt_script{$path_prefix_ . 'delivered_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
|
||||||
|
$exempt_query{''} = 1 ;
|
||||||
|
$exempt_query{'list'} = 1 ;
|
||||||
|
|
||||||
|
if ($glod_user_level > 0) {
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calendar.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_db_cal_events.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'fixed_systems_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/events.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_report_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_status_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/calibration_status_report_uploads.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_logistics_item.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_poc.pl'} = 1 ;
|
||||||
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level > 1) {
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_venues_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_cities_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_delete_attach.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_roe.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_city.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_school.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_sport_type.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_club.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_operator.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/event_email.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/email.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'pdf/event_details_pdf.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_poc_or_recipient_contact_nr.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_country_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_region_country_from_client.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_client.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_regions_from_country.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_region_from_city.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_country_and_region_from_city.pl'} = 1 ;
|
||||||
|
# $exempt_script{$path_prefix_ . 'get/get_cities_from_country.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'set_up_groups_report.pl'} = 1 ;
|
||||||
|
|
||||||
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
||||||
|
$exempt_query{'edit'} = 1 ;
|
||||||
|
$exempt_query{'add'} = 1 ;
|
||||||
|
$exempt_query{'view'} = 1 ;
|
||||||
|
$exempt_query{'copy'} = 1 ;
|
||||||
|
$exempt_query{'search'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level > 2) {
|
||||||
|
$exempt_script{$path_prefix_ . 'operators.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'monitoring_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'temp_calibrator_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'mobile_site_surveys_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'mobile_system_tracking_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($usertype eq 'support') {
|
||||||
|
$exempt_script{$path_prefix_ . 'demos.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_dcb_partner) {
|
||||||
|
%exempt_script = () ;
|
||||||
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($exempt_script{$ENV{SCRIPT_NAME}}) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
||||||
|
unless ($exempt_query{$ENV{QUERY_STRING}} || length($ENV{QUERY_STRING}) > 10) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
@ -5,7 +5,8 @@ sub config_set_vars {
|
||||||
|
|
||||||
$useropts{acronym} = 'AISA' ;
|
$useropts{acronym} = 'AISA' ;
|
||||||
$useropts{short} = 'AI Sport Africa' ;
|
$useropts{short} = 'AI Sport Africa' ;
|
||||||
$useropts{title} = "$useropts{short} Admin | " . ucfirst $username ;
|
$useropts{title} = ($env eq 'DEV') ? "*DEV* " : '' ;
|
||||||
|
$useropts{title} .= "$useropts{short} Admin | " . ucfirst $username ;
|
||||||
$title = $useropts{title} ;
|
$title = $useropts{title} ;
|
||||||
$useropts{salt} = '1Tv4dM1n' ;
|
$useropts{salt} = '1Tv4dM1n' ;
|
||||||
$useropts{company} = "$useropts{short} (Pty) Ltd" ;
|
$useropts{company} = "$useropts{short} (Pty) Ltd" ;
|
||||||
|
|
@ -108,11 +109,11 @@ our ($subdomain,$domain,$ext) = split(/\./,$ENV{SERVER_NAME}) ;
|
||||||
|
|
||||||
sub config_set_paths {
|
sub config_set_paths {
|
||||||
|
|
||||||
$cgipath = "/home/libs" ;
|
# $cgipath = "/home/libs" ;
|
||||||
$htmlpath = "/var/www/html" ;
|
# $htmlpath = "/var/www/html" ;
|
||||||
$htmlpath_sss = "/var/www/sssadmin.co.za/public_html" ;
|
# $htmlpath_sss = "/var/www/sssadmin.co.za/public_html" ;
|
||||||
|
|
||||||
$useropts{'scripts'} = '/cgi-bin/scripts';
|
# $useropts{'scripts'} = '/cgi-bin/scripts';
|
||||||
$useropts{'folder'} = '';
|
$useropts{'folder'} = '';
|
||||||
|
|
||||||
$useropts{'js'} = '/js' ;
|
$useropts{'js'} = '/js' ;
|
||||||
|
|
@ -147,6 +148,8 @@ sub config_common_html {
|
||||||
|
|
||||||
# ---------------- darkly ----------------------------------------------------------------------------
|
# ---------------- darkly ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
our $main_bg_color = ($env eq 'DEV') ? 'red' : '#5e5e5e' ;
|
||||||
|
|
||||||
$useropts{'common'}{'css'} = qq~tbody tr td { font-size: 11px; }
|
$useropts{'common'}{'css'} = qq~tbody tr td { font-size: 11px; }
|
||||||
.control-label { font-size:12px; } .controls .form-control { height:24px;font-size:12px; } .controls span.input-group-addon { padding:0px 5px 0px 5px;font-size:12px; } textarea.form-control { font-size:12px; } .chosen-container { position:relative;max-width:100%; }
|
.control-label { font-size:12px; } .controls .form-control { height:24px;font-size:12px; } .controls span.input-group-addon { padding:0px 5px 0px 5px;font-size:12px; } textarea.form-control { font-size:12px; } .chosen-container { position:relative;max-width:100%; }
|
||||||
.controls table { font-size:12px; }
|
.controls table { font-size:12px; }
|
||||||
|
|
@ -167,7 +170,7 @@ form-control{ padding:8px 12px; }
|
||||||
.modal-body, .modal-footer { background-color: #ffffff ; border-top: 1px solid #ffffff; }
|
.modal-body, .modal-footer { background-color: #ffffff ; border-top: 1px solid #ffffff; }
|
||||||
.modal-header { border-bottom: 1px solid #ffffff; }
|
.modal-header { border-bottom: 1px solid #ffffff; }
|
||||||
.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}
|
.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}
|
||||||
hr { border-top: 2px solid #5E5E5E; }
|
hr { border-top: 2px solid #5e5e5e; }
|
||||||
body { background-color:#ffffff; color:#222222; }
|
body { background-color:#ffffff; color:#222222; }
|
||||||
.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}
|
.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}
|
||||||
.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}
|
.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}
|
||||||
|
|
@ -183,6 +186,8 @@ th.dt-right, td.dt-right { text-align: right; }
|
||||||
.tooltip {white-space:normal}
|
.tooltip {white-space:normal}
|
||||||
~ ;
|
~ ;
|
||||||
|
|
||||||
|
$useropts{'common'}{'css'} .= qq~.navbar-default { background-color: $main_bg_color; } .navbar-default .navbar-nav > li > a { color: white; }~ if $env eq 'DEV' ;
|
||||||
|
|
||||||
# $useropts{'common'}{'css'} .= qq~
|
# $useropts{'common'}{'css'} .= qq~
|
||||||
# .buttons .glyphicons:before { padding: 0px; }
|
# .buttons .glyphicons:before { padding: 0px; }
|
||||||
# ~;
|
# ~;
|
||||||
|
|
|
||||||
1912
libs/modules/_FromProd/common.pm
Normal file
1912
libs/modules/_FromProd/common.pm
Normal file
File diff suppressed because it is too large
Load Diff
3123
libs/modules/_FromProd/common_min.pm
Normal file
3123
libs/modules/_FromProd/common_min.pm
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/modules/_FromProd/csv.pm
Normal file
54
libs/modules/_FromProd/csv.pm
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
sub csv_create_new_file {
|
||||||
|
|
||||||
|
my ($filepath,$filename,$seperator) = @_ ;
|
||||||
|
|
||||||
|
use Text::CSV;
|
||||||
|
|
||||||
|
return if !$filepath || !$filename ;
|
||||||
|
|
||||||
|
unlink "$filepath/$filename" or die "Cannot remove $filepath/$filename: $!" if -e "$filepath/$filename" ;
|
||||||
|
|
||||||
|
$seperator = ';' unless $seperator ;
|
||||||
|
|
||||||
|
our $csv = Text::CSV->new({ binary => 1, sep_char => $seperator, eol => "\n" }) or die "Cannot use CSV: " . Text::CSV->error_diag();
|
||||||
|
|
||||||
|
open(our $fh, ">", "$filepath/$filename") or die "Cannot open $filepath/$filename: $!";
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_write_in_file {
|
||||||
|
|
||||||
|
my ($row) = @_ ;
|
||||||
|
$csv->print($fh, $row);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_close_file {
|
||||||
|
|
||||||
|
my ($filepath) = @_ ;
|
||||||
|
close $fh or die "Cannot close $filepath: $!";
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_clear_folder {
|
||||||
|
|
||||||
|
my ($path,$name_to_look_for) = @_ ;
|
||||||
|
|
||||||
|
return unless -d $path ;
|
||||||
|
|
||||||
|
opendir(DIR, "$path") or die "cant open Directory $path: $!\n";
|
||||||
|
|
||||||
|
while(defined($folder = readdir(DIR))) {
|
||||||
|
if (length $folder > 2) {
|
||||||
|
my ($file,$type) = split(/\./,$folder) ;
|
||||||
|
if ((-e "$path/$file.csv" && !$name_to_look_for) || ($name_to_look_for && -e "$path/$file.csv" && $file =~ /$name_to_look_for/)) {
|
||||||
|
unlink ("$path/$file.csv") or print "unable to unlink - $path/$file.csv : $!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(DIR) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
@ -63,11 +63,25 @@ sub ops_db_credentials {
|
||||||
my $dbuser = "itv_admin_user";
|
my $dbuser = "itv_admin_user";
|
||||||
my $dbpass = '!Ja16Q7P0X3SVTWr';
|
my $dbpass = '!Ja16Q7P0X3SVTWr';
|
||||||
|
|
||||||
|
if ($env eq 'DEV') {
|
||||||
|
$db = 'dev_aisa' ;
|
||||||
|
$dbhost = 'localhost' ;
|
||||||
|
$dbuser = 'dev_aisa_user' ;
|
||||||
|
$dbpass = 'L0rdJ35u5R31gN51vQow*!' ;
|
||||||
|
}
|
||||||
|
|
||||||
if ($sys eq 'sss') {
|
if ($sys eq 'sss') {
|
||||||
$db = "sss_admin_db";
|
$db = "sss_admin_db";
|
||||||
$dbhost = "localhost";
|
$dbhost = "localhost";
|
||||||
$dbuser = "sss_admin_user";
|
$dbuser = "sss_admin_user";
|
||||||
$dbpass = 'bVrC2kyGJ8ZO0oVe!';
|
$dbpass = 'bVrC2kyGJ8ZO0oVe!';
|
||||||
|
|
||||||
|
if ($env eq 'DEV') {
|
||||||
|
$db = 'dev_sss' ;
|
||||||
|
$dbhost = 'localhost' ;
|
||||||
|
$dbuser = 'dev_sss_user' ;
|
||||||
|
$dbpass = 'L0rdJ35u5R31gN51vQow*!' ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($db,$dbhost,$dbuser,$dbpass) ;
|
return ($db,$dbhost,$dbuser,$dbpass) ;
|
||||||
|
|
|
||||||
269
libs/modules/_FromProd/db_min.pm
Normal file
269
libs/modules/_FromProd/db_min.pm
Normal file
|
|
@ -0,0 +1,269 @@
|
||||||
|
sub db_min_upd {
|
||||||
|
|
||||||
|
my ($table,$where) = @_ ;
|
||||||
|
|
||||||
|
our $set = '' ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
if (substr($_,0,3) eq 'new') { next ; }
|
||||||
|
if ($ignore{$_}) { next ; }
|
||||||
|
if ($hidden{$_} == 1) { next ; }
|
||||||
|
if ($i{$_} =~ /\"/) { $set .= qq(`$_`='$i{$_}',) ; } elsif ($i{$_} eq 'NULL') { $set .= qq(`$_`=$i{$_},) ; } else { $set .= qq(`$_`="$i{$_}",) ; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$set = substr($set,0,-1) ;
|
||||||
|
|
||||||
|
unless ($set) { return ; }
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(UPDATE $table SET $set WHERE $where) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY SAVED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_insert {
|
||||||
|
|
||||||
|
my ($table) = @_ ;
|
||||||
|
|
||||||
|
my $columns = '' ;
|
||||||
|
my $values = '' ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
if ($ignore{$_}) { next ; }
|
||||||
|
if ($hidden{$_} == 1) { next ; }
|
||||||
|
$columns .= qq(`$_`,) ;
|
||||||
|
if ($i{$_} =~ /\"/) { $values .= qq('$i{$_}',) ; } elsif ($i{$_} eq 'NULL') { $values .= qq(`$_`=$i{$_},) ; } else { $values .= qq("$i{$_}",) ; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$columns = substr($columns,0,-1) ;
|
||||||
|
$values = substr($values,0,-1) ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(INSERT INTO $table ($columns) VALUES ($values) ;) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
our $new_row_id = $dbh->last_insert_id(undef, undef, $table, 'id') ; # or die "no insert id?";
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY SAVED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_delete {
|
||||||
|
|
||||||
|
my ($table,$where) = @_ ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(DELETE FROM $table WHERE $where) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY DELETED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_ro {
|
||||||
|
|
||||||
|
my ($table,$select,$where,$orderby,$limit) = @_ ;
|
||||||
|
|
||||||
|
if ($where) { $where = 'WHERE ' . $where ; }
|
||||||
|
if ($limit) { $limit = 'LIMIT ' . $limit ; }
|
||||||
|
if ($orderby) { $orderby = 'ORDER BY ' . $orderby ; }
|
||||||
|
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
my $sql = qq(SELECT $select FROM $table $where $orderby $limit) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
$col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
my $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$db{$table} = () ; $done_col_val{$table} = () ;
|
||||||
|
|
||||||
|
foreach $row (@$rows_array_ref) {
|
||||||
|
for (0 .. $col_cnt){
|
||||||
|
if ($done_col_val{$table}{@$row[0]}{$col_name{$_}}) { next; }
|
||||||
|
# &common_debug("db_common_ro - [$_] [$table] [@$row[0]] [$col_name{$_}] [@$row[$_]]") ;
|
||||||
|
$db{$table}{@$row[0]}{$col_name{$_}} = @$row[$_] ;
|
||||||
|
$done_col_val{$table}{@$row[0]}{$col_name{$_}} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_raw {
|
||||||
|
|
||||||
|
my ($sql) = @_ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth->execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
our $col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
our $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_copy {
|
||||||
|
|
||||||
|
my ($table,$id) = @_ ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
our $db_ignore_open_close = 1 ; # do one open and one close instead of repeating it
|
||||||
|
|
||||||
|
$i{id} = &db_min_get_max($table,'id') ;
|
||||||
|
|
||||||
|
my $add_upd_sql = '' ;
|
||||||
|
if ($table eq 'quotes' or $table eq 'event_quotes'){
|
||||||
|
$i{quote_nr} = &db_min_get_max($table,'quote_nr') ;
|
||||||
|
$add_upd_sql = qq~, `quote_nr`='$i{quote_nr}'~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($table eq 'cameras'){
|
||||||
|
$i{camera_nr} = &db_min_get_max_camera_nr($table,'camera_nr',$id) ;
|
||||||
|
$add_upd_sql = qq~, `camera_nr`='$i{camera_nr}'~;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $sql = qq~CREATE TEMPORARY TABLE `#temp` SELECT * FROM $table WHERE `id`='$id';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~UPDATE `#temp` SET `id`='$i{id}'$add_upd_sql WHERE `id`='$id';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~INSERT INTO $table SELECT * FROM `#temp` WHERE `id`='$i{id}';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~DROP TEMPORARY TABLE IF EXISTS `#temp`;~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$db_ignore_open_close = 0 ; # do one open and one close instead of repeating it
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($id SUCCESSFULLY COPIED TO $i{id}) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_get_max_camera_nr {
|
||||||
|
|
||||||
|
my ($table,$orderby,$camera_id) = @_ ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'id,camera_system_id',"`id`='$camera_id'",'','') ;
|
||||||
|
# &db_min_ro($table,'id,camera_nr',"`camera_system_id`='$db{$table}{$camera_id}{camera_nr}'",'`id` DESC',1) ;
|
||||||
|
&db_min_ro($table,'id,camera_nr',"`camera_system_id`='$db{$table}{$camera_id}{camera_system_id}'",'`id` DESC',1) ;
|
||||||
|
|
||||||
|
my $max_cam_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
($cam_type,$cam_cnt) = split(/\-/,$db{$table}{$id}{camera_nr});
|
||||||
|
$max_cam_cnt = $cam_cnt unless $max_cam_cnt > $cam_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_cam_cnt++;
|
||||||
|
|
||||||
|
my $camera_nr = $cam_type . '-' . sprintf("%04s", $max_cam_cnt) ; # e.g. S1-0001
|
||||||
|
|
||||||
|
return ($camera_nr) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_get_max {
|
||||||
|
|
||||||
|
my ($table,$orderby,$where) = @_ ;
|
||||||
|
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
if ($where) { $where = 'WHERE ' . $where ; }
|
||||||
|
|
||||||
|
my $sql = qq~SELECT * FROM $table $where ORDER BY $orderby DESC LIMIT 1~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
$col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
my $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
my $new_id = 1 ;
|
||||||
|
|
||||||
|
$db{$table} = () ;
|
||||||
|
|
||||||
|
foreach $row (@$rows_array_ref) {
|
||||||
|
for (0 .. $col_cnt){
|
||||||
|
$db{$table}{@$row[0]}{$col_name{$_}} = @$row[$_] ;
|
||||||
|
}
|
||||||
|
$new_id = $db{$table}{@$row[0]}{$orderby} ;
|
||||||
|
$new_id++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($new_id) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
525
libs/modules/_FromProd/dcb.pm
Normal file
525
libs/modules/_FromProd/dcb.pm
Normal file
|
|
@ -0,0 +1,525 @@
|
||||||
|
|
||||||
|
sub dcb_trackntrace {
|
||||||
|
|
||||||
|
my ($waybillNumber) = @_ ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<TracknTrace xmlns="http://tempuri.org/">
|
||||||
|
<!-- Optional -->
|
||||||
|
<request>
|
||||||
|
<enPassword xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></enPassword>
|
||||||
|
<enUsername xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></enUsername>
|
||||||
|
<waybillNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybillNumber</waybillNumber>
|
||||||
|
</request>
|
||||||
|
</TracknTrace>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_trackntrace : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('TracknTrace') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('TracknTrace') ;
|
||||||
|
|
||||||
|
# $returnxml = qq~<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <s:Body>
|
||||||
|
# <TracknTraceResponse xmlns="http://tempuri.org/">
|
||||||
|
# <TracknTraceResult xmlns:a="http://schemas.datacontract.org/2004/07/OMSIntegrate.Response" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
# <a:ErrorCode i:nil="true"/>
|
||||||
|
# <a:ErrorMessage>Completed</a:ErrorMessage>
|
||||||
|
# <a:Waybill>
|
||||||
|
# <a:BookingDate/>
|
||||||
|
# <a:Comments i:nil="true"></a:Comments>
|
||||||
|
# <a:ConsigneeName>DEV</a:ConsigneeName>
|
||||||
|
# <a:ConsignorName>DARREN</a:ConsignorName>
|
||||||
|
# <a:CurrentStatus>Proof of delivery</a:CurrentStatus>
|
||||||
|
# <a:DeliveryDate>08052023</a:DeliveryDate>
|
||||||
|
# <a:InsuredValue>0.00</a:InsuredValue>
|
||||||
|
# <a:NumberOfParcels>1</a:NumberOfParcels>
|
||||||
|
# <a:ReceiverAddressLine1>15 SIM ROAD</a:ReceiverAddressLine1>
|
||||||
|
# <a:ReceiverAddressLine2>.</a:ReceiverAddressLine2>
|
||||||
|
# <a:ReceiverCity>KEMPTON PARK</a:ReceiverCity>
|
||||||
|
# <a:ReceiverContactName>DARREN</a:ReceiverContactName>
|
||||||
|
# <a:ReceiverContactTel1>0834752596</a:ReceiverContactTel1>
|
||||||
|
# <a:ReceiverName i:nil="true">ReceiverName TESTING</a:ReceiverName>
|
||||||
|
# <a:ReceiverPostalCode>1619</a:ReceiverPostalCode>
|
||||||
|
# <a:ReceiverSuburb>POMONA</a:ReceiverSuburb>
|
||||||
|
# <a:SenderAddressLine1></a:SenderAddressLine1>
|
||||||
|
# <a:SenderAddressLine2>.</a:SenderAddressLine2>
|
||||||
|
# <a:SenderCity>KEMPTON PARK</a:SenderCity>
|
||||||
|
# <a:SenderContactName>DEV</a:SenderContactName>
|
||||||
|
# <a:SenderContactTel>0112302085</a:SenderContactTel>
|
||||||
|
# <a:SenderPostalCode>1619</a:SenderPostalCode>
|
||||||
|
# <a:SenderSuburb>POMONA</a:SenderSuburb>
|
||||||
|
# <a:ServiceTypeCode>EC</a:ServiceTypeCode>
|
||||||
|
# <a:ShipmentIsInsured>YES</a:ShipmentIsInsured>
|
||||||
|
# <a:ShipperReference/>
|
||||||
|
# <a:accNr>DCBDEVLP</a:accNr>
|
||||||
|
# <a:additionalInformation xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
# <b:AdditionalInformation>
|
||||||
|
# <b:additionalInfoCode>overrideDefaultSubcontractor</b:additionalInfoCode>
|
||||||
|
# <b:additionalInfoValue>no</b:additionalInfoValue>
|
||||||
|
# <b:waybillNumber>Dn230505</b:waybillNumber>
|
||||||
|
# </b:AdditionalInformation>
|
||||||
|
# </a:additionalInformation>
|
||||||
|
# <a:pod xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities"/>
|
||||||
|
# <a:trackingDetail xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
# <b:TrackingDetail>
|
||||||
|
# <b:eventCode>PODCRE</b:eventCode>
|
||||||
|
# <b:eventDate>09052023</b:eventDate>
|
||||||
|
# <b:eventDescription>Waybill has been PODed</b:eventDescription>
|
||||||
|
# <b:eventHubCode>JNB</b:eventHubCode>
|
||||||
|
# <b:eventTime>0719</b:eventTime>
|
||||||
|
# </b:TrackingDetail>
|
||||||
|
# <b:TrackingDetail>
|
||||||
|
# <b:eventCode>WBLCRE</b:eventCode>
|
||||||
|
# <b:eventDate>05052023</b:eventDate>
|
||||||
|
# <b:eventDescription>Waybill Dn230505 created in import</b:eventDescription>
|
||||||
|
# <b:eventHubCode>JNB</b:eventHubCode>
|
||||||
|
# <b:eventTime>0718</b:eventTime>
|
||||||
|
# </b:TrackingDetail>
|
||||||
|
# </a:trackingDetail>
|
||||||
|
# <a:waybillDate>05052023</a:waybillDate>
|
||||||
|
# <a:waybillNumber>Dn230505</a:waybillNumber>
|
||||||
|
# </a:Waybill>
|
||||||
|
# </TracknTraceResult>
|
||||||
|
# </TracknTraceResponse>
|
||||||
|
# </s:Body>
|
||||||
|
# </s:Envelope>~ ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_postalcode {
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<PostalCode xmlns="http://tempuri.org/">
|
||||||
|
<request>
|
||||||
|
<PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
<Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
</request>
|
||||||
|
</PostalCode>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_postalcode : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('PostalCode') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('PostalCode') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_savewabill {
|
||||||
|
|
||||||
|
my ($venue,$ft,$ev_id) = @_ ;
|
||||||
|
|
||||||
|
my $system_loc = $i{"system_location_$ft\_$ev_id"} ;
|
||||||
|
my $supplier = $i{"logistics_supplier_id_$ft\_$ev_id"} ;
|
||||||
|
my $status = $i{"status_$ft\_$ev_id"} ;
|
||||||
|
my $waybill_nr = $i{"waybill_nr_$ft\_$ev_id"} ;
|
||||||
|
my $items = $i{"item_$ft\_$ev_id"} ;
|
||||||
|
my $poc = $i{"poc_$ft\_$ev_id"} ;
|
||||||
|
my $special_instructions = $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
# my $dest = ($ft eq 'to') ? $db{organisations}{$venue}{name} : $db{logistics_locations}{$system_loc}{location} ;
|
||||||
|
# my $orig = ($ft eq 'from') ? $db{organisations}{$venue}{name} : $db{logistics_locations}{$system_loc}{location} ;
|
||||||
|
|
||||||
|
my $dest = ($ft eq 'from') ? $db{logistics_locations}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{organisations}{$venue}{region_code} ;
|
||||||
|
my $orig = ($ft eq 'to') ? $db{logistics_locations}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{organisations}{$venue}{region_code} ;
|
||||||
|
|
||||||
|
my ($poc_name,$poc_nr) = split(/\_/,$poc) ;
|
||||||
|
|
||||||
|
if ($dest =~ /ITV/) { $dest =~ s/\ITV//g ; $dest =~ s/ //g ; }
|
||||||
|
elsif ($orig =~ /ITV/) { $orig =~ s/\ITV//g ; $orig =~ s/ //g ; }
|
||||||
|
|
||||||
|
# my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31F' ;
|
||||||
|
my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31' ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<savewabill xmlns="http://tempuri.org/">
|
||||||
|
<!-- Optional -->
|
||||||
|
<request>
|
||||||
|
<AccNr xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$accountnumber</AccNr>
|
||||||
|
<AddressLine1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address1</AddressLine1>
|
||||||
|
<AddressLine2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address2</AddressLine2>
|
||||||
|
<AddressLine3 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address3</AddressLine3>
|
||||||
|
<AddressLine4 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address4</AddressLine4>
|
||||||
|
<ContactNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$poc_nr</ContactNumber>
|
||||||
|
<ContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$poc_name</ContactPerson>
|
||||||
|
<CustomerReferenceNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></CustomerReferenceNumber>
|
||||||
|
<Date xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$dcbdate</Date>
|
||||||
|
<DestHub xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$dest</DestHub>
|
||||||
|
<Number xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybill_nr</Number>
|
||||||
|
<OriginHub xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$orig</OriginHub>
|
||||||
|
<PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
<Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
<Reciever xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$db{organisations}{$venue}{name}</Reciever>
|
||||||
|
<RouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$routeCode</RouteCode>
|
||||||
|
<SpecialInstructions xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$special_instructions</SpecialInstructions>
|
||||||
|
<serviceType xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">1</serviceType>
|
||||||
|
</request>
|
||||||
|
</savewabill>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_savewabill : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('savewabill') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('savewabill') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_upload_oms_waybill {
|
||||||
|
|
||||||
|
my ($venue,$ft,$ev_id) = @_ ;
|
||||||
|
|
||||||
|
my $tbl_log_loc = 'logistics_locations' ;
|
||||||
|
my $tbl_org = 'organisations' ;
|
||||||
|
my $system_loc = $i{"system_location_$ft\_$ev_id"} ;
|
||||||
|
my $supplier = $i{"logistics_supplier_id_$ft\_$ev_id"} ;
|
||||||
|
my $status = $i{"status_$ft\_$ev_id"} ;
|
||||||
|
my $waybill_nr = $i{"waybill_nr_$ft\_$ev_id"} ;
|
||||||
|
my $items = $i{"item_$ft\_$ev_id"} ;
|
||||||
|
my $poc = $i{"poc_$ft\_$ev_id"} ; my ($poc_name,$poc_nr) = split(/\_/,$poc) ;
|
||||||
|
# my $special_instructions = $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
my $start_end = ($ft eq 'from') ? 'end' : 'start' ;
|
||||||
|
my $special_instructions = "Event $start_end : $dcbdate. " . $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
$rec{address1} = $address1 ;
|
||||||
|
$rec{address1} .= ', ' if $address1 && $address2 ;
|
||||||
|
$rec{address1} .= $address2 if $address2 ;
|
||||||
|
$rec{address2} = $address3 ;
|
||||||
|
$rec{address2} .= ', ' if $address3 && $address4 ;
|
||||||
|
$rec{address2} .= $address4 if $address4 ;
|
||||||
|
$rec{city} = $city ;
|
||||||
|
$rec{suburb} = $suburb ;
|
||||||
|
$rec{postal_code} = $postal_code ;
|
||||||
|
$rec{poc_name} = $poc_name ;
|
||||||
|
$rec{poc_nr} = $poc_nr ;
|
||||||
|
$rec{name} = $db{$tbl_org}{$venue}{name} ;
|
||||||
|
$rec{routecode} = $routeCode ;
|
||||||
|
|
||||||
|
$send{address1} = $db{$tbl_log_loc}{$system_loc}{address_line_1} ;
|
||||||
|
$send{address1} .= ', ' if $db{$tbl_log_loc}{$system_loc}{address_line_1} && $db{$tbl_log_loc}{$system_loc}{address_line_2} ;
|
||||||
|
$send{address1} .= $db{$tbl_log_loc}{$system_loc}{address_line_2} if $db{$tbl_log_loc}{$system_loc}{address_line_2} ;
|
||||||
|
$send{address2} = $db{$tbl_log_loc}{$system_loc}{address_line_3} ;
|
||||||
|
$send{address2} .= ', ' if $db{$tbl_log_loc}{$system_loc}{address_line_3} && $db{$tbl_log_loc}{$system_loc}{address_line_4} ;
|
||||||
|
$send{address2} .= $db{$tbl_log_loc}{$system_loc}{address_line_4} if $db{$tbl_log_loc}{$system_loc}{address_line_4} ;
|
||||||
|
$send{city} = $db{$tbl_log_loc}{$system_loc}{city} ;
|
||||||
|
$send{suburb} = $db{$tbl_log_loc}{$system_loc}{suburb} ;
|
||||||
|
$send{postal_code} = $db{$tbl_log_loc}{$system_loc}{postal_code} ;
|
||||||
|
$send{poc_name} = $db{$tbl_log_loc}{$system_loc}{poc_name} ;
|
||||||
|
$send{poc_nr} = $db{$tbl_log_loc}{$system_loc}{poc_nr} ;
|
||||||
|
$send{name} = $db{$tbl_log_loc}{$system_loc}{location} ;
|
||||||
|
$send{routecode} = $db{$tbl_log_loc}{$system_loc}{dcb_route_code} ;
|
||||||
|
|
||||||
|
# my $dest = ($ft eq 'from') ? $db{$tbl_log_loc}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{$tbl_log_loc}{$venue}{region_code} ;
|
||||||
|
# my $orig = ($ft eq 'to') ? $db{$tbl_log_loc}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{$tbl_log_loc}{$venue}{region_code} ;
|
||||||
|
|
||||||
|
if ($ft eq 'from') {
|
||||||
|
foreach (keys %rec) {
|
||||||
|
my $rec = $rec{$_} ;
|
||||||
|
$rec{$_} = $send{$_} ;
|
||||||
|
$send{$_} = $rec ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($dest =~ /ITV/) { $dest =~ s/\ITV//g ; $dest =~ s/ //g ; }
|
||||||
|
# elsif ($orig =~ /ITV/) { $orig =~ s/\ITV//g ; $orig =~ s/ //g ; }
|
||||||
|
|
||||||
|
# our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
# <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <Body>
|
||||||
|
# <UploadOMSWaybill xmlns="http://tempuri.org/">
|
||||||
|
# <request>
|
||||||
|
# <accountNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">DCBMAILBAG</accountNumber>
|
||||||
|
# <numParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$items_cnt</numParcels>~;
|
||||||
|
|
||||||
|
# my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31F' ;
|
||||||
|
my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31' ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<Body>
|
||||||
|
<UploadOMSWaybill xmlns="http://tempuri.org/">
|
||||||
|
<request>
|
||||||
|
<accountNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$accountnumber</accountNumber>
|
||||||
|
<invoices xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">
|
||||||
|
<WaybillInvoices xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
<InvAmount></InvAmount>
|
||||||
|
<InvDescription></InvDescription>
|
||||||
|
<InvNum></InvNum>
|
||||||
|
<InvUnits></InvUnits>
|
||||||
|
<WaybillId>0</WaybillId>
|
||||||
|
</WaybillInvoices>
|
||||||
|
</invoices>
|
||||||
|
<numParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$items_cnt</numParcels>~;
|
||||||
|
|
||||||
|
for my $parcel_cnt (1 .. $items_cnt) {
|
||||||
|
my $parcel_qty = ($db{logistics_items}{$items[$parcel_cnt-1]}{qty}) ? $db{logistics_items}{$items[$parcel_cnt-1]}{qty} : 1 ;
|
||||||
|
my $parcel_desc = ($db{logistics_items}{$items[$parcel_cnt-1]}{name}) ? $db{logistics_items}{$items[$parcel_cnt-1]}{name} : 1 ;
|
||||||
|
$soapenvelope .= qq~
|
||||||
|
<parcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">
|
||||||
|
<WaybillParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
<LoadType>STD</LoadType>
|
||||||
|
<RateType>G</RateType>
|
||||||
|
<WaybillId>0</WaybillId>
|
||||||
|
<breadth>1</breadth>
|
||||||
|
<description>$parcel_desc</description>
|
||||||
|
<height>1</height>
|
||||||
|
<length>1</length>
|
||||||
|
<mass>1</mass>
|
||||||
|
<parcelNumber>$parcel_cnt</parcelNumber>
|
||||||
|
<qty>$parcel_qty</qty>
|
||||||
|
</WaybillParcels>
|
||||||
|
</parcels>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
$soapenvelope .= qq~
|
||||||
|
<recieversAddress1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{address1}</recieversAddress1>
|
||||||
|
<recieversAddress2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{address2}</recieversAddress2>
|
||||||
|
<recieversCity xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{city}</recieversCity>
|
||||||
|
<recieversContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{poc_name}</recieversContactPerson>
|
||||||
|
<recieversContactTel xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{poc_nr}</recieversContactTel>
|
||||||
|
<recieversName xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{name}</recieversName>
|
||||||
|
<recieversPostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{postal_code}</recieversPostalCode>
|
||||||
|
<recieversRouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{routecode}</recieversRouteCode>
|
||||||
|
<recieversSuburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{suburb}</recieversSuburb>
|
||||||
|
<sendersAddress1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{address1}</sendersAddress1>
|
||||||
|
<sendersAddress2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{address2}</sendersAddress2>
|
||||||
|
<sendersCity xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{city}</sendersCity>
|
||||||
|
<sendersContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{poc_name}</sendersContactPerson>
|
||||||
|
<sendersContactTelephone xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{poc_nr}</sendersContactTelephone>
|
||||||
|
<sendersName xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{name}</sendersName>
|
||||||
|
<sendersPostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{postal_code}</sendersPostalCode>
|
||||||
|
<sendersRouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{routecode}</sendersRouteCode>
|
||||||
|
<sendersSuburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{suburb}</sendersSuburb>
|
||||||
|
<serviceType xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">OE</serviceType>
|
||||||
|
<specialInstructions xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$special_instructions</specialInstructions>
|
||||||
|
<waybillNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybill_nr</waybillNumber>
|
||||||
|
</request>
|
||||||
|
</UploadOMSWaybill>
|
||||||
|
</Body>
|
||||||
|
</Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_upload_oms_waybill : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('UploadOMSWaybill') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('UploadOMSWaybill') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_send_it {
|
||||||
|
|
||||||
|
my ($soapaction) = @_ ;
|
||||||
|
|
||||||
|
my $environment = ($testdcd) ? 'APIUAT' : 'API' ;
|
||||||
|
|
||||||
|
my $header_soapaction = "http://tempuri.org/IOMSIntegrate/$soapaction" ;
|
||||||
|
my $host = "https://dcboms.co.za/$environment/OMSIntegrate.svc" ;
|
||||||
|
|
||||||
|
&common_write_log("dcb/xml_send_$now_year\_$now_mm.log","$now_ccyymmddhrmnsc|$now_ccyy_mm_ddT$now_hh_min_sec|$soapaction|$host|$header_soapaction|$soapenvelope|");
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_send_it : [host=$host]") ;
|
||||||
|
&common_debug("[API] dcb_send_it : [soapaction=$header_soapaction]") ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username} && $soapaction ne 'PostalCode') { &common_debug(">>>>>> *** TESTING, $soapaction API call NOT SENT *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
my $userAgent = LWP::UserAgent->new();
|
||||||
|
my $request = HTTP::Request->new(POST => $host);
|
||||||
|
$request->header(SOAPAction => "$header_soapaction");
|
||||||
|
$request->content($soapenvelope);
|
||||||
|
$request->content_type("text/xml; charset=utf-8");
|
||||||
|
my $response = $userAgent->request($request);
|
||||||
|
|
||||||
|
# Check response
|
||||||
|
my $response_code = $response -> code ;
|
||||||
|
my $response_content = $response -> content ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_send_it : [response_code=$response_code]") ;
|
||||||
|
&common_debug("[API] response_content : [response_content=$response_content]") ;
|
||||||
|
|
||||||
|
$returnxml = $response_content ;
|
||||||
|
|
||||||
|
&common_write_log("dcb/xml_response_$now_year\_$now_mm.log","$now_ccyymmddhrmnsc|$now_ccyy_mm_ddT$now_hh_min_sec|$soapaction|$response_code|$returnxml|");
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_parse_it {
|
||||||
|
|
||||||
|
# use Data::Dumper;
|
||||||
|
# print Dumper(\$returnxml);
|
||||||
|
# exit;
|
||||||
|
|
||||||
|
$returnxml =~ s/[\x80-\xFF]/?/g ;
|
||||||
|
my $xml = new XML::Simple or die "Cant instantiate object XML::Simple $!" ;
|
||||||
|
# my $xmldata = $xml->XMLin($returnxml) or die "Cant open xmldata $!" ;
|
||||||
|
$xmldata = $xml->XMLin($returnxml, forcearray => 1) or die "Cant open xmldata $!";
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
use Data::Dumper;
|
||||||
|
print Dumper(\$xmldata);
|
||||||
|
# exit ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_read_it {
|
||||||
|
|
||||||
|
my ($soapaction) = @_ ;
|
||||||
|
|
||||||
|
# my $result = '' ;
|
||||||
|
|
||||||
|
if ($soapaction eq 'UploadOMSWaybill') {
|
||||||
|
our $uploadwaybillresult = $xmldata->{'s:Body'}->[0]->{'UploadOMSWaybillResponse'}->[0]->{'UploadOMSWaybillResult'}->[0] ;
|
||||||
|
} elsif ($soapaction eq 'savewabill') {
|
||||||
|
our $savewabillResult = $xmldata->{'s:Body'}->[0]->{'savewabillResponse'}->[0]->{'savewabillResult'}->[0] ;
|
||||||
|
} elsif ($soapaction eq 'PostalCode') {
|
||||||
|
our $routeCode = '' ; # our $routeCode = '' ;
|
||||||
|
foreach my $hashref (@{$xmldata->{'s:Body'}->[0]->{'PostalCodeResponse'}->[0]->{'PostalCodeResult'}->[0]->{'a:ArrayOfpostalCode'} } ) {
|
||||||
|
foreach $address (@{$hashref}{'a:postalCode'}) {
|
||||||
|
$routeCode = ${$hashref}{'a:postalCode'}->[0]->{'a:routeCode'}->[0] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# $routeCode = substr($routeCode,0,3) ;
|
||||||
|
} elsif ($soapaction eq 'TracknTrace') {
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $hashref (@{$xmldata->{'s:Body'}->[0]->{'TracknTraceResponse'}->[0]->{'TracknTraceResult'}->[0]->{'a:Waybill'} } ) {
|
||||||
|
|
||||||
|
$trackntrace{booking_date} = (ref(${$hashref}{'a:BookingDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:BookingDate'}->[0] ;
|
||||||
|
$trackntrace{comments} = ${$hashref}{'a:Comments'}->[0]->{'content'} ;
|
||||||
|
$trackntrace{consignee_name} = (ref(${$hashref}{'a:ConsigneeName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ConsigneeName'}->[0] ;
|
||||||
|
$trackntrace{consignor_name} = (ref(${$hashref}{'a:ConsignorName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ConsignorName'}->[0] ;
|
||||||
|
$trackntrace{current_status} = (ref(${$hashref}{'a:CurrentStatus'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:CurrentStatus'}->[0] ;
|
||||||
|
$trackntrace{delivery_date} = (ref(${$hashref}{'a:DeliveryDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:DeliveryDate'}->[0] ;
|
||||||
|
$trackntrace{insured_value} = (ref(${$hashref}{'a:InsuredValue'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:InsuredValue'}->[0] ;
|
||||||
|
$trackntrace{number_of_parcels} = (ref(${$hashref}{'a:NumberOfParcels'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:NumberOfParcels'}->[0] ;
|
||||||
|
$trackntrace{receiver_address_line_1} = (ref(${$hashref}{'a:ReceiverAddressLine1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverAddressLine1'}->[0] ;
|
||||||
|
$trackntrace{receiver_address_line_2} = (ref(${$hashref}{'a:ReceiverAddressLine2'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverAddressLine2'}->[0] ;
|
||||||
|
$trackntrace{receiver_city} = (ref(${$hashref}{'a:ReceiverCity'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverCity'}->[0] ;
|
||||||
|
$trackntrace{receiver_contact_name} = (ref(${$hashref}{'a:ReceiverContactName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverContactName'}->[0] ;
|
||||||
|
$trackntrace{receiver_contact_tel_1} = (ref(${$hashref}{'a:ReceiverContactTel1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverContactTel1'}->[0] ;
|
||||||
|
$trackntrace{receiver_name} = ${$hashref}{'a:ReceiverName'}->[0]->{'content'} ;
|
||||||
|
$trackntrace{receiver_postal_code} = (ref(${$hashref}{'a:ReceiverPostalCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverPostalCode'}->[0] ;
|
||||||
|
$trackntrace{receiver_suburb} = (ref(${$hashref}{'a:ReceiverSuburb'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverSuburb'}->[0] ;
|
||||||
|
$trackntrace{sender_address_line_1} = (ref(${$hashref}{'a:SenderAddressLine1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderAddressLine1'}->[0] ;
|
||||||
|
$trackntrace{sender_address_line_2} = (ref(${$hashref}{'a:SenderAddressLine2'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderAddressLine2'}->[0] ;
|
||||||
|
$trackntrace{sender_city} = (ref(${$hashref}{'a:SenderCity'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderCity'}->[0] ;
|
||||||
|
$trackntrace{sender_contact_name} = (ref(${$hashref}{'a:SenderContactName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderContactName'}->[0] ;
|
||||||
|
$trackntrace{sender_contact_tel} = (ref(${$hashref}{'a:SenderContactTel'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderContactTel'}->[0] ;
|
||||||
|
$trackntrace{sender_postal_code} = (ref(${$hashref}{'a:SenderPostalCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderPostalCode'}->[0] ;
|
||||||
|
$trackntrace{sender_suburb} = (ref(${$hashref}{'a:SenderSuburb'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderSuburb'}->[0] ;
|
||||||
|
$trackntrace{service_type_code} = (ref(${$hashref}{'a:ServiceTypeCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ServiceTypeCode'}->[0] ;
|
||||||
|
$trackntrace{shipment_is_insured} = (ref(${$hashref}{'a:ShipmentIsInsured'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ShipmentIsInsured'}->[0] ;
|
||||||
|
$trackntrace{shipper_reference} = (ref(${$hashref}{'a:ShipperReference'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ShipperReference'}->[0]->{''} ;
|
||||||
|
$trackntrace{account_nr} = (ref(${$hashref}{'a:accNr'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:accNr'}->[0] ;
|
||||||
|
$trackntrace{pod} = ${$hashref}{'a:pod'}->[0]->{'xmlns:b'} ;
|
||||||
|
$trackntrace{waybill_date} = (ref(${$hashref}{'a:waybillDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:waybillDate'}->[0] ;
|
||||||
|
$trackntrace{waybill_number} = (ref(${$hashref}{'a:waybillNumber'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:waybillNumber'}->[0] ;
|
||||||
|
|
||||||
|
my $additional_info = $hashref->{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0];
|
||||||
|
$trackntrace{additional_information}{additional_info_code} = (ref($additional_info->{'b:additionalInfoCode'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:additionalInfoCode'}->[0];
|
||||||
|
$trackntrace{additional_information}{additional_info_value} = (ref($additional_info->{'b:additionalInfoValue'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:additionalInfoValue'}->[0];
|
||||||
|
$trackntrace{additional_information}{waybill_number} = (ref($additional_info->{'b:waybillNumber'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:waybillNumber'}->[0];
|
||||||
|
|
||||||
|
my $tracking_details = $hashref->{'a:trackingDetail'}->[0]->{'b:TrackingDetail'};
|
||||||
|
for my $i (0..$#$tracking_details) {
|
||||||
|
my $event_index = $i + 1;
|
||||||
|
$trackntrace{tracking_detail}{event_code}{$event_index} = (ref($tracking_details->[$i]->{'b:eventCode'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventCode'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_date}{$event_index} = (ref($tracking_details->[$i]->{'b:eventDate'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventDate'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_description}{$event_index} = (ref($tracking_details->[$i]->{'b:eventDescription'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventDescription'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_hub_code}{$event_index} = (ref($tracking_details->[$i]->{'b:eventHubCode'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventHubCode'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_time}{$event_index} = (ref($tracking_details->[$i]->{'b:eventTime'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventTime'}->[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
# $trackntrace{additional_information}{additional_info_code} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:additionalInfoCode'}->[0] ;
|
||||||
|
# $trackntrace{additional_information}{additional_info_value} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:additionalInfoValue'}->[0] ;
|
||||||
|
# $trackntrace{additional_information}{waybill_number} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:waybillNumber'}->[0] ;
|
||||||
|
|
||||||
|
# $trackntrace{tracking_detail}{event_code}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_date}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventDate'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_description}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventDescription'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_hub_code}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventHubCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_time}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventTime'}->[0] ;
|
||||||
|
|
||||||
|
# $trackntrace{tracking_detail}{event_code}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_date}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventDate'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_description}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventDescription'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_hub_code}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventHubCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_time}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventTime'}->[0] ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# return ($result) ;
|
||||||
|
|
||||||
|
# print "\n" . $xmldata->{'s:Body'}->[0]->{'savewabillResponse'}->[0]->{'savewabillResult'}->[0] ;
|
||||||
|
|
||||||
|
# return unless $event_id ;
|
||||||
|
# return unless $from_to ;
|
||||||
|
|
||||||
|
# &db_min_ro("event_quotes","1,logistics_dcb_waybill","`id`='$event_id'","","") ;
|
||||||
|
|
||||||
|
# my @waybill_nrs = split(/\-/,$db{event_quotes}{1}{logistics_waybill_nrs}) ;
|
||||||
|
# my @dcb_waybill = split(/\-/,$logistics_dcb_waybill) ;
|
||||||
|
|
||||||
|
# my $dcb_waybill = ($from_to eq 'to') ? "$dcb_waybill[0]-1" : "1-$dcb_waybill[1]" ;
|
||||||
|
|
||||||
|
# $ii{$event_id}{logistics_dcb_waybill} = $dcb_waybill ;
|
||||||
|
|
||||||
|
# our $testing = 1 ;
|
||||||
|
|
||||||
|
# &db_min_upd('event_quotes',"`id`='$event_id'") ;
|
||||||
|
# &db_min_upd('event_quotes',"`id`='5136'") ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub dcb_send_it_get_route_code {
|
||||||
|
|
||||||
|
# my ($postal_code,$suburb) = @_ ;
|
||||||
|
|
||||||
|
# my $message = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
# <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <soap:Body>
|
||||||
|
# <PostalCode xmlns="http://tempuri.org/">
|
||||||
|
# <request>
|
||||||
|
# <PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
# <Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
# </request>
|
||||||
|
# </PostalCode>
|
||||||
|
# </soap:Body>
|
||||||
|
# </soap:Envelope>
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# if ($debug) {
|
||||||
|
# print $message;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# my $userAgent = LWP::UserAgent->new();
|
||||||
|
# my $request = HTTP::Request->new(POST => 'https://dcboms.co.za/APIUAT/OMSIntegrate.svc');
|
||||||
|
# $request->header(SOAPAction => '"http://tempuri.org/IOMSIntegrate/savewabill"');
|
||||||
|
# $request->content($message);
|
||||||
|
# $request->content_type("text/xml; charset=utf-8");
|
||||||
|
# my $response = $userAgent->request($request);
|
||||||
|
|
||||||
|
# # Check response
|
||||||
|
# my $response_code = $response -> code ;
|
||||||
|
# my $response_content = $response -> content ;
|
||||||
|
|
||||||
|
# $returnxml = $response_content ;
|
||||||
|
|
||||||
|
# } #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
1 ;
|
||||||
34
libs/modules/_FromProd/dialog.pm
Normal file
34
libs/modules/_FromProd/dialog.pm
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dialog_common {
|
||||||
|
|
||||||
|
$dialog{'common'}{'head'} = qq(<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{short} Admin</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="$useropts{'css'}/bootstrap-darkly.min.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
146
libs/modules/_FromProd/event_email.pm
Normal file
146
libs/modules/_FromProd/event_email.pm
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
|
||||||
|
sub create_event_email_table {
|
||||||
|
|
||||||
|
my ($event_id) = @_ ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','1,country_id,event_system_id_multiple,type_details_id,qty,club_name,operator_ids,ref,organisation_ids,date_from,date_to,poc_name,poc_contact_nr,type,sport_type_ids,region_id,city_id,quote_to,category_id_1,category_id_2,additional_notes,user_id,format_of_title',"`id`='$event_id'",'','') ;
|
||||||
|
|
||||||
|
# &db_min_ro('user_type','id,name,email,user_type',"",'','') ;
|
||||||
|
&db_min_ro('users','id,name,email,user_type',"",'','') ;
|
||||||
|
|
||||||
|
our %operator_email = () ;
|
||||||
|
foreach (keys %{$db{user_type}}) {
|
||||||
|
$operator_email{$db{user_type}{$_}{email}} = 1 if substr($db{user_type}{$_}{user_type},0,6) eq 'casual' and $db{user_type}{$_}{email} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $system_details = "" ;
|
||||||
|
|
||||||
|
&db_min_ro('event_type_details','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{type_details_id})) {
|
||||||
|
$system_details .= qq~$db{event_type_details}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $system_details if $system_details ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name','','','') ;
|
||||||
|
|
||||||
|
my $SystemName = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{$table}{$qt_id}{event_system_id_multiple})) {
|
||||||
|
$SystemName .= qq~$db{event_systems}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $SystemName if $SystemName ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes_categories','id,category','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('regions','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('countries','1,name,country',"`id`='$db{event_quotes}{1}{country_id}'",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('cities','id,city','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('customers','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_types','1,name',"`id`='$db{event_quotes}{1}{type}'",'','') if $db{event_quotes}{1}{type} ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes_min','1,category_details',"`id`='$event_id'",'','') ;
|
||||||
|
|
||||||
|
my @cat_details = split('\|;\|',$db{event_quotes_min}{1}{category_details}) ;
|
||||||
|
|
||||||
|
our $sports = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{sport_type_ids})) {
|
||||||
|
|
||||||
|
$sports .= qq~$db{sport_types}{$_}{name},~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $sports if $sports ;
|
||||||
|
|
||||||
|
my $venues = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{organisation_ids})) {
|
||||||
|
|
||||||
|
$venues .= qq~$db{organisations}{$_}{name},~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $venues if $venues ;
|
||||||
|
|
||||||
|
my $op_cnt = qq~~ ; my $op_names = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{operator_ids})) {
|
||||||
|
$op_cnt++ ;
|
||||||
|
$op_names .= qq~$db{users}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $op_names if $op_names ;
|
||||||
|
$op_names = qq~$op_cnt [$op_names]~ if $op_names;
|
||||||
|
|
||||||
|
my %event_details = () ;
|
||||||
|
|
||||||
|
my $city_name = qq~~ ;
|
||||||
|
$city_name .= qq~$db{cities}{$db{event_quotes}{1}{city_id}}{city},~ if $db{cities}{$db{event_quotes}{1}{city_id}}{city} ;
|
||||||
|
$city_name .= qq~$db{regions}{$db{event_quotes}{1}{region_id}}{name},~ if $db{regions}{$db{event_quotes}{1}{region_id}}{name} ;
|
||||||
|
$city_name .= qq~$db{countries}{1}{name} [$db{countries}{1}{country}]~ ;
|
||||||
|
|
||||||
|
$event_details{Client} = qq~<tr><th>Client</th><th>$db{customers}{$db{event_quotes}{1}{quote_to}}{name}</th></tr>~ ;
|
||||||
|
$event_details{EventName} = qq~<tr><th>Event Name</th><th>$db{event_quotes}{1}{ref} [$event_id]</th></tr>~ ;
|
||||||
|
$event_details{DateFrom} = qq~<tr><td>Event Date/Time From</td><td> $db{event_quotes}{1}{date_from}</td></tr>~ if $db{event_quotes}{1}{date_from} ;
|
||||||
|
$event_details{DateTo} = qq~<tr><td>Event Date/Time To</td><td> $db{event_quotes}{1}{date_to}</td></tr>~ if $db{event_quotes}{1}{date_to} ;
|
||||||
|
$event_details{Type} = qq~<tr><td>Type of System</td><td> $db{event_types}{1}{name}</td></tr>~ if $db{event_types}{1}{name} ;
|
||||||
|
$event_details{SystemDetails} = qq~<tr><td>System Details</td><td> $system_details</td></tr>~ if $system_details ;
|
||||||
|
$event_details{SystemName} = qq~<tr><td>System Name</td><td> $SystemName</td></tr>~ if $SystemName ;
|
||||||
|
$event_details{ClubName} = qq~<tr><td>Club Name</td><td> $db{event_quotes}{1}{club_name}</td></tr>~ if $db{event_quotes}{1}{club_name} ;
|
||||||
|
$event_details{Days} = qq~<tr><td>Days</td><td> $db{event_quotes}{1}{qty}</td></tr>~ if $db{event_quotes}{1}{qty} ;
|
||||||
|
$event_details{NrofOperators} = qq~<tr><td>Nr of Operators</td><td> $op_names</td></tr>~ if $op_names ;
|
||||||
|
$event_details{SportTypes} = qq~<tr><td>Sport Types(s)</td><td> $sports</td></tr>~ if $sports ;
|
||||||
|
$event_details{City} = qq~<tr><td>City</td><td> $city_name</td></tr>~ ;
|
||||||
|
$event_details{Venue} = qq~<tr><td>Venue(s)</td><td> $venues</td></tr>~ if $venues ;
|
||||||
|
$event_details{PocName} = qq~<tr><td>Poc Name</td><td> $db{event_quotes}{1}{poc_name}</td></tr>~ if $db{event_quotes}{1}{poc_name} ;
|
||||||
|
$event_details{PocContactNr} = qq~<td>Poc Contact Nr</td><td> $db{event_quotes}{1}{poc_contact_nr}</td></tr>~ if $db{event_quotes}{1}{poc_contact_nr} ;
|
||||||
|
|
||||||
|
$cat_details[0] =~ s/\n/,/g; $cat_details[1] =~ s/\n/,/g; $db{event_quotes}{1}{additional_notes} =~ s/\n/,/g; $db{event_quotes}{1}{format_of_title} =~ s/\n/,/g;
|
||||||
|
|
||||||
|
$event_details{Category1} = qq~<tr><td>Category 1</td><td> $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_1}}{category}</td></tr>~ if $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_1}}{category} ;
|
||||||
|
$event_details{Category1Details} = qq~<tr><td>Category 1 Details</td><td> $cat_details[0]</td></tr>~ if $cat_details[0] ;
|
||||||
|
$event_details{Category2} = qq~<tr><td>Category 2</td><td> $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_2}}{category}</td></tr>~ if $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_2}}{category} ;
|
||||||
|
$event_details{Category2Details} = qq~<tr><td>Category 2 Details</td><td> $cat_details[1]</td></tr>~ if $cat_details[1] ;
|
||||||
|
$event_details{AdditionalNotes} = qq~<tr><td>Additional Notes</td><td> $db{event_quotes}{1}{additional_notes}</td></tr>~ if $db{event_quotes}{1}{additional_notes} ;
|
||||||
|
$event_details{format_of_title} = qq~<tr><td>Format of TITLE to be followed <br>when scheduling events</td><td> $db{event_quotes}{1}{format_of_title}</td></tr>~ if $db{event_quotes}{1}{format_of_title} ;
|
||||||
|
|
||||||
|
our $table_message = qq~
|
||||||
|
$event_details{Client}
|
||||||
|
$event_details{EventName}
|
||||||
|
$event_details{DateFrom}
|
||||||
|
$event_details{DateTo}
|
||||||
|
$event_details{Type}
|
||||||
|
$event_details{SystemDetails}
|
||||||
|
$event_details{SystemName}
|
||||||
|
$event_details{ClubName}
|
||||||
|
$event_details{Days}
|
||||||
|
$event_details{NrofOperators}
|
||||||
|
$event_details{SportTypes}
|
||||||
|
$event_details{City}
|
||||||
|
$event_details{Venue}
|
||||||
|
$event_details{PocName}
|
||||||
|
$event_details{PocContactNr}
|
||||||
|
$event_details{Category1}
|
||||||
|
$event_details{Category1Details}
|
||||||
|
$event_details{Category2}
|
||||||
|
$event_details{Category2Details}
|
||||||
|
$event_details{AdditionalNotes}
|
||||||
|
$event_details{format_of_title}
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$message = qq~Good day
|
||||||
|
|
||||||
|
Please find attached event details.~ ;
|
||||||
|
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
5118
libs/modules/_FromProd/event_tabs.pm
Normal file
5118
libs/modules/_FromProd/event_tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
430
libs/modules/_FromProd/fixedsystem.pm
Normal file
430
libs/modules/_FromProd/fixedsystem.pm
Normal file
|
|
@ -0,0 +1,430 @@
|
||||||
|
sub fixedsystem_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("cnt","event","start_date","start_time","venue","region","system_name","online_status","network_test","system_test","test_event","sound_test","overall_status","additional_comments") ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $event_cnt = 0 ; our $found_after_date = 0 ;
|
||||||
|
|
||||||
|
# $format84->set_align('center');
|
||||||
|
# $format88->set_align('center');
|
||||||
|
# $format89->set_align('center');
|
||||||
|
# $format90->set_align('center');
|
||||||
|
# $format91->set_align('center');
|
||||||
|
|
||||||
|
my %defualt_color = () ;
|
||||||
|
$defualt_color{-1} = "#F90D0D" ;
|
||||||
|
$defualt_color{1} = "#51B529" ;
|
||||||
|
|
||||||
|
my %defualt_color2 = () ;
|
||||||
|
$defualt_color2{1} = "#51B529" ;
|
||||||
|
$defualt_color2{2} = "#F6E305" ;
|
||||||
|
$defualt_color2{3} = "#F90D0D" ;
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";-1;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $now_date = int("$now_year$now_mm$now_dd") ;
|
||||||
|
my $end_date = substr($db{$table}{$id}{date_to},0,10) ;
|
||||||
|
$end_date =~ s/\-//g ;
|
||||||
|
$end_date = int($end_date) ;
|
||||||
|
my $is_in_future = ($now_date < $end_date) ? 1 : 0 ;
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
|
||||||
|
my @fixed_system_online_status = split(/\;/,$db{$table}{$id}{fixed_system_online_status}) ;
|
||||||
|
my @fixed_system_network_test = split(/\;/,$db{$table}{$id}{fixed_system_network_test}) ;
|
||||||
|
my @fixed_system_system_test = split(/\;/,$db{$table}{$id}{fixed_system_system_test}) ;
|
||||||
|
my @fixed_system_test_event = split(/\;/,$db{$table}{$id}{fixed_system_test_event}) ;
|
||||||
|
my @fixed_system_sound_test = split(/\;/,$db{$table}{$id}{fixed_system_sound_test}) ;
|
||||||
|
my @fixed_system_overall_status = split(/\;/,$db{$table}{$id}{fixed_system_overall_status}) ;
|
||||||
|
my @fixed_system_additional_comments = split(/\;/,$db{$table}{$id}{fixed_system_additional_comments}) ;
|
||||||
|
|
||||||
|
my $cnt_sys_ids = -1 ;
|
||||||
|
|
||||||
|
# my @table_op_ids = () ;
|
||||||
|
|
||||||
|
# for (1 .. $cnt_rows) {
|
||||||
|
# push @table_op_ids,$op_ids[$_ - 1] if $op_ids[$_ - 1] ;
|
||||||
|
# push @table_op_ids,0 unless $op_ids[$_ - 1] ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
my $system_count = 0 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
foreach my $event_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$cnt_sys_ids++ ;
|
||||||
|
|
||||||
|
next unless $event_id ;
|
||||||
|
next unless $db{event_systems}{$event_id}{system_type} eq 'fixed' ;
|
||||||
|
next if $i{overall_status} ne 'all' and $i{overall_status} and $i{overall_status} ne $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
|
||||||
|
$event_cnt++ ;
|
||||||
|
$system_count++ ;
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id">~ if $report ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
my $val_min = $val ;
|
||||||
|
my $align = '' ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($_ eq 'cnt') {
|
||||||
|
$val = $event_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} ($id)" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
$val = substr($db{$table}{$id}{date_from},0,10) ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'system_name') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_id}{description})~ if $db{event_systems}{$event_id}{description} ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = $db{users}{$op_ids[$system_count - 1]}{name} if $op_ids[$system_count - 1] ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'online_status') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "online_status_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Online Status" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
if ($fixed_system_online_status[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_online_status[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Online" if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Offline" if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Online" if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Offline" if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(7)").css("background-color","$defualt_color{$fixed_system_online_status[$cnt_sys_ids]}");~ if $fixed_system_online_status[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'network_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "network_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Network" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_network_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_network_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Passed" if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Failed" if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Passed" if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Failed" if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(6)").css("background-color","$defualt_color{$fixed_system_network_test[$cnt_sys_ids]}");~ if $fixed_system_network_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'system_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "system_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "System Test" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_system_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_system_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Passed" if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Failed" if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$val = "Passed" if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Failed" if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(5)").css("background-color","$defualt_color{$fixed_system_system_test[$cnt_sys_ids]}");~ if $fixed_system_system_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'test_event') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "test_event_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Event" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_test_event[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_test_event[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Good" if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Not Good" if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Good" if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Not Good" if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(4)").css("background-color","$defualt_color{$fixed_system_test_event[$cnt_sys_ids]}");~ if $fixed_system_test_event[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'sound_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "sound_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Sound" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_sound_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_sound_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $db{fixed_system_sound_test}{$fixed_system_sound_test[$cnt_sys_ids]}{name} if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $db{fixed_system_sound_test}{$fixed_system_sound_test[$cnt_sys_ids]}{name} if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(3)").css("background-color","$defualt_color2{$fixed_system_sound_test[$cnt_sys_ids]}");~ if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_sound_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format95 if $fixed_system_sound_test[$cnt_sys_ids] eq '2' ;
|
||||||
|
$formatting = $format96 if $fixed_system_sound_test[$cnt_sys_ids] eq '3' ;
|
||||||
|
} elsif ($_ eq 'overall_status') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
my $field = "overall_status_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Overall Status" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_overall_status[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_overall_status[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = $db{fixed_system_status}{$fixed_system_overall_status[$cnt_sys_ids]}{status} if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $db{fixed_system_status}{$fixed_system_overall_status[$cnt_sys_ids]}{status} if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(2)").css("background-color","$defualt_color2{$fixed_system_overall_status[$cnt_sys_ids]}");~ if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_overall_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format95 if $fixed_system_overall_status[$cnt_sys_ids] eq '2' ;
|
||||||
|
$formatting = $format96 if $fixed_system_overall_status[$cnt_sys_ids] eq '3' ;
|
||||||
|
} elsif ($_ eq 'additional_comments') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "additional_comments_$id\_$event_id" ; my $ucfirstfield = ucfirst $field ; $align = qq~ class="dt-center $_ controls"~ ;
|
||||||
|
$preferred_title{$field} = "Additional Comments" ; $useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_input_col($field,'') ;
|
||||||
|
$val = qq~<input type='text' name='$field' class='form-control $cust_class{$field}' id='input$ucfirst_field' placeholder='$preferred_title{$field}' value="$fixed_system_additional_comments[$cnt_sys_ids]">~ ;
|
||||||
|
if ($fixed_system_additional_comments[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#inputAdditional_comments_$id\_$event_id").val("$fixed_system_additional_comments[$cnt_sys_ids]") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$val_min = $fixed_system_additional_comments[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $fixed_system_additional_comments[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_ ne 'online_status' && $_ ne 'network_test' && $_ ne 'system_test' && $_ ne 'test_event' && $_ ne 'sound_test' && $_ ne 'overall_status' && $_ ne 'additional_comments') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $align $nowrap>$val</td>~ if $report ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10);
|
||||||
|
$worksheet{$ws}->set_column(1,1,30);
|
||||||
|
$worksheet{$ws}->set_column(2,3,15);
|
||||||
|
$worksheet{$ws}->set_column(4,4,45);
|
||||||
|
$worksheet{$ws}->set_column(5,5,15);
|
||||||
|
$worksheet{$ws}->set_column(6,6,45);
|
||||||
|
$worksheet{$ws}->set_column(7,12,15);
|
||||||
|
$worksheet{$ws}->set_column(13,13,45);
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('N',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub fixedsystem_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{-1} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{-1} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
287
libs/modules/_FromProd/getmail.pm
Normal file
287
libs/modules/_FromProd/getmail.pm
Normal file
|
|
@ -0,0 +1,287 @@
|
||||||
|
sub getmail_fetch {
|
||||||
|
|
||||||
|
# $mail_psw = 'znMpCa6pikZF' ;
|
||||||
|
# $mail_host = 'pop.yandex.com' ;
|
||||||
|
# $mail_user = 'itv.k@re8it.com' ;
|
||||||
|
|
||||||
|
# $mail_psw = 'vf1VBE6AGuPE' ;
|
||||||
|
$mail_psw = $send_mail_psw ;
|
||||||
|
# $mail_host = 'envoy.aserv.co.za' ;
|
||||||
|
$mail_host = 'pop3.interactivetvafrica.com' ;
|
||||||
|
$mail_user = 'tickets@interactivetvafrica.com' ;
|
||||||
|
|
||||||
|
# $mail_psw = "Jat20161" ;
|
||||||
|
# $mail_host = "outlook.office365.com" ;
|
||||||
|
# $mail_user = "tickets\@aisport.africa" ;
|
||||||
|
|
||||||
|
use IO::Socket::SSL;
|
||||||
|
|
||||||
|
$socket = IO::Socket::SSL->new( PeerAddr => $mail_host,
|
||||||
|
PeerPort => 995,
|
||||||
|
SSL_verify_mode => SSL_VERIFY_NONE,
|
||||||
|
Proto => 'tcp') || die "No socket!";
|
||||||
|
|
||||||
|
$pop = new Mail::POP3Client( USER => $mail_user, PASSWORD => $mail_psw, HOST => $mail_host, USESSL => true, SOCKET => $socket ) || die $pop->Message();
|
||||||
|
# $pop = new Mail::POP3Client( USER => $mail_user, PASSWORD => $mail_psw, HOST => $mail_host, PORT => 995, AUTH_MODE => 'PASS', USESSL => true, SOCKET => $socket ) || die $pop->Message();
|
||||||
|
|
||||||
|
# # OR with SSL
|
||||||
|
# $pop = new Mail::POP3Client( USER => $mail_user,
|
||||||
|
# PASSWORD => $mail_psw,
|
||||||
|
# HOST => $mail_host,
|
||||||
|
# USESSL => true,
|
||||||
|
# ) || die $pop->Message();
|
||||||
|
|
||||||
|
#connect to POP3 sever
|
||||||
|
# my $pop = new Mail::POP3Client( HOST => $mail_host );
|
||||||
|
# $pop->User($mail_user);
|
||||||
|
# $pop->Pass($mail_psw);
|
||||||
|
# $pop->Connect() || die "Unable to connect to POP3 server: ".$pop->Message()."\n";
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
use Data::Dumper;
|
||||||
|
print Dumper(\$pop);
|
||||||
|
&common_debug ("get_mail : office_user = $mail_user") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nummsgs = $pop->Count;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : nummsgs [$nummsgs]") ;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $pop->Count(); $i++) {
|
||||||
|
|
||||||
|
# # sometimes the 'To' is like this : 'graham evens <12345+gevens-bookings@eccotours.co.za>'
|
||||||
|
# # sometimes the 'To' is like this : '12345+gevens-bookings@eccotours.co.za'
|
||||||
|
# # so we split it by '<' to just get the bit we want
|
||||||
|
# my @to_array = split (/\</, $mailcontent{'To'}) ;
|
||||||
|
|
||||||
|
$head = $pop->Head( $i ) ;
|
||||||
|
$head = &getmail_clean($head) ;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : head [$head]") ;
|
||||||
|
|
||||||
|
%mailcontent = () ;
|
||||||
|
|
||||||
|
my $subject_auto_conf = '' ;
|
||||||
|
my $subject_auto_decline = '' ;
|
||||||
|
|
||||||
|
# if ($head =~ /[\d]+\++[\w]+-bookings@[\w\.\-]+\w+/) { # 18398+autoreq-bookings@ecco.co.za
|
||||||
|
# $to = $& ;
|
||||||
|
# }
|
||||||
|
# elsif ($head =~ /AUTO+\s+CONFIRMATION+\s:\s+[\d]+\s:\s+[\w]+-+[\w]+\s+\(+[\w]+\)/) { # If subject = AUTO CONFIRMATION : 123456 : hotelcode-room (789123)
|
||||||
|
# $subject_auto_conf = $& ;
|
||||||
|
# }
|
||||||
|
# else
|
||||||
|
# {
|
||||||
|
foreach ( $pop->Head( $i ) ) {
|
||||||
|
chomp;
|
||||||
|
/^(From|Subject|To|Cc):\s+/i;
|
||||||
|
my ($index,$value) = split(/:/);
|
||||||
|
$mailcontent{$index} = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @to_array = split (/\</, $mailcontent{'To'}) ;
|
||||||
|
$to = pop @to_array ; # get the last item in the array
|
||||||
|
$to =~ s/\>//g ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $mailaccount = '' ;
|
||||||
|
# $junk = '' ;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : to [$to]") ;
|
||||||
|
|
||||||
|
$uniqueid = $pop->Uidl($i);
|
||||||
|
$uniqueid =~ s/\s//g; # strip whitespace
|
||||||
|
|
||||||
|
$headandbody = $pop->HeadAndBody( $i ) ;
|
||||||
|
|
||||||
|
# &common_debug ("get_mail : uniqueid [$uniqueid] headandbody [$headandbody]") ;
|
||||||
|
&common_debug ("get_mail : uniqueid [$uniqueid]") ;
|
||||||
|
|
||||||
|
&getmail_mailparse ;
|
||||||
|
|
||||||
|
$pop->Delete( $i ) ; # temp comment out
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$pop->Close();
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_clean {
|
||||||
|
|
||||||
|
my ($item) = @_ ;
|
||||||
|
|
||||||
|
$item =~ s/\|/-/g; # remove any pipes
|
||||||
|
$item =~ s/\n//g; # remove any newlines
|
||||||
|
$item =~ s/\r//g; # remove any carriage returns
|
||||||
|
$item =~ s/\"//g; # remove " marks
|
||||||
|
$item =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
return ($item) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_mailparse {
|
||||||
|
|
||||||
|
$parser = MIME::Parser->new;
|
||||||
|
|
||||||
|
### Keep parsed message bodies in core (default outputs to disk):
|
||||||
|
# $parser->output_to_core(1); # don't write attachments to disk
|
||||||
|
$parser->output_to_core('NONE') ; # or die "can't output_to_core: $!" ;
|
||||||
|
|
||||||
|
### Change how nameless message-component files are named:
|
||||||
|
$parser->output_prefix("msg") or die "can't output_prefix: $!" ;
|
||||||
|
|
||||||
|
&getmail_make_dir ;
|
||||||
|
|
||||||
|
binmode(STDOUT, ":utf8");
|
||||||
|
|
||||||
|
### Output each message body to the same directory:
|
||||||
|
# $parser->output_under($outputdir);
|
||||||
|
$parser->output_dir($outputdir) or die "can't output into $outputdir: $!" ;
|
||||||
|
|
||||||
|
# $entity->dump_skeleton; # for debugging
|
||||||
|
|
||||||
|
$entity = $parser->parse_data($headandbody) or die "can't parse_data $headandbody: $!" ;
|
||||||
|
|
||||||
|
&getmail_process_entity_header ;
|
||||||
|
&getmail_process_output_dir ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_process_output_dir {
|
||||||
|
|
||||||
|
$i{unique_id} = $uniqueid ;
|
||||||
|
$i{date_time} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ;
|
||||||
|
$i{client_id} = '0' ;
|
||||||
|
$i{staff_id} = '0' ;
|
||||||
|
$i{sent_date} = $mailparsedate ;
|
||||||
|
$i{doctype} = 'ticket' ;
|
||||||
|
$i{mailtype} = 'EMAILI' ;
|
||||||
|
$i{subject} = $mailparsesubject ;
|
||||||
|
$i{sent_from} = $mailparsefrom ;
|
||||||
|
$i{sent_to} = $to ;
|
||||||
|
$i{cc} = $mailcontent{'Cc'} ;
|
||||||
|
$i{bcc} = $mailcontent{'Bcc'} ;
|
||||||
|
$i{reply_to} = $mailparsereplyto ;
|
||||||
|
# $i{action_time} = ;
|
||||||
|
$i{completed} = '0' ;
|
||||||
|
|
||||||
|
&db_min_insert('tickets') ;
|
||||||
|
|
||||||
|
my @hash_split = split /\#\#/, $mailparsesubject ;
|
||||||
|
my @subj_uid = split / /, $hash_split[1] ;
|
||||||
|
my $suid = $subj_uid[0] ;
|
||||||
|
|
||||||
|
if ($suid && length($suid)>5) {
|
||||||
|
%i = () ;
|
||||||
|
$i{completed} = '0' ;
|
||||||
|
&db_min_upd('tickets',"suid='$suid' OR unique_id='$suid' OR suid='$uniqueid' OR unique_id='$uniqueid'") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_make_dir {
|
||||||
|
|
||||||
|
our $outputdir = "$mailpath/tickets/$uniqueid" ;
|
||||||
|
|
||||||
|
return if -d $outputdir ;
|
||||||
|
|
||||||
|
mkdir ($outputdir,0777) or die "mkdir $outputdir: $!" ;
|
||||||
|
chmod (0777, $outputdir) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_process_entity_header {
|
||||||
|
|
||||||
|
use Encode qw(decode);
|
||||||
|
|
||||||
|
$mailparsesubject = $entity->head->get('subject');
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : subject [$mailparsesubject]") ;
|
||||||
|
|
||||||
|
$mailparsesubject = decode("MIME-Header", $mailparsesubject) ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : subject [$mailparsesubject]") ;
|
||||||
|
|
||||||
|
$mailparsesubject =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsesubject =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsesubject =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsesubject =~ s/\'//g; # remove any apostrophes
|
||||||
|
|
||||||
|
$mailparsesubject =~ s/\/\///g; # remove the '//' from TLF chasers
|
||||||
|
$mailparsesubject =~ s/\\//g; # remove the '\' from TLF chasers
|
||||||
|
|
||||||
|
unless ($mailparsesubject) { $mailparsesubject = "(No Subject)" ; }
|
||||||
|
|
||||||
|
$mailparsefrom = $entity->head->get('from');
|
||||||
|
$mailparsefrom =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsefrom =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsefrom =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsefrom =~ s/\"//g; # remove " marks
|
||||||
|
$mailparsefrom =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
$mailpamailparsefrom = decode("MIME-Header", $mailparsefrom) ;
|
||||||
|
|
||||||
|
$mailparsereplyto = $entity->head->get('Reply-To');
|
||||||
|
$mailparsereplyto =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsereplyto =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsereplyto =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsereplyto =~ s/\"//g; # remove " marks
|
||||||
|
$mailparsereplyto =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
$mailparsedate = $entity->head->get('date');
|
||||||
|
|
||||||
|
my ($dayofweek, $day, $month, $ccyy, $time, $gmt) = split /\s/, $mailparsedate ;
|
||||||
|
|
||||||
|
$day = sprintf("%02d", ($day)) ;
|
||||||
|
|
||||||
|
$m{jan} = '01' ; $m{feb} = '02' ; $m{mar} = '03' ; $m{apr} = '04' ; $m{may} = '05' ; $m{jun} = '06' ; $m{jul} = '07' ; $m{aug} = '08' ; $m{sep} = '09' ; $m{oct} = '10' ; $m{nov} = '11' ; $m{dec} = '12' ;
|
||||||
|
|
||||||
|
my $hashkey = lc $month ;
|
||||||
|
# $mailparsedate = "$day." . $m{$hashkey} ."." . substr($ccyy,2,2) . " (" . substr($time,0,5) . ")" ; # 15.06.22 (12:49)
|
||||||
|
$mailparsedate = "$ccyy-$m{$hashkey}-$day " . substr($time,0,8) ; # 2022-06-21 12:49:35
|
||||||
|
|
||||||
|
chomp $mailparsesubject ;
|
||||||
|
chomp $mailparsedate ;
|
||||||
|
chomp $mailparsefrom ;
|
||||||
|
chomp $mailparsereplyto ;
|
||||||
|
|
||||||
|
unless ($mailparsereplyto) {
|
||||||
|
$mailparsereplyto = $mailparsefrom ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&getmail_auto_reply ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : mailparsereplyto [$mailparsereplyto]") ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_auto_reply {
|
||||||
|
|
||||||
|
my @hash_split = split /\#\#/, $mailparsesubject ;
|
||||||
|
my @subj_uid = split / /, $hash_split[1] ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_auto_reply : subj_uid=[$subj_uid[0]]") ;
|
||||||
|
|
||||||
|
unless ($subj_uid[0] && length($subj_uid[0])>5) {
|
||||||
|
my $resubject = ($mailparsesubject =~ /Re:/iog) ? '' : 'Re: ' ;
|
||||||
|
my $resubject .= "$mailparsesubject ##$uniqueid##" ;
|
||||||
|
my $remsg = qq~Hello, thank you for contacting ITV.
|
||||||
|
|
||||||
|
Your ticket ID is $uniqueid.
|
||||||
|
|
||||||
|
One of our consultants will reply to you shortly to assist you with your query - typically within a few hours.
|
||||||
|
|
||||||
|
For after-hour emergencies please contact Technical Support on support\@aisport.africa or telephonically on (+27) 10 534 7011.
|
||||||
|
|
||||||
|
Best regards,
|
||||||
|
|
||||||
|
The ITV Africa Team~ ;
|
||||||
|
&common_debug ("getmail_auto_reply : to=[$mailparsefrom] subject=[$resubject]") ;
|
||||||
|
&common_send_mail($mailparsefrom,'','','','',"$remsg","$resubject") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
710
libs/modules/_FromProd/logistics.pm
Normal file
710
libs/modules/_FromProd/logistics.pm
Normal file
|
|
@ -0,0 +1,710 @@
|
||||||
|
sub logistics_load_db_vars {
|
||||||
|
|
||||||
|
&db_min_ro('organisations','*',"",'','') ;
|
||||||
|
&db_min_ro('logistics_locations','*',"",'','') ;
|
||||||
|
&db_min_ro('logistics_suppliers','*',"active = '1'",'','') ;
|
||||||
|
&db_min_ro('logistics_items','*',"",'','') ;
|
||||||
|
&db_min_ro('event_systems','id,logistics_location_id',"(`system_type` = 'mobile' OR `system_type` = 'solo' OR `description` lIKE 'cricket%')",'','') ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
local @abc = split("_",$_) ;
|
||||||
|
if (substr($_,0,7) eq 'update_') {
|
||||||
|
$seen_event_id{$abc[-1]} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# create_waybill_out_5136
|
||||||
|
local @event_ids = () ;
|
||||||
|
foreach (keys %seen_event_id) {
|
||||||
|
push @event_ids , "`id` = '$_'" ;
|
||||||
|
}
|
||||||
|
local $e_q_sql = join (" OR ",@event_ids) ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'id,event_system_id_multiple,logistics_suppliers,logistics_waybill_nrs,logistics_status_ids,logistics_venue_id,logistics_item_ids,poc_id,recipient_id,logistics_special_instructions,logistics_complete,logistics_dcb_waybill,date_from,date_to,logistics_delivery_datetime,logistics_received_by,logistics_location_other,logistics_system_location_id,logistics_last_changed_by,logistics_dcb_comments,logistics_shipment_operator_id',"$e_q_sql",'','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_dates {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
my ($year1,$month1,$day1) = split(/\-/,substr($db{$table}{$id}{date_from},0,10)) ;
|
||||||
|
my ($year2,$month2,$day2) = split(/\-/,substr($db{$table}{$id}{date_to},0,10)) ;
|
||||||
|
$val = qq~~ ;
|
||||||
|
if ($year1 ne $year2 && $month1 ne $month2 && $day1 ne $day2) {
|
||||||
|
$val = qq~ $day1 $month_names[$month1] $year1 -<br>$day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 ne $month2) {
|
||||||
|
$val = qq~ $day1 $month_names[$month1] -<br>$day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 ne $day2) {
|
||||||
|
$val = qq~ $day1 - $day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 eq $day2) {
|
||||||
|
$val = qq~ $day2 $month_names[$month2] $year2~ ;
|
||||||
|
}
|
||||||
|
my $stime = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
my $etime = substr($db{$table}{$id}{date_to},11,5) ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/<br>//g ;
|
||||||
|
# $val = qq~<a href='#' title data-toggle="tooltip" data-placement="top" data-original-title="Start Time : $stime<br>End Time : $etime">$val</a>~ ;
|
||||||
|
|
||||||
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+1,$stime,$formatting) ;
|
||||||
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+2,$etime,$formatting) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_venue {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $nowrap = 'nowrap' ;
|
||||||
|
foreach my $_oid (@venue_ids) {
|
||||||
|
$val .= qq~$db{organisations}{$_oid}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$_oid}{region_code}]~ if $db{organisations}{$_oid}{region_code} ;
|
||||||
|
$val .= ',' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-1) if $val ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/\,/\;/g ;
|
||||||
|
if (length($val) > 30) {
|
||||||
|
$val =~ s/\,/\<br>/g ;
|
||||||
|
$val = substr($val,0,27) . qq~<i class="glyphicons glyphicons-more" title data-toggle="tooltip" data-placement="top" data-original-title="$val"></i>~ ;
|
||||||
|
} else {
|
||||||
|
$val =~ s/\,/\<br>/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_system {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; my $tooltip = '' ;
|
||||||
|
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
$system_count++ ;
|
||||||
|
$tooltip .= qq~<br>$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$tooltip .= qq~ [$db{event_systems}{$event_sys_id}{description}]~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tooltip = substr($tooltip,4) if $tooltip ;
|
||||||
|
$val = $tooltip ;
|
||||||
|
# $val = ($system_count > 1) ? qq~<i class="glyphicons glyphicons-laptop" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : ($system_count == 1) ? qq~<i class="glyphicons glyphicons-facetime-video" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : "" ;
|
||||||
|
$valxlsx = $tooltip ;
|
||||||
|
$valxlsx =~ s/\<br>/\;/g ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_from_to {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{1},#$ucfirstfield{2}").chosen({allow_single_deselect:true}) ; ~ ;
|
||||||
|
|
||||||
|
my $col_venue = ($from_to eq 'to') ? 10 : 11 ;
|
||||||
|
my $col_log_loc = ($from_to eq 'to') ? 11 : 10 ;
|
||||||
|
|
||||||
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) { # && $iaction eq 'report') || ($_ eq 'from' && $_ eq 'report_from')
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{1}" id="$ucfirstfield{1}" data-placeholder="Select $preferred_title{$field{1}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{venue_location}{$db{$table}{$id}{region_id}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||||||
|
$valxlsx = "$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name} [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]" if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{1}").val("$db{$table}{$id}{logistics_venue_id}") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)" ;
|
||||||
|
|
||||||
|
$default_javascript .= qq~"$field{1}":"$db{$table}{$id}{logistics_venue_id}",~ ;
|
||||||
|
} elsif ($venue_ids[0]) {
|
||||||
|
$valxlsx = "$db{organisations}{$venue_ids[0]}{name} [$db{organisations}{$venue_ids[0]}{region_code}]" if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{1}").val("$venue_ids[0]") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||||||
|
$default_javascript .= qq~"$field{1}":"$venue_ids[0]",~ ;
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{1}":"",~ ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{2}" id="$ucfirstfield{2}" data-placeholder="Select $preferred_title{$field{2}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{system_location}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
my $found_loc = 0 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||||||
|
$valxlsx = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("$db{event_systems}{$event_sys_id}{logistics_location_id}") ;
|
||||||
|
~ ;
|
||||||
|
$found_loc = 1 ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)" ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"$db{event_systems}{$event_sys_id}{logistics_location_id}",~ ;
|
||||||
|
}
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("1") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"1",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("2") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"2",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("3") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"3",~ ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("4") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"4",~ ;
|
||||||
|
} elsif (!$found_loc) {
|
||||||
|
$default_javascript .= qq~"$field{2}":"",~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{1}\_chosen,#$ucfirstfield{2}\_chosen" if $ucfirstfield{1} && $ucfirstfield{2} ;
|
||||||
|
} else {
|
||||||
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) {
|
||||||
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||||||
|
$val = qq~$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]~ if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||||||
|
} elsif ($venue_ids[0]) {
|
||||||
|
$val = qq~$db{organisations}{$venue_ids[0]}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$venue_ids[0]}{region_code}]~ if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
my $found_loc = 0 ;
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||||||
|
$val = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||||||
|
$found_loc = 1 ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||||||
|
$val = $db{logistics_locations}{1}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||||||
|
$val = $db{logistics_locations}{2}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||||||
|
$val = $db{logistics_locations}{3}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||||||
|
$val = $db{logistics_locations}{4}{location} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_supplier {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{supplier}} = "Supplier" ;
|
||||||
|
$opts{$field{supplier}} = $opts{logistics_supplier} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{supplier}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = qq~<select class="form-control" name="$field{supplier}" id="$ucfirstfield{supplier}" data-placeholder="Select $preferred_title{$field{supplier}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{supplier}}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
if ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||||||
|
$valxlsx = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{supplier}" if $ucfirstfield{supplier} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)" ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{supplier}").val("$logistics_supplier_ids_hash{$id}{$from_to}") ;
|
||||||
|
// \$("#$ucfirstfield{supplier}").trigger("chosen:updated") ;
|
||||||
|
// \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{supplier}\_chosen" if $ucfirstfield{supplier} ;
|
||||||
|
} elsif ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||||||
|
$val = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_status {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
local %status_hash = (1 =>"Booked",2 => "Pending",3=>"In Transit",4 =>"Delivered") ;
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{status}} = "Status" ;
|
||||||
|
$opts{$field{status}} = $opts{status} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{status}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = qq~<select class="form-control" name="$field{status}" id="$ucfirstfield{status}" data-placeholder="Select $preferred_title{$field{status}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{status}}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$val = &common_min_form_select_col($field{status},'') ; ########### >= OR >
|
||||||
|
if ($logistics_status_ids_hash{$id}{$from_to}) {
|
||||||
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{status}").val("$logistics_status_ids_hash{$id}{$from_to}") ;
|
||||||
|
// \$("#$ucfirstfield{status}").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{status}":"$logistics_status_ids_hash{$id}{$from_to}",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{status}" if $ucfirstfield{status} ;
|
||||||
|
if ($logistics_status_ids_hash{$id}{$from_to} eq '1') { #Booked
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(81,203,242)") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '2') { #Pending
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(66,73,73)") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '3') { #In Transit
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(255,165,0) ") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '4') { #Delivered
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(46,204,113)") ; ~ ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{status}":"2",~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{status}\_chosen" if $ucfirstfield{status} ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to}) {
|
||||||
|
$val = $logistics_status_ids_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_waybill_nr {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
my $fname = 'waybill_nr' ; $val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
my $wb_code = 'AIS' . uc substr($from_to,0,1) . '_' ;
|
||||||
|
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $print_field = &common_min_print_field($field{$fname}) ; $tindex++ ;
|
||||||
|
my $wb_nr = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : $wb_code . $id ;
|
||||||
|
$default_javascript .= qq~"$field{$fname}":"$wb_nr",~ ;
|
||||||
|
$val = qq~<div class="control-group"><div class='controls'><input type='text' class='form-control' name='$field{$fname}' id='$ucfirstfield{$fname}' placeholder='$print_field' value="$wb_nr" tabindex="$tindex">
|
||||||
|
</div></div>~ ;
|
||||||
|
$valxlsx = $wb_nr ;
|
||||||
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{$fname}").css("width","100%") ;~ ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(7)").css("background-color","#424949") ; ~ if $logistics_waybill_ids_hash{$id}{$from_to} ;
|
||||||
|
} else {
|
||||||
|
$val = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : (!$readlonly_row) ? $id : "" ;
|
||||||
|
print "\n logistics_waybill_nr" ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_item {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
|
||||||
|
$all_ids .= qq~,$id~ ;
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{item}} = "Item" ;
|
||||||
|
$opts{$field{item}} = $opts{logistics_items} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{item}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
|
||||||
|
if ($logistics_item_ids_hash{$id}) {
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(6)" ;
|
||||||
|
foreach my $item_id (split(/\,/,$logistics_item_ids_hash{$id})) {
|
||||||
|
next unless $item_id ;
|
||||||
|
$opts{$field{item}} =~ s/\Q"$item_id"/"$item_id" SELECTED/g ;
|
||||||
|
}
|
||||||
|
$valxlsx = join (';', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||||||
|
}
|
||||||
|
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{item}" id="$ucfirstfield{item}" multiple data-placeholder="Select $preferred_title{$field{item}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{item}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{item}\_chosen").css("width","100%") ;~ if $ucfirstfield{item} ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="hidden" name="item$id" id="item-$id" value="">~;
|
||||||
|
|
||||||
|
$jquery_chosen_sel .= qq~
|
||||||
|
item_val = \$("#selectItem_$id").chosen().val() ;
|
||||||
|
\$('#item-$id').val(item_val) ;
|
||||||
|
~ ;
|
||||||
|
} elsif ($logistics_item_ids_hash{$id}) {
|
||||||
|
$val = join (',', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/\,/\;/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_poc {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{poc}} = "poc" ;
|
||||||
|
$opts{$field{poc}} = $opts{poc}{$id} ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{poc}").chosen({ allow_single_deselect:true }) ; \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{poc}" id="$ucfirstfield{poc}" data-placeholder="Select $preferred_title{$field{poc}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{poc}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
if ($logistics_poc_hash{$id}) {
|
||||||
|
$valxlsx = $logistics_poc_hash{$id} ;
|
||||||
|
$valxlsx =~ s/\_/ \[/g ;
|
||||||
|
$valxlsx .= qq~]~ ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)" ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{poc}" ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{poc}").val("$logistics_poc_hash{$id}") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{poc}":"$logistics_poc_hash{$id}",~ ;
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{poc}":"",~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{poc}\_chosen" if $ucfirstfield{poc} ;
|
||||||
|
|
||||||
|
} elsif ($logistics_poc_hash{$id}) {
|
||||||
|
$val = $logistics_poc_hash{$id} ;
|
||||||
|
$val =~ s/\_/\[/g ;
|
||||||
|
$val .= qq~]~ ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_special_instructions {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $print_field = &common_min_print_field($field{special_instructions}) ;
|
||||||
|
$tindex++ ;
|
||||||
|
|
||||||
|
my $defualt = ($logistics_special_instructions_hash{$id}{$from_to}) ? $logistics_special_instructions_hash{$id}{$from_to} : "" ;
|
||||||
|
|
||||||
|
$valxlsx = $defualt if $defualt ;
|
||||||
|
$val = qq~
|
||||||
|
<div class="control-group">
|
||||||
|
<div class='controls'>
|
||||||
|
<textarea type='text' class='form-control' name='$field{special_instructions}' id='$ucfirstfield{special_instructions}' placeholder='$print_field' value="$defualt" tabindex="$tindex">$defualt</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$ucfirstfield{special_instructions}").css("width","100%") ;
|
||||||
|
~ ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(4)").css("background-color","#424949") ;
|
||||||
|
~ if $logistics_special_instructions_hash{$id}{$from_to} ;
|
||||||
|
} elsif ($logistics_special_instructions_hash{$id}{$from_to}) {
|
||||||
|
$val = $logistics_special_instructions_hash{$id}{$from_to} ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_create_waybill {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
if (!$readlonly_row) {
|
||||||
|
|
||||||
|
$ignore{"$_\_$id"} = 1 ;
|
||||||
|
$valxlsx = '' ;
|
||||||
|
|
||||||
|
# if ($_ eq 'process_complete') {
|
||||||
|
# $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
# } elsif (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $items && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
|
||||||
|
if ($logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) {
|
||||||
|
# if ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||||||
|
if ($dcb_waybill_nr{$from_to}) {
|
||||||
|
my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||||||
|
my $arrow_direction = ($from_to eq 'to') ? 'right' : 'left' ;
|
||||||
|
my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||||||
|
my $uc_from_to = uc $from_to ;
|
||||||
|
$val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} else {
|
||||||
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
}
|
||||||
|
} elsif ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||||||
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
my $tool_tip = qq~~ ;
|
||||||
|
|
||||||
|
$tool_tip .= qq~<br><b>- Add WayBillNr</b>~ unless $waybill_nr_default_val ;
|
||||||
|
$tool_tip .= qq~<br><b>- Add Item(s)</b>~ unless $item_default_val ;
|
||||||
|
$tool_tip .= qq~<br><b>- Set Supplier to DCB</b>~ if $supplier_default_val != 2 ;
|
||||||
|
|
||||||
|
$val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:$tool_tip'></i>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# # # if (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
# # # $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
# # # } elsif ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
|
||||||
|
# # # my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||||||
|
# # # # my $to_arrow_class = ($dcb_waybill_nr{to} && $logistics_waybill_ids_hash{$id}{to}) ? 'success' : 'danger' ;
|
||||||
|
# # # # my $from_arrow_class = ($dcb_waybill_nr{from} && $logistics_waybill_ids_hash{$id}{from}) ? 'success' : 'danger' ;
|
||||||
|
|
||||||
|
# # # my $arrow_direction = ($from_to eq 'to') ? 'rigth' : 'left' ;
|
||||||
|
|
||||||
|
# # # my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||||||
|
|
||||||
|
# # # my $uc_from_to = uc $from_to ;
|
||||||
|
|
||||||
|
# # # $val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||||||
|
# # # # $val = qq~<a class="btn btn-$to_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace TO Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-right"></i></a>
|
||||||
|
# # # # <a class="btn btn-$from_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{from}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace FROM Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-left"></i></a>~ ;
|
||||||
|
# # # $nowrap = 'nowrap' ;
|
||||||
|
# # # } else {
|
||||||
|
# # # $val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:<br><b>- Add WayBillNr</b><br><b>- Add Item(s)</b><br><b>- Set Supplier to DCB</b>'></i>~ ;
|
||||||
|
# # # }
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_jquery {
|
||||||
|
|
||||||
|
my ($from_to) = @_ ;
|
||||||
|
|
||||||
|
foreach my $system_id (keys %seen_system_cnt) {
|
||||||
|
chop $all_location_ids_per_system{$system_id} if $all_location_ids_per_system{$system_id} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $update_ids_str = join(',',@update_ids) ;
|
||||||
|
my $selects_with_default_ids_str = join(',',@selects_with_default_ids) ;
|
||||||
|
my $table_with_default_ids_str = join(',',@table_with_default_ids) ;
|
||||||
|
my $dropdown_chosen_ids_str = join(',',@dropdown_chosen_ids) ;
|
||||||
|
# <span title data-toggle="tooltip" data-original-title="System in use!">
|
||||||
|
my $plus_item = ($is_dcb_partner) ? qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved again!'>ITEM</span>~ : qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved!'>ITEM</span><a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_logistics_item.pl?add&$all_ids&$from_to','Add Item','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:75%;' title='Add Item' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").html("$plus_item") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>FROM</span>") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>TO</span>") ;
|
||||||
|
\$('[data-toggle="tooltip"]').tooltip({
|
||||||
|
container: 'body'
|
||||||
|
});
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my $plus_poc = ($is_dcb_partner) ? 'POC' : qq~POC<a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_poc.pl?add&$i{date_from}&$i{date_to}&$i{client_id}&$i{organisation_ids}&$i{supplier_id}&$i{status_id}&$i{region_id}&$from_to','Add POC','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:50%;' title='Add POC' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").html("$plus_poc") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my $icon = qq~~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id}_wrapper").css("overflow","scroll");
|
||||||
|
\$("#$useropts{table_id}_wrapper").css("height","60vh");
|
||||||
|
// \$("#$useropts{table_id}_wrapper").css("overflow-y","hidden");
|
||||||
|
\$("#$useropts{table_id}").css("width","175%") ;
|
||||||
|
\$("#$useropts{table_id}").css("max-width","175%");
|
||||||
|
\$("#$useropts{table_id} tr th").slice(-3, -1).css("width","0%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").css("width","0%");
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
# if ($from_to eq 'to') {
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(1); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill Out'></i></a>~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-open").tooltip();
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th").slice(-7, -3).css("width","7.5%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","13%");
|
||||||
|
# \$("#$useropts{table_id} tr th").slice(-15, -10).css("width","7.5%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
|
||||||
|
# } else {
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill In'></i></a>~ ;
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-save").tooltip();
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# foreach (keys %last_child) { $trigger_jquery .= qq~\$("#$useropts{table_id} tr th:nth-last-child($last_child{$_})").css("width","7.5%");~ ; }
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("width","7%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","16%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{shipment_operator})").css("width","7%");
|
||||||
|
~ ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("min-width","320px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("max-width","320px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("min-width","105px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("max-width","105px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("max-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("min-width","120px");
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $icon = ($from_to eq 'from') ? qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ : qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
|
||||||
|
$icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(2)").html("$icon").trigger("chosen:updated") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(2) .glyphicons-disk-open").tooltip();
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$icon = qq~<i class='glyphicons glyphicons-ok' title data-toggle='tooltip' data-placement='top' data-original-title='Update'></i>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").html("$icon") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1) .glyphicons-ok").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
chop $quote_and_ops_ids if $quote_and_ops_ids ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
function selectAll(col) {
|
||||||
|
|
||||||
|
let from_to = \$("#from_to").text() ;
|
||||||
|
let col_id = "" ;
|
||||||
|
if (col == '1') {
|
||||||
|
col_id = "create_waybill_out_" ;
|
||||||
|
} else if (col == '2') {
|
||||||
|
col_id = "create_waybill_in_" ;
|
||||||
|
}
|
||||||
|
// else if (col == '3') {
|
||||||
|
// col_id = "process_complete_from_" ;
|
||||||
|
// } else if (col == '4') {
|
||||||
|
// col_id = "process_complete_to_" ;
|
||||||
|
// }
|
||||||
|
let jsObject = {
|
||||||
|
$quote_and_ops_ids
|
||||||
|
};
|
||||||
|
for (let key in jsObject) {
|
||||||
|
let event_id = key ;
|
||||||
|
\$(\$("#$useropts{table_id}").dataTable().fnGetNodes()).find(\$("input[name='"+col_id+""+event_id+"']")).each(function () {
|
||||||
|
if(!\$(this).is(':checked')) {
|
||||||
|
\$(this).prop('checked',true);
|
||||||
|
} else {
|
||||||
|
\$(this).prop('checked',false);
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("DELIVERY DATE BY") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("$icon") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date}) .glyphicons-calendar").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("DELIVERY TIME BY") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("$icon") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time}) .glyphicon-time").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
89
libs/modules/_FromProd/mailsend.pm
Normal file
89
libs/modules/_FromProd/mailsend.pm
Normal file
File diff suppressed because one or more lines are too long
603
libs/modules/_FromProd/match_event_production_time.pm
Normal file
603
libs/modules/_FromProd/match_event_production_time.pm
Normal file
|
|
@ -0,0 +1,603 @@
|
||||||
|
sub read_db_to_match_events_and_systems {
|
||||||
|
|
||||||
|
&common_date_array($last_start_ccyymmdd,$last_end_ccyymmdd);
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name,description,system_type','','','') ;
|
||||||
|
foreach my $id (keys %{$db{event_systems}}) {
|
||||||
|
$event_system_description{$id} = $db{event_systems}{$id}{description} ;
|
||||||
|
$event_system_name{$id} = $db{event_systems}{$id}{name} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_sql = substr($start_sql,0,11) . '00:00:00' ;
|
||||||
|
$end_sql = substr($end_sql,0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to',"(date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to,sport_type_ids,club_ids',"((date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')) AND event_system_id_multiple IS NOT NULL AND event_system_id_multiple <> ''",'','') ;
|
||||||
|
|
||||||
|
our %seen_event_system_in_event_quotes = () ;
|
||||||
|
|
||||||
|
foreach my $event_id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{ref} =~ s/\'//g ;
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/;+/;/g; # Replace multiple semicolons with one
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/^;+|;+$//g; # Remove leading or trailing semicolons
|
||||||
|
|
||||||
|
# next unless $db{event_quotes}{$event_id}{event_system_id_multiple} ;
|
||||||
|
|
||||||
|
$opts{matched_event} .= qq~<option value="$event_id">[$event_id] $db{event_quotes}{$event_id}{ref}</option>~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{event_quotes}{$event_id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
# $opts{matched_system} .= $seen_event_system_in_event_quotes{$_}
|
||||||
|
$seen_event_system_in_event_quotes{$_} = 1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (sort {$seen_event_system_in_event_quotes{$a} cmp $seen_event_system_in_event_quotes{$b}} keys %seen_event_system_in_event_quotes) {
|
||||||
|
$opts{matched_system} .= qq~<option value="$_">$db{event_systems}{$_}{name} [$db{event_systems}{$_}{description}]</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$opts{matched_system_none} .= qq~<option value="-1">$db{event_systems}{-1}{name} [$db{event_systems}{-1}{description}]</option>~ ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
|
||||||
|
our %sport_name_to_id = () ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{sport_types}}) {
|
||||||
|
$db{sport_types}{$_}{name} = lc $db{sport_types}{$_}{name} ;
|
||||||
|
$db{sport_types}{$_}{name} =~ s/ //g ;
|
||||||
|
$sport_name_to_id{$db{sport_types}{$_}{name}} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('clubs','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{clubs}}) {
|
||||||
|
my $c_name = lc $db{clubs}{$_}{name} ;
|
||||||
|
$c_name =~ s/\'//g ;
|
||||||
|
$club_name_to_id{$c_name} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
# # $match_bank_trans{$db{event_quotes}{$id}{trans_date}}{$db{event_quotes}{$id}{description}} = 1 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$tables}{$id}{event_system_id_multiple})) {
|
||||||
|
# $val .= qq~$db{event_systems}{$event_id}{name} [$db{event_systems}{$event_id}{description}], ~ ;
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub process_matched_events_and_systems {
|
||||||
|
|
||||||
|
my %system_match = () ; my %matched_event_name = () ; my %csv_line_possible_match = () ; my %matched_events = () ;
|
||||||
|
|
||||||
|
$system_match{"None"}{"None"} = -1 ;
|
||||||
|
|
||||||
|
foreach my $event_code (keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
my ($club_name,$system_desc_clue) = split("-",$csv_line{$event_code}{club_name}) ;
|
||||||
|
$club_name =~ s/ $//g ; $system_desc_clue =~ s/^ //g ; # remove whitespace
|
||||||
|
$club_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
$system_desc_clue = "None" unless $system_desc_clue ;
|
||||||
|
|
||||||
|
my @eventdetails = split(/ /,$club_name) ;
|
||||||
|
|
||||||
|
my $system_name_clue = $eventdetails[-1] ; $system_name_clue = "None" if $system_name_clue !~ /\d+/ ;
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /\d+/ && length($system_desc_clue) == 5) {
|
||||||
|
$system_name_clue = $system_desc_clue ;
|
||||||
|
$system_desc_clue = 'None' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /AISA/ && $system_desc_clue =~ /SOLO/) {
|
||||||
|
my @sysparts = split(/\_/,$system_desc_clue) ;
|
||||||
|
$system_name_clue = $sysparts[2] ;
|
||||||
|
$system_desc_clue =~ s/\_/ /g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = -1 if $system_name_clue eq 'None' && $system_desc_clue eq 'None' ;
|
||||||
|
|
||||||
|
$system_desc_clue = lc $system_desc_clue ;
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = $system_match{$system_name_clue}{$system_desc_clue} if $system_match{$system_name_clue}{$system_desc_clue} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $system_id (keys %{$db{event_systems}}) {
|
||||||
|
# foreach my $system_id (keys %seen_event_system_in_event_quotes) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my @sport_split = split(":",$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
$sport_split[0] =~ s/ //g ;
|
||||||
|
$sport_split[0] = lc $sport_split[0] ;
|
||||||
|
|
||||||
|
my $sport_id = ($csv_line{$event_code}{event_name} =~ /:/) ? $sport_name_to_id{$sport_split[0]} : '' ;
|
||||||
|
|
||||||
|
my @event_name_details = split(/-/,$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
my $to_match_event_name = $event_name_details[-1] ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/^ //g ;
|
||||||
|
$to_match_event_name =~ s/ $//g ;
|
||||||
|
|
||||||
|
$to_match_event_name = ($csv_line{$event_code}{event_name} =~ /:/ && $csv_line{$event_code}{event_name} !~ /-/) ? $sport_split[1] : $to_match_event_name ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
my $club_id = $club_name_to_id{$club_name} ;
|
||||||
|
|
||||||
|
$club_name = ($csv_line{$event_code}{club_name} =~ /AISA/ && $csv_line{$event_code}{club_name} =~ /SOLO/) ? lc $club_name : lc $csv_line{$event_code}{club_name} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
$matched_events{$event_code} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $found_match = 0 ;
|
||||||
|
|
||||||
|
foreach my $system_id (split(";",$db{event_quotes}{$id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if ($sys_name =~ /\b$system_name_clue\b/ && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_name =~ /\b$system_name_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $sys_desc = $db{event_systems}{$system_id}{description} ;
|
||||||
|
# my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
# # my @sysparts = split(/\_/,$system) ;
|
||||||
|
|
||||||
|
# if ($sys_name =~ /\b$sysno\b/ && $sys_desc =~ /\b$system\b/iog) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /\d+/ && $sys_name =~ /\b$system\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /AISA/ && $system =~ /SOLO/ && $sysparts[2] && $sys_name =~ /\b$sysparts[2]\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($sys_desc eq 'St Stithians Hockey Red' && $clubname =~ /Red/i && $clubname =~ /Stithians/i) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $event_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_match && !$csv_line{$event_code}{event_id}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
next ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!$csv_line{$event_code}{system_id}) && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
# if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
# if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
# $csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
# }
|
||||||
|
# next ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $csv_line_possible_match{$event_code}{event_id} if $csv_line_possible_match{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_box_content_rows .= &common_min_forms_start("$lcpage") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("club_system","system_nr","matched_system","production_hours","production_seconds","cloud_recording_seconds","club_name","start","end","event_name","matched_event","match") ;
|
||||||
|
|
||||||
|
my $row_cnt = 0 ; my %no_system_or_event = () ;
|
||||||
|
|
||||||
|
foreach my $event_code (sort {$csv_line{$a}{line_cnt} cmp $csv_line{$b}{line_cnt}} keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
$row_cnt++ ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~<tr id="$row_cnt">~ ;
|
||||||
|
|
||||||
|
my $cell_id = qq~~ ;
|
||||||
|
|
||||||
|
my ($system,$sysno) = split(" - ",$csv_line{$event_code}{club_name}) ;
|
||||||
|
|
||||||
|
my @get_sport = (!$csv_line{$event_code}{system_id} || (!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /;/)) ? split(/\:/,$csv_line{$event_code}{event_name}) : () ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="text" name='$event_code' value="$event_code_to_line{$event_code}" style="display:none;">~ if !$csv_line{$event_code}{system_id} || !$csv_line{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
foreach my $col (@sql_col_display) {
|
||||||
|
|
||||||
|
my $val = '' ; $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($col eq 'club_name') {
|
||||||
|
$val = $csv_line{$event_code}{club_name} ;
|
||||||
|
} elsif ($col eq 'system_nr') {
|
||||||
|
$val = $sysno ;
|
||||||
|
} elsif ($col eq 'start') {
|
||||||
|
$val = $csv_line{$event_code}{start_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'end') {
|
||||||
|
$val = $csv_line{$event_code}{end_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'club_system') {
|
||||||
|
$val = $system ;
|
||||||
|
} elsif ($col eq 'matched_system') {
|
||||||
|
|
||||||
|
$preferred_placeholder{"system_$row_cnt"} = "Select System" ;
|
||||||
|
|
||||||
|
$found_system_drop_down = 1 if !$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1' ;
|
||||||
|
|
||||||
|
# $allow_deselect{"system_$row_cnt"} = 1 ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : ($csv_line{$event_code}{system_id} eq '-1') ? &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system_none") : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
# $val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1') {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{system} .= qq~"#selectSystem_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$cell_id = qq~id="matched_system_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'production_hours') {
|
||||||
|
$val = $csv_line{$event_code}{production_hours} ;
|
||||||
|
$val =~ s/\,/\./g ;
|
||||||
|
} elsif ($col eq 'production_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{production_seconds}) ;
|
||||||
|
} elsif ($col eq 'cloud_recording_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{cloud_seconds}) ;
|
||||||
|
} elsif ($col eq 'event_name') {
|
||||||
|
$val = $csv_line{$event_code}{event_name} ;
|
||||||
|
} elsif ($col eq 'matched_event') {
|
||||||
|
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} =~ s/\;/\_/g ;
|
||||||
|
|
||||||
|
my $col_name = (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? "matched_event_$csv_line_possible_match{$event_code}{event_id}" : "matched_event" ;
|
||||||
|
|
||||||
|
$opts{$col_name} =
|
||||||
|
($csv_line_possible_match{$event_code}{event_id} && !$csv_line{$event_code}{event_id}) ? join "</option><option ", map { qq~value="$_"><strong>Possible : </strong>$db{event_quotes}{$_}{ref} [$_]~ } split "_" , $csv_line_possible_match{$event_code}{event_id} :
|
||||||
|
$opts{matched_event} ;
|
||||||
|
|
||||||
|
$opts{$col_name} = qq~<option ~ . $opts{$col_name} . qq~</option>~ if $col_name ne 'matched_event' ;
|
||||||
|
|
||||||
|
$preferred_placeholder{"event_$row_cnt"} = "Select Event" ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{event_id}) ? "$db{event_quotes}{$csv_line{$event_code}{event_id}}{ref} [$csv_line{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
# (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? "<strong>POSSIBLE : </strong>$db{event_quotes}{$csv_line_possible_match{$event_code}{event_id}}{ref} [$csv_line_possible_match{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
(!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? &common_min_table_select("event_$row_cnt",'','','','','','',$col_name) :
|
||||||
|
&common_min_table_select("event_$row_cnt",'','','','','','','matched_event') ;
|
||||||
|
|
||||||
|
$found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} ;
|
||||||
|
# $found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} && (!$csv_line_possible_match{$event_code}{event_id} || $csv_line_possible_match{$event_code}{event_id} =~ /_/) ;
|
||||||
|
|
||||||
|
# if ((!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /_/)) {
|
||||||
|
if (!$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{event} .= qq~"#selectEvent_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$cell_id = qq~id="matched_event_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'match') {
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
|
||||||
|
$cell_id = qq~id="final_col_$row_cnt"~ ;
|
||||||
|
|
||||||
|
my $tool = $pixellot_system{$ccyymmdd}{$period} ;
|
||||||
|
|
||||||
|
$start_sql =~ s/ /T/g ;
|
||||||
|
$end_sql =~ s/ /T/g ;
|
||||||
|
|
||||||
|
# my $system_input = ($csv_line{$event_code}{system_id}) ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
my $system_input = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : ($csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? $csv_line_possible_match{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $event_input = ($matched_event_id) ? qq~<input style='display:none;' value='$matched_event_id' id='selectEvent_$row_cnt' name="event_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
my $match_icon = ($system_input && $event_input) ? "ok" : "remove" ;
|
||||||
|
my $match_class = ($system_input && $event_input) ? "success" : "danger" ;
|
||||||
|
|
||||||
|
push @unmatched_rows, "#selectEvent_$row_cnt" if !$event_input ;
|
||||||
|
push @unmatched_rows, "#selectSystem_$row_cnt" if !$system_input ;
|
||||||
|
|
||||||
|
my $not_matched = (!$event_input || !$system_input) ? qq~<input style='display:none;' value='1' id='not_matched_$row_cnt'>~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $no_similar_rows = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1' && $csv_line{$event_code}{event_id}) ? '-1' : '' ;
|
||||||
|
|
||||||
|
my $similar_rows = (!$event_input || !$system_input) ? qq~<input value='' name='similar_rows_$row_cnt' style='display:none;'>~ : qq~~ ;
|
||||||
|
|
||||||
|
$val = "
|
||||||
|
$system_input
|
||||||
|
$event_input
|
||||||
|
$not_matched
|
||||||
|
$similar_rows
|
||||||
|
<input style='display:none;' value='$event_code' id='event_code_$row_cnt' name='event_code_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{production_seconds}' id='time_$row_cnt' name='time_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{cloud_seconds}' id='cloud_time_$row_cnt' name='cloud_time_$row_cnt'>
|
||||||
|
<a class='btn btn-$match_class btn-sm' id='matched_row_$row_cnt' href=javascript:match_event_system('$row_cnt','$event_code','$csv_line{$event_code}{production_seconds}','$csv_line{$event_code}{cloud_seconds}'); data-title='MATCH' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-$match_icon'></i></a>
|
||||||
|
|
||||||
|
<a class='btn btn-success btn-sm' href=javascript:dlgMdl('$useropts{'scripts'}/dialog/manually_match_csv_row.pl?$matched_event_id&$csv_line{$event_code}{system_id}&$csv_line{$event_code}{production_seconds}&$csv_line{$event_code}{cloud_seconds}&$event_code&$start_sql&$end_sql&$row_cnt&add','Manually Match','','medium-dialog'); data-title='MATCH MANUALLY' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title>
|
||||||
|
<i class='glyphicon glyphicon-question-sign'></i>
|
||||||
|
</a>
|
||||||
|
" ;
|
||||||
|
|
||||||
|
$start_sql =~ s/T/ /g ;
|
||||||
|
$end_sql =~ s/T/ /g ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $cell_id $nowrap>$val</td>~ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
// let inputString = '1,21,32,4'; // Your input string
|
||||||
|
// let outputString = inputString.split(',').map(num => 'abc_' + num).join(',');
|
||||||
|
|
||||||
|
function auto_select_similar_drop_downs (ids,changed_val) {
|
||||||
|
for (let id of ids) {
|
||||||
|
if (\$(id).val()) {
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
\$(id).val(changed_val) ;
|
||||||
|
\$(id).trigger("chosen:updated") ;
|
||||||
|
fix_match_icon(id) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my %seen_rows_set = () ;
|
||||||
|
|
||||||
|
foreach my $club_name (keys %no_system_or_event) {
|
||||||
|
foreach my $start_time (keys %{$no_system_or_event{$club_name}}) {
|
||||||
|
foreach my $sport_name (keys %{$no_system_or_event{$club_name}{$start_time}}) {
|
||||||
|
foreach my $sys_evt (keys %{$no_system_or_event{$club_name}{$start_time}{$sport_name}}) {
|
||||||
|
|
||||||
|
chop $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} if $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
my $ids_change = $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
$ids_change =~ s/\"//g ;
|
||||||
|
|
||||||
|
my $ids_change2 = $ids_change ;
|
||||||
|
|
||||||
|
$ids_change2 =~ s/#selectEvent_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
$ids_change2 =~ s/#selectSystem_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
|
||||||
|
my $ids_change_row_nrs = $ids_change ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectEvent_//g ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectSystem_//g ;
|
||||||
|
|
||||||
|
my @first_nr = split(/\,/,$ids_change_row_nrs) ;
|
||||||
|
|
||||||
|
my $event_or_system = ($no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} =~ /Event/) ? 'event' : 'system' ;
|
||||||
|
|
||||||
|
next if $seen_rows_set{$ids_change_row_nrs}{$event_or_system} ;
|
||||||
|
$seen_rows_set{$ids_change_row_nrs}{$event_or_system} = 1 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
if (\$("#not_matched_$first_nr[0]").val() && !\$("input[name='similar_rows_$first_nr[0]']").val()) {
|
||||||
|
\$("$ids_change2").val("$ids_change_row_nrs") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("$ids_change").change( function () {
|
||||||
|
|
||||||
|
fix_match_icon(this.id) ;
|
||||||
|
if (!\$(this).val()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
auto_select_similar_drop_downs([$no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt}],\$(this).val()) ;
|
||||||
|
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $unmatched_rows_str = join(",",@unmatched_rows) ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function get_row_nr (id) {
|
||||||
|
|
||||||
|
let lastIndex = id.lastIndexOf('_');
|
||||||
|
lastIndex = parseInt(lastIndex) ;
|
||||||
|
let row_nr_1 = id.substring(1+lastIndex);
|
||||||
|
return row_nr_1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_match_icon (id) {
|
||||||
|
|
||||||
|
let row_nr = get_row_nr(id) ;
|
||||||
|
|
||||||
|
if (\$("#selectEvent_"+row_nr).val() && \$("#selectSystem_"+row_nr).val() && \$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-danger btn-sm').addClass('btn btn-success btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-ok'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("") ;
|
||||||
|
} else if ((!\$("#selectEvent_"+row_nr).val() || !\$("#selectSystem_"+row_nr).val()) && !\$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-success btn-sm').addClass('btn btn-danger btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-remove'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("1") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("$unmatched_rows_str").change( function () {
|
||||||
|
// fix_match_icon(this.id) ;
|
||||||
|
// }) ;
|
||||||
|
|
||||||
|
~ if $unmatched_rows_str ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(2)").css("width","20%");~ if $found_event_drop_down ; ## MATCHED EVENT COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(10)").css("width","20%");~ if $found_system_drop_down ; ## MATCHED SYSTEM COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function match_event_system (row_nr,event_code,production_seconds,cloud_seconds) {
|
||||||
|
|
||||||
|
let event_id = \$("#selectEvent_"+row_nr).val() ;
|
||||||
|
let system_id = \$("#selectSystem_"+row_nr).val() ;
|
||||||
|
|
||||||
|
if (!event_id || !system_id) {
|
||||||
|
noty({text:'Please select a System and Event!!!',layout:"center",type:"error",timeout:3000}) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("#"+row_nr).css("display","none") ;
|
||||||
|
|
||||||
|
var url = "$useropts{scripts}/get/add_event_system_hours.pl?"+event_id+"&"+system_id+"&"+production_seconds+"&"+cloud_seconds+"&"+event_code ;
|
||||||
|
|
||||||
|
\$.get(url) ;
|
||||||
|
\$("#final_col_"+row_nr).html('') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("#itv-table tr:eq(0) th:nth-last-child(1)").html("<span>Match All</span> <a class='btn btn-success btn-sm' href=javascript:match_all(1); data-title='MATCH ALL (inc. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a> <a class='btn btn-warning btn-sm' href=javascript:match_all(0); data-title='MATCH ALL (excl. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a>") ;
|
||||||
|
|
||||||
|
\$("#itv-table thead tr:eq(0) th:nth-last-child(1)").css('white-space','nowrap') ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
946
libs/modules/_FromProd/pdf.pm
Normal file
946
libs/modules/_FromProd/pdf.pm
Normal file
|
|
@ -0,0 +1,946 @@
|
||||||
|
sub pdf_delete_previous_pdf {
|
||||||
|
|
||||||
|
my ($pdfpath) = @_ ;
|
||||||
|
|
||||||
|
opendir(DIR, "$pdfpath") or die "cant open Directory $pdfpath: $!\n";
|
||||||
|
|
||||||
|
while(defined($folder = readdir(DIR))) {
|
||||||
|
if (length $folder > 2) {
|
||||||
|
my ($file,$type) = split(/\./,$folder) ;
|
||||||
|
if (-e "$pdfpath/$file.pdf"){
|
||||||
|
unlink ("$pdfpath/$file.pdf") or print "unable to unlink - $pdfpath/$file.pdf : $!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(DIR) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_initialise {
|
||||||
|
|
||||||
|
my ($folder,$file,$title) = @_ ;
|
||||||
|
|
||||||
|
my $pdf_file = "$folder/$file";
|
||||||
|
|
||||||
|
$pdf = PDF::API2 -> new(-file => $pdf_file);
|
||||||
|
|
||||||
|
%font = (
|
||||||
|
Helvetica => {
|
||||||
|
Oblique => $pdf->corefont('Helvetica-Oblique', -encoding => 'latin1'),
|
||||||
|
Bold => $pdf->corefont('Helvetica-Bold', -encoding => 'latin1'),
|
||||||
|
Normal => $pdf->corefont('Helvetica', -encoding => 'latin1'),
|
||||||
|
},
|
||||||
|
Verdana => {
|
||||||
|
Bold => $pdf->corefont('Verdana-Bold', -encoding => 'Western'),
|
||||||
|
Normal => $pdf->corefont('Verdana', -encoding => 'Western'),
|
||||||
|
},
|
||||||
|
Courier => {
|
||||||
|
Bold => $pdf->corefont('Courier-Bold', -encoding => 'latin1'),
|
||||||
|
Normal => $pdf->corefont('Courier', -encoding => 'latin1'),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
$pdf->info(
|
||||||
|
'Author' => "ITV",
|
||||||
|
'Creator' => "ITV",
|
||||||
|
'Producer' => "ITV",
|
||||||
|
'Title' => $title,
|
||||||
|
'Subject' => $title,
|
||||||
|
'Keywords' => $title
|
||||||
|
);
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_initialise_page {
|
||||||
|
|
||||||
|
if ($layout eq 'landscape'){
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(297/mm, 210/mm);
|
||||||
|
}
|
||||||
|
elsif ($layout eq 'label'){
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(100/mm, 100/mm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(210/mm, 297/mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$small_oblique_text = $page->text;
|
||||||
|
$small_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
|
||||||
|
$small_oblique_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_oblique_text = $page->text;
|
||||||
|
$medium_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
|
||||||
|
$medium_oblique_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
|
||||||
|
$bar_head_bold_text = $page->text;
|
||||||
|
$bar_head_bold_text->font( $font{'Helvetica'}{'Bold'}, 13/pt );
|
||||||
|
$bar_head_bold_text->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$xx_large_bold_text = $page->text;
|
||||||
|
$xx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 16/pt );
|
||||||
|
$xx_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xxx_large_bold_text = $page->text;
|
||||||
|
$xxx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 24/pt );
|
||||||
|
$xxx_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xx_large_italic_text = $page->text;
|
||||||
|
$xx_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 16/pt );
|
||||||
|
$xx_large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xx_large_text = $page->text;
|
||||||
|
$xx_large_text->font( $font{'Helvetica'}{'Normal'}, 16/pt );
|
||||||
|
$xx_large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_bold_text = $page->text;
|
||||||
|
$x_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 14/pt );
|
||||||
|
$x_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_italic_text = $page->text;
|
||||||
|
$x_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 14/pt );
|
||||||
|
$x_large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_text = $page->text;
|
||||||
|
$x_large_text->font( $font{'Helvetica'}{'Normal'}, 14/pt );
|
||||||
|
$x_large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_bold_text = $page->text;
|
||||||
|
$large_bold_text->font( $font{'Helvetica'}{'Bold'}, 12/pt );
|
||||||
|
$large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_italic_text = $page->text;
|
||||||
|
$large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 12/pt );
|
||||||
|
$large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_text = $page->text;
|
||||||
|
$large_text->font( $font{'Helvetica'}{'Normal'}, 12/pt );
|
||||||
|
$large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_bold_text = $page->text;
|
||||||
|
$medium_bold_text->font( $font{'Helvetica'}{'Bold'}, 9.5/pt );
|
||||||
|
$medium_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_italic_text = $page->text;
|
||||||
|
$medium_italic_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
|
||||||
|
$medium_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_text = $page->text;
|
||||||
|
$medium_text->font( $font{'Helvetica'}{'Normal'}, 9/pt );
|
||||||
|
$medium_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_red_bold_text = $page->text;
|
||||||
|
$medium_red_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$medium_red_bold_text->fillcolor( 'red' );
|
||||||
|
|
||||||
|
$small_text = $page->text;
|
||||||
|
$small_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
|
||||||
|
$small_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$small_blue_text = $page->text;
|
||||||
|
$small_blue_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
|
||||||
|
$small_blue_text->fillcolor( 'blue' );
|
||||||
|
|
||||||
|
$small_bold_text = $page->text;
|
||||||
|
$small_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$small_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$small_italic_text = $page->text;
|
||||||
|
$small_italic_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
|
||||||
|
$small_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_text = $page->text;
|
||||||
|
$tiny_text->font( $font{'Helvetica'}{'Normal'}, 7/pt );
|
||||||
|
$tiny_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_bold_text = $page->text;
|
||||||
|
$tiny_bold_text->font( $font{'Helvetica'}{'Bold'}, 7/pt );
|
||||||
|
$tiny_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_italic_text = $page->text;
|
||||||
|
$tiny_italic_text->font( $font{'Helvetica'}{'Oblique'}, 7/pt );
|
||||||
|
$tiny_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$grey_text_above_right = $page -> text;
|
||||||
|
$grey_text_above_right -> font($font{'Helvetica'}{'Normal'}, 9/pt);
|
||||||
|
$grey_text_above_right -> fillcolor('#808080');
|
||||||
|
|
||||||
|
$small_bold_text_white = $page->text;
|
||||||
|
$small_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$small_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$small_medium_bold_text_white = $page->text;
|
||||||
|
$small_medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 9/pt );
|
||||||
|
$small_medium_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$medium_bold_text_white = $page->text;
|
||||||
|
$medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 10/pt );
|
||||||
|
$medium_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$large_bold_text_white = $page->text;
|
||||||
|
$large_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 12/pt );
|
||||||
|
$large_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$medium_green_text = $page->text;
|
||||||
|
$medium_green_text->font( $font{'Helvetica'}{'Normal'}, 10/pt );
|
||||||
|
$medium_green_text->fillcolor( 'green' );
|
||||||
|
|
||||||
|
|
||||||
|
if ($blue_box) {
|
||||||
|
$up = 292 ;
|
||||||
|
&pdf_box_block_top(5,205,'#009bc8') ; # start block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inner_blue_box) {
|
||||||
|
$up = 287 ;
|
||||||
|
$top = $up;
|
||||||
|
&pdf_box_block_top($blocks[1],200,'#009bc8') ; # start block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub finish_pdf {
|
||||||
|
|
||||||
|
$pdf->save;
|
||||||
|
$pdf->end();
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_page_header {
|
||||||
|
|
||||||
|
$page_num++ ;
|
||||||
|
|
||||||
|
# my $image1 = $page->gfx(1) ;
|
||||||
|
# my $image1_thumb = "$htmlpath/img/pdf_logo.jpg";
|
||||||
|
# $pdf_image1_file = $pdf->image_jpeg($image1_thumb);
|
||||||
|
# $image1->image($pdf_image1_file, $across/mm, $up/mm, 80/mm, 19/mm);
|
||||||
|
|
||||||
|
my $image1 = $page->gfx(1) ;
|
||||||
|
my $image1_thumb = "$htmlpath/img/pdf_logo.png";
|
||||||
|
$pdf_image1_file = $pdf->image_png($image1_thumb);
|
||||||
|
$image1->image($pdf_image1_file, 10/mm, $up/mm, 90/mm, 29/mm);
|
||||||
|
|
||||||
|
$up+=26 ;
|
||||||
|
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{company}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Co Reg: $useropts{co_reg}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Vat Reg: $useropts{vat_nr}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{address1}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{address2}, $useropts{address3}, $useropts{city}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"South Africa") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Tel: $useropts{tel}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_footer {
|
||||||
|
|
||||||
|
$up = 10 ;
|
||||||
|
|
||||||
|
&pdf_black_line ;
|
||||||
|
&pdf_tiny_text (50, 5, "Johannesburg: $useropts{tel}, Email: $useropts{email}") ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_block {
|
||||||
|
|
||||||
|
my ($along,$text_block,$tlock_length,$grid) = @_ ;
|
||||||
|
|
||||||
|
my $lines = 1;
|
||||||
|
|
||||||
|
# $max_text_length = 120 unless $max_text_length ;
|
||||||
|
|
||||||
|
$text_block =~ s/\n/ <br>/g;
|
||||||
|
$text_block = substr($text_block,0,-4) if substr($text_block,-4,4) eq '<br>' ;
|
||||||
|
|
||||||
|
my @words_array = split (/ /, $text_block) ;
|
||||||
|
my $wrapped_line = '' ;
|
||||||
|
my $block_start_up = $up ;
|
||||||
|
my $tlock_length_orig = $tlock_length ;
|
||||||
|
my $word_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $word (@words_array) {
|
||||||
|
my $word_length = length($word) ;
|
||||||
|
my $wrapped_line_length = length($wrapped_line) ;
|
||||||
|
$tlock_length-- if $word eq uc $word ;
|
||||||
|
$word_length -= 4 if $word =~ /<br>/ ;
|
||||||
|
if (($wrapped_line_length + $word_length) > $tlock_length or $word =~ /<br>/) {
|
||||||
|
$word =~ s/<br>//g if $word =~ /<br>/ ;
|
||||||
|
$tlock_length = $tlock_length_orig ;
|
||||||
|
&pdf_text_block_line($along,$grid,$wrapped_line) ;
|
||||||
|
if ($grid == 1 or $grid == 2) {
|
||||||
|
&pdf_nl_gr ;
|
||||||
|
} elsif ($grid == 6) {
|
||||||
|
$up -= 3.25 ;
|
||||||
|
} else {
|
||||||
|
&pdf_nl_s ;
|
||||||
|
}
|
||||||
|
$lines++;
|
||||||
|
$wrapped_line = '' ;
|
||||||
|
}
|
||||||
|
$word_cnt++ ;
|
||||||
|
$wrapped_line .= $word . ' ' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_text_block_line($along,$grid,$wrapped_line) ;
|
||||||
|
|
||||||
|
if ($grid == 2) {
|
||||||
|
&pdf_nl_t;
|
||||||
|
}
|
||||||
|
elsif ($grid == 1) {
|
||||||
|
$up = $block_start_up ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 5) {
|
||||||
|
&pdf_nl_gr;
|
||||||
|
}
|
||||||
|
elsif ($grid == 6) {
|
||||||
|
$up -= 1.25 ;
|
||||||
|
} else {
|
||||||
|
&pdf_nl_s;
|
||||||
|
#$up = $up - 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($lines) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_block_line {
|
||||||
|
|
||||||
|
my ($along,$grid,$wrapped_line) = @_ ;
|
||||||
|
|
||||||
|
if ($grid == 1) {
|
||||||
|
&pdf_tiny_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 2) {
|
||||||
|
&pdf_tiny_bold_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 3) {
|
||||||
|
&pdf_medium_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 4) {
|
||||||
|
&pdf_small_bold_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&pdf_small_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_center {
|
||||||
|
|
||||||
|
my ($text,$along,$colwidth) = @_ ;
|
||||||
|
|
||||||
|
my $width = $tiny_text->advancewidth($text);
|
||||||
|
|
||||||
|
$width-=$colwidth ;
|
||||||
|
|
||||||
|
$tiny_text->translate( $along/mm, $up/mm );
|
||||||
|
$tiny_text->text($text,-indent=>-($width/2));
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_check_value_of_up {
|
||||||
|
|
||||||
|
my ($value) = @_ ;
|
||||||
|
|
||||||
|
if ($up < $value) {
|
||||||
|
if ($blue_box) {
|
||||||
|
$up=5;
|
||||||
|
&pdf_box_block_bottom(5,205,'#009bc8') ; # end block -------------------------------------
|
||||||
|
}
|
||||||
|
if ($inner_blue_box) {
|
||||||
|
$up=10;
|
||||||
|
&vertical_lines_inner_box;
|
||||||
|
&pdf_box_block_bottom($blocks[1],200,'#009bc8') ; # end block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
if ($layout eq 'landscape') {
|
||||||
|
$up = 195 ;
|
||||||
|
$across = 1 ;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
}
|
||||||
|
elsif ($label) {
|
||||||
|
$label_height = '' ;
|
||||||
|
$up = 287 ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$up = 272 ;
|
||||||
|
$across = 1 ;
|
||||||
|
}
|
||||||
|
# &pdf_page_header ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_tt {
|
||||||
|
|
||||||
|
$up = $up - 2 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gr {
|
||||||
|
|
||||||
|
$up = $up - 2.7 ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_t {
|
||||||
|
|
||||||
|
$up = $up - 3 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_s {
|
||||||
|
|
||||||
|
$up = $up - 4 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl {
|
||||||
|
|
||||||
|
$up = $up - 5 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_1 {
|
||||||
|
|
||||||
|
$up = $up - 6 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_2 {
|
||||||
|
|
||||||
|
$up = $up - 7 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_3 {
|
||||||
|
|
||||||
|
$up = $up - 8 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_dashed_line {
|
||||||
|
|
||||||
|
my ($start,$length) = @_ ;
|
||||||
|
|
||||||
|
unless ($start) { $start = 10 ; }
|
||||||
|
unless ($length) { $length = 200 ; }
|
||||||
|
|
||||||
|
my $dashed_line = $page->gfx(1);
|
||||||
|
$dashed_line->strokecolor( 'black' );
|
||||||
|
$dashed_line->linewidth( '0.5' );
|
||||||
|
$dashed_line->linedash(3,4);
|
||||||
|
$dashed_line->move($start/mm,$up/mm);
|
||||||
|
$dashed_line->line($length/mm,$up/mm);
|
||||||
|
$dashed_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_grey_line {
|
||||||
|
|
||||||
|
my ($start,$end) = @_ ;
|
||||||
|
|
||||||
|
my $grey_line = $page->gfx(1);
|
||||||
|
$grey_line->strokecolor( 'grey' );
|
||||||
|
$grey_line->linewidth( '0.8' );
|
||||||
|
$grey_line->linedash();
|
||||||
|
$grey_line->move( $start/mm, ($up/mm) ); $grey_line->line($end/mm, ($up/mm) ); $grey_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2) = @_ ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor( 'black' );
|
||||||
|
$pdf_black_line->linewidth( '0.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_bar {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$cl,$tx,$lw,$txa,$size,$text_color,$cnt_lines,$max_text_length) = @_ ; # &pdf_bar(10,$up,200,$up,'#009bc8','Quote',5) ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
unless ($cl) { $cl = 'black' ; }
|
||||||
|
unless ($lw) { $lw = 5 ; }
|
||||||
|
# unless ($txcl) { $txcl = 'white' ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($cl);
|
||||||
|
$pdf_black_line->linewidth($lw);
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
if (not $size and not $text_color) { &pdf_bar_head_bold_text($txa,$up-1.5,$tx) ; } # default to large text
|
||||||
|
elsif ($size eq 'med' and not $text_color) { &pdf_medium_white_text_bold($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and not $text_color) { &pdf_small_medium_white_text_bold($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'med_right' and not $text_color) { &pdf_medium_white_text_bold_right($txa,$up-1,$tx) ; } # medium text
|
||||||
|
elsif ($size eq 'small_right' and not $text_color) { &pdf_small_medium_white_text_bold_right($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and $text_color eq 'small_black' and ($cnt_lines == 1 or not $cnt_lines)) { &pdf_small_text($txa,$up,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and $text_color eq 'small_black' and $cnt_lines >= 1) { &pdf_text_block($txa,$tx,$max_text_length,6) ; }
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------ added by handre
|
||||||
|
sub pdf_extra_thin_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$color) = @_ ;
|
||||||
|
|
||||||
|
$color = 'black' if not $color ; # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($color);
|
||||||
|
$pdf_black_line->linewidth( '0.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_thin_box_block_top {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start{$st} = $up ;
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_thin_box_block_bottom {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
|
||||||
|
&pdf_extra_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------- added by handre
|
||||||
|
|
||||||
|
|
||||||
|
sub pdf_thin_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($color);
|
||||||
|
$pdf_black_line->linewidth( '1.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_curr_symbols {
|
||||||
|
|
||||||
|
$curr_symb{ZAR} = 'R';
|
||||||
|
$curr_symb{USD} = '$';
|
||||||
|
# $curr_symb{GBP} = '£';
|
||||||
|
$curr_symb{GBP} = 'GBP';
|
||||||
|
# $curr_symb{EUR} = '€';
|
||||||
|
$curr_symb{EUR} = 'EUR';
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_box_block_top {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start{$st} = $up ;
|
||||||
|
|
||||||
|
&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_box_block_bottom {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
&pdf_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
|
||||||
|
&pdf_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_rounded_half_page_block_top {
|
||||||
|
|
||||||
|
my ($color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start = $up ;
|
||||||
|
|
||||||
|
$pdf_rounded_half_page_block = $page->gfx(1);
|
||||||
|
$pdf_rounded_half_page_block->strokecolor( 'black' );
|
||||||
|
$pdf_rounded_half_page_block->linewidth( '0.5' );
|
||||||
|
$pdf_rounded_half_page_block->linedash();
|
||||||
|
$pdf_rounded_half_page_block->move(14/mm,($up/mm) );
|
||||||
|
$pdf_rounded_half_page_block->line(196/mm,($up/mm) );
|
||||||
|
$curve = $up-4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
|
||||||
|
$up-=4 ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_rounded_half_page_block_rest {
|
||||||
|
|
||||||
|
$box_up = $up + 3 ;
|
||||||
|
|
||||||
|
$pdf_rounded_half_page_block->line(200/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up-4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(200/mm,($box_up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
|
||||||
|
$box_up-=4 ;
|
||||||
|
$pdf_rounded_half_page_block->move(196/mm,($box_up/mm) );
|
||||||
|
$pdf_rounded_half_page_block->line(14/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up+4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(14/mm,($box_up/mm),10/mm,($box_up/mm),10/mm,($curve/mm)) ;
|
||||||
|
$box_up+=4 ;
|
||||||
|
$pdf_rounded_half_page_block->move(10/mm,($box_up/mm) );
|
||||||
|
$box_up = $box_start-4 ;
|
||||||
|
$pdf_rounded_half_page_block->line(10/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up+4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(10/mm,($box_up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
|
||||||
|
$pdf_rounded_half_page_block->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_rounded_half_page_block {
|
||||||
|
|
||||||
|
# my $pdf_rounded_half_page_block = $page->gfx(1);
|
||||||
|
# $pdf_rounded_half_page_block->strokecolor( 'black' );
|
||||||
|
# $pdf_rounded_half_page_block->linewidth( '0.5' );
|
||||||
|
# $pdf_rounded_half_page_block->linedash();
|
||||||
|
# $pdf_rounded_half_page_block->move(14/mm,($up/mm) );
|
||||||
|
# $pdf_rounded_half_page_block->line(196/mm,($up/mm) );
|
||||||
|
# $curve = $up-4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
|
||||||
|
# $up-=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(200/mm,($up/mm) );
|
||||||
|
# $up-=106 ;
|
||||||
|
# $pdf_rounded_half_page_block->line(200/mm,($up/mm) );
|
||||||
|
# $curve = $up-4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(200/mm,($up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
|
||||||
|
# $up-=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(196/mm,($up/mm) );
|
||||||
|
# $pdf_rounded_half_page_block->line(14/mm,($up/mm) );
|
||||||
|
# $curve = $up+4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(14/mm,($up/mm),10/mm,($up/mm),10/mm,($curve/mm)) ;
|
||||||
|
# $up+=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(10/mm,($up/mm) );
|
||||||
|
# $up+=106 ;
|
||||||
|
# $pdf_rounded_half_page_block->line(10/mm,($up/mm) );
|
||||||
|
# $curve = $up+4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(10/mm,($up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
|
||||||
|
# $pdf_rounded_half_page_block->stroke;
|
||||||
|
# $up-=110 ;
|
||||||
|
|
||||||
|
# } #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xx_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_text->translate( $along/mm, $up/mm ); $xx_large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xxx_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xxx_large_bold_text->translate( $along/mm, $up/mm ); $xxx_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
sub pdf_xx_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_bold_text->translate( $along/mm, $up/mm ); $xx_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xx_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_italic_text->translate( $along/mm, $up/mm ); $xx_large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_text->translate( $along/mm, $up/mm ); $x_large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_bold_text->translate( $along/mm, $up/mm ); $x_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_italic_text->translate( $along/mm, $up/mm ); $x_large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_text->translate( $along/mm, $up/mm ); $large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text->translate( $along/mm, $up/mm ); $large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_italic_text->translate( $along/mm, $up/mm ); $large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_text->translate( $along/mm, $up/mm ); $medium_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ); $medium_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_italic_text->translate( $along/mm, $up/mm ); $medium_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_bar_head_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $bar_head_bold_text->translate( $along/mm, $up/mm ); $bar_head_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_red_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_red_bold_text->translate( $along/mm, $up/mm ); $medium_red_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ) ; $medium_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ); $small_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_blue_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_blue_text->translate( $along/mm, $up/mm ); $small_blue_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ); $small_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_italic_text->translate( $along/mm, $up/mm ); $small_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ) ; $small_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ) ; $small_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ); $tiny_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ); $tiny_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_italic_text->translate( $along/mm, $up/mm ); $tiny_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ) ; $tiny_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ) ; $tiny_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_medium_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_grey_text_above_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $grey_text_above_right->translate( $along/mm, $up/mm ); $grey_text_above_right->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_medium_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_oblique_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_oblique_text->translate( $along/mm, $up/mm ); $small_oblique_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_oblique_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_oblique_text->translate( $along/mm, $up/mm ); $medium_oblique_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_green_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_green_text->translate( $along/mm, $up/mm ); $medium_green_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_get_text_width {
|
||||||
|
|
||||||
|
# my ($$string) = @_ ;
|
||||||
|
# my $text = $page->text;
|
||||||
|
# my $font = $pdf->corefont('Helvetica'); # built-in font
|
||||||
|
# my $size = 8;
|
||||||
|
# $text->font($font, $size);
|
||||||
|
# my $width = $text->advancewidth($string);
|
||||||
|
|
||||||
|
# } #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_get_text_width {
|
||||||
|
|
||||||
|
# my ($string) = @_ ;
|
||||||
|
# my $width = $text->advancewidth($string);
|
||||||
|
# return ($width) ;
|
||||||
|
|
||||||
|
# } #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
603
libs/modules/_FromProd/production_time.pm
Normal file
603
libs/modules/_FromProd/production_time.pm
Normal file
|
|
@ -0,0 +1,603 @@
|
||||||
|
sub production_time_read_db_to_match_events_and_systems {
|
||||||
|
|
||||||
|
&common_date_array($last_start_ccyymmdd,$last_end_ccyymmdd);
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name,description,system_type','','','') ;
|
||||||
|
foreach my $id (keys %{$db{event_systems}}) {
|
||||||
|
$event_system_description{$id} = $db{event_systems}{$id}{description} ;
|
||||||
|
$event_system_name{$id} = $db{event_systems}{$id}{name} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_sql = substr($start_sql,0,11) . '00:00:00' ;
|
||||||
|
$end_sql = substr($end_sql,0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to',"(date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to,sport_type_ids,club_ids',"((date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')) AND event_system_id_multiple IS NOT NULL AND event_system_id_multiple <> ''",'','') ;
|
||||||
|
|
||||||
|
our %seen_event_system_in_event_quotes = () ;
|
||||||
|
|
||||||
|
foreach my $event_id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{ref} =~ s/\'//g ;
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/;+/;/g; # Replace multiple semicolons with one
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/^;+|;+$//g; # Remove leading or trailing semicolons
|
||||||
|
|
||||||
|
# next unless $db{event_quotes}{$event_id}{event_system_id_multiple} ;
|
||||||
|
|
||||||
|
$opts{matched_event} .= qq~<option value="$event_id">[$event_id] $db{event_quotes}{$event_id}{ref}</option>~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{event_quotes}{$event_id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
# $opts{matched_system} .= $seen_event_system_in_event_quotes{$_}
|
||||||
|
$seen_event_system_in_event_quotes{$_} = 1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (sort {$seen_event_system_in_event_quotes{$a} cmp $seen_event_system_in_event_quotes{$b}} keys %seen_event_system_in_event_quotes) {
|
||||||
|
$opts{matched_system} .= qq~<option value="$_">$db{event_systems}{$_}{name} [$db{event_systems}{$_}{description}]</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$opts{matched_system_none} .= qq~<option value="-1">$db{event_systems}{-1}{name} [$db{event_systems}{-1}{description}]</option>~ ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
|
||||||
|
our %sport_name_to_id = () ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{sport_types}}) {
|
||||||
|
$db{sport_types}{$_}{name} = lc $db{sport_types}{$_}{name} ;
|
||||||
|
$db{sport_types}{$_}{name} =~ s/ //g ;
|
||||||
|
$sport_name_to_id{$db{sport_types}{$_}{name}} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('clubs','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{clubs}}) {
|
||||||
|
my $c_name = lc $db{clubs}{$_}{name} ;
|
||||||
|
$c_name =~ s/\'//g ;
|
||||||
|
$club_name_to_id{$c_name} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
# # $match_bank_trans{$db{event_quotes}{$id}{trans_date}}{$db{event_quotes}{$id}{description}} = 1 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$tables}{$id}{event_system_id_multiple})) {
|
||||||
|
# $val .= qq~$db{event_systems}{$event_id}{name} [$db{event_systems}{$event_id}{description}], ~ ;
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub production_time_process_matched_events_and_systems {
|
||||||
|
|
||||||
|
my %system_match = () ; my %matched_event_name = () ; my %csv_line_possible_match = () ; my %matched_events = () ;
|
||||||
|
|
||||||
|
$system_match{"None"}{"None"} = -1 ;
|
||||||
|
|
||||||
|
foreach my $event_code (keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
my ($club_name,$system_desc_clue) = split("-",$csv_line{$event_code}{club_name}) ;
|
||||||
|
$club_name =~ s/ $//g ; $system_desc_clue =~ s/^ //g ; # remove whitespace
|
||||||
|
$club_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
$system_desc_clue = "None" unless $system_desc_clue ;
|
||||||
|
|
||||||
|
my @eventdetails = split(/ /,$club_name) ;
|
||||||
|
|
||||||
|
my $system_name_clue = $eventdetails[-1] ; $system_name_clue = "None" if $system_name_clue !~ /\d+/ ;
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /\d+/ && length($system_desc_clue) == 5) {
|
||||||
|
$system_name_clue = $system_desc_clue ;
|
||||||
|
$system_desc_clue = 'None' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /AISA/ && $system_desc_clue =~ /SOLO/) {
|
||||||
|
my @sysparts = split(/\_/,$system_desc_clue) ;
|
||||||
|
$system_name_clue = $sysparts[2] ;
|
||||||
|
$system_desc_clue =~ s/\_/ /g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = -1 if $system_name_clue eq 'None' && $system_desc_clue eq 'None' ;
|
||||||
|
|
||||||
|
$system_desc_clue = lc $system_desc_clue ;
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = $system_match{$system_name_clue}{$system_desc_clue} if $system_match{$system_name_clue}{$system_desc_clue} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $system_id (keys %{$db{event_systems}}) {
|
||||||
|
# foreach my $system_id (keys %seen_event_system_in_event_quotes) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my @sport_split = split(":",$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
$sport_split[0] =~ s/ //g ;
|
||||||
|
$sport_split[0] = lc $sport_split[0] ;
|
||||||
|
|
||||||
|
my $sport_id = ($csv_line{$event_code}{event_name} =~ /:/) ? $sport_name_to_id{$sport_split[0]} : '' ;
|
||||||
|
|
||||||
|
my @event_name_details = split(/-/,$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
my $to_match_event_name = $event_name_details[-1] ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/^ //g ;
|
||||||
|
$to_match_event_name =~ s/ $//g ;
|
||||||
|
|
||||||
|
$to_match_event_name = ($csv_line{$event_code}{event_name} =~ /:/ && $csv_line{$event_code}{event_name} !~ /-/) ? $sport_split[1] : $to_match_event_name ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
my $club_id = $club_name_to_id{$club_name} ;
|
||||||
|
|
||||||
|
$club_name = ($csv_line{$event_code}{club_name} =~ /AISA/ && $csv_line{$event_code}{club_name} =~ /SOLO/) ? lc $club_name : lc $csv_line{$event_code}{club_name} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
$matched_events{$event_code} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $found_match = 0 ;
|
||||||
|
|
||||||
|
foreach my $system_id (split(";",$db{event_quotes}{$id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if ($sys_name =~ /\b$system_name_clue\b/ && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_name =~ /\b$system_name_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $sys_desc = $db{event_systems}{$system_id}{description} ;
|
||||||
|
# my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
# # my @sysparts = split(/\_/,$system) ;
|
||||||
|
|
||||||
|
# if ($sys_name =~ /\b$sysno\b/ && $sys_desc =~ /\b$system\b/iog) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /\d+/ && $sys_name =~ /\b$system\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /AISA/ && $system =~ /SOLO/ && $sysparts[2] && $sys_name =~ /\b$sysparts[2]\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($sys_desc eq 'St Stithians Hockey Red' && $clubname =~ /Red/i && $clubname =~ /Stithians/i) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $event_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_match && !$csv_line{$event_code}{event_id}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
next ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!$csv_line{$event_code}{system_id}) && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
# if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
# if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
# $csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
# }
|
||||||
|
# next ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $csv_line_possible_match{$event_code}{event_id} if $csv_line_possible_match{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_box_content_rows .= &common_min_forms_start("$lcpage") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("club_system","system_nr","matched_system","production_hours","production_seconds","cloud_recording_seconds","club_name","start","end","event_name","matched_event","match") ;
|
||||||
|
|
||||||
|
my $row_cnt = 0 ; my %no_system_or_event = () ;
|
||||||
|
|
||||||
|
foreach my $event_code (sort {$csv_line{$a}{line_cnt} cmp $csv_line{$b}{line_cnt}} keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
$row_cnt++ ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~<tr id="$row_cnt">~ ;
|
||||||
|
|
||||||
|
my $cell_id = qq~~ ;
|
||||||
|
|
||||||
|
my ($system,$sysno) = split(" - ",$csv_line{$event_code}{club_name}) ;
|
||||||
|
|
||||||
|
my @get_sport = (!$csv_line{$event_code}{system_id} || (!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /;/)) ? split(/\:/,$csv_line{$event_code}{event_name}) : () ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="text" name='$event_code' value="$event_code_to_line{$event_code}" style="display:none;">~ if !$csv_line{$event_code}{system_id} || !$csv_line{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
foreach my $col (@sql_col_display) {
|
||||||
|
|
||||||
|
my $val = '' ; $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($col eq 'club_name') {
|
||||||
|
$val = $csv_line{$event_code}{club_name} ;
|
||||||
|
} elsif ($col eq 'system_nr') {
|
||||||
|
$val = $sysno ;
|
||||||
|
} elsif ($col eq 'start') {
|
||||||
|
$val = $csv_line{$event_code}{start_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'end') {
|
||||||
|
$val = $csv_line{$event_code}{end_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'club_system') {
|
||||||
|
$val = $system ;
|
||||||
|
} elsif ($col eq 'matched_system') {
|
||||||
|
|
||||||
|
$preferred_placeholder{"system_$row_cnt"} = "Select System" ;
|
||||||
|
|
||||||
|
$found_system_drop_down = 1 if !$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1' ;
|
||||||
|
|
||||||
|
# $allow_deselect{"system_$row_cnt"} = 1 ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : ($csv_line{$event_code}{system_id} eq '-1') ? &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system_none") : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
# $val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1') {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{system} .= qq~"#selectSystem_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$cell_id = qq~id="matched_system_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'production_hours') {
|
||||||
|
$val = $csv_line{$event_code}{production_hours} ;
|
||||||
|
$val =~ s/\,/\./g ;
|
||||||
|
} elsif ($col eq 'production_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{production_seconds}) ;
|
||||||
|
} elsif ($col eq 'cloud_recording_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{cloud_seconds}) ;
|
||||||
|
} elsif ($col eq 'event_name') {
|
||||||
|
$val = $csv_line{$event_code}{event_name} ;
|
||||||
|
} elsif ($col eq 'matched_event') {
|
||||||
|
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} =~ s/\;/\_/g ;
|
||||||
|
|
||||||
|
my $col_name = (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? "matched_event_$csv_line_possible_match{$event_code}{event_id}" : "matched_event" ;
|
||||||
|
|
||||||
|
$opts{$col_name} =
|
||||||
|
($csv_line_possible_match{$event_code}{event_id} && !$csv_line{$event_code}{event_id}) ? join "</option><option ", map { qq~value="$_"><strong>Possible : </strong>$db{event_quotes}{$_}{ref} [$_]~ } split "_" , $csv_line_possible_match{$event_code}{event_id} :
|
||||||
|
$opts{matched_event} ;
|
||||||
|
|
||||||
|
$opts{$col_name} = qq~<option ~ . $opts{$col_name} . qq~</option>~ if $col_name ne 'matched_event' ;
|
||||||
|
|
||||||
|
$preferred_placeholder{"event_$row_cnt"} = "Select Event" ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{event_id}) ? "$db{event_quotes}{$csv_line{$event_code}{event_id}}{ref} [$csv_line{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
# (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? "<strong>POSSIBLE : </strong>$db{event_quotes}{$csv_line_possible_match{$event_code}{event_id}}{ref} [$csv_line_possible_match{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
(!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? &common_min_table_select("event_$row_cnt",'','','','','','',$col_name) :
|
||||||
|
&common_min_table_select("event_$row_cnt",'','','','','','','matched_event') ;
|
||||||
|
|
||||||
|
$found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} ;
|
||||||
|
# $found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} && (!$csv_line_possible_match{$event_code}{event_id} || $csv_line_possible_match{$event_code}{event_id} =~ /_/) ;
|
||||||
|
|
||||||
|
# if ((!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /_/)) {
|
||||||
|
if (!$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{event} .= qq~"#selectEvent_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$cell_id = qq~id="matched_event_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'match') {
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
|
||||||
|
$cell_id = qq~id="final_col_$row_cnt"~ ;
|
||||||
|
|
||||||
|
my $tool = $pixellot_system{$ccyymmdd}{$period} ;
|
||||||
|
|
||||||
|
$start_sql =~ s/ /T/g ;
|
||||||
|
$end_sql =~ s/ /T/g ;
|
||||||
|
|
||||||
|
# my $system_input = ($csv_line{$event_code}{system_id}) ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
my $system_input = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : ($csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? $csv_line_possible_match{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $event_input = ($matched_event_id) ? qq~<input style='display:none;' value='$matched_event_id' id='selectEvent_$row_cnt' name="event_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
my $match_icon = ($system_input && $event_input) ? "ok" : "remove" ;
|
||||||
|
my $match_class = ($system_input && $event_input) ? "success" : "danger" ;
|
||||||
|
|
||||||
|
push @unmatched_rows, "#selectEvent_$row_cnt" if !$event_input ;
|
||||||
|
push @unmatched_rows, "#selectSystem_$row_cnt" if !$system_input ;
|
||||||
|
|
||||||
|
my $not_matched = (!$event_input || !$system_input) ? qq~<input style='display:none;' value='1' id='not_matched_$row_cnt'>~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $no_similar_rows = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1' && $csv_line{$event_code}{event_id}) ? '-1' : '' ;
|
||||||
|
|
||||||
|
my $similar_rows = (!$event_input || !$system_input) ? qq~<input value='' name='similar_rows_$row_cnt' style='display:none;'>~ : qq~~ ;
|
||||||
|
|
||||||
|
$val = "
|
||||||
|
$system_input
|
||||||
|
$event_input
|
||||||
|
$not_matched
|
||||||
|
$similar_rows
|
||||||
|
<input style='display:none;' value='$event_code' id='event_code_$row_cnt' name='event_code_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{production_seconds}' id='time_$row_cnt' name='time_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{cloud_seconds}' id='cloud_time_$row_cnt' name='cloud_time_$row_cnt'>
|
||||||
|
<a class='btn btn-$match_class btn-sm' id='matched_row_$row_cnt' href=javascript:match_event_system('$row_cnt','$event_code','$csv_line{$event_code}{production_seconds}','$csv_line{$event_code}{cloud_seconds}'); data-title='MATCH' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-$match_icon'></i></a>
|
||||||
|
|
||||||
|
<a class='btn btn-success btn-sm' href=javascript:dlgMdl('$useropts{'scripts'}/dialog/manually_match_csv_row.pl?$matched_event_id&$csv_line{$event_code}{system_id}&$csv_line{$event_code}{production_seconds}&$csv_line{$event_code}{cloud_seconds}&$event_code&$start_sql&$end_sql&$row_cnt&add','Manually Match','','medium-dialog'); data-title='MATCH MANUALLY' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title>
|
||||||
|
<i class='glyphicon glyphicon-question-sign'></i>
|
||||||
|
</a>
|
||||||
|
" ;
|
||||||
|
|
||||||
|
$start_sql =~ s/T/ /g ;
|
||||||
|
$end_sql =~ s/T/ /g ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $cell_id $nowrap>$val</td>~ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
// let inputString = '1,21,32,4'; // Your input string
|
||||||
|
// let outputString = inputString.split(',').map(num => 'abc_' + num).join(',');
|
||||||
|
|
||||||
|
function auto_select_similar_drop_downs (ids,changed_val) {
|
||||||
|
for (let id of ids) {
|
||||||
|
if (\$(id).val()) {
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
\$(id).val(changed_val) ;
|
||||||
|
\$(id).trigger("chosen:updated") ;
|
||||||
|
fix_match_icon(id) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my %seen_rows_set = () ;
|
||||||
|
|
||||||
|
foreach my $club_name (keys %no_system_or_event) {
|
||||||
|
foreach my $start_time (keys %{$no_system_or_event{$club_name}}) {
|
||||||
|
foreach my $sport_name (keys %{$no_system_or_event{$club_name}{$start_time}}) {
|
||||||
|
foreach my $sys_evt (keys %{$no_system_or_event{$club_name}{$start_time}{$sport_name}}) {
|
||||||
|
|
||||||
|
chop $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} if $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
my $ids_change = $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
$ids_change =~ s/\"//g ;
|
||||||
|
|
||||||
|
my $ids_change2 = $ids_change ;
|
||||||
|
|
||||||
|
$ids_change2 =~ s/#selectEvent_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
$ids_change2 =~ s/#selectSystem_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
|
||||||
|
my $ids_change_row_nrs = $ids_change ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectEvent_//g ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectSystem_//g ;
|
||||||
|
|
||||||
|
my @first_nr = split(/\,/,$ids_change_row_nrs) ;
|
||||||
|
|
||||||
|
my $event_or_system = ($no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} =~ /Event/) ? 'event' : 'system' ;
|
||||||
|
|
||||||
|
next if $seen_rows_set{$ids_change_row_nrs}{$event_or_system} ;
|
||||||
|
$seen_rows_set{$ids_change_row_nrs}{$event_or_system} = 1 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
if (\$("#not_matched_$first_nr[0]").val() && !\$("input[name='similar_rows_$first_nr[0]']").val()) {
|
||||||
|
\$("$ids_change2").val("$ids_change_row_nrs") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("$ids_change").change( function () {
|
||||||
|
|
||||||
|
fix_match_icon(this.id) ;
|
||||||
|
if (!\$(this).val()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
auto_select_similar_drop_downs([$no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt}],\$(this).val()) ;
|
||||||
|
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $unmatched_rows_str = join(",",@unmatched_rows) ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function get_row_nr (id) {
|
||||||
|
|
||||||
|
let lastIndex = id.lastIndexOf('_');
|
||||||
|
lastIndex = parseInt(lastIndex) ;
|
||||||
|
let row_nr_1 = id.substring(1+lastIndex);
|
||||||
|
return row_nr_1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_match_icon (id) {
|
||||||
|
|
||||||
|
let row_nr = get_row_nr(id) ;
|
||||||
|
|
||||||
|
if (\$("#selectEvent_"+row_nr).val() && \$("#selectSystem_"+row_nr).val() && \$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-danger btn-sm').addClass('btn btn-success btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-ok'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("") ;
|
||||||
|
} else if ((!\$("#selectEvent_"+row_nr).val() || !\$("#selectSystem_"+row_nr).val()) && !\$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-success btn-sm').addClass('btn btn-danger btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-remove'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("1") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("$unmatched_rows_str").change( function () {
|
||||||
|
// fix_match_icon(this.id) ;
|
||||||
|
// }) ;
|
||||||
|
|
||||||
|
~ if $unmatched_rows_str ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(2)").css("width","20%");~ if $found_event_drop_down ; ## MATCHED EVENT COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(10)").css("width","20%");~ if $found_system_drop_down ; ## MATCHED SYSTEM COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function match_event_system (row_nr,event_code,production_seconds,cloud_seconds) {
|
||||||
|
|
||||||
|
let event_id = \$("#selectEvent_"+row_nr).val() ;
|
||||||
|
let system_id = \$("#selectSystem_"+row_nr).val() ;
|
||||||
|
|
||||||
|
if (!event_id || !system_id) {
|
||||||
|
noty({text:'Please select a System and Event!!!',layout:"center",type:"error",timeout:3000}) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("#"+row_nr).css("display","none") ;
|
||||||
|
|
||||||
|
var url = "$useropts{scripts}/get/add_event_system_hours.pl?"+event_id+"&"+system_id+"&"+production_seconds+"&"+cloud_seconds+"&"+event_code ;
|
||||||
|
|
||||||
|
\$.get(url) ;
|
||||||
|
\$("#final_col_"+row_nr).html('') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("#itv-table tr:eq(0) th:nth-last-child(1)").html("<span>Match All</span> <a class='btn btn-success btn-sm' href=javascript:match_all(1); data-title='MATCH ALL (inc. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a> <a class='btn btn-warning btn-sm' href=javascript:match_all(0); data-title='MATCH ALL (excl. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a>") ;
|
||||||
|
|
||||||
|
\$("#itv-table thead tr:eq(0) th:nth-last-child(1)").css('white-space','nowrap') ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
501
libs/modules/_FromProd/report.pm
Normal file
501
libs/modules/_FromProd/report.pm
Normal file
|
|
@ -0,0 +1,501 @@
|
||||||
|
sub report_create_xls {
|
||||||
|
|
||||||
|
our $xlspath = "$htmlpath/xls/customreport" ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlspath) ;
|
||||||
|
|
||||||
|
&report_xls_details_header ;
|
||||||
|
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
&xlsxcreator_write_xls($ws,$xlsrow,0,$id,$format18);
|
||||||
|
|
||||||
|
my $col=1;
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
&xlsxcreator_write_xls($ws,$xlsrow,$col,$xls_hash{$id}{$field},$format1);
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
$xlsrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $col=1;
|
||||||
|
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
$fieldrow = $xlsrow ;
|
||||||
|
foreach my $curr (keys %curr_hash) {
|
||||||
|
if ($ttl{$field}{$curr}) {
|
||||||
|
my $ttl = &common_commify( sprintf("%0.2f",$ttl{$field}{$curr} )) ;
|
||||||
|
&xlsxcreator_write_xls($ws,$fieldrow,$col,"$curr $ttl",$format57) ;
|
||||||
|
$fieldrow++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column('A:Z',20);
|
||||||
|
$worksheet{$ws}->activate();
|
||||||
|
$worksheet{$ws}->select();
|
||||||
|
|
||||||
|
&xlsxcreator_close_xls;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_details_header {
|
||||||
|
|
||||||
|
our $xlsname = 'CUSTOM-REPORT-' . $now_ccyymmdd . '.xls' ;
|
||||||
|
my $xlsfile = $xlspath . '/' . $xlsname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xls($xlsfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xls_format;
|
||||||
|
|
||||||
|
$ws = 'custom_report';
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xls($ws,0,0,"Film Freight : $success",$format2);
|
||||||
|
|
||||||
|
&xlsxcreator_write_xls($ws,2,0,'ID',$format18);
|
||||||
|
# $xlsrow = 2 ;
|
||||||
|
my $col=1;
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
my $uc_field = uc $field ;
|
||||||
|
&xlsxcreator_write_xls($ws,2,$col,$uc_field,$format18);
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
&xlsxcreator_freeze_panes($ws,3,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
$xlsrow=3;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_start {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
$layout = 'landscape' ;
|
||||||
|
|
||||||
|
our $pdfpath = "$pdfpath/export" ;
|
||||||
|
|
||||||
|
my $pdfnamestart = uc $report ; $pdfnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
our $pdfname = $pdfnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.pdf' ;
|
||||||
|
my $pdffile = $pdfpath . '/' . $pdfname ;
|
||||||
|
|
||||||
|
my $pdftitle = $report ; $pdftitle =~ s/_/ /gi ;
|
||||||
|
|
||||||
|
&pdf_delete_previous_pdf($pdfpath) ;
|
||||||
|
&pdf_initialise($pdfpath,$pdfname,"Film Freight $pdftitle") ; ;
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
|
||||||
|
$up = 180 ;
|
||||||
|
$across = 1 ;
|
||||||
|
&pdf_page_header_landscape ;
|
||||||
|
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_x_large_bold_text (10, $up, $pdftitle) ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
|
||||||
|
my $date = pdf_date_to_text($now_ccyy_mm_dd);
|
||||||
|
&pdf_medium_text (220, $up, "Date : $date") ;
|
||||||
|
|
||||||
|
&pdf_nl;
|
||||||
|
$top=$up;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
&pdf_nl_s;
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $txtstart = length($_) * 2 + 2 ;
|
||||||
|
&pdf_small_bold_text ($txtstart,$up,$_) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_nl_tt;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_line {
|
||||||
|
|
||||||
|
my ($id) = @_ ;
|
||||||
|
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
&report_grid_pdf_check_value_of_up(20) ;
|
||||||
|
&pdf_nl;
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $txtstart = length($_) * 2 + 2 ;
|
||||||
|
&pdf_small_bold_text ($txtstart,$up,$db{$table}{$id}{$_}) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_nl_tt;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_end {
|
||||||
|
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $colstart = length($_) * 2 ;
|
||||||
|
&pdf_black_line ($colstart,$top,$colstart,$up) ; # vertical
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_footer_landscape ;
|
||||||
|
&finish_pdf ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_header_events {
|
||||||
|
|
||||||
|
my ($report,$xlsxfolder) = @_ ;
|
||||||
|
|
||||||
|
our $xlsxpath = "$htmlpath/xlsx/$xlsxfolder" ;
|
||||||
|
|
||||||
|
my $xlsxnamestart = uc $report ;
|
||||||
|
|
||||||
|
# $xlsxnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlsxpath) ;
|
||||||
|
|
||||||
|
our $xlsxname = $xlsxnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
|
||||||
|
my $xlsxfile = $xlsxpath . '/' . $xlsxname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsxfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
$now_yy += 2000 ;
|
||||||
|
my $xlsxtitle = "Interactive Television Africa Events Division $now_yy" ;
|
||||||
|
|
||||||
|
$xlsxtitle =~ s/_/ /gi ;
|
||||||
|
|
||||||
|
my @letters = ("", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R","S", "T", "U", "V", "W", "X", "Y", "Z") ;
|
||||||
|
my $cnt = 0;
|
||||||
|
for (@col_display_excel) {$cnt++;}
|
||||||
|
my $range = "A1:$letters[$cnt]" ;
|
||||||
|
$range .= "1" ;
|
||||||
|
|
||||||
|
$worksheet{$ws} -> merge_range($range, "$xlsxtitle", $format_event_heading) ;
|
||||||
|
|
||||||
|
my @month_fullname = ("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") ;
|
||||||
|
my $current_month = $month_fullname[int($now_mm)] ;
|
||||||
|
|
||||||
|
$range = "A2:$letters[$cnt]" ;
|
||||||
|
$range .= "2" ;
|
||||||
|
|
||||||
|
$worksheet{$ws} -> merge_range($range, "$current_month $now_yy", $format_event_heading_2) ;
|
||||||
|
$range = "A4:$letters[$cnt]" ;
|
||||||
|
$range .= "4" ;
|
||||||
|
$worksheet{$ws} -> merge_range($range, "", $format_empty_row) ;
|
||||||
|
|
||||||
|
# &xlsxcreator_write_xlsx($ws,0,0,$xlsxtitle,$format2);
|
||||||
|
|
||||||
|
our $xlsxcol=0;
|
||||||
|
|
||||||
|
foreach (@col_display_excel) {
|
||||||
|
my $coltitle = $_ ;
|
||||||
|
$coltitle =~ s/\_id//g ;
|
||||||
|
$coltitle =~ s/\_/ /g ;
|
||||||
|
my $ucfirst = join '', map { ucfirst lc } split /(\s+)/, $coltitle;
|
||||||
|
&xlsxcreator_write_xlsx($ws,2,$xlsxcol,$ucfirst,$format_event_heading_2);
|
||||||
|
$xlsxcol++;
|
||||||
|
}
|
||||||
|
|
||||||
|
&xlsxcreator_freeze_panes($ws,3,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
our $xlsxrow=4;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_header {
|
||||||
|
|
||||||
|
my ($report,$xlsfolder) = @_ ;
|
||||||
|
|
||||||
|
unless ($xlsfolder) { $xlsfolder = 'export' ; }
|
||||||
|
|
||||||
|
# my $xlsfolder = lc $report ; $xlsfolder =~ s/_//gi ;
|
||||||
|
|
||||||
|
our $xlspath = "$htmlpath/xls/$xlsfolder" ;
|
||||||
|
|
||||||
|
my $xlsnamestart = uc $report ; $xlsnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlspath) ;
|
||||||
|
|
||||||
|
our $xlsname = $xlsnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
my $xlsfile = $xlspath . '/' . $xlsname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&report_build_headings($report, $ws) ;
|
||||||
|
|
||||||
|
our $xlscol = 0 ;
|
||||||
|
our $xlsrow = 4 ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_header {
|
||||||
|
|
||||||
|
my ($report,$xlsxfolder,$csv_folder,$title_heading) = @_ ;
|
||||||
|
|
||||||
|
unless ($xlsxfolder) { $xlsxfolder = 'export' ; }
|
||||||
|
|
||||||
|
# my $xlsfolder = lc $report ; $xlsfolder =~ s/_//gi ;
|
||||||
|
|
||||||
|
our $xlsxpath = "$htmlpath/xlsx/$xlsxfolder" ;
|
||||||
|
|
||||||
|
my $xlsxnamestart = uc $report ; $xlsxnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlsxpath) ;
|
||||||
|
|
||||||
|
our $xlsxname = $xlsxnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
my $xlsxfile = $xlsxpath . '/' . $xlsxname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsxfile) ;
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report ;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&report_build_headings($report,$ws,$title_heading) ;
|
||||||
|
|
||||||
|
our $xlsxcol = 0 ;
|
||||||
|
our $xlsxrow = 4 ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_build_headings {
|
||||||
|
|
||||||
|
my ($report,$worksheet,$title_heading,$xlsx_start_row,$xlsx_start_col) = @_ ;
|
||||||
|
my $xlsxtitle = ($xlsxheading) ? $xlsxheading : $report ;
|
||||||
|
$xlsxtitle = $title_heading if $title_heading ;
|
||||||
|
$xlsxtitle =~ s/_/ /gi ;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,0,0,$xlsxtitle,$format_management_report_title) if $xlsxtitle ;
|
||||||
|
my $col = ($xlsx_start_col) ? $xlsx_start_col : 0 ;
|
||||||
|
|
||||||
|
return unless scalar @sql_col_display ;
|
||||||
|
|
||||||
|
if ($calibration_report_cron) {
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
&xlsxcreator_write_xlsx($ws,1,$col,"$day_of_week",$format93) unless $col ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,1,$col,"",$format93) if $col ;
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
$col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $titles_row = ($xlsxtitle) ? 2 : ($xlsx_start_row) ? $xlsx_start_row : 0 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
my $coltitle = $_ ;
|
||||||
|
$coltitle =~ s/\_id//g ;
|
||||||
|
$coltitle =~ s/\_/ /g ;
|
||||||
|
my $ucfirst = join '', map { ucfirst lc } split /(\s+)/, $coltitle;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,$titles_row,$col,$ucfirst,$format_management_report_headings) unless $calibration_report;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,$titles_row,$col,$ucfirst,$format93) if $calibration_report;
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$titles_row++ ;
|
||||||
|
&xlsxcreator_freeze_panes($worksheet,$titles_row,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub report_xlsx_export_process_cell {
|
||||||
|
|
||||||
|
my ($changed,$money,$val) = @_ ;
|
||||||
|
|
||||||
|
if ($changed) {
|
||||||
|
&report_xlsx_export_output_cell($format23,$val) ;
|
||||||
|
}
|
||||||
|
elsif ($money) {
|
||||||
|
&report_xlsx_export_output_cell($format3,$val) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&report_xlsx_export_output_cell($format1,$val) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------\
|
||||||
|
|
||||||
|
|
||||||
|
sub report_write_events {
|
||||||
|
|
||||||
|
my ($val, $last) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format_event_data) if $last == 0;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format_event_data_2) if $last == 1;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_output_cell {
|
||||||
|
|
||||||
|
my ($format,$val) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_process_cell {
|
||||||
|
|
||||||
|
my ($changed,$money,$val) = @_ ;
|
||||||
|
|
||||||
|
if ($changed) {
|
||||||
|
&report_xls_export_output_cell($format23,$val) ;
|
||||||
|
}
|
||||||
|
elsif ($money) {
|
||||||
|
&report_xls_export_output_cell($format3,$val) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&report_xls_export_output_cell($format1,$val) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_output_cell {
|
||||||
|
|
||||||
|
my ($format,$val) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsrow,$xlscol,$val,$format);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_footer {
|
||||||
|
|
||||||
|
my ($resize_cell_to,$col_width,$report) = @_ ;
|
||||||
|
|
||||||
|
my $col = 0;
|
||||||
|
my $output_row = $xlsxrow+1 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
if ($money_format{$_}) {
|
||||||
|
my $cellfrom = &xl_rowcol_to_cell(4,$col) ;
|
||||||
|
my $cellto = &xl_rowcol_to_cell($xlsxrow,$col) ;
|
||||||
|
&xlsxcreator_write_formula($ws,$output_row,$col,"=SUM($cellfrom:$cellto)",$format67);
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# $worksheet{$ws}->set_column("A:$resize_cell_to",$col_width) ;
|
||||||
|
$worksheet{$ws}->activate() ;
|
||||||
|
$worksheet{$ws}->select() ;
|
||||||
|
|
||||||
|
&xlsxcreator_close_xlsx ;
|
||||||
|
|
||||||
|
if (-f "$xlsxpath/$xlsxname") {
|
||||||
|
$box_icon .= qq(<div class="box-icon" title='Export to Excel' data-toggle="tooltip" data-placement="left"><a class="btn btn-default btn-round" href="/xlsx/$report/$xlsxname" style="padding-top:1px;"><i class="glyphicon glyphicon-download-alt icon-white"></i></a></div>) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_footer {
|
||||||
|
|
||||||
|
my ($resize_cell_to,$col_width,$report) = @_ ;
|
||||||
|
|
||||||
|
unless ($report) { $report = 'export' ; }
|
||||||
|
|
||||||
|
my $col = 0; my $output_row = $xlsrow+1 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
if ($money_format{$_}) {
|
||||||
|
my $cellfrom = &xl_rowcol_to_cell(4,$col) ;
|
||||||
|
my $cellto = &xl_rowcol_to_cell($xlsrow,$col) ;
|
||||||
|
&xlsxcreator_write_formula($ws,$output_row,$col,"=SUM($cellfrom:$cellto)",$format67);
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column("A:$resize_cell_to",$col_width);
|
||||||
|
$worksheet{$ws}->activate();
|
||||||
|
$worksheet{$ws}->select();
|
||||||
|
|
||||||
|
&xlsxcreator_close_xlsx;
|
||||||
|
|
||||||
|
if (-f "$xlspath/$xlsname") {
|
||||||
|
$box_icon .= qq(<div class="box-icon" title='Export to Excel' data-toggle="tooltip" data-placement="left"><a class="btn btn-default btn-round" href="/xls/$report/$xlsname" style="padding-top:1px;"><i class="glyphicon glyphicon-download-alt icon-white"></i></a></div>) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_add_chart {
|
||||||
|
|
||||||
|
&xlsxcreator_add_pie_chart($ws);
|
||||||
|
|
||||||
|
# Configure the series.
|
||||||
|
$chart{$ws}->add_series(
|
||||||
|
name => 'Pie Chart',
|
||||||
|
# categories => '=risk_report!$A$4:$A$18',
|
||||||
|
# values => '=risk_report!$B$4:$B$18',
|
||||||
|
categories => "=$ws!A4:A$catspan",
|
||||||
|
values => "=$ws!B4:B$catspan",
|
||||||
|
);
|
||||||
|
|
||||||
|
# Add a title.
|
||||||
|
$chart{$ws}->set_title( name => 'Report Pie Chart' );
|
||||||
|
|
||||||
|
$xlsrow+=5 ;
|
||||||
|
|
||||||
|
# Insert the chart into the worksheet (with an offset).
|
||||||
|
# $worksheet{$ws}->insert_chart('B23',$chart{$ws},25,10);
|
||||||
|
$worksheet{$ws}->insert_chart("B$xlsrow",$chart{$ws},40,16);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_grid_pdf_check_value_of_up {
|
||||||
|
|
||||||
|
my ($value) = @_ ;
|
||||||
|
|
||||||
|
if ($up < $value) {
|
||||||
|
&report_grid_pdf_print_vertical_lines_table ;
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
$up = 195 ;
|
||||||
|
$across = 1 ;
|
||||||
|
$top = $up;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
}
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_grid_pdf_print_vertical_lines_table {
|
||||||
|
|
||||||
|
# &pdf_black_line (10,$top,10,$up) ; # vertical
|
||||||
|
|
||||||
|
&pdf_black_line ($colstart[0],$top,$colstart[0],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[1],$top,$colstart[1],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[2],$top,$colstart[2],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[3],$top,$colstart[3],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[4],$top,$colstart[4],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[5],$top,$colstart[5],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[6],$top,$colstart[6],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[7],$top,$colstart[7],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[8],$top,$colstart[8],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[9],$top,$colstart[9],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[10],$top,$colstart[10],$up) ; # vertical
|
||||||
|
|
||||||
|
# &pdf_black_line(287,$top,287,$up) ; # vertical
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
1883
libs/modules/_FromProd/schedule.pm
Normal file
1883
libs/modules/_FromProd/schedule.pm
Normal file
File diff suppressed because it is too large
Load Diff
1892
libs/modules/_FromProd/schedule_test.pm
Normal file
1892
libs/modules/_FromProd/schedule_test.pm
Normal file
File diff suppressed because it is too large
Load Diff
51
libs/modules/_FromProd/session.pm
Normal file
51
libs/modules/_FromProd/session.pm
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
sub check_session {
|
||||||
|
|
||||||
|
use DBI;
|
||||||
|
use CGI::Session;
|
||||||
|
use CGI::Cookie;
|
||||||
|
|
||||||
|
my %cookies = fetch CGI::Cookie ;
|
||||||
|
my $cgisessid = defined $cookies{'CGISESSID'} ? $cookies{'CGISESSID'}->value : undef; # This does
|
||||||
|
|
||||||
|
use db ;
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
$userid = 0 ;
|
||||||
|
$session = load CGI::Session("driver:MySQL", $cgisessid, {Handle=>$dbh});
|
||||||
|
$userid = $session->param(-name=>'id');
|
||||||
|
$is_logged_in = $session->param(-name=>'_IS_LOGGED_IN');
|
||||||
|
$username = lc $session->param(-name=>'uname');
|
||||||
|
$useremail = lc $session->param(-name=>'uemail');
|
||||||
|
$usertype = lc $session->param(-name=>'utype');
|
||||||
|
$orgids = $session->param(-name=>'oids');
|
||||||
|
$regids = $session->param(-name=>'rids');
|
||||||
|
$custids = $session->param(-name=>'cids');
|
||||||
|
|
||||||
|
my @orgids = split(/\,/,$orgids);
|
||||||
|
foreach (@orgids) { $glob_orgids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
my @regids = split(/\,/,$regids);
|
||||||
|
foreach (@regids) { next unless $_ > 0 ; $glob_regids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
my @custids = split(/\,/,$custids);
|
||||||
|
foreach (@custids) { next unless $_ > 0 ; $glob_custids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
$sessionid = $session->id();
|
||||||
|
|
||||||
|
if ($sessionid && $is_logged_in > 0 && $userid > 0) { # if $userid and $is_logged_in is -1 not allowed in
|
||||||
|
$session_state = 'active' ;
|
||||||
|
} elsif ($session->is_expired) {
|
||||||
|
$session_state = 'expired' ;
|
||||||
|
$session->delete() ;
|
||||||
|
} elsif ($session->is_empty) {
|
||||||
|
$session_state = 'empty' ;
|
||||||
|
} else {
|
||||||
|
$session_state = 'empty' ;
|
||||||
|
$session->delete() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
1971
libs/modules/_FromProd/tabs.pm
Normal file
1971
libs/modules/_FromProd/tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
42
libs/modules/_FromProd/today.pm
Normal file
42
libs/modules/_FromProd/today.pm
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
sub today {
|
||||||
|
|
||||||
|
our ($now_sec,$now_min,$now_hour,$now_dd,$now_mm,$now_year,$now_wday,$now_yday,$isdst)=localtime();
|
||||||
|
|
||||||
|
$now_sec = sprintf("%02d", $now_sec) ;
|
||||||
|
$now_min = sprintf("%02d", $now_min) ;
|
||||||
|
$now_hour = sprintf("%02d", $now_hour) ;
|
||||||
|
|
||||||
|
$now_year += 1900;
|
||||||
|
|
||||||
|
$now_dd = sprintf("%02s", $now_dd) ;
|
||||||
|
$now_mm = sprintf("%02s", $now_mm + 1) ;
|
||||||
|
$now_yy = sprintf("%02s", $now_year - 2000) ;
|
||||||
|
|
||||||
|
use Date::Calc qw(:all);
|
||||||
|
|
||||||
|
our ($sayear,$samonth,$saday,$sahour,$samin,$sasec) = Add_Delta_DHMS($now_year,$now_mm,$now_dd,$now_hour,$now_min,$now_sec,0,2,0,0); # add 2 hours for server time
|
||||||
|
|
||||||
|
$samonth = sprintf("%02s", $samonth) ;
|
||||||
|
$saday = sprintf("%02s", $saday) ;
|
||||||
|
$sahour = sprintf("%02s", $sahour) ;
|
||||||
|
$samin = sprintf("%02s", $samin) ;
|
||||||
|
$sasec = sprintf("%02s", $sasec) ;
|
||||||
|
|
||||||
|
$now_year = $sayear ;
|
||||||
|
$now_mm = $samonth ;
|
||||||
|
$now_dd = $saday ;
|
||||||
|
$now_sec = $sasec ;
|
||||||
|
$now_min = $samin ;
|
||||||
|
$now_hour = $sahour ;
|
||||||
|
|
||||||
|
$now_hh_min_sec = $sahour . ':' . $samin . ':' . $sasec ;
|
||||||
|
|
||||||
|
$now_ccyymmdd = $now_year . $now_mm . $now_dd ;
|
||||||
|
$now_ccyymmddhrmnsc = $now_year . $now_mm . $now_dd . $now_hour . $now_min . $now_sec ;
|
||||||
|
$now_dd_mm_ccyy = $now_dd . '-' . $now_mm . '-' . $now_year ;
|
||||||
|
$now_ccyy_mm_dd = $now_year . '-' . $now_mm . '-' . $now_dd ;
|
||||||
|
$nowsddsmmsccyy = $now_dd . '/' . $now_mm . '/' . $now_year ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
30
libs/modules/_FromProd/uploader.pm
Normal file
30
libs/modules/_FromProd/uploader.pm
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
sub uploader_filmfreight {
|
||||||
|
|
||||||
|
my ($file_to_upload,$ftp_dir,$ftp_file_name,$delete_file_to_upload) = @_ ;
|
||||||
|
|
||||||
|
use Net::FTP;
|
||||||
|
|
||||||
|
my $host = "154.0.175.152"; # filmfreight.co.za
|
||||||
|
my $user = "filmfree";
|
||||||
|
my $password = "h0lNH8fMzrrWUC";
|
||||||
|
|
||||||
|
my $ftp = Net::FTP->new($host) or die "Can't open $host : $!\n" ;
|
||||||
|
$ftp->login($user, $password) or die "Can't log $user in : $!\n" ;
|
||||||
|
|
||||||
|
$ftp->cwd($ftp_dir) or die "Can't cwd to $ftp_dir\n";
|
||||||
|
|
||||||
|
$ftp->binary() or die "Can't change to binary mode"; # Unix and Windows switch $ftp->ascii();
|
||||||
|
|
||||||
|
$ftp->put($file_to_upload, "$ftp_dir/$ftp_file_name") or die "Can't put $file_to_upload into $ftp_dir\n" ;
|
||||||
|
|
||||||
|
$ftp->quit;
|
||||||
|
|
||||||
|
# if ($delete_file_to_upload eq 'y') {
|
||||||
|
# unlink ("$file_to_upload") ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
426
libs/modules/_FromProd/users.pm
Normal file
426
libs/modules/_FromProd/users.pm
Normal file
|
|
@ -0,0 +1,426 @@
|
||||||
|
|
||||||
|
sub users_list_screen {
|
||||||
|
|
||||||
|
&db_open_ro;
|
||||||
|
$db_ignore_open_close=1;
|
||||||
|
&users_list_vars ;
|
||||||
|
$db_ignore_open_close=0 ;
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
$delete_button = ($seen_operator{$id}) ? qq~<a class="btn btn-default btn-xs" href="#" title data-toggle="tooltip" data-original-title="In system use!"><i class="glyphicon glyphicon-trash icon-white"></i></a>~ : qq~<a class="btn btn-danger btn-xs" href="javascript:deleteMinItem('$db{$table}{$id}{username}','$db{$table}{$id}{id}')"><i class="glyphicon glyphicon-trash icon-white"></i></a>~ ;
|
||||||
|
|
||||||
|
my $disp_blocked = qq~<span class="label label-success" title="Active!" data-toggle="tooltip"><i class="glyphicon glyphicon-ok"></i></span>~;
|
||||||
|
if ($db{$table}{$id}{block} || $db{$table}{$id}{inactive} ) { $disp_blocked = qq~<span class="label label-danger" title="Blocked!" data-toggle="tooltip"><i class="glyphicon glyphicon-remove"></i></span>~; }
|
||||||
|
|
||||||
|
# if (!$useropts{it}{$username} && (substr($db{$table}{$id}{username},0,4) eq 'rory' || substr($db{$table}{$id}{username},0,6) eq 'handre')) { next ; }
|
||||||
|
|
||||||
|
my $it_username_subs_4 = substr($db{$table}{$id}{username},0,4) ; # rory / jean
|
||||||
|
my $it_username_subs_6 = substr($db{$table}{$id}{username},0,6) ; # handre
|
||||||
|
|
||||||
|
if (($useropts{it}{$it_username_subs_4} || $useropts{it}{$it_username_subs_6}) && !$useropts{it}{$username} && $useremail =~ /re8it/g) { next ; }
|
||||||
|
|
||||||
|
next if $glod_user_level < 4 && $level{$db{$table}{$id}{user_type}} > 1 && $user_type eq 'casual' ;
|
||||||
|
|
||||||
|
$opts{$lcpage} .= qq~<option value="$db{$table}{$id}{username}">$db{$table}{$id}{name}</option>~ ;
|
||||||
|
$print_tbody .= qq~<tr id="$id">
|
||||||
|
<td>$id</td>
|
||||||
|
<td>$db{$table}{$id}{username}</td>
|
||||||
|
<td>$db{$table}{$id}{name}</td>
|
||||||
|
<td>$db{$table}{$id}{email}</td>
|
||||||
|
<td>$disp_blocked</td>
|
||||||
|
<td>$db{$table}{$id}{based_in}</td>~ ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~
|
||||||
|
<td>$level{$db{$table}{$id}{user_type}}</td>~ if $user_type eq 'casual' ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~
|
||||||
|
<td>$db{$table}{$id}{lastupdate}</td>
|
||||||
|
<td>$db{$table}{$id}{lastvisitdate}</td>
|
||||||
|
<td nowrap>
|
||||||
|
<a class="btn btn-info btn-xs" href="javascript:editMinItem('$db{$table}{$id}{id}');"><i class="glyphicon glyphicon-edit icon-white"></i></a>
|
||||||
|
$delete_button
|
||||||
|
</td>
|
||||||
|
</tr>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_list_vars {
|
||||||
|
|
||||||
|
our %seen = () ; our %seen_operator = () ; our $delete_button = '' ;
|
||||||
|
|
||||||
|
&db_min_ro('events','id, user_id','','','') ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{'events'}}) {
|
||||||
|
next if $seen{$db{'events'}{$id}{user_id}} ;
|
||||||
|
$seen{$db{'events'}{$id}{user_id}} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','id,user_id,operator_ids,daily_operator_ids','','','') ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
# next if $seen{$db{event_quotes}{$id}{user_id}} ;
|
||||||
|
$seen{$db{event_quotes}{$id}{user_id}} = 1 ;
|
||||||
|
my $op_ids = $db{event_quotes}{$id}{operator_ids} ;
|
||||||
|
next unless $op_ids ;
|
||||||
|
my @op_ids = ($op_ids =~ /;/) ? split(/;/,$op_ids) : split(/,/,$op_ids) ;
|
||||||
|
for my $op_id (@op_ids) {
|
||||||
|
next if $seen_operator{$op_id} || !$op_id ;
|
||||||
|
$seen_operator{$op_id} = 1 ;
|
||||||
|
}
|
||||||
|
foreach my $op_ids_list (split(/\|/,$db{event_quotes}{$id}{daily_operator_ids})) {
|
||||||
|
next unless $op_ids_list ;
|
||||||
|
foreach my $op_id (split(/\;/,$op_ids_list)) {
|
||||||
|
next if $seen_operator{$op_id} || !$op_id ;
|
||||||
|
$seen_operator{$op_id} = 1 if $op_id ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('quotes','id,user_id','','','') ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{quotes}}) {
|
||||||
|
next if $seen{$db{quotes}{$id}{user_id}} ;
|
||||||
|
$seen{$db{quotes}{$id}{user_id}} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$level{casual_a} = 1 ;
|
||||||
|
$level{casual_b} = 2 ;
|
||||||
|
$level{casual_c} = 3 ;
|
||||||
|
|
||||||
|
if ($user_type eq 'coding_provider') {
|
||||||
|
&db_min_ro('analytics_event_bookings','id,fixtures_saved_values','','','') ;
|
||||||
|
foreach my $id (keys %{$db{analytics_event_bookings}}) {
|
||||||
|
my @split1 = split(/\|/,$db{analytics_event_bookings}{$id}{fixtures_saved_values}) ;
|
||||||
|
foreach my $row (@split1) {
|
||||||
|
my @split2 = split(/\;/,$row) ;
|
||||||
|
$seen{$split2[-2]} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_type eq 'analytics_client') {
|
||||||
|
&db_min_ro('analytics_event_bookings','id,client_id','','','') ;
|
||||||
|
foreach (keys %{$db{analytics_event_bookings}}) {
|
||||||
|
$seen{$db{analytics_event_bookings}{$_}{client_id}} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $cust_sql_where = "user_type = '$user_type'" if $user_type ;
|
||||||
|
my $cust_sql_where = ($user_type) ? "user_type LIKE '$user_type%'" : "user_type NOT LIKE 'casual%' AND user_type <> 'schools_manager' AND user_type <> 'installation_partner'" ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'*',$cust_sql_where,'username','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_sort_fields {
|
||||||
|
|
||||||
|
my $fcnt = 1 ;
|
||||||
|
|
||||||
|
$sort_field{$fcnt} = 'name' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'email' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'phone' ; $fcnt++ ;
|
||||||
|
|
||||||
|
if ($user_type eq 'casual') {
|
||||||
|
$sort_field{$fcnt} = 'bank' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'bank_acc_no' ; $fcnt++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sort_field{$fcnt} = 'based_in' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'user_type' ; $fcnt++ ;
|
||||||
|
# $sort_field{$fcnt} = 'organisation_ids' ; $fcnt++ ;
|
||||||
|
|
||||||
|
if ($user_type eq 'schools_manager' || $user_type eq 'installation_partner' || $user_type eq 'casual') {
|
||||||
|
$sort_field{$fcnt} = 'region_ids' ;
|
||||||
|
$fcnt++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_type eq 'installation_partner') {
|
||||||
|
$sort_field{$fcnt} = 'customer_ids' ;
|
||||||
|
$fcnt++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sort_field{$fcnt} = 'block' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'inactive' ; $fcnt++ ;
|
||||||
|
|
||||||
|
# if ($dialog) {
|
||||||
|
# $sort_field{$fcnt} = 'sel_field' ; $fcnt++ ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
$sort_field{$fcnt} = 'username' ; $fcnt++ ;
|
||||||
|
$sort_field{$fcnt} = 'password' if $iaction eq 'add' ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_add_db_fields {
|
||||||
|
|
||||||
|
$ignore{lastvisitdate} = 1 ;
|
||||||
|
$ignore{iaction} = 1 ;
|
||||||
|
$ignore{block} = 1 ;
|
||||||
|
$ignore{inactive} = 1 ;
|
||||||
|
# $ignore{id} = 1 ;
|
||||||
|
$hidden{lastupdate} = 2 ;
|
||||||
|
$required{email} = 1 ;
|
||||||
|
$required{username} = 1 ;
|
||||||
|
$required{name} = 1 ;
|
||||||
|
$required{password} = 1 ;
|
||||||
|
|
||||||
|
&sort_fields ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_edit_db_fields {
|
||||||
|
|
||||||
|
$ignore{lastvisitdate} = 1 ;
|
||||||
|
$ignore{password} = 1 ;
|
||||||
|
$ignore{iaction} = 1 ;
|
||||||
|
$hidden{id} = 1 ; # 1 = bypass for db update
|
||||||
|
$hidden{username} = 1 ; # 1 = bypass for db update
|
||||||
|
$hidden{lastupdate} = 2 ; # 2 = update db
|
||||||
|
# $readonly{username} = 'READONLY' ;
|
||||||
|
$checkbox{block} = 1 ;
|
||||||
|
$checkbox{inactive} = 1 ;
|
||||||
|
# $required{username} = 1 ;
|
||||||
|
$required{email} = 1 ;
|
||||||
|
|
||||||
|
&sort_fields ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_add_screen {
|
||||||
|
|
||||||
|
# called from common_add_screen
|
||||||
|
|
||||||
|
$selected{user_type}{$user_type} = "SELECTED" if $user_type ;
|
||||||
|
|
||||||
|
&users_select_opts ;
|
||||||
|
|
||||||
|
our $savjqy = 1 if $user_type ; # incorporate jquery into the save event to accommodate the multiple chosen options
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_edit_screen {
|
||||||
|
|
||||||
|
our ($lcol,$fcol) = &common_min_columns($label_col,$field_col) ;
|
||||||
|
|
||||||
|
$selected{based_in}{$db{$table}{$i{id}}{based_in}} = "SELECTED" ;
|
||||||
|
$selected{user_type}{$db{$table}{$i{id}}{user_type}} = "SELECTED" ;
|
||||||
|
|
||||||
|
$extra_form_fields .= &common_min_form_input('new_password','','password') ;
|
||||||
|
|
||||||
|
&users_select_opts ;
|
||||||
|
|
||||||
|
our $savjqy = 1 if $user_type ; # incorporate jquery into the save event to accommodate the multiple chosen options
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_thead {
|
||||||
|
|
||||||
|
$print_thead = qq~<THEAD><TR><TH>ID</TH><TH>USERNAME</TH><TH>NAME</TH><TH>EMAIL</TH><TH>ACTIVE</TH><TH>BASE</TH>~;
|
||||||
|
|
||||||
|
$print_thead .= qq~<TH>LEVEL</TH>~ if $user_type eq 'casual' ;
|
||||||
|
|
||||||
|
$print_thead .= qq~<TH>LASTUPDATE</TH><TH>LASTVISITDATE</TH><TH> </TH></TR></THEAD>~ ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_process_multi_select {
|
||||||
|
|
||||||
|
# local @organisationids = split(/\,/,$i{organisationids}) ;
|
||||||
|
# my $organisationids = join(",",@organisationids) ;
|
||||||
|
# $organisationids =~ s/\s//g; # remove white space
|
||||||
|
# $ignore{organisationids} = 1 ;
|
||||||
|
# $i{organisation_ids} = $organisationids ;
|
||||||
|
|
||||||
|
$i{organisation_ids} = '0' ;
|
||||||
|
|
||||||
|
local @regionids = split(/\,/,$i{regionids}) ;
|
||||||
|
my $regionids = join(",",@regionids) ;
|
||||||
|
$regionids =~ s/\s//g; # remove white space
|
||||||
|
$ignore{regionids} = 1 ;
|
||||||
|
$i{region_ids} = $regionids || '0' ;
|
||||||
|
|
||||||
|
if ($user_type eq 'installation_partner' || $user_type eq 'coding_provider' || $user_type eq 'analytics_client') {
|
||||||
|
local @customerids = split(/\,/,$i{customerids}) ;
|
||||||
|
my $customerids = join(",",@customerids) ;
|
||||||
|
$customerids =~ s/\s//g; # remove white space
|
||||||
|
$ignore{customerids} = 1 ;
|
||||||
|
$i{customer_ids} = $customerids ;
|
||||||
|
} else {
|
||||||
|
$i{customer_ids} = '0' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_select_opts {
|
||||||
|
|
||||||
|
# $multiple{organisation_ids} = 1;
|
||||||
|
# my @organisation_ids = split(/\,/,$db{$table}{$i{id}}{organisation_ids});
|
||||||
|
# foreach (@organisation_ids) { $selected_multi{$_} = 'SELECTED' ; }
|
||||||
|
# $preferred_title{organisation_ids} = "Venue" ;
|
||||||
|
# &common_min_select_opts('organisation_ids','organisations','name',$db{$table}{$i{id}}{organisation_ids},'') ;
|
||||||
|
# $extra_form_fields .= qq~<input type="hidden" name="organisationids" id="organisation-ids" value="">~;
|
||||||
|
|
||||||
|
# $trigger_jquery_raw .= qq~
|
||||||
|
# \$("#savebutt").click(function() {
|
||||||
|
# let st_val = \$("#selectOrganisation_ids").chosen().val() ;
|
||||||
|
# \$('#organisation-ids').val(st_val);
|
||||||
|
# \$('#users-form').submit();
|
||||||
|
# });~;
|
||||||
|
|
||||||
|
if ($user_type eq 'installation_partner' || $user_type eq 'coding_provider' || $user_type eq 'analytics_client') {
|
||||||
|
$multiple{customer_ids} = 1;
|
||||||
|
my @customer_ids = split(/\,/,$db{$table}{$i{id}}{customer_ids});
|
||||||
|
foreach (@customer_ids) { $selected_multi{$_} = 'SELECTED' ; }
|
||||||
|
$preferred_title{customer_ids} = "Customers" ;
|
||||||
|
&common_min_select_opts('customer_ids','customers','name','','') ;
|
||||||
|
$extra_form_fields .= qq~<input type="hidden" name="customerids" id="customer-ids" value="">~;
|
||||||
|
$add_to_trigger_jquery_raw = qq~
|
||||||
|
let cust_val = \$("#selectCustomer_ids").chosen().val() ;
|
||||||
|
\$('#customer-ids').val(cust_val);
|
||||||
|
~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_type eq 'schools_manager' || $user_type eq 'installation_partner' || $user_type eq 'casual' || $user_type eq 'coding_provider' || $user_type eq 'analytics_client') {
|
||||||
|
$multiple{region_ids} = 1;
|
||||||
|
my @region_ids = split(/\,/,$db{$table}{$i{id}}{region_ids});
|
||||||
|
foreach (@region_ids) { $selected_multi{$_} = 'SELECTED' ; }
|
||||||
|
$preferred_title{region_ids} = "Regions" ;
|
||||||
|
&common_min_select_opts('region_ids','regions','name','','') ;
|
||||||
|
$extra_form_fields .= qq~<input type="hidden" name="regionids" id="region-ids" value="">~;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#savebutt").click(function() {
|
||||||
|
let st_val = \$("#selectRegion_ids").chosen().val() ;
|
||||||
|
\$('#region-ids').val(st_val);
|
||||||
|
$add_to_trigger_jquery_raw
|
||||||
|
\$('#users-form').submit();
|
||||||
|
});~;
|
||||||
|
}
|
||||||
|
|
||||||
|
# &common_min_select_opts('organisation_ids','organisations','name',$db{$table}{$i{id}}{organisation_ids},1,'','');
|
||||||
|
|
||||||
|
&common_min_select_opts('based_in','regions','name',$db{$table}{$i{id}}{based_in},1,'','','code') ;
|
||||||
|
|
||||||
|
# $required{based_in} = 1 ;
|
||||||
|
# $select{based_in} = 1 ;
|
||||||
|
# # $opts{based_in} = qq~<option value="JNB" $selected{based_in}{'JNB'}>Johannesburg</option><option value="CPT" $selected{based_in}{'CPT'}>Cape Town</option>~ ;
|
||||||
|
# $opts{based_in} = qq~<option value="GP" $selected{based_in}{'GP'}>Gauteng</option><option value="CT" $selected{based_in}{'CT'}>Cape Town</option>~ ;
|
||||||
|
|
||||||
|
$required{user_type} = 1 ;
|
||||||
|
$select{user_type} = 1 ;
|
||||||
|
if ($user_type eq 'casual') {
|
||||||
|
if ($glod_user_level > 2) {
|
||||||
|
$opts{user_type} = qq~<option value="casual_a" $selected{user_type}{casual_a}>Operator Level 1</option>~;
|
||||||
|
}
|
||||||
|
if ($glod_user_level > 3) {
|
||||||
|
$opts{user_type} .= qq~<option value="casual_b" $selected{user_type}{casual_b}>Operator Level 2</option><option value="casual_c" $selected{user_type}{casual_c}>Operator Level 3</option>~;
|
||||||
|
}
|
||||||
|
$opts{user_type} .= qq~<option value="casual_calibrator" $selected{user_type}{casual_calibrator}>Temp Calibrator</option>~;
|
||||||
|
} elsif ($user_type) {
|
||||||
|
my $user_type_name = join(" ", map { ucfirst lc } split /_/, $user_type);
|
||||||
|
$opts{user_type} = qq~
|
||||||
|
<option value="$user_type" $selected{user_type}{$user_type}>$user_type_name</option>
|
||||||
|
~ ;
|
||||||
|
} else {
|
||||||
|
$opts{user_type} = qq~
|
||||||
|
<option value="manager" $selected{user_type}{'manager'}>Manager</option>
|
||||||
|
<option value="support" $selected{user_type}{'support'}>Support</option>
|
||||||
|
<option value="external" $selected{user_type}{external}>External</option>
|
||||||
|
<option value="it" $selected{user_type}{it}>IT</option>
|
||||||
|
<option value="nonquote" $selected{user_type}{nonquote}>Non-quotes</option>
|
||||||
|
<option value="parttime" $selected{user_type}{'parttime'}>Part-time</option>
|
||||||
|
<option value="permanent" $selected{user_type}{'permanent'}>Permanent</option>
|
||||||
|
<option value="senior_manager" $selected{user_type}{'senior_manager'}>Senior Manager</option>
|
||||||
|
<option value="dcb_partner" $selected{user_type}{'dcb_partner'}>DCB Partner</option>
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_insert {
|
||||||
|
|
||||||
|
&add_db_fields ;
|
||||||
|
|
||||||
|
my $crypted_password = apache_md5_crypt($i{password},$useropts{salt}) ;
|
||||||
|
$i{password} = $crypted_password ;
|
||||||
|
$i{lastupdate} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ;
|
||||||
|
$i{email} = lc $i{email} ;
|
||||||
|
|
||||||
|
$i{id} = &db_min_get_max($table,'id') ;
|
||||||
|
|
||||||
|
&process_multi_select if $user_type ;
|
||||||
|
|
||||||
|
&db_min_insert($table) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_update {
|
||||||
|
|
||||||
|
unless ($i{id}) { $error = qq(NO ID) ; return ; }
|
||||||
|
|
||||||
|
&edit_db_fields ;
|
||||||
|
|
||||||
|
unless ($i{block}) { $i{block} = '0' ; }
|
||||||
|
unless ($i{inactive}) { $i{inactive} = '0' ; }
|
||||||
|
|
||||||
|
if ($i{new_password}) {
|
||||||
|
my $crypted_password = apache_md5_crypt($i{new_password},$useropts{salt}) ;
|
||||||
|
$i{password} = $crypted_password ;
|
||||||
|
$ignore{password} = 0 ;
|
||||||
|
$hidden{password} = 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$i{lastupdate} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ;
|
||||||
|
|
||||||
|
&process_multi_select if $user_type ;
|
||||||
|
|
||||||
|
&db_min_upd($table,"id='$i{id}'") ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub users_validate {
|
||||||
|
|
||||||
|
my $user_exists = '' ; my $email_exists = '' ;
|
||||||
|
|
||||||
|
$i{username} = lc $i{username} ;
|
||||||
|
$i{username} =~ s/ //gi ;
|
||||||
|
|
||||||
|
$i{email} = lc $i{email} ;
|
||||||
|
$i{email} =~ s/ //gi ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'*',"username='$i{username}' OR email='$i{email}'",'username','') ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
if ($db{$table}{$id}{username} eq $i{username}) {
|
||||||
|
$user_exists = 1 ;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($i{email} && $db{$table}{$id}{email} eq $i{email}) {
|
||||||
|
$email_exists = 1 ;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user_exists) {
|
||||||
|
$alert = &common_min_alert('warning',"USERNAME ALREADY EXISTS!",'ok') ;
|
||||||
|
%col_name = ();
|
||||||
|
&common_min_add_screen;
|
||||||
|
&common_min_screen1 unless $dialog ;
|
||||||
|
&screen1 if $dialog ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($email_exists) {
|
||||||
|
$alert = &common_min_alert('warning',"EMAIL ALREADY EXISTS!",'ok') ;
|
||||||
|
%col_name = ();
|
||||||
|
&common_min_add_screen;
|
||||||
|
&common_min_screen1 unless $dialog ;
|
||||||
|
&screen1 if $dialog ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
2029
libs/modules/_FromProd/v1.0/analytics_event_booking_tabs.pm
Normal file
2029
libs/modules/_FromProd/v1.0/analytics_event_booking_tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
2082
libs/modules/_FromProd/v1.0/analytics_event_booking_tabs_test.pm
Normal file
2082
libs/modules/_FromProd/v1.0/analytics_event_booking_tabs_test.pm
Normal file
File diff suppressed because it is too large
Load Diff
797
libs/modules/_FromProd/v1.0/calibration.pm
Normal file
797
libs/modules/_FromProd/v1.0/calibration.pm
Normal file
|
|
@ -0,0 +1,797 @@
|
||||||
|
sub calibration_load_list_vars {
|
||||||
|
|
||||||
|
my ($where) = @_ ;
|
||||||
|
|
||||||
|
our %quote_status = () ;
|
||||||
|
|
||||||
|
our %calibrator_users = () ;
|
||||||
|
|
||||||
|
# &db_min_ro('users','id,name,user_type',"",'','') ;
|
||||||
|
# &db_min_ro('users','id,name,user_type,username',"(user_type = 'support' OR user_type = 'manager' OR user_type = 'casual_calibrator') AND name NOT LIKE 'Rory%'",'','') ;
|
||||||
|
&db_min_ro('regions','*','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('users','id,name,user_type,username,region_ids',"name NOT LIKE 'Rory%' AND name NOT LIKE 'Handre%'",'','') ;
|
||||||
|
$opts{calibrator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
$opts{head_operator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
foreach my $_uid (sort {$db{users}{$a}{name} cmp $db{users}{$b}{name}} keys %{$db{users}}) {
|
||||||
|
next if $useropts{it}{$db{users}{$_uid}{username}} ;
|
||||||
|
next if $db{users}{$_uid}{username} =~ m/test/i ;
|
||||||
|
next if $db{users}{$_uid}{username} =~ m/handre/i ;
|
||||||
|
|
||||||
|
my $regions = join(",",map{"$db{regions}{$_}{code}"} split(/\,/,$db{users}{$_uid}{region_ids})) ;
|
||||||
|
|
||||||
|
$regions = "[" . $regions . "]" if $regions ;
|
||||||
|
|
||||||
|
# if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator' || $monitoring_report) {
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator') {
|
||||||
|
$calibrator_users{$_uid} = $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if lc $db{users}{$_uid}{username} eq lc $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name} [$db{users}{$_uid}{username}]</option>~ if lc $db{users}{$_uid}{username} ne lc $db{users}{$_uid}{name} ;
|
||||||
|
# $opts{calibrator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if !$regions ;
|
||||||
|
}
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'casual_c' || ($db{users}{$_uid}{user_type} eq 'casual_b' && $lcpage eq 'set-up-groups-report')) {
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if lc $db{users}{$_uid}{username} eq lc $db{users}{$_uid}{name} ;
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name} [$db{users}{$_uid}{username}]</option>~ if lc $db{users}{$_uid}{username} ne lc $db{users}{$_uid}{name} ;
|
||||||
|
# $opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ if !$regions ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $event_systems_sql_where = ($monitoring_report) ? "" : "system_type = 'mobile'" ;
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile' OR system_type = 'solo'",'','') if $set_up_groups;
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile'",'','') if !$set_up_groups;
|
||||||
|
|
||||||
|
my @event_quote_ids = () ;
|
||||||
|
|
||||||
|
# &db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,if(date_from < '$now_year-$now_mm-$now_dd 00:00:00',0,1) AS 'after_start_date',event_system_calibration_ids,event_system_calibration_status","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
&db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,event_system_calibration_ids,event_system_calibration_status,event_system_head_operator_ids,times_from,times_to,daily_operator_ids,days_active,monitor_ids,temp_calibrator_ids,set_up_groups_status_ids,set_up_groups_head_operator_ids","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
|
||||||
|
unless ($set_up_group) {
|
||||||
|
|
||||||
|
my $calibration_status_report_where = join(" OR ", map { "event_quote_id='$_'" } grep { $_ } keys %{$db{$table}});
|
||||||
|
&db_min_ro('calibration_status_report','event_quote_id,request_sent',$calibration_status_report_where,'','') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# calibration_status_report
|
||||||
|
|
||||||
|
my $min_id = 0 ; my $max_id = 0 ; my @all_event_ids = () ;
|
||||||
|
|
||||||
|
our %event_system_calibration_ids = () ; our %event_system_calibration_status = () ; our %event_system_head_operator_id = () ; our %default_vaules = () ; our %event_system_request_sent = () ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 1. [$id] $db{$table}{$id}{ref}") ;
|
||||||
|
|
||||||
|
next unless $id ; my $cnt = 0 ;
|
||||||
|
|
||||||
|
push @all_event_ids,"`id` = '$id'" ;
|
||||||
|
|
||||||
|
my @ed_from = &common_split_sql_time($db{$table}{$id}{date_from}) ;
|
||||||
|
my @ed_to = &common_split_sql_time($db{$table}{$id}{date_to}) ;
|
||||||
|
|
||||||
|
&common_date_array("$ed_from[0]$ed_from[1]$ed_from[2]","$ed_to[0]$ed_to[1]$ed_to[2]") ;
|
||||||
|
|
||||||
|
# $sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$db{$table}{$id}{ref}"} = $id ;
|
||||||
|
$sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$id"} = $id ;
|
||||||
|
|
||||||
|
# my @event_sys_calibration_status = split(";",$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_sys_calibration_status = ($set_up_groups) ? split(/\;/,$db{$table}{$id}{set_up_groups_status_ids}) : split(/\;/,$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_system_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @calibration_ids = split(/\;/,$db{$table}{$id}{event_system_calibration_ids}) ;
|
||||||
|
my @head_operator_ids = ($set_up_groups) ? split(/\;/,$db{$table}{$id}{set_up_groups_head_operator_ids}) : split(/\;/,$db{$table}{$id}{event_system_head_operator_ids}) ;
|
||||||
|
my @request_sent = ($set_up_groups) ? () : split(/\|/,$db{calibration_status_report}{$id}{request_sent}) ;
|
||||||
|
|
||||||
|
my $evntday = 0 ; my $evntsys = 0 ; my $system_id = 0 ;
|
||||||
|
|
||||||
|
foreach my $_cid (@calibration_ids) {
|
||||||
|
|
||||||
|
if ($_cid =~ /~/) {
|
||||||
|
($system_id,$_cid) = split(/\~/,$_cid) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++ ;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@calibrator_ids_per_event_day) = split(/\-/,$_cid);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cid_pd (@calibrator_ids_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cid_pd ;
|
||||||
|
$event_system_calibration_ids{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
$default_vaules{calibrator}{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_ids{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@event_sys_calibration_status) {
|
||||||
|
|
||||||
|
if ($_cstatus =~ /~/) {
|
||||||
|
($system_id,$_cstatus) = split(/\~/,$_cstatus) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@calibrator_status_per_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@calibrator_status_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_calibration_status{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{status}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@head_operator_ids) {
|
||||||
|
|
||||||
|
if ($_cstatus =~ /~/) {
|
||||||
|
($system_id,$_cstatus) = split(/\~/,$_cstatus) ;
|
||||||
|
} else {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
}
|
||||||
|
$evntsys++ ;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my (@head_operator_id_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@head_operator_id_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_head_operator_id{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{head_operator}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $data_per_system (@request_sent) {
|
||||||
|
|
||||||
|
($system_id,$data_per_system) = split(/\~/,$data_per_system) ;
|
||||||
|
next unless $system_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} ;
|
||||||
|
|
||||||
|
my @request_sent_event_day = split(/\;/,$data_per_system) ;
|
||||||
|
$evntday = 0 ;
|
||||||
|
foreach my $_cstatus_pd (@request_sent_event_day) {
|
||||||
|
$evntday++ ;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_request_sent{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
$default_vaules{request_sent}{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# &db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
# &calibration_check_for_overlapping_dates('event_systems',"event_system_id_multiple") ;
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
$min_id = $id if not $min_id or $min_id > $id ;
|
||||||
|
$max_id = $id if $max_id < $id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_sql = qq~(`id` <= '$max_id' AND `id` >= '$min_id')~ ;
|
||||||
|
# $id_sql = qq~ AND $id_sql~ if $where_2 or $where_3 ;
|
||||||
|
|
||||||
|
|
||||||
|
# my $id_sql = join (" OR " ,@all_event_ids) ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$where_2$where_3$id_sql",'','') ;
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$id_sql",'','') ;
|
||||||
|
# &db_min_ro('event_cost_items','id,name','','','') ;
|
||||||
|
&db_min_ro('event_cost_items','id,name',"excl_from_expenses < 1",'','') ;
|
||||||
|
&db_min_ro('calibration_status',"id,status",'','','') unless $calibration_status ;
|
||||||
|
|
||||||
|
foreach (sort {$db{calibration_status}{$a}{status} cmp $db{calibration_status}{$b}{status}} keys %{$db{calibration_status}}) {
|
||||||
|
$db{calibration_status}{$_}{name} = $db{calibration_status}{$_}{status} ;
|
||||||
|
$opts{status} .= qq~<option value="$_">$db{calibration_status}{$_}{status}</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','id,name','','','') ;
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
# our @sql_col_display = ($monitoring_report) ? ("event_nr","event","date","day","start_date","start_time","end_time","venue","region","type","system","sport","operator") : ($temp_calibrator_report) ? ("count","event","date","day","start_date","start_time","end_time","venue","region","type","system","sport","operator","shift_1_(07:00-10:00)","shift_2_(10:00-13:00)","shift_3_(13:00-16:00)","shift_4_(16:00-19:00)") : ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
# our @sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("count","event","calib_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","request_sent","calibrator","status","frames") ;
|
||||||
|
|
||||||
|
@sql_col_display = grep { $_ ne "calibrator" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "request_sent" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "frames" } @sql_col_display if $set_up_groups ;
|
||||||
|
@sql_col_display = grep { $_ ne "head_operator" } @sql_col_display if $calibration_report ;
|
||||||
|
|
||||||
|
$custom_column_styles{calibrator} = qq~style="min-width:150px;"~ ;
|
||||||
|
$custom_column_styles{head_operator} = qq~style="min-width:150px;"~ ;
|
||||||
|
$custom_column_styles{status} = qq~style="min-width:150px;"~ ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
push @sql_col_display,"update" ;
|
||||||
|
|
||||||
|
my $nr_of_cols = scalar @sql_col_display ;
|
||||||
|
|
||||||
|
my @rev_sql_col_display = reverse @sql_col_display ;
|
||||||
|
|
||||||
|
foreach (@rev_sql_col_display) { $lastchild++ ; $last_child{$_} = $lastchild ; } # &common_debug("last-child : $_ [$last_child{$_}]");
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $cali_cnt = 0 ; my $found_editable = 0 ; my @all_select_ids = () ;
|
||||||
|
|
||||||
|
$format84 -> set_align("center") ;
|
||||||
|
|
||||||
|
my $found_editable_status = 0 ;
|
||||||
|
|
||||||
|
our $max_frame_width = 0 ;
|
||||||
|
|
||||||
|
my %default_val_id = () ;
|
||||||
|
|
||||||
|
# foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
foreach my $date_ref (sort {$sort_calibration_by_time_ref{$b} <=> $sort_calibration_by_time_ref{$a}} keys %sort_calibration_by_time_ref) {
|
||||||
|
|
||||||
|
my $id = $sort_calibration_by_time_ref{$date_ref} ;
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
my $system_count = 0 ; my $system_day_cnt = 0 ;
|
||||||
|
|
||||||
|
my %system_has_daily_op = () ; my %default_op_ids = () ;
|
||||||
|
|
||||||
|
foreach my $system_row (split(/\|/,$db{$table}{$id}{daily_operator_ids})) {
|
||||||
|
$system_count++ ;
|
||||||
|
next unless $system_row ;
|
||||||
|
$system_day_cnt = 0 ;
|
||||||
|
foreach my $col (split(/\;/,$system_row)) {
|
||||||
|
$system_day_cnt++ ;
|
||||||
|
next unless $col ;
|
||||||
|
$default_op_ids{$system_count}{$system_day_cnt} = $col if $col ;
|
||||||
|
$system_has_daily_op{$system_count} = 1 if $col ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$system_count = 0 ;
|
||||||
|
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";none;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @club_ids = split(/\;/,$db{$table}{$id}{club_ids}) ;
|
||||||
|
my @op_ids = ($db{$table}{$id}{operator_ids} =~ /,/) ? split(/\,/,$db{$table}{$id}{operator_ids}) : ($db{$table}{$id}{operator_ids} =~ /;/) ? split(/\;/,$db{$table}{$id}{operator_ids}) : $db{$table}{$id}{operator_ids} ;
|
||||||
|
my @start_times = split(/\;/,";".$db{$table}{$id}{times_from}) ;
|
||||||
|
my @end_times = split(/\;/,$db{$table}{$id}{times_to}.";") ;
|
||||||
|
my @days_active = split(/\;/,$db{$table}{$id}{days_active}) ;
|
||||||
|
|
||||||
|
my $cnt_rows = 0 ;
|
||||||
|
for (1 .. 50) {
|
||||||
|
$cnt_rows = $_ if $system_name_ids[$_ - 1] or $club_ids[$_ - 1] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$system_count = 0 ;
|
||||||
|
|
||||||
|
$colname_to_id{head_operator} = "head_operator" ;
|
||||||
|
$colname_to_id{calibrator} = "calibrator_id" ;
|
||||||
|
$colname_to_id{status} = "calibration_status" ;
|
||||||
|
$colname_to_id{request_sent} = "request_sent" ;
|
||||||
|
|
||||||
|
$preferred_title{head_operator} = "Head Operator" ;
|
||||||
|
$preferred_title{calibrator} = "Calibrator" ;
|
||||||
|
$preferred_title{status} = "Calibration Status" ;
|
||||||
|
|
||||||
|
$default_val_table{head_operator} = 'users' ;
|
||||||
|
$default_val_table{calibrator} = 'users' ;
|
||||||
|
$default_val_table{status} = 'calibration_status' ;
|
||||||
|
# $default_val_table{request_sent} = 'calibration_status_report' ;
|
||||||
|
|
||||||
|
&calibration_get_status_frames($id) ;
|
||||||
|
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$system_count++ ;
|
||||||
|
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
|
||||||
|
$system_day_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $cal_date (sort keys %day_of_week) {
|
||||||
|
|
||||||
|
my $srch_date_from_comp = $i{date_from} ; $srch_date_from_comp =~ s/\-//g ;
|
||||||
|
my $srch_date_to_comp = $i{date_to} ; $srch_date_to_comp =~ s/\-//g ;
|
||||||
|
my $date_from_comp = substr($db{$table}{$id}{date_from},0,10) ; $date_from_comp =~ s/\-//g ;
|
||||||
|
my $date_to_comp = substr($db{$table}{$id}{date_to},0,10) ; $date_to_comp =~ s/\-//g ;
|
||||||
|
my $cal_date_comp = $cal_date ; # $cal_date_comp =~ s/\-//g ;
|
||||||
|
$cal_date = substr($cal_date,0,4) . '-' . substr($cal_date,4,2) . '-' . substr($cal_date,6,2) ;
|
||||||
|
my $date_from = substr($db{$table}{$id}{date_from},0,10) ;
|
||||||
|
$system_day_cnt++ ;
|
||||||
|
|
||||||
|
next if $cal_date_comp < $date_from_comp ;
|
||||||
|
|
||||||
|
next if $cal_date_comp > $date_to_comp ;
|
||||||
|
|
||||||
|
$cnt{$event_sys_id}{$id}++ ;
|
||||||
|
|
||||||
|
next if $db{$table}{$id}{days_active} && !$days_active[$cnt{$event_sys_id}{$id}-1] ;
|
||||||
|
|
||||||
|
next if $cal_date_comp > $srch_date_to_comp ;
|
||||||
|
|
||||||
|
next if $cal_date_comp < $srch_date_from_comp ;
|
||||||
|
|
||||||
|
next if $i{calibration_status} && $i{calibration_status} ne 'all' && $i{calibration_status} ne $default_vaules{status}{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}} ;
|
||||||
|
|
||||||
|
$cali_cnt++;
|
||||||
|
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id$dow">~ if $report ;
|
||||||
|
|
||||||
|
my $nr_of_cols_cnt = $nr_of_cols + 1 ;
|
||||||
|
|
||||||
|
our $default_javascript = qq~~ ;
|
||||||
|
|
||||||
|
my $contains_select = 0 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
$nr_of_cols_cnt-- ;
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
our $val_min = $val ;
|
||||||
|
my $align = qq~ class="dt-center"~ ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
my $sys_day_cnt = $cnt{$event_sys_id}{$id} ;
|
||||||
|
|
||||||
|
my $field = "" ; my $default_val = $default_vaules{$_}{$id}{$event_sys_id}{$sys_day_cnt} ; my $only_display_val = 0 ; my $background_color ="#424949" ; my $default_val_is_saved = ($default_val) ? 1 : 0 ;
|
||||||
|
|
||||||
|
if ($_ eq 'head_operator' || $_ eq 'calibrator' || $_ eq 'status' || $_ eq 'request_sent') {
|
||||||
|
|
||||||
|
$val_min = '' ;
|
||||||
|
|
||||||
|
$formatting = $format91 ;
|
||||||
|
|
||||||
|
if ($report) {
|
||||||
|
|
||||||
|
$field = "$colname_to_id{$_}\_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
|
||||||
|
if (($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") || (!$default_val)) {
|
||||||
|
$preferred_title{$field} = $preferred_title{$_} ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
# $useropts{'common'}{'css'} .= qq~.$_ { min-width:180px; } ~ ; ????
|
||||||
|
$val_min = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
if ($_ eq 'status') {
|
||||||
|
if ($default_val) {
|
||||||
|
if ($default_val eq '1') { #calibrating
|
||||||
|
$background_color = "#FFA500" ;
|
||||||
|
$formatting = $format89 ;
|
||||||
|
} elsif ($default_val eq '2') { #cancelled
|
||||||
|
$background_color = "#AD0502" ;
|
||||||
|
$formatting = $format90 ;
|
||||||
|
} elsif ($default_val eq '3') { #done
|
||||||
|
$background_color = "#2ECC71" ;
|
||||||
|
$formatting = $format88 ;
|
||||||
|
} elsif ($default_val eq '4') {
|
||||||
|
$background_color = "#424949" ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_val = 4 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$contains_select = 1 ;
|
||||||
|
} else {
|
||||||
|
$default_val_id{$_}{$db{$default_val_table{$_}}{$default_val}{name}} = $default_val if $default_val_table{$_} ;
|
||||||
|
$default_val = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
$default_val = "None" if $default_val eq 'none' ;
|
||||||
|
$only_display_val = 1 ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_val_id{$_}{$db{$default_val_table{$_}}{$default_val}{name}} = $default_val if $default_val_table{$_} ;
|
||||||
|
$default_val = $db{$default_val_table{$_}}{$default_val}{name} if $default_val_table{$_} ;
|
||||||
|
$default_val = "None" if $default_val eq 'none' ;
|
||||||
|
$only_display_val = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_ eq 'count') {
|
||||||
|
$val = $cali_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} [$id]" ;
|
||||||
|
} elsif ($_ eq 'calib_date' || $_ eq 'date') {
|
||||||
|
# $val = "$cal_date [$day_of_week{$cal_date}]" ;
|
||||||
|
$val = "$cal_date" ;
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'day') {
|
||||||
|
$val = "$sys_day_cnt" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val = $date_from ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
# $nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ;
|
||||||
|
} elsif ($_ eq 'type') {
|
||||||
|
$val = (lc $db{event_systems}{$event_sys_id}{description} =~ /cricket/) ? "C" :
|
||||||
|
($db{event_systems}{$event_sys_id}{system_type} eq 'mobile') ? "M" :
|
||||||
|
($db{event_systems}{$event_sys_id}{system_type} eq 'fixed') ? "F" : "";
|
||||||
|
} elsif ($_ eq 'system') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_sys_id}{description})~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
# $nowrap = "nowrap" ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val = '' ;
|
||||||
|
# $val = $db{users}{$table_op_ids[$system_count - 1]}{name} if $table_op_ids[$system_count - 1] ;
|
||||||
|
$val = ($default_op_ids{$system_count}{$cnt{$event_sys_id}{$id}}) ? $db{users}{$default_op_ids{$system_count}{$cnt{$event_sys_id}{$id}}}{name} : (!$default_op_ids{$system_count}{$system_day_cnt} && $system_has_daily_op{$system_count}) ? "None" : $db{users}{$op_ids[$system_count - 1]}{name} ;
|
||||||
|
# $formatting = $format92 if $event_cnt == 2 ;
|
||||||
|
$formatting = $format92 if $cali_cnt == 2 ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
if ($sys_day_cnt == 1 or ($sys_day_cnt > 1 and not $start_times[$sys_day_cnt-1])) {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($start_times[$sys_day_cnt-1],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'end_time') {
|
||||||
|
if ($start_times[$sys_day_cnt-1] && !$end_times[$sys_day_cnt-1]) {
|
||||||
|
$val = substr($db{$table}{$id}{date_to},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($end_times[$sys_day_cnt-1],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'head_operator') {
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'request_sent') {
|
||||||
|
$val_min = $default_val ;
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val' type='hidden'>~ : qq~~ ;
|
||||||
|
$default_val = "$now_hour:$now_min:$now_sec" unless $default_val ;
|
||||||
|
$val .= &common_min_table_timepicker($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'calibrator') {
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
} elsif ($_ eq 'status') {
|
||||||
|
$found_editable_status = 1 if !$only_display_val ;
|
||||||
|
# $val = ($only_display_val && $default_val) ? qq~<input name='$field' value='$default_val_id{$_}{$default_val}' type='hidden'>~ : qq~~ ;
|
||||||
|
$val .= &common_min_table_select($field,$default_val,$only_display_val,$cali_cnt,$nr_of_cols_cnt,$background_color,$default_val_is_saved,$_) ;
|
||||||
|
$val_min = '' if $val_min == 4 ;
|
||||||
|
} elsif ($_ eq 'frames') {
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
$val .= &calibration_get_frames($id,$event_sys_id,$sys_day_cnt) ;
|
||||||
|
} elsif ($_ eq 'update') {
|
||||||
|
if (($report && $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") || $contains_select) {
|
||||||
|
$val = &common_min_table_checkbox("update_$id\_$event_sys_id\_$sys_day_cnt") ;
|
||||||
|
chop $default_javascript if $default_javascript ;
|
||||||
|
if ($default_javascript) {
|
||||||
|
push @default_javascript_by_id, qq~"$id\_$event_sys_id\_$sys_day_cnt":{$default_javascript}~ ;
|
||||||
|
push @all_update_field_ids,"#selectHead_operator\_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibrator_id\_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibration_status\_$id\_$event_sys_id\_$sys_day_cnt,#timepickerRequest_sent\_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$val = '' ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_ ne 'frames' && $_ ne 'request_sent' && $_ ne 'head_operator' && $_ ne 'status' && $_ ne 'calibrator' && substr($_,0,5) ne 'shift' && $_ ne 'update') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~<td $align $nowrap>$val</td>~ if $report ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) if $val_min && $_ ne 'update' ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,"",$format84) if !$val_min && ($_ eq 'head_operator' || $_ eq 'calibrator' || $_ eq 'status' || $_ eq 'request_sent') ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $all_select_ids_string = join(",",@all_select_ids) ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("$all_select_ids_string").chosen({allow_single_deselect:true});~ ;
|
||||||
|
|
||||||
|
if (!$found_editable) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} ").find("th:last").remove() ;
|
||||||
|
\$("#$useropts{table_id} tr").each(function() {
|
||||||
|
\$(this).find("td:last").remove() ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
} elsif ($set_up_groups) {
|
||||||
|
&common_min_table_select_jquery("#$useropts{table_id} td:nth-last-child(3),#$useropts{table_id} td:nth-last-child(2)") ;
|
||||||
|
&common_min_table_update_checkbox_col("3") ;
|
||||||
|
} else {
|
||||||
|
&common_min_table_select_jquery("#$useropts{table_id} td:nth-last-child(4),#$useropts{table_id} td:nth-last-child(3)") ;
|
||||||
|
&common_min_table_update_checkbox_col("3") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_editable) {
|
||||||
|
$trigger_jquery .= qq~\$("#$useropts{table_id} td:nth-last-child(3)").css("width","12.5%"); ~ ;
|
||||||
|
$trigger_jquery .= ($set_up_groups) ? qq~\$("#$useropts{table_id} td:nth-last-child(2)").css("width","12.5%");~ : qq~\$("#$useropts{table_id} td:nth-last-child(4)").css("width","12.5%");~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found_editable_status) {
|
||||||
|
$trigger_jquery .= qq~\$("#$useropts{table_id} td:nth-last-child(3)").css("width","");~ if !$set_up_groups ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10) ;
|
||||||
|
$worksheet{$ws}->set_column(1,1,30) ;
|
||||||
|
$worksheet{$ws}->set_column(2,2,15) ;
|
||||||
|
$worksheet{$ws}->set_column(3,3,5) ;
|
||||||
|
$worksheet{$ws}->set_column(4,5,13) ;
|
||||||
|
$worksheet{$ws}->set_column(6,6,30) ;
|
||||||
|
$worksheet{$ws}->set_column(7,7,8 );
|
||||||
|
$worksheet{$ws}->set_column(8,12,30) ;
|
||||||
|
$worksheet{$ws}->set_column(13,13,30) unless $set_up_groups ;
|
||||||
|
$worksheet{$ws}->set_column(14,14,$max_frame_width/7) unless $set_up_groups ;
|
||||||
|
|
||||||
|
&common_min_table_timepicker_jquery("[id^='timepickerRequest_sent_']") ;
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('L',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{none} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{none} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_frames {
|
||||||
|
|
||||||
|
my ($id,$event_sys_id,$sys_day_cnt) = @_ ;
|
||||||
|
|
||||||
|
$nowrap = "nowrap" ;
|
||||||
|
my $attachments = "" ; my $attach_butt = "" ;
|
||||||
|
|
||||||
|
if ($gallery{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
|
||||||
|
my $margin = 5 ; my $scaled_height = 100 ; my $total_width = 0 ; my $max_height = 350 ; my $max_image_height = 0 ;
|
||||||
|
|
||||||
|
foreach my $img_name (split(/\;/,$gallery{$id}{$event_sys_id}{$sys_day_cnt})) {
|
||||||
|
|
||||||
|
my $file_path = "$htmlpath/uploads/calibration_status_uploads/$id/$img_name";
|
||||||
|
|
||||||
|
my ($width, $height) = imgsize($file_path);
|
||||||
|
|
||||||
|
if ($height && -f $file_path) {
|
||||||
|
|
||||||
|
my $final_file = $file_path; # default: use original
|
||||||
|
# my $scaled_width = $width;
|
||||||
|
# my $scaled_height = $height;
|
||||||
|
|
||||||
|
if ($height > $max_height) {
|
||||||
|
|
||||||
|
$max_image_height = $max_height if $max_image_height < $height ;
|
||||||
|
|
||||||
|
# Load and resize with fixed height = 500
|
||||||
|
my $img = Image::Magick->new ;
|
||||||
|
$img->Read($file_path) ;
|
||||||
|
|
||||||
|
my $scale = $max_height / $height;
|
||||||
|
$width = int($width * $scale);
|
||||||
|
$height = $max_height;
|
||||||
|
|
||||||
|
$img->Resize(geometry => "${width}x${height}");
|
||||||
|
|
||||||
|
# Write to temporary file
|
||||||
|
my ($fh, $tempfile) = tempfile(SUFFIX => '.jpg');
|
||||||
|
$img->Write(filename => $tempfile, quality => 70);
|
||||||
|
|
||||||
|
$final_file = $tempfile;
|
||||||
|
$temp_files{$tempfile} = 1; # track temp file for cleanup
|
||||||
|
} else {
|
||||||
|
$max_image_height = $height if $max_image_height < $height ;
|
||||||
|
}
|
||||||
|
|
||||||
|
($width,$height) = imgsize($final_file);
|
||||||
|
|
||||||
|
$total_width += $margin;
|
||||||
|
|
||||||
|
&xlsxcreator_insert_image($ws,$xlsxrow,$xlsxcol,$final_file,$total_width,$margin,150/$height,150/$height) if $height > 150 ;
|
||||||
|
&xlsxcreator_insert_image($ws,$xlsxrow,$xlsxcol,$final_file,$total_width,$margin) if $height <= 150 ;
|
||||||
|
|
||||||
|
$total_width += $width*150/$height;
|
||||||
|
}
|
||||||
|
|
||||||
|
$total_width += $margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_row($xlsxrow,(2*$margin+150)*(83/110)) if $max_image_height ;
|
||||||
|
|
||||||
|
$max_frame_width = $total_width if $total_width && $max_frame_width < $total_width ;
|
||||||
|
|
||||||
|
$attachments .= &calibration_get_uploads_list($db{calibration_status_report}{$id}{event_quote_id},$gallery{$id}{$event_sys_id}{$sys_day_cnt}) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($attachments) {
|
||||||
|
|
||||||
|
$attach_butt = qq~
|
||||||
|
|
||||||
|
<a href="#" data-toggle="popover" data-placement="left" data-content="$attachments" title="Uploads" data-html="true" data-trigger="focus" class="btn btn-round btn-default">
|
||||||
|
<i class="glyphicon glyphicon-paperclip" style="top:4px;"></i>
|
||||||
|
</a>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
my $val_return = qq~
|
||||||
|
$attach_butt
|
||||||
|
<a href="javascript:dlgMdl('$useropts{scripts}/dialog/calibration_status_report_uploads.pl?$id&$event_sys_id&$sys_day_cnt','Edit Images','','medium-dialog');" class="btn btn-round btn-info" data-toggle="tooltip" data-placement="left" title="" data-original-title="Edit Images">
|
||||||
|
<i class="glyphicon glyphicon-edit" style="top:4px;">
|
||||||
|
</i>
|
||||||
|
</a>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
return $val_return ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_status_frames {
|
||||||
|
|
||||||
|
my ($event_id) = @_ ;
|
||||||
|
|
||||||
|
return unless $event_id ;
|
||||||
|
|
||||||
|
my %frames_hash = () ;
|
||||||
|
|
||||||
|
foreach my $system_frames (split(/\|/,$db{calibration_status_report}{$event_id}{upload_names})) {
|
||||||
|
|
||||||
|
next unless $system_frames ;
|
||||||
|
my ($system_id,$system_frames_2) = split(/\~/,$system_frames) ;
|
||||||
|
my $day_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $day_frames (split(/\:/,$system_frames_2)) {
|
||||||
|
$day_cnt++ ;
|
||||||
|
next unless $day_frames ;
|
||||||
|
$gallery{$event_id}{$system_id}{$day_cnt} = $day_frames ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_get_uploads_list {
|
||||||
|
|
||||||
|
my ($id,$uploads) = @_ ;
|
||||||
|
|
||||||
|
my $attachments = '' ;
|
||||||
|
|
||||||
|
return '' unless $id ;
|
||||||
|
|
||||||
|
my @uploads_arr = split(/\;/,$uploads) ;
|
||||||
|
|
||||||
|
my $uploads_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach (@uploads_arr) {
|
||||||
|
|
||||||
|
$uploads_cnt++ ;
|
||||||
|
|
||||||
|
next unless $_ ;
|
||||||
|
|
||||||
|
my $url_prefix = qq~/uploads/calibration_status_uploads/$id~ ;
|
||||||
|
|
||||||
|
my ($width,$height) = imgsize("$htmlpath/$url_prefix/$_");
|
||||||
|
|
||||||
|
next unless $height ;
|
||||||
|
|
||||||
|
$width = 100*($width/$height) ;
|
||||||
|
$height = 100 ;
|
||||||
|
$attachments .= qq~<a target='_blank' href='$url_prefix/$_'><img src='$url_prefix/$_' style='width:$width\px;height:$height\px;border:1px solid #ccc;margin:2px;max-width:100%;display:block;'></a>~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attachments ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
1 ;
|
||||||
688
libs/modules/_FromProd/v1.0/calibrator_payments.pm
Normal file
688
libs/modules/_FromProd/v1.0/calibrator_payments.pm
Normal file
|
|
@ -0,0 +1,688 @@
|
||||||
|
sub calibration_load_list_vars {
|
||||||
|
|
||||||
|
my ($where,$for_payments) = @_ ;
|
||||||
|
|
||||||
|
our %quote_status = () ;
|
||||||
|
|
||||||
|
our %calibrator_users = () ;
|
||||||
|
|
||||||
|
# &db_min_ro('users','id,name,user_type',"",'','') ;
|
||||||
|
# &db_min_ro('users','id,name,user_type,username',"(user_type = 'support' OR user_type = 'manager' OR user_type = 'casual_calibrator') AND name NOT LIKE 'Rory%'",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('users','id,name,user_type,username',"`name` NOT LIKE 'Rory%'",'','') ;
|
||||||
|
|
||||||
|
if (!$for_payments) {
|
||||||
|
$opts{calibration_users} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
$opts{head_operator} .= qq~<option value="none">>>>None<<<</option>~ ;
|
||||||
|
foreach my $_uid (sort {$db{users}{$a}{name} cmp $db{users}{$b}{name}} keys %{$db{users}}) {
|
||||||
|
next if $useropts{it}{$db{users}{$_uid}{username}} ;
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'support' || $db{users}{$_uid}{user_type} eq 'manager' || $db{users}{$_uid}{user_type} eq 'casual_calibrator') {
|
||||||
|
$calibrator_users{$_uid} = $db{users}{$_uid}{name} ;
|
||||||
|
$opts{calibration_users} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ ;
|
||||||
|
}
|
||||||
|
if ($db{users}{$_uid}{user_type} eq 'casual_c') {
|
||||||
|
$opts{head_operator} .= qq~<option value="$_uid">$db{users}{$_uid}{name}</option>~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
my @event_quote_ids = () ;
|
||||||
|
|
||||||
|
# &db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,if(date_from < '$now_year-$now_mm-$now_dd 00:00:00',0,1) AS 'after_start_date',event_system_calibration_ids,event_system_calibration_status","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
&db_min_ro($table,"id,ref,organisation_ids,quote_accepted,event_system_id_multiple,region_id,sport_type_ids,operator_ids,date_from,date_to,event_system_calibration_ids,event_system_calibration_status,event_system_head_operator_ids,times_from","$where AND `quote_accepted` = '1'",'','') ;
|
||||||
|
|
||||||
|
my $min_id = 0 ; my $max_id = 0 ;
|
||||||
|
|
||||||
|
our %event_system_calibration_ids = () ; our %event_system_calibration_status = () ; our %event_system_head_operator_id = () ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 1. [$id] $db{$table}{$id}{ref}") ;
|
||||||
|
|
||||||
|
next unless $id ; my $cnt = 0 ;
|
||||||
|
|
||||||
|
my @ed_from = &common_split_sql_time($db{$table}{$id}{date_from}) ;
|
||||||
|
my @ed_to = &common_split_sql_time($db{$table}{$id}{date_to}) ;
|
||||||
|
|
||||||
|
&common_date_array("$ed_from[0]$ed_from[1]$ed_from[2]","$ed_to[0]$ed_to[1]$ed_to[2]") ;
|
||||||
|
|
||||||
|
# $sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$db{$table}{$id}{ref}"} = $id ;
|
||||||
|
$sort_calibration_by_time_ref{"$ed_from[0]$ed_from[1]$ed_from[2]$ed_from[3]$ed_from[4]-$id"} = $id ;
|
||||||
|
|
||||||
|
# my @event_sys_calibration_status = split(";",$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_sys_calibration_status = split(/\;/,$db{$table}{$id}{event_system_calibration_status}) ;
|
||||||
|
my @event_system_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @calibration_ids = split(/\;/,$db{$table}{$id}{event_system_calibration_ids}) ;
|
||||||
|
my @head_operator_ids = split(/\;/,$db{$table}{$id}{event_system_head_operator_ids}) ;
|
||||||
|
|
||||||
|
my $evntday=0; my $evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cid (@calibration_ids) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@calibrator_ids_per_event_day) = split(/\-/,$_cid);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
|
||||||
|
foreach my $_cid_pd (@calibrator_ids_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cid_pd ;;
|
||||||
|
$event_system_calibration_ids{$id}{$system_id}{$evntday} = $_cid_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_ids{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@event_sys_calibration_status) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
|
||||||
|
my (@calibrator_status_per_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@calibrator_status_per_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_calibration_status{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@head_operator_ids) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@head_operator_id_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@head_operator_id_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$event_system_head_operator_id{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
if ($for_payments) {
|
||||||
|
|
||||||
|
my @calibrator_amounts_paid = split(/\;/,$db{$table}{$id}{calibrator_amounts_paid}) ;
|
||||||
|
my @calibrator_dates_paid = split(/\;/,$db{$table}{$id}{calibrator_dates_paid}) ;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@calibrator_amounts_paid) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@amounts_paid_event_day) = split(/\-/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@amounts_paid_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$calibrator_amounts_paid_hash{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$evntsys=0;
|
||||||
|
|
||||||
|
foreach my $_cstatus (@calibrator_dates_paid) {
|
||||||
|
$system_id = $event_system_ids[$evntsys] ;
|
||||||
|
$evntsys++;
|
||||||
|
next unless $system_id ;
|
||||||
|
next unless $db{event_systems}{$system_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
my (@dates_paid_event_day) = split(/\:/,$_cstatus);
|
||||||
|
$evntday=0; # set the event day back to zero for each set of calibrators
|
||||||
|
foreach my $_cstatus_pd (@dates_paid_event_day) {
|
||||||
|
$evntday++;
|
||||||
|
next unless $_cstatus_pd ;
|
||||||
|
$calibrator_dates_paid_hash{$id}{$system_id}{$evntday} = $_cstatus_pd ;
|
||||||
|
# &common_debug("1. >>> $event_system_calibration_status{$id}{$system_id}{$evntday} [$id] [$system_id] [$evntday]") ;
|
||||||
|
}
|
||||||
|
# $evntsys++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# &db_min_ro('event_systems','*',"system_type = 'mobile'",'','') ;
|
||||||
|
|
||||||
|
&calibration_check_for_overlapping_dates('event_systems',"event_system_id_multiple") ;
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
$min_id = $id if not $min_id or $min_id > $id ;
|
||||||
|
$max_id = $id if $max_id < $id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $id_sql = qq~(`id` <= '$max_id' AND `id` >= '$min_id')~ ;
|
||||||
|
# $id_sql = qq~ AND $id_sql~ if $where_2 or $where_3 ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes_min','*',"$where_2$where_3$id_sql",'','') ;
|
||||||
|
&db_min_ro('event_quotes_min','*',"$id_sql",'','') ;
|
||||||
|
&db_min_ro('event_cost_items','id,name',"excl_from_expenses < 1",'','') ;
|
||||||
|
&db_min_ro('calibration_status','id,status','','','') unless $calibration_status ;
|
||||||
|
|
||||||
|
foreach (sort {$db{calibration_status}{$a}{status} cmp $db{calibration_status}{$b}{status}} keys %{$db{calibration_status}}) {
|
||||||
|
$opts{calibration_status} .= qq~<option value="$_">$db{calibration_status}{$_}{status}</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
&db_min_ro('regions','*','','','') ;
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report,$for_payments) = @_ ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","update") ;
|
||||||
|
|
||||||
|
@sql_col_display = ("count","event","calibration_date","day","start_date","start_time","venue","region","system","sport","operator","head_operator","calibrator","status","date_payable","amount_payable","paid") if $for_payments ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $cali_cnt = 0 ; our $found_after_date = 0 ; my $found_editable = 0 ;
|
||||||
|
|
||||||
|
# foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
foreach my $date_ref (sort keys %sort_calibration_by_time_ref) {
|
||||||
|
|
||||||
|
my $id = $sort_calibration_by_time_ref{$date_ref} ;
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";none;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my @system_name_ids = split(";",$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
my @club_ids = split(/\;/,$db{$table}{$id}{club_ids}) ;
|
||||||
|
my @op_ids = split(/\,/,$db{$table}{$id}{operator_ids}) ;
|
||||||
|
my @start_times = split(/\;/,$db{$table}{$id}{times_from}) ;
|
||||||
|
|
||||||
|
my $cnt_rows = 0 ;
|
||||||
|
for (1 .. 50) {
|
||||||
|
$cnt_rows = $_ if $system_name_ids[$_ - 1] or $club_ids[$_ - 1] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my @table_op_ids = () ;
|
||||||
|
|
||||||
|
# for (1 .. $cnt_rows) {
|
||||||
|
# push @table_op_ids,$op_ids[$_ - 1] if $op_ids[$_ - 1] ;
|
||||||
|
# push @table_op_ids,0 unless $op_ids[$_ - 1] ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
my $system_count = 0 ;
|
||||||
|
|
||||||
|
# foreach my $event_sys_id (split(";",$db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
# foreach my $event_sys_id (sort { $a <=> $b } @system_name_ids) {
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$system_count++ ;
|
||||||
|
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} eq 'mobile' ;
|
||||||
|
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 2. $system_count [$id] $db{$table}{$id}{ref} [$db{event_systems}{$event_sys_id}{system_type}]") ;
|
||||||
|
|
||||||
|
# $event_cnt++ ;
|
||||||
|
|
||||||
|
# foreach my $cal_date (sort {$day_of_week{$a} cmp $day_of_week{$b}} keys %day_of_week) {
|
||||||
|
foreach my $cal_date (sort keys %day_of_week) {
|
||||||
|
|
||||||
|
|
||||||
|
my $srch_date_from_comp = $i{date_from} ; $srch_date_from_comp =~ s/\-//g ;
|
||||||
|
my $srch_date_to_comp = $i{date_to} ; $srch_date_to_comp =~ s/\-//g ;
|
||||||
|
my $date_from_comp = substr($db{$table}{$id}{date_from},0,10) ; $date_from_comp =~ s/\-//g ;
|
||||||
|
my $date_to_comp = substr($db{$table}{$id}{date_to},0,10) ; $date_to_comp =~ s/\-//g ;
|
||||||
|
my $cal_date_comp = $cal_date ; # $cal_date_comp =~ s/\-//g ;
|
||||||
|
$cal_date = substr($cal_date,0,4) . '-' . substr($cal_date,4,2) . '-' . substr($cal_date,6,2) ;
|
||||||
|
my $date_from = substr($db{$table}{$id}{date_from},0,10) ;
|
||||||
|
|
||||||
|
# &common_debug("[$cnt{$event_sys_id}{$id}] : $event_sys_id [$id] $cal_date") ;
|
||||||
|
|
||||||
|
# &common_debug("1. DATE >>> $cal_date_comp < $date_from_comp") if !$report ;
|
||||||
|
next if $cal_date_comp < $date_from_comp ;
|
||||||
|
# &common_debug("2. DATE >>> $cal_date_comp > $date_to_comp") if !$report ;
|
||||||
|
next if $cal_date_comp > $date_to_comp ;
|
||||||
|
|
||||||
|
$cnt{$event_sys_id}{$id}++ ; ## WHY HERE???????????????
|
||||||
|
next if $for_payments && ($db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}}}{user_type} ne 'casual_calibrator' || $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$cnt{$event_sys_id}{$id}}}{status} ne 'Done' || ($i{paid_status} eq 'paid' && !$calibrator_amounts_paid_hash{$id}{$system_id}{$evntday}) || ($i{paid_status} eq 'outstanding' && $calibrator_amounts_paid_hash{$id}{$system_id}{$evntday})) ;
|
||||||
|
|
||||||
|
|
||||||
|
# &common_debug("3. DATE >>> $cal_date_comp > $srch_date_to_comp") if !$report ;
|
||||||
|
next if $cal_date_comp > $srch_date_to_comp ;
|
||||||
|
# &common_debug("4. DATE >>> $cal_date_comp < $srch_date_from_comp") if !$report ;
|
||||||
|
next if $cal_date_comp < $srch_date_from_comp ;
|
||||||
|
|
||||||
|
# &common_debug(">>>>>>>>> 3. $system_count [$id] $db{$table}{$id}{ref} [$db{event_systems}{$event_sys_id}{system_type}]") ;
|
||||||
|
|
||||||
|
# &common_debug("[$cnt{$event_sys_id}{$id}] : $event_sys_id [$id] $cal_date [$cal_date_comp > $srch_date_to_comp]") ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$cali_cnt++;
|
||||||
|
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id$dow">~ if $report ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
# &common_debug("1. XLSX >>> $_") if !$report ;
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
my $val_min = $val ;
|
||||||
|
my $align = qq~ class="dt-center"~ ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
# &common_debug("2. XLSX >>> val_min=$val_min") if !$report ;
|
||||||
|
|
||||||
|
my $sys_day_cnt = $cnt{$event_sys_id}{$id} ;
|
||||||
|
|
||||||
|
if ($_ eq 'count') {
|
||||||
|
# $val = $event_cnt ;
|
||||||
|
$val = $cali_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} ($id)" ;
|
||||||
|
} elsif ($_ eq 'calibration_date') {
|
||||||
|
# $val = "$cal_date [$day_of_week{$cal_date}]" ;
|
||||||
|
$val = "$cal_date" ;
|
||||||
|
} elsif ($_ eq 'day') {
|
||||||
|
$val = "$sys_day_cnt" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$val = $date_from ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ;
|
||||||
|
} elsif ($_ eq 'system') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_sys_id}{description})~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$val = '' ;
|
||||||
|
# $val = $db{users}{$table_op_ids[$system_count - 1]}{name} if $table_op_ids[$system_count - 1] ;
|
||||||
|
$val = $db{users}{$op_ids[$system_count - 1]}{name} if $op_ids[$system_count - 1] ;
|
||||||
|
# $formatting = $format92 if $event_cnt == 2 ;
|
||||||
|
$formatting = $format92 if $cali_cnt == 2 ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
if ($sys_day_cnt == 1 or ($sys_day_cnt > 1 and not $start_times[$sys_day_cnt-2])) {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
} else {
|
||||||
|
$val = substr($start_times[$sys_day_cnt-2],0,5) ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'head_operator') {
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
# &common_debug("=== $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne -1") ;
|
||||||
|
|
||||||
|
my $field = "head_operator_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "-1") {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
|
||||||
|
$preferred_title{$field} = "Head Operator" ;
|
||||||
|
$opts{$field} = $opts{head_operator} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("2. >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
|
||||||
|
if ($event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(4)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%") ;~ ;
|
||||||
|
# $val_min = $db{users}{$db{event_systems}{$event_sys_id}{calibrator_id}}{name} ;
|
||||||
|
$val_min = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
} else {
|
||||||
|
$val = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# # $val = "$db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} [$sys_day_cnt]" ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# $val = $db{users}{$db{event_systems}{$id}{calibrator_id}}{name} ;
|
||||||
|
$val = $db{users}{$event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_head_operator_id{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'calibrator') {
|
||||||
|
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
# &common_debug("=== $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne -1") ;
|
||||||
|
|
||||||
|
my $field = "calibrator_id_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
|
||||||
|
$preferred_title{$field} = "Calibrator" ;
|
||||||
|
$opts{$field} = $opts{calibration_users} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("2. >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
if ($event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(3)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%") ;~ ;
|
||||||
|
# $val_min = $db{users}{$db{event_systems}{$event_sys_id}{calibrator_id}}{name} ;
|
||||||
|
$val_min = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
} else {
|
||||||
|
$val = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# # $val = "$db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} [$sys_day_cnt]" ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{users}{$db{event_systems}{$id}{calibrator_id}}{name} ;
|
||||||
|
|
||||||
|
$val = $db{users}{$event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt}}{name} ;
|
||||||
|
$val = "None" if $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} eq 'none' ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'status') {
|
||||||
|
if ($report && !$for_payments) {
|
||||||
|
# if ($db{$table}{$id}{after_start_date} and $event_sys_id ne "-1") {
|
||||||
|
my $field = "calibration_status_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$opts{$field} = $opts{calibration_status} ;
|
||||||
|
$preferred_title{$field} = "Calibration Status" ;
|
||||||
|
$allow_deselect{$field} = 1;
|
||||||
|
$val = &common_min_form_select_col($field,'') ;
|
||||||
|
|
||||||
|
# &common_debug("STATUS >>> $event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
if ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").val("$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}") ;~ ;
|
||||||
|
if ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '1') { #calibrating
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#FFA500");~ ;
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '2') { #cancelled
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#AD0502");~ ;
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '3') { #done
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#2ECC71");~ ; #D5EDBB
|
||||||
|
}
|
||||||
|
elsif ($event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} eq '4') { #done
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($cali_cnt) td:nth-last-child(2)").css("background-color","#424949");~ ; #D5D8DC
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").val("4") ;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt").trigger("chosen:updated") ;
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt\_chosen").css("width","100%");
|
||||||
|
~ ;
|
||||||
|
$val_min = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
$val = "None" if !$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
# $readonly{$field} = 'READONLY' ;
|
||||||
|
# $val = qq~<div style="display:none;">~ . &common_min_form_input_col($field,$db{event_systems}{$event_sys_id}{calibration_status}) . qq~</div>~ ;
|
||||||
|
# $val .= $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
# $val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
# $val = $db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} ;
|
||||||
|
$val = $db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} ;
|
||||||
|
$val = "None" if !$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
# $val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
# if ($db{calibration_status}{$db{event_systems}{$event_sys_id}{calibration_status}}{status} eq "Calibrating") {
|
||||||
|
if ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Calibrating") {
|
||||||
|
$formatting = $format89 ;
|
||||||
|
} elsif ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Cancelled") {
|
||||||
|
$formatting = $format90 ;
|
||||||
|
} elsif ($db{calibration_status}{$event_system_calibration_status{$id}{$event_sys_id}{$sys_day_cnt}}{status} eq "Done") {
|
||||||
|
$formatting = $format88 ;
|
||||||
|
} else {
|
||||||
|
$formatting = $format91 ;
|
||||||
|
}
|
||||||
|
} elsif ($_ eq 'update') {
|
||||||
|
|
||||||
|
if ($report && $cal_date_comp >= $now_ccyymmdd && $event_sys_id ne "none") {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $field = "update_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
$val = &common_min_form_checkbox_col($field,'') ;
|
||||||
|
# $val .= qq~<span id="update_history_$id\_$event_sys_id\_$sys_day_cnt" style="display:none;"></span>~ ; #
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#selectCalibration_status_$id\_$event_sys_id\_$sys_day_cnt,#selectCalibrator_id_$id\_$event_sys_id\_$sys_day_cnt,#selectHead_operator_$id\_$event_sys_id\_$sys_day_cnt").change(function () {
|
||||||
|
\$("#checkboxUpdate_$id\_$event_sys_id\_$sys_day_cnt").prop("checked",true) ;
|
||||||
|
// \$("#update_history_$id\_$event_sys_id\_$sys_day_cnt").text("1") ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$val = '' ;
|
||||||
|
}
|
||||||
|
$formatting = $format91 ;
|
||||||
|
} elsif ($_ eq 'date_payable') {
|
||||||
|
my $field = "date_payable_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
|
||||||
|
if ($calibrator_dates_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = $calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt} ;
|
||||||
|
$val_min = $val ;
|
||||||
|
$val = &common_min_form_input_col($field,"$calibrator_dates_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}") ;
|
||||||
|
} else {
|
||||||
|
$val = &common_min_form_input_col($field,"$cal_date") ;
|
||||||
|
$val_min = $cal_date ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ($_ eq 'amount_payable') {
|
||||||
|
my $field = "amount_payable_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
if ($calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = "Paid" ;
|
||||||
|
$val_min = "None" ;
|
||||||
|
} else {
|
||||||
|
$val = &common_min_form_input_col($field,'500.00') ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("input[name='$field']").change( function () {
|
||||||
|
let input = \$(this).val() ;
|
||||||
|
input = parseFloat(input) ;
|
||||||
|
if (!input) { input = 0 ; }
|
||||||
|
\$(this).val(input.toFixed(2)) ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
$val_min = "500.00" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ($_ eq 'paid') {
|
||||||
|
if ($calibrator_amounts_paid_hash{$id}{$event_sys_id}{$sys_day_cnt}) {
|
||||||
|
$val = '<i class="glyphicons glyphicons-tick"></i>' ;
|
||||||
|
$val_min = "Paid" ;
|
||||||
|
} else {
|
||||||
|
$paid_fields .= qq~$id\_$event_sys_id\_$sys_day_cnt:$cali_cnt,~ ;
|
||||||
|
my $field = "paid_$id\_$event_sys_id\_$sys_day_cnt" ;
|
||||||
|
$val = &common_min_form_checkbox_col($field,'') ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($_ ne 'status' and $_ ne 'calibrator' and $_ ne 'update' and $_ ne 'date_payable' and $_ ne 'amount_payable') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $align>$val</td>~ if $report ;
|
||||||
|
|
||||||
|
# &common_debug("XLSX >>> $event_system_calibration_ids{$id}{$event_sys_id}{$sys_day_cnt} [$id] [$event_sys_id] [$sys_day_cnt] [$field]") ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# next if $i{calibration_status} ne 'all' and $i{calibration_status} and $i{calibration_status} ne $db{event_systems}{$event_sys_id}{calibration_status} ;
|
||||||
|
# next if $i{calibrator_id} ne 'all' and $i{calibrator_id} and $i{calibrator_id} ne $db{event_systems}{$event_sys_id}{calibrator_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# \$("#itv-table tr th:nth-last-child(1)").css("width","0%") ;
|
||||||
|
# \$("#itv-table tr th:nth-last-child(1)").css("display","none") ;
|
||||||
|
|
||||||
|
if (!$found_editable && !$for_payments) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#itv-table").find("th:last").remove() ;
|
||||||
|
\$("#itv-table tr").each(function() {
|
||||||
|
\$(this).find("td:last").remove() ;
|
||||||
|
}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10);
|
||||||
|
$worksheet{$ws}->set_column(1,1,30);
|
||||||
|
$worksheet{$ws}->set_column(2,2,15);
|
||||||
|
$worksheet{$ws}->set_column(3,3,5);
|
||||||
|
$worksheet{$ws}->set_column(4,5,13);
|
||||||
|
$worksheet{$ws}->set_column(6,6,30);
|
||||||
|
$worksheet{$ws}->set_column(7,7,8);
|
||||||
|
$worksheet{$ws}->set_column(8,10,30);
|
||||||
|
$worksheet{$ws}->set_column(11,12,15);
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('L',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub calibration_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{none} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{none} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
159
libs/modules/_FromProd/v1.0/cfg.pm
Normal file
159
libs/modules/_FromProd/v1.0/cfg.pm
Normal file
|
|
@ -0,0 +1,159 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
require cfg_paths ;
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$useropts{domain} = "https://$ENV{SERVER_NAME}" ;
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
use session ;
|
||||||
|
&check_session ;
|
||||||
|
&session_state ;
|
||||||
|
&config_set_vars;
|
||||||
|
&check_access;
|
||||||
|
&config_set_paths ;
|
||||||
|
&config_set_breadcrumbs ;
|
||||||
|
&config_common_html ;
|
||||||
|
# &check_ticket_inbox ;
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub check_ticket_inbox {
|
||||||
|
|
||||||
|
# return unless $useropts{super}{$username} || $useropts{boss}{$username} || $useropts{it}{$username} ;
|
||||||
|
|
||||||
|
my $xtra_sql_where = (!$useropts{super}{$username} && !$useropts{boss}{$username} && !$useropts{it}{$username} && !$useropts{tickets}{$username}) ? " AND staff_id = '$userid'" : '' ;
|
||||||
|
|
||||||
|
&db_min_ro('tickets','COUNT(unique_id) AS ActiveTickets',"completed = '0' AND responded = '0'$xtra_sql_where",'','') ;
|
||||||
|
|
||||||
|
foreach my $count (keys %{$db{tickets}}) {
|
||||||
|
our $activetickets = "$db{tickets}{$count}{ActiveTickets}" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub session_state {
|
||||||
|
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/index.pl/gi) { return ; }
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/cron/gi) { return ; }
|
||||||
|
if ($ENV{SCRIPT_NAME} =~ m/get/gi) { return ; }
|
||||||
|
|
||||||
|
unless ($session_state eq 'active') { print 'Status: 302 Moved', "\r\n", "Location: https://$ENV{SERVER_NAME}/", "\r\n\r\n" ; }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub config_session_state {
|
||||||
|
|
||||||
|
# if ($ENV{SCRIPT_NAME} eq '/index.pl') { return ; }
|
||||||
|
# if (($ENV{SCRIPT_NAME} =~ m/admin/g) or ($skip_relocate)) { $skip_relocate = 1 ; return ; }
|
||||||
|
|
||||||
|
# if (($session_state eq 'expired') or ($session_state eq 'empty')) {
|
||||||
|
# print 'Status: 302 Moved', "\r\n", "Location: http://$ENV{SERVER_NAME}/", "\r\n\r\n" ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub check_access {
|
||||||
|
|
||||||
|
# return unless $pixellot_limit{$username} || $events_limit{$username} || $is_operator || $usertype eq 'external' || $usertype eq 'schools_manager' ;
|
||||||
|
return if $glod_user_level >= 5 ;
|
||||||
|
|
||||||
|
# my $path_prefix_ = '/cgi-bin/scripts/' ;
|
||||||
|
my $path_prefix_ = $useropts{'scripts'} . '/' ;
|
||||||
|
|
||||||
|
if ($events_limit{$username} || $glod_user_level >= 4){
|
||||||
|
$exempt_script{$path_prefix_ . 'costings_detailed_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'costings_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'events_detailed_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'events_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'operators_summary_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'operators_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'pdf/event_quote_pdf.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'stock_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'cameras.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
$exempt_script{$path_prefix_ . 'cameras_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
$exempt_script{$path_prefix_ . 'delivered_report.pl'} = 1 if ($pixellot_limit{$username} || $events_limit{$username}) ;
|
||||||
|
|
||||||
|
$exempt_query{''} = 1 ;
|
||||||
|
$exempt_query{'list'} = 1 ;
|
||||||
|
|
||||||
|
if ($glod_user_level > 0) {
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calendar.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_db_cal_events.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'fixed_systems_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/events.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_report_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'calibration_status_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/calibration_status_report_uploads.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_logistics_item.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_poc.pl'} = 1 ;
|
||||||
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level > 1) {
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'event_quotes_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_event_quote_conflicts_test.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_venues_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_cities_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_delete_attach.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_roe.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_city.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_school.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_sport_type.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_club.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/add_operator.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/event_email.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'dialog/email.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'pdf/event_details_pdf.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_poc_or_recipient_contact_nr.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_country_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_region_country_from_client.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_client.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_regions_from_country.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_sss_teams_from_region.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_region_from_city.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'get/get_country_and_region_from_city.pl'} = 1 ;
|
||||||
|
# $exempt_script{$path_prefix_ . 'get/get_cities_from_country.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'set_up_groups_report.pl'} = 1 ;
|
||||||
|
|
||||||
|
$exempt_query{$ENV{QUERY_STRING}} = 1 ;
|
||||||
|
$exempt_query{'edit'} = 1 ;
|
||||||
|
$exempt_query{'add'} = 1 ;
|
||||||
|
$exempt_query{'view'} = 1 ;
|
||||||
|
$exempt_query{'copy'} = 1 ;
|
||||||
|
$exempt_query{'search'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($glod_user_level > 2) {
|
||||||
|
$exempt_script{$path_prefix_ . 'operators.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'monitoring_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'temp_calibrator_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'mobile_site_surveys_report.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'mobile_system_tracking_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($usertype eq 'support') {
|
||||||
|
$exempt_script{$path_prefix_ . 'demos.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_dcb_partner) {
|
||||||
|
%exempt_script = () ;
|
||||||
|
$exempt_script{$path_prefix_ . 'index.pl'} = 1 ;
|
||||||
|
$exempt_script{$path_prefix_ . 'logistics_report.pl'} = 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($exempt_script{$ENV{SCRIPT_NAME}}) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
||||||
|
unless ($exempt_query{$ENV{QUERY_STRING}} || length($ENV{QUERY_STRING}) > 10) { print "Content-type: text/html\n\n"; require '401.pm' ; exit ; }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
246
libs/modules/_FromProd/v1.0/cfg_paths.pm
Normal file
246
libs/modules/_FromProd/v1.0/cfg_paths.pm
Normal file
|
|
@ -0,0 +1,246 @@
|
||||||
|
sub config_set_vars {
|
||||||
|
|
||||||
|
# $useropts{title} = 'AI Sport Africa Admin | ' . ucfirst $username ;
|
||||||
|
# $title = $useropts{title} ;
|
||||||
|
|
||||||
|
$useropts{acronym} = 'AISA' ;
|
||||||
|
$useropts{short} = 'AI Sport Africa' ;
|
||||||
|
$useropts{title} = ($env eq 'DEV') ? "*DEV* " : '' ;
|
||||||
|
$useropts{title} .= "$useropts{short} Admin | " . ucfirst $username ;
|
||||||
|
$title = $useropts{title} ;
|
||||||
|
$useropts{salt} = '1Tv4dM1n' ;
|
||||||
|
$useropts{company} = "$useropts{short} (Pty) Ltd" ;
|
||||||
|
$useropts{lc} = lc $useropts{acronym} ;
|
||||||
|
# $useropts{logo} = 'itv_logo.jpg' ;
|
||||||
|
$useropts{logo} = 'aisa_logo.jpg' ;
|
||||||
|
$useropts{domainpart} = 'itvadmin' ;
|
||||||
|
$useropts{table_id} = 'itv-table' ;
|
||||||
|
$useropts{web} = 'itvadmin.co.za' ;
|
||||||
|
$useropts{address1} = '16 Wessel Road, Unit 3' ;
|
||||||
|
$useropts{address2} = 'Eden Gardens' ;
|
||||||
|
$useropts{address3} = 'Rivonia' ;
|
||||||
|
$useropts{city} = 'Johannesburg' ;
|
||||||
|
$useropts{post_code} = '2128' ;
|
||||||
|
# $useropts{cell} = '+27 83 653 9151' ;
|
||||||
|
$useropts{tel} = '+27 10 534 7011' ;
|
||||||
|
$useropts{vat_nr} = '4280292691' ;
|
||||||
|
$useropts{co_reg} = '2020/535585/07' ;
|
||||||
|
$useropts{email} = 'info@aisport.africa' ;
|
||||||
|
# $useropts{linkcolor} = '#0092dc' ;
|
||||||
|
# $useropts{infocolor} = '#039deb' ;
|
||||||
|
# $useropts{primarycolor} = '#00559b' ;
|
||||||
|
# $useropts{pdfcolor} = '#0098e3' ;
|
||||||
|
|
||||||
|
$useropts{boss}{'vivian'} = 1 ;
|
||||||
|
$useropts{boss}{'shaun'} = 1 ;
|
||||||
|
$useropts{boss}{'rory'} = 1 ;
|
||||||
|
|
||||||
|
$useropts{super}{'rory'} = 1 ;
|
||||||
|
$useropts{super}{'handre'} = 1 ;
|
||||||
|
$useropts{super}{'vivian'} = 1 ;
|
||||||
|
$useropts{super}{'shaun'} = 1 ;
|
||||||
|
|
||||||
|
# $useropts{tickets}{'dom'} = 1 ;
|
||||||
|
# $useropts{tickets}{'erin'} = 1 ;
|
||||||
|
# $useropts{tickets}{'cristy'} = 1 ;
|
||||||
|
|
||||||
|
$useropts{it}{'rory'} = 1 ;
|
||||||
|
$useropts{it}{'handre'} = 1 ;
|
||||||
|
$useropts{it}{'jean'} = 1 ;
|
||||||
|
|
||||||
|
$pixellot_limit{'connor'} = 1 ;
|
||||||
|
|
||||||
|
$events_limit{$username} = 1 if ($usertype eq 'nonquote');
|
||||||
|
|
||||||
|
our $glod_user_level = ($usertype eq 'manager' || $usertype eq 'senior_manager' || $usertype eq 'it') ? 5 : 0 ; # max
|
||||||
|
|
||||||
|
our $is_installation_partner = ($usertype eq 'installation_partner') ? 1 : 0 ;
|
||||||
|
our $is_dcb_partner = ($usertype eq 'dcb_partner') ? 1 : 0 ;
|
||||||
|
our $is_schools_manager = ($usertype eq 'schools_manager') ? 1 : 0 ;
|
||||||
|
our $is_operator = (substr($usertype,0,6) eq 'casual') ? 1 : 0 ;
|
||||||
|
our $is_temp_calibrator = ($usertype eq 'casual_calibrator') ? 1 : 0 ;
|
||||||
|
our $operator_level = ($is_operator && (substr($usertype,-1,1) eq 'a' || substr($usertype,-10,10) eq 'calibrator')) ? 1 : ($is_operator && substr($usertype,-1,1) eq 'b') ? 2 : ($is_operator && substr($usertype,-1,1) eq 'c') ? 3 : 0 ;
|
||||||
|
|
||||||
|
if ($is_operator && $operator_level) {
|
||||||
|
$glod_user_level = $operator_level ;
|
||||||
|
} elsif ($usertype eq 'external' || $usertype eq 'installation_partner' || $usertype eq 'dcb_partner') {
|
||||||
|
$glod_user_level = 1 ;
|
||||||
|
} elsif ($usertype eq 'schools_manager' || $usertype eq 'support') {
|
||||||
|
$glod_user_level = 2 ;
|
||||||
|
# } elsif ($events_limit{$username} || $usertype eq 'permanent' || $username eq 'cristy' || $username eq 'dom') {
|
||||||
|
} elsif ($events_limit{$username} || $usertype eq 'permanent') {
|
||||||
|
$glod_user_level = 4 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
our $smtp_server = 'smtp.interactivetvafrica.com';
|
||||||
|
$email_add{'tickets'} = 'tickets@interactivetvafrica.com' ;
|
||||||
|
our $send_mail_psw = 'vf1VBE6AGuPE' ;
|
||||||
|
$email_add{'events'} = 'events@interactivetvafrica.com' ;
|
||||||
|
our $send_mail_psw_events = 'ickxadYgbZ)X' ;
|
||||||
|
our $email_reply_to = 'marizen@aisport.africa' ;
|
||||||
|
our %email_events = () ;
|
||||||
|
$email_events{1} = 'marizen@aisport.africa' ;
|
||||||
|
$email_events{2} = 'cristy@aisport.africa' ;
|
||||||
|
$email_events{3} = 'dom@aisport.africa' ;
|
||||||
|
$email_events{4} = 'erin@aisport.africa' ;
|
||||||
|
$email_events{5} = 'techsupport@aisport.africa' ;
|
||||||
|
$email_events{6} = 'dan@aisport.africa' ;
|
||||||
|
$email_events{7} = 'mitheel@aisport.africa' ;
|
||||||
|
$email_events{8} = 'mikhaar@aisport.africa' ;
|
||||||
|
$email_events{9} = 'daniel@aisport.africa' ;
|
||||||
|
# $email_events{10} = 'events@kre8it.co.za' ;
|
||||||
|
our $email_it_1 = 'rory@kre8it.co.za' ;
|
||||||
|
our $email_it_2 = 'handre@kre8it.co.za' ;
|
||||||
|
our $email_accounts = 'viv@aisport.africa' ;
|
||||||
|
|
||||||
|
our $afrihost_smtp = 'mail.aisport.africa';
|
||||||
|
our $afrihost_psw = 'Events@2025' ;
|
||||||
|
our $afrihost_port = 465 ;
|
||||||
|
our $afrihost_from = 'events@aisport.africa' ;
|
||||||
|
|
||||||
|
our $gmail_smtp = 'smtp.googlemail.com';
|
||||||
|
our $gmail_psw = 'AISA@Events1+' ;
|
||||||
|
our $gmail_port = 465 ;
|
||||||
|
our $gmail_from = 'aisportafrica@gmail.com' ;
|
||||||
|
|
||||||
|
our ($subdomain,$domain,$ext) = split(/\./,$ENV{SERVER_NAME}) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub config_set_paths {
|
||||||
|
|
||||||
|
# $cgipath = "/home/libs" ;
|
||||||
|
# $htmlpath = "/var/www/html" ;
|
||||||
|
# $htmlpath_sss = "/var/www/sssadmin.co.za/public_html" ;
|
||||||
|
|
||||||
|
# $useropts{'scripts'} = '/cgi-bin/scripts';
|
||||||
|
$useropts{'folder'} = '';
|
||||||
|
|
||||||
|
$useropts{'js'} = '/js' ;
|
||||||
|
$useropts{'css'} = '/css' ;
|
||||||
|
$useropts{'img'} = '/img' ;
|
||||||
|
$useropts{'fonts'} = '/fonts' ;
|
||||||
|
$useropts{'bower_components'} = '/bower_components' ;
|
||||||
|
$useropts{'mail'} = '/mail' ;
|
||||||
|
|
||||||
|
$mailpath = "$cgipath/data/mail" ;
|
||||||
|
|
||||||
|
our $mysqlbakpath = "/home/mysqlbak";
|
||||||
|
|
||||||
|
our $pdfpath = $htmlpath . '/pdf' ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub config_common_html {
|
||||||
|
|
||||||
|
# .controls .form-control { height:24px; } .chosen-container { position:relative;max-width:100%; }
|
||||||
|
|
||||||
|
# ---------------- spacelab --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# $useropts{'common'}{'css'} = qq(tbody tr td { font-size: 11px; }
|
||||||
|
# .control-label { font-size:12px; } .controls .form-control { height:24px;font-size:12px; } .controls span.input-group-addon { padding:0px 5px 0px 5px;font-size:12px; } textarea.form-control { font-size:12px; } .chosen-container { position:relative;max-width:100%; } .controls table { font-size:12px; }
|
||||||
|
# .waybill-dialog .modal-dialog { width: 94%; }
|
||||||
|
# .medium-dialog .modal-dialog { width: 76%; }
|
||||||
|
# .table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#EAEAEA}
|
||||||
|
# label { margin-top:5px; }
|
||||||
|
# form-control{ padding:8px 12px; }
|
||||||
|
# ) ;
|
||||||
|
|
||||||
|
# ---------------- darkly ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
our $main_bg_color = ($env eq 'DEV') ? 'red' : '#5e5e5e' ;
|
||||||
|
|
||||||
|
$useropts{'common'}{'css'} = qq~tbody tr td { font-size: 11px; }
|
||||||
|
.control-label { font-size:12px; } .controls .form-control { height:24px;font-size:12px; } .controls span.input-group-addon { padding:0px 5px 0px 5px;font-size:12px; } textarea.form-control { font-size:12px; } .chosen-container { position:relative;max-width:100%; }
|
||||||
|
.controls table { font-size:12px; }
|
||||||
|
.label { font-size:12px; }
|
||||||
|
.fc-event { font-size:12px; }
|
||||||
|
.form-control, input, textarea { border: 1px solid #AAAAAA; }
|
||||||
|
.max-dialog .modal-dialog { width: 99%; }
|
||||||
|
.waybill-dialog .modal-dialog { width: 94%; }
|
||||||
|
.medium-dialog .modal-dialog { width: 76%; }
|
||||||
|
.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#EAEAEA; color:#222222; }
|
||||||
|
.table-striped>tbody>tr:nth-child(even)>td,.table-striped>tbody>tr:nth-child(even)>th{ background-color:#a4a2a2; color:#ffffff; }
|
||||||
|
.table-striped>tbody>tr:nth-child(odd)>td a:not(.btn) { text-decoration: none; color: #708399; font-weight: bold; }
|
||||||
|
.table-striped>tbody>tr:nth-child(even)>td a:not(.btn) { text-decoration: none; color: #708399; }
|
||||||
|
.chosen-container, .help-block { color:#222222; }
|
||||||
|
label { margin-top:5px; }
|
||||||
|
form-control{ padding:8px 12px; }
|
||||||
|
.box-header { background: #5e5e5e ; }
|
||||||
|
.modal-body, .modal-footer { background-color: #ffffff ; border-top: 1px solid #ffffff; }
|
||||||
|
.modal-header { border-bottom: 1px solid #ffffff; }
|
||||||
|
.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}
|
||||||
|
hr { border-top: 2px solid #5e5e5e; }
|
||||||
|
body { background-color:#ffffff; color:#222222; }
|
||||||
|
.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}
|
||||||
|
.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}
|
||||||
|
.ffinline { display:inline-block; }
|
||||||
|
.form-control { height:12px;padding:2px 8px;font-size:12px; }
|
||||||
|
.search-query { height: 35px; padding: 10px 15px; font-size: 13px; width: 75%; margin-top: 4px; }
|
||||||
|
.alert-info a { color:#80BEE8 ;}
|
||||||
|
.alert-info a:hover { color:#ffffff;text-decoration:none;}
|
||||||
|
th.dt-center, td.dt-center { text-align: center; }
|
||||||
|
th.dt-right, td.dt-right { text-align: right; }
|
||||||
|
#atalist .form-control,#spinvlist .form-control,#clientvatlist .form-control,#clientinvlist .form-control,#storagelist .form-control { height:25px;padding:2px 5px;font-size:12px;color:#464545; }
|
||||||
|
.saccidate { width: 120px; }
|
||||||
|
.tooltip {white-space:normal}
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$useropts{'common'}{'css'} .= qq~.navbar-default { background-color: $main_bg_color; } .navbar-default .navbar-nav > li > a { color: white; }~ if $env eq 'DEV' ;
|
||||||
|
|
||||||
|
# $useropts{'common'}{'css'} .= qq~
|
||||||
|
# .buttons .glyphicons:before { padding: 0px; }
|
||||||
|
# ~;
|
||||||
|
|
||||||
|
# .search-query { height:43px;padding:10px 15px;font-size:14px;width:70%; }
|
||||||
|
|
||||||
|
my $menu_list_leave = qq(<li><a href="$useropts{'folder'}/list-leave">List Leave</a></li>);
|
||||||
|
my $menu_leave_settings = qq(<li><a href="$useropts{'folder'}/list-leave-settings">Leave Settings</a></li>);
|
||||||
|
my $menu_leave_report = qq(<li><a href="$useropts{'folder'}/leave-report">Leave Report</a></li>);
|
||||||
|
our $menu_leave = '' ;
|
||||||
|
|
||||||
|
my $menu_list_weekend = qq(<li><a href="$useropts{'folder'}/list-weekend">Weekend Work</a></li>);
|
||||||
|
my $menu_weekend_report = qq(<li><a href="$useropts{'folder'}/weekend-report">Weekend Report</a></li>);
|
||||||
|
our $menu_weekend = '' ;
|
||||||
|
|
||||||
|
# if ($useropts{super}{lc $username}){
|
||||||
|
if ($useropts{boss}{lc $username}){
|
||||||
|
$menu_leave = qq(
|
||||||
|
<li class="divider"></li>
|
||||||
|
$menu_list_leave
|
||||||
|
$menu_leave_settings
|
||||||
|
$menu_leave_report
|
||||||
|
);
|
||||||
|
$menu_weekend = qq(
|
||||||
|
<li class="divider"></li>
|
||||||
|
$menu_list_weekend
|
||||||
|
$menu_weekend_report
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$menu_leave = qq(
|
||||||
|
<li class="divider"></li>
|
||||||
|
$menu_leave_report
|
||||||
|
);
|
||||||
|
$menu_weekend = qq(
|
||||||
|
<li class="divider"></li>
|
||||||
|
$menu_list_weekend
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub config_set_breadcrumbs {
|
||||||
|
|
||||||
|
our $curr_crumb = $ENV{REQUEST_URI} ;
|
||||||
|
$curr_crumb =~ s/\///g ;
|
||||||
|
@curr_crumb = split(/\-/,$curr_crumb) ;
|
||||||
|
@curr_crumb_ucf = map(ucfirst, map(lc,@curr_crumb));
|
||||||
|
$curr_crumb = join(' ', @curr_crumb_ucf);
|
||||||
|
|
||||||
|
$useropts{'breadcrumbs'} = qq(<div><ul class="breadcrumb"><li><a href="$useropts{'folder'}/">Home</a></li>$insert_crumbs<li><a href="$useropts{'folder'}$ENV{REQUEST_URI}">$curr_crumb</a></li></ul></div>) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
1912
libs/modules/_FromProd/v1.0/common.pm
Normal file
1912
libs/modules/_FromProd/v1.0/common.pm
Normal file
File diff suppressed because it is too large
Load Diff
3123
libs/modules/_FromProd/v1.0/common_min.pm
Normal file
3123
libs/modules/_FromProd/v1.0/common_min.pm
Normal file
File diff suppressed because it is too large
Load Diff
1428
libs/modules/_FromProd/v1.0/common_test.pm
Normal file
1428
libs/modules/_FromProd/v1.0/common_test.pm
Normal file
File diff suppressed because it is too large
Load Diff
54
libs/modules/_FromProd/v1.0/csv.pm
Normal file
54
libs/modules/_FromProd/v1.0/csv.pm
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
sub csv_create_new_file {
|
||||||
|
|
||||||
|
my ($filepath,$filename,$seperator) = @_ ;
|
||||||
|
|
||||||
|
use Text::CSV;
|
||||||
|
|
||||||
|
return if !$filepath || !$filename ;
|
||||||
|
|
||||||
|
unlink "$filepath/$filename" or die "Cannot remove $filepath/$filename: $!" if -e "$filepath/$filename" ;
|
||||||
|
|
||||||
|
$seperator = ';' unless $seperator ;
|
||||||
|
|
||||||
|
our $csv = Text::CSV->new({ binary => 1, sep_char => $seperator, eol => "\n" }) or die "Cannot use CSV: " . Text::CSV->error_diag();
|
||||||
|
|
||||||
|
open(our $fh, ">", "$filepath/$filename") or die "Cannot open $filepath/$filename: $!";
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_write_in_file {
|
||||||
|
|
||||||
|
my ($row) = @_ ;
|
||||||
|
$csv->print($fh, $row);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_close_file {
|
||||||
|
|
||||||
|
my ($filepath) = @_ ;
|
||||||
|
close $fh or die "Cannot close $filepath: $!";
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub csv_clear_folder {
|
||||||
|
|
||||||
|
my ($path,$name_to_look_for) = @_ ;
|
||||||
|
|
||||||
|
return unless -d $path ;
|
||||||
|
|
||||||
|
opendir(DIR, "$path") or die "cant open Directory $path: $!\n";
|
||||||
|
|
||||||
|
while(defined($folder = readdir(DIR))) {
|
||||||
|
if (length $folder > 2) {
|
||||||
|
my ($file,$type) = split(/\./,$folder) ;
|
||||||
|
if ((-e "$path/$file.csv" && !$name_to_look_for) || ($name_to_look_for && -e "$path/$file.csv" && $file =~ /$name_to_look_for/)) {
|
||||||
|
unlink ("$path/$file.csv") or print "unable to unlink - $path/$file.csv : $!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(DIR) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
98
libs/modules/_FromProd/v1.0/db.pm
Normal file
98
libs/modules/_FromProd/v1.0/db.pm
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
use db_min ;
|
||||||
|
|
||||||
|
sub db_open_ro {
|
||||||
|
|
||||||
|
my ($sys) = @_ ;
|
||||||
|
|
||||||
|
if ($db_ignore_open_close) { return ; }
|
||||||
|
|
||||||
|
my ($db,$dbhost,$dbuser,$dbpass) = &ops_db_credentials($sys) ;
|
||||||
|
|
||||||
|
my $connstr = "DBI:mysql:database=$db;host=$dbhost;" ;
|
||||||
|
|
||||||
|
$dbh = DBI->connect($connstr,$dbuser,$dbpass) or die $DBI::errstr;
|
||||||
|
|
||||||
|
&common_debug("db_open_ro:$connstr") ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_open_upd {
|
||||||
|
|
||||||
|
my ($sys) = @_ ;
|
||||||
|
|
||||||
|
if ($db_ignore_open_close) { return ; }
|
||||||
|
|
||||||
|
my ($db,$dbhost,$dbuser,$dbpass) = &ops_db_credentials($sys) ;
|
||||||
|
|
||||||
|
my $connstr = "DBI:mysql:database=$db;host=$dbhost;" ;
|
||||||
|
|
||||||
|
$dbh = DBI->connect($connstr,$dbuser,$dbpass, { RaiseError => 1, AutoCommit => 1 } ) or die "Unable to connect, $DBI::errstr";
|
||||||
|
$dbh->{LongReadLen} = 1000 ;
|
||||||
|
|
||||||
|
&common_debug("db_open_upd:$connstr") ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_close_conn {
|
||||||
|
|
||||||
|
if ($db_ignore_open_close) { return ; }
|
||||||
|
|
||||||
|
$dbh->disconnect();
|
||||||
|
|
||||||
|
&common_debug('db_close_conn:$dbh->disconnect();') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_switch_conn {
|
||||||
|
|
||||||
|
my ($sys) = @_ ;
|
||||||
|
|
||||||
|
$db_ignore_open_close = 0 ;
|
||||||
|
&db_close_conn ;
|
||||||
|
&db_open_upd($sys) ;
|
||||||
|
$db_ignore_open_close = 1 ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub ops_db_credentials {
|
||||||
|
|
||||||
|
my ($sys) = @_ ;
|
||||||
|
|
||||||
|
my $db = "itv_admin_db";
|
||||||
|
my $dbhost = "localhost";
|
||||||
|
my $dbuser = "itv_admin_user";
|
||||||
|
my $dbpass = '!Ja16Q7P0X3SVTWr';
|
||||||
|
|
||||||
|
if ($env eq 'DEV') {
|
||||||
|
$db = 'dev_aisa' ;
|
||||||
|
$dbhost = 'localhost' ;
|
||||||
|
$dbuser = 'dev_aisa_user' ;
|
||||||
|
$dbpass = 'L0rdJ35u5R31gN51vQow*!' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sys eq 'sss') {
|
||||||
|
$db = "sss_admin_db";
|
||||||
|
$dbhost = "localhost";
|
||||||
|
$dbuser = "sss_admin_user";
|
||||||
|
$dbpass = 'bVrC2kyGJ8ZO0oVe!';
|
||||||
|
|
||||||
|
if ($env eq 'DEV') {
|
||||||
|
$db = 'dev_sss' ;
|
||||||
|
$dbhost = 'localhost' ;
|
||||||
|
$dbuser = 'dev_sss_user' ;
|
||||||
|
$dbpass = 'L0rdJ35u5R31gN51vQow*!' ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($db,$dbhost,$dbuser,$dbpass) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_uniq {
|
||||||
|
|
||||||
|
my %seen;
|
||||||
|
grep !$seen{$_}++, @_;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
269
libs/modules/_FromProd/v1.0/db_min.pm
Normal file
269
libs/modules/_FromProd/v1.0/db_min.pm
Normal file
|
|
@ -0,0 +1,269 @@
|
||||||
|
sub db_min_upd {
|
||||||
|
|
||||||
|
my ($table,$where) = @_ ;
|
||||||
|
|
||||||
|
our $set = '' ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
if (substr($_,0,3) eq 'new') { next ; }
|
||||||
|
if ($ignore{$_}) { next ; }
|
||||||
|
if ($hidden{$_} == 1) { next ; }
|
||||||
|
if ($i{$_} =~ /\"/) { $set .= qq(`$_`='$i{$_}',) ; } elsif ($i{$_} eq 'NULL') { $set .= qq(`$_`=$i{$_},) ; } else { $set .= qq(`$_`="$i{$_}",) ; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$set = substr($set,0,-1) ;
|
||||||
|
|
||||||
|
unless ($set) { return ; }
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(UPDATE $table SET $set WHERE $where) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY SAVED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_insert {
|
||||||
|
|
||||||
|
my ($table) = @_ ;
|
||||||
|
|
||||||
|
my $columns = '' ;
|
||||||
|
my $values = '' ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
if ($ignore{$_}) { next ; }
|
||||||
|
if ($hidden{$_} == 1) { next ; }
|
||||||
|
$columns .= qq(`$_`,) ;
|
||||||
|
if ($i{$_} =~ /\"/) { $values .= qq('$i{$_}',) ; } elsif ($i{$_} eq 'NULL') { $values .= qq(`$_`=$i{$_},) ; } else { $values .= qq("$i{$_}",) ; }
|
||||||
|
}
|
||||||
|
|
||||||
|
$columns = substr($columns,0,-1) ;
|
||||||
|
$values = substr($values,0,-1) ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(INSERT INTO $table ($columns) VALUES ($values) ;) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
our $new_row_id = $dbh->last_insert_id(undef, undef, $table, 'id') ; # or die "no insert id?";
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY SAVED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_delete {
|
||||||
|
|
||||||
|
my ($table,$where) = @_ ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
my $sql = qq(DELETE FROM $table WHERE $where) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($i{id} SUCCESSFULLY DELETED) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_ro {
|
||||||
|
|
||||||
|
my ($table,$select,$where,$orderby,$limit) = @_ ;
|
||||||
|
|
||||||
|
if ($where) { $where = 'WHERE ' . $where ; }
|
||||||
|
if ($limit) { $limit = 'LIMIT ' . $limit ; }
|
||||||
|
if ($orderby) { $orderby = 'ORDER BY ' . $orderby ; }
|
||||||
|
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
my $sql = qq(SELECT $select FROM $table $where $orderby $limit) ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
$col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
my $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$db{$table} = () ; $done_col_val{$table} = () ;
|
||||||
|
|
||||||
|
foreach $row (@$rows_array_ref) {
|
||||||
|
for (0 .. $col_cnt){
|
||||||
|
if ($done_col_val{$table}{@$row[0]}{$col_name{$_}}) { next; }
|
||||||
|
# &common_debug("db_common_ro - [$_] [$table] [@$row[0]] [$col_name{$_}] [@$row[$_]]") ;
|
||||||
|
$db{$table}{@$row[0]}{$col_name{$_}} = @$row[$_] ;
|
||||||
|
$done_col_val{$table}{@$row[0]}{$col_name{$_}} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_raw {
|
||||||
|
|
||||||
|
my ($sql) = @_ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username}) { &common_debug(">>>>>> *** TESTING, DB NOT UPDATED *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth->execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
our $col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
our $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_copy {
|
||||||
|
|
||||||
|
my ($table,$id) = @_ ;
|
||||||
|
|
||||||
|
&db_open_upd ;
|
||||||
|
|
||||||
|
our $db_ignore_open_close = 1 ; # do one open and one close instead of repeating it
|
||||||
|
|
||||||
|
$i{id} = &db_min_get_max($table,'id') ;
|
||||||
|
|
||||||
|
my $add_upd_sql = '' ;
|
||||||
|
if ($table eq 'quotes' or $table eq 'event_quotes'){
|
||||||
|
$i{quote_nr} = &db_min_get_max($table,'quote_nr') ;
|
||||||
|
$add_upd_sql = qq~, `quote_nr`='$i{quote_nr}'~;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($table eq 'cameras'){
|
||||||
|
$i{camera_nr} = &db_min_get_max_camera_nr($table,'camera_nr',$id) ;
|
||||||
|
$add_upd_sql = qq~, `camera_nr`='$i{camera_nr}'~;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $sql = qq~CREATE TEMPORARY TABLE `#temp` SELECT * FROM $table WHERE `id`='$id';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~UPDATE `#temp` SET `id`='$i{id}'$add_upd_sql WHERE `id`='$id';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~INSERT INTO $table SELECT * FROM `#temp` WHERE `id`='$i{id}';~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$sql = qq~DROP TEMPORARY TABLE IF EXISTS `#temp`;~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
$sth = $dbh -> do ($sql) or die "could not execute :<BR>$sql<BR>$!" ;
|
||||||
|
|
||||||
|
$db_ignore_open_close = 0 ; # do one open and one close instead of repeating it
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
$success = qq($id SUCCESSFULLY COPIED TO $i{id}) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_get_max_camera_nr {
|
||||||
|
|
||||||
|
my ($table,$orderby,$camera_id) = @_ ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'id,camera_system_id',"`id`='$camera_id'",'','') ;
|
||||||
|
# &db_min_ro($table,'id,camera_nr',"`camera_system_id`='$db{$table}{$camera_id}{camera_nr}'",'`id` DESC',1) ;
|
||||||
|
&db_min_ro($table,'id,camera_nr',"`camera_system_id`='$db{$table}{$camera_id}{camera_system_id}'",'`id` DESC',1) ;
|
||||||
|
|
||||||
|
my $max_cam_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{$table}}) {
|
||||||
|
($cam_type,$cam_cnt) = split(/\-/,$db{$table}{$id}{camera_nr});
|
||||||
|
$max_cam_cnt = $cam_cnt unless $max_cam_cnt > $cam_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_cam_cnt++;
|
||||||
|
|
||||||
|
my $camera_nr = $cam_type . '-' . sprintf("%04s", $max_cam_cnt) ; # e.g. S1-0001
|
||||||
|
|
||||||
|
return ($camera_nr) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub db_min_get_max {
|
||||||
|
|
||||||
|
my ($table,$orderby,$where) = @_ ;
|
||||||
|
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
if ($where) { $where = 'WHERE ' . $where ; }
|
||||||
|
|
||||||
|
my $sql = qq~SELECT * FROM $table $where ORDER BY $orderby DESC LIMIT 1~ ;
|
||||||
|
|
||||||
|
&common_debug($sql) ;
|
||||||
|
|
||||||
|
my $sth = $dbh->prepare($sql) ;
|
||||||
|
|
||||||
|
$sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!";
|
||||||
|
|
||||||
|
$col_cnt=0;
|
||||||
|
|
||||||
|
foreach $col (@{$sth->{NAME}}) { $col_name{$col_cnt}=$col; $col_cnt++; } # &common_debug($col); NB *** must be before fetchall_arrayref
|
||||||
|
|
||||||
|
my $rows_array_ref = $sth->fetchall_arrayref();
|
||||||
|
|
||||||
|
$sth->finish();
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
my $new_id = 1 ;
|
||||||
|
|
||||||
|
$db{$table} = () ;
|
||||||
|
|
||||||
|
foreach $row (@$rows_array_ref) {
|
||||||
|
for (0 .. $col_cnt){
|
||||||
|
$db{$table}{@$row[0]}{$col_name{$_}} = @$row[$_] ;
|
||||||
|
}
|
||||||
|
$new_id = $db{$table}{@$row[0]}{$orderby} ;
|
||||||
|
$new_id++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($new_id) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
525
libs/modules/_FromProd/v1.0/dcb.pm
Normal file
525
libs/modules/_FromProd/v1.0/dcb.pm
Normal file
|
|
@ -0,0 +1,525 @@
|
||||||
|
|
||||||
|
sub dcb_trackntrace {
|
||||||
|
|
||||||
|
my ($waybillNumber) = @_ ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<TracknTrace xmlns="http://tempuri.org/">
|
||||||
|
<!-- Optional -->
|
||||||
|
<request>
|
||||||
|
<enPassword xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></enPassword>
|
||||||
|
<enUsername xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></enUsername>
|
||||||
|
<waybillNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybillNumber</waybillNumber>
|
||||||
|
</request>
|
||||||
|
</TracknTrace>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_trackntrace : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('TracknTrace') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('TracknTrace') ;
|
||||||
|
|
||||||
|
# $returnxml = qq~<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <s:Body>
|
||||||
|
# <TracknTraceResponse xmlns="http://tempuri.org/">
|
||||||
|
# <TracknTraceResult xmlns:a="http://schemas.datacontract.org/2004/07/OMSIntegrate.Response" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
# <a:ErrorCode i:nil="true"/>
|
||||||
|
# <a:ErrorMessage>Completed</a:ErrorMessage>
|
||||||
|
# <a:Waybill>
|
||||||
|
# <a:BookingDate/>
|
||||||
|
# <a:Comments i:nil="true"></a:Comments>
|
||||||
|
# <a:ConsigneeName>DEV</a:ConsigneeName>
|
||||||
|
# <a:ConsignorName>DARREN</a:ConsignorName>
|
||||||
|
# <a:CurrentStatus>Proof of delivery</a:CurrentStatus>
|
||||||
|
# <a:DeliveryDate>08052023</a:DeliveryDate>
|
||||||
|
# <a:InsuredValue>0.00</a:InsuredValue>
|
||||||
|
# <a:NumberOfParcels>1</a:NumberOfParcels>
|
||||||
|
# <a:ReceiverAddressLine1>15 SIM ROAD</a:ReceiverAddressLine1>
|
||||||
|
# <a:ReceiverAddressLine2>.</a:ReceiverAddressLine2>
|
||||||
|
# <a:ReceiverCity>KEMPTON PARK</a:ReceiverCity>
|
||||||
|
# <a:ReceiverContactName>DARREN</a:ReceiverContactName>
|
||||||
|
# <a:ReceiverContactTel1>0834752596</a:ReceiverContactTel1>
|
||||||
|
# <a:ReceiverName i:nil="true">ReceiverName TESTING</a:ReceiverName>
|
||||||
|
# <a:ReceiverPostalCode>1619</a:ReceiverPostalCode>
|
||||||
|
# <a:ReceiverSuburb>POMONA</a:ReceiverSuburb>
|
||||||
|
# <a:SenderAddressLine1></a:SenderAddressLine1>
|
||||||
|
# <a:SenderAddressLine2>.</a:SenderAddressLine2>
|
||||||
|
# <a:SenderCity>KEMPTON PARK</a:SenderCity>
|
||||||
|
# <a:SenderContactName>DEV</a:SenderContactName>
|
||||||
|
# <a:SenderContactTel>0112302085</a:SenderContactTel>
|
||||||
|
# <a:SenderPostalCode>1619</a:SenderPostalCode>
|
||||||
|
# <a:SenderSuburb>POMONA</a:SenderSuburb>
|
||||||
|
# <a:ServiceTypeCode>EC</a:ServiceTypeCode>
|
||||||
|
# <a:ShipmentIsInsured>YES</a:ShipmentIsInsured>
|
||||||
|
# <a:ShipperReference/>
|
||||||
|
# <a:accNr>DCBDEVLP</a:accNr>
|
||||||
|
# <a:additionalInformation xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
# <b:AdditionalInformation>
|
||||||
|
# <b:additionalInfoCode>overrideDefaultSubcontractor</b:additionalInfoCode>
|
||||||
|
# <b:additionalInfoValue>no</b:additionalInfoValue>
|
||||||
|
# <b:waybillNumber>Dn230505</b:waybillNumber>
|
||||||
|
# </b:AdditionalInformation>
|
||||||
|
# </a:additionalInformation>
|
||||||
|
# <a:pod xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities"/>
|
||||||
|
# <a:trackingDetail xmlns:b="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
# <b:TrackingDetail>
|
||||||
|
# <b:eventCode>PODCRE</b:eventCode>
|
||||||
|
# <b:eventDate>09052023</b:eventDate>
|
||||||
|
# <b:eventDescription>Waybill has been PODed</b:eventDescription>
|
||||||
|
# <b:eventHubCode>JNB</b:eventHubCode>
|
||||||
|
# <b:eventTime>0719</b:eventTime>
|
||||||
|
# </b:TrackingDetail>
|
||||||
|
# <b:TrackingDetail>
|
||||||
|
# <b:eventCode>WBLCRE</b:eventCode>
|
||||||
|
# <b:eventDate>05052023</b:eventDate>
|
||||||
|
# <b:eventDescription>Waybill Dn230505 created in import</b:eventDescription>
|
||||||
|
# <b:eventHubCode>JNB</b:eventHubCode>
|
||||||
|
# <b:eventTime>0718</b:eventTime>
|
||||||
|
# </b:TrackingDetail>
|
||||||
|
# </a:trackingDetail>
|
||||||
|
# <a:waybillDate>05052023</a:waybillDate>
|
||||||
|
# <a:waybillNumber>Dn230505</a:waybillNumber>
|
||||||
|
# </a:Waybill>
|
||||||
|
# </TracknTraceResult>
|
||||||
|
# </TracknTraceResponse>
|
||||||
|
# </s:Body>
|
||||||
|
# </s:Envelope>~ ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_postalcode {
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<PostalCode xmlns="http://tempuri.org/">
|
||||||
|
<request>
|
||||||
|
<PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
<Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
</request>
|
||||||
|
</PostalCode>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_postalcode : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('PostalCode') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('PostalCode') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_savewabill {
|
||||||
|
|
||||||
|
my ($venue,$ft,$ev_id) = @_ ;
|
||||||
|
|
||||||
|
my $system_loc = $i{"system_location_$ft\_$ev_id"} ;
|
||||||
|
my $supplier = $i{"logistics_supplier_id_$ft\_$ev_id"} ;
|
||||||
|
my $status = $i{"status_$ft\_$ev_id"} ;
|
||||||
|
my $waybill_nr = $i{"waybill_nr_$ft\_$ev_id"} ;
|
||||||
|
my $items = $i{"item_$ft\_$ev_id"} ;
|
||||||
|
my $poc = $i{"poc_$ft\_$ev_id"} ;
|
||||||
|
my $special_instructions = $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
# my $dest = ($ft eq 'to') ? $db{organisations}{$venue}{name} : $db{logistics_locations}{$system_loc}{location} ;
|
||||||
|
# my $orig = ($ft eq 'from') ? $db{organisations}{$venue}{name} : $db{logistics_locations}{$system_loc}{location} ;
|
||||||
|
|
||||||
|
my $dest = ($ft eq 'from') ? $db{logistics_locations}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{organisations}{$venue}{region_code} ;
|
||||||
|
my $orig = ($ft eq 'to') ? $db{logistics_locations}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{organisations}{$venue}{region_code} ;
|
||||||
|
|
||||||
|
my ($poc_name,$poc_nr) = split(/\_/,$poc) ;
|
||||||
|
|
||||||
|
if ($dest =~ /ITV/) { $dest =~ s/\ITV//g ; $dest =~ s/ //g ; }
|
||||||
|
elsif ($orig =~ /ITV/) { $orig =~ s/\ITV//g ; $orig =~ s/ //g ; }
|
||||||
|
|
||||||
|
# my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31F' ;
|
||||||
|
my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31' ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<soap:Body>
|
||||||
|
<savewabill xmlns="http://tempuri.org/">
|
||||||
|
<!-- Optional -->
|
||||||
|
<request>
|
||||||
|
<AccNr xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$accountnumber</AccNr>
|
||||||
|
<AddressLine1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address1</AddressLine1>
|
||||||
|
<AddressLine2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address2</AddressLine2>
|
||||||
|
<AddressLine3 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address3</AddressLine3>
|
||||||
|
<AddressLine4 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$address4</AddressLine4>
|
||||||
|
<ContactNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$poc_nr</ContactNumber>
|
||||||
|
<ContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$poc_name</ContactPerson>
|
||||||
|
<CustomerReferenceNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request"></CustomerReferenceNumber>
|
||||||
|
<Date xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$dcbdate</Date>
|
||||||
|
<DestHub xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$dest</DestHub>
|
||||||
|
<Number xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybill_nr</Number>
|
||||||
|
<OriginHub xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$orig</OriginHub>
|
||||||
|
<PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
<Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
<Reciever xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$db{organisations}{$venue}{name}</Reciever>
|
||||||
|
<RouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$routeCode</RouteCode>
|
||||||
|
<SpecialInstructions xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$special_instructions</SpecialInstructions>
|
||||||
|
<serviceType xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">1</serviceType>
|
||||||
|
</request>
|
||||||
|
</savewabill>
|
||||||
|
</soap:Body>
|
||||||
|
</soap:Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_savewabill : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('savewabill') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('savewabill') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_upload_oms_waybill {
|
||||||
|
|
||||||
|
my ($venue,$ft,$ev_id) = @_ ;
|
||||||
|
|
||||||
|
my $tbl_log_loc = 'logistics_locations' ;
|
||||||
|
my $tbl_org = 'organisations' ;
|
||||||
|
my $system_loc = $i{"system_location_$ft\_$ev_id"} ;
|
||||||
|
my $supplier = $i{"logistics_supplier_id_$ft\_$ev_id"} ;
|
||||||
|
my $status = $i{"status_$ft\_$ev_id"} ;
|
||||||
|
my $waybill_nr = $i{"waybill_nr_$ft\_$ev_id"} ;
|
||||||
|
my $items = $i{"item_$ft\_$ev_id"} ;
|
||||||
|
my $poc = $i{"poc_$ft\_$ev_id"} ; my ($poc_name,$poc_nr) = split(/\_/,$poc) ;
|
||||||
|
# my $special_instructions = $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
my $start_end = ($ft eq 'from') ? 'end' : 'start' ;
|
||||||
|
my $special_instructions = "Event $start_end : $dcbdate. " . $i{"special_instructions_$ft\_$ev_id"} ;
|
||||||
|
|
||||||
|
$rec{address1} = $address1 ;
|
||||||
|
$rec{address1} .= ', ' if $address1 && $address2 ;
|
||||||
|
$rec{address1} .= $address2 if $address2 ;
|
||||||
|
$rec{address2} = $address3 ;
|
||||||
|
$rec{address2} .= ', ' if $address3 && $address4 ;
|
||||||
|
$rec{address2} .= $address4 if $address4 ;
|
||||||
|
$rec{city} = $city ;
|
||||||
|
$rec{suburb} = $suburb ;
|
||||||
|
$rec{postal_code} = $postal_code ;
|
||||||
|
$rec{poc_name} = $poc_name ;
|
||||||
|
$rec{poc_nr} = $poc_nr ;
|
||||||
|
$rec{name} = $db{$tbl_org}{$venue}{name} ;
|
||||||
|
$rec{routecode} = $routeCode ;
|
||||||
|
|
||||||
|
$send{address1} = $db{$tbl_log_loc}{$system_loc}{address_line_1} ;
|
||||||
|
$send{address1} .= ', ' if $db{$tbl_log_loc}{$system_loc}{address_line_1} && $db{$tbl_log_loc}{$system_loc}{address_line_2} ;
|
||||||
|
$send{address1} .= $db{$tbl_log_loc}{$system_loc}{address_line_2} if $db{$tbl_log_loc}{$system_loc}{address_line_2} ;
|
||||||
|
$send{address2} = $db{$tbl_log_loc}{$system_loc}{address_line_3} ;
|
||||||
|
$send{address2} .= ', ' if $db{$tbl_log_loc}{$system_loc}{address_line_3} && $db{$tbl_log_loc}{$system_loc}{address_line_4} ;
|
||||||
|
$send{address2} .= $db{$tbl_log_loc}{$system_loc}{address_line_4} if $db{$tbl_log_loc}{$system_loc}{address_line_4} ;
|
||||||
|
$send{city} = $db{$tbl_log_loc}{$system_loc}{city} ;
|
||||||
|
$send{suburb} = $db{$tbl_log_loc}{$system_loc}{suburb} ;
|
||||||
|
$send{postal_code} = $db{$tbl_log_loc}{$system_loc}{postal_code} ;
|
||||||
|
$send{poc_name} = $db{$tbl_log_loc}{$system_loc}{poc_name} ;
|
||||||
|
$send{poc_nr} = $db{$tbl_log_loc}{$system_loc}{poc_nr} ;
|
||||||
|
$send{name} = $db{$tbl_log_loc}{$system_loc}{location} ;
|
||||||
|
$send{routecode} = $db{$tbl_log_loc}{$system_loc}{dcb_route_code} ;
|
||||||
|
|
||||||
|
# my $dest = ($ft eq 'from') ? $db{$tbl_log_loc}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{$tbl_log_loc}{$venue}{region_code} ;
|
||||||
|
# my $orig = ($ft eq 'to') ? $db{$tbl_log_loc}{$system_loc}{location} : ($routeCode) ? substr($routeCode,0,3) : $db{$tbl_log_loc}{$venue}{region_code} ;
|
||||||
|
|
||||||
|
if ($ft eq 'from') {
|
||||||
|
foreach (keys %rec) {
|
||||||
|
my $rec = $rec{$_} ;
|
||||||
|
$rec{$_} = $send{$_} ;
|
||||||
|
$send{$_} = $rec ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($dest =~ /ITV/) { $dest =~ s/\ITV//g ; $dest =~ s/ //g ; }
|
||||||
|
# elsif ($orig =~ /ITV/) { $orig =~ s/\ITV//g ; $orig =~ s/ //g ; }
|
||||||
|
|
||||||
|
# our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
# <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <Body>
|
||||||
|
# <UploadOMSWaybill xmlns="http://tempuri.org/">
|
||||||
|
# <request>
|
||||||
|
# <accountNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">DCBMAILBAG</accountNumber>
|
||||||
|
# <numParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$items_cnt</numParcels>~;
|
||||||
|
|
||||||
|
# my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31F' ;
|
||||||
|
my $accountnumber = ($testdcd) ? 'DCBMAILBAG' : 'DI31' ;
|
||||||
|
|
||||||
|
our $soapenvelope = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
<Body>
|
||||||
|
<UploadOMSWaybill xmlns="http://tempuri.org/">
|
||||||
|
<request>
|
||||||
|
<accountNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$accountnumber</accountNumber>
|
||||||
|
<invoices xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">
|
||||||
|
<WaybillInvoices xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
<InvAmount></InvAmount>
|
||||||
|
<InvDescription></InvDescription>
|
||||||
|
<InvNum></InvNum>
|
||||||
|
<InvUnits></InvUnits>
|
||||||
|
<WaybillId>0</WaybillId>
|
||||||
|
</WaybillInvoices>
|
||||||
|
</invoices>
|
||||||
|
<numParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$items_cnt</numParcels>~;
|
||||||
|
|
||||||
|
for my $parcel_cnt (1 .. $items_cnt) {
|
||||||
|
my $parcel_qty = ($db{logistics_items}{$items[$parcel_cnt-1]}{qty}) ? $db{logistics_items}{$items[$parcel_cnt-1]}{qty} : 1 ;
|
||||||
|
my $parcel_desc = ($db{logistics_items}{$items[$parcel_cnt-1]}{name}) ? $db{logistics_items}{$items[$parcel_cnt-1]}{name} : 1 ;
|
||||||
|
$soapenvelope .= qq~
|
||||||
|
<parcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">
|
||||||
|
<WaybillParcels xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Entities">
|
||||||
|
<LoadType>STD</LoadType>
|
||||||
|
<RateType>G</RateType>
|
||||||
|
<WaybillId>0</WaybillId>
|
||||||
|
<breadth>1</breadth>
|
||||||
|
<description>$parcel_desc</description>
|
||||||
|
<height>1</height>
|
||||||
|
<length>1</length>
|
||||||
|
<mass>1</mass>
|
||||||
|
<parcelNumber>$parcel_cnt</parcelNumber>
|
||||||
|
<qty>$parcel_qty</qty>
|
||||||
|
</WaybillParcels>
|
||||||
|
</parcels>~;
|
||||||
|
}
|
||||||
|
|
||||||
|
$soapenvelope .= qq~
|
||||||
|
<recieversAddress1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{address1}</recieversAddress1>
|
||||||
|
<recieversAddress2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{address2}</recieversAddress2>
|
||||||
|
<recieversCity xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{city}</recieversCity>
|
||||||
|
<recieversContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{poc_name}</recieversContactPerson>
|
||||||
|
<recieversContactTel xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{poc_nr}</recieversContactTel>
|
||||||
|
<recieversName xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{name}</recieversName>
|
||||||
|
<recieversPostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{postal_code}</recieversPostalCode>
|
||||||
|
<recieversRouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{routecode}</recieversRouteCode>
|
||||||
|
<recieversSuburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$rec{suburb}</recieversSuburb>
|
||||||
|
<sendersAddress1 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{address1}</sendersAddress1>
|
||||||
|
<sendersAddress2 xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{address2}</sendersAddress2>
|
||||||
|
<sendersCity xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{city}</sendersCity>
|
||||||
|
<sendersContactPerson xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{poc_name}</sendersContactPerson>
|
||||||
|
<sendersContactTelephone xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{poc_nr}</sendersContactTelephone>
|
||||||
|
<sendersName xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{name}</sendersName>
|
||||||
|
<sendersPostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{postal_code}</sendersPostalCode>
|
||||||
|
<sendersRouteCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{routecode}</sendersRouteCode>
|
||||||
|
<sendersSuburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$send{suburb}</sendersSuburb>
|
||||||
|
<serviceType xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">OE</serviceType>
|
||||||
|
<specialInstructions xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$special_instructions</specialInstructions>
|
||||||
|
<waybillNumber xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$waybill_nr</waybillNumber>
|
||||||
|
</request>
|
||||||
|
</UploadOMSWaybill>
|
||||||
|
</Body>
|
||||||
|
</Envelope>~ ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_upload_oms_waybill : [soapenvelope=$soapenvelope]") ;
|
||||||
|
|
||||||
|
&dcb_send_it('UploadOMSWaybill') ;
|
||||||
|
&dcb_parse_it ;
|
||||||
|
&dcb_read_it('UploadOMSWaybill') ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_send_it {
|
||||||
|
|
||||||
|
my ($soapaction) = @_ ;
|
||||||
|
|
||||||
|
my $environment = ($testdcd) ? 'APIUAT' : 'API' ;
|
||||||
|
|
||||||
|
my $header_soapaction = "http://tempuri.org/IOMSIntegrate/$soapaction" ;
|
||||||
|
my $host = "https://dcboms.co.za/$environment/OMSIntegrate.svc" ;
|
||||||
|
|
||||||
|
&common_write_log("dcb/xml_send_$now_year\_$now_mm.log","$now_ccyymmddhrmnsc|$now_ccyy_mm_ddT$now_hh_min_sec|$soapaction|$host|$header_soapaction|$soapenvelope|");
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_send_it : [host=$host]") ;
|
||||||
|
&common_debug("[API] dcb_send_it : [soapaction=$header_soapaction]") ;
|
||||||
|
|
||||||
|
if ($testing == 1 && $useropts{it}{$username} && $soapaction ne 'PostalCode') { &common_debug(">>>>>> *** TESTING, $soapaction API call NOT SENT *** <<<<<<") ; return ; }
|
||||||
|
|
||||||
|
my $userAgent = LWP::UserAgent->new();
|
||||||
|
my $request = HTTP::Request->new(POST => $host);
|
||||||
|
$request->header(SOAPAction => "$header_soapaction");
|
||||||
|
$request->content($soapenvelope);
|
||||||
|
$request->content_type("text/xml; charset=utf-8");
|
||||||
|
my $response = $userAgent->request($request);
|
||||||
|
|
||||||
|
# Check response
|
||||||
|
my $response_code = $response -> code ;
|
||||||
|
my $response_content = $response -> content ;
|
||||||
|
|
||||||
|
&common_debug("[API] dcb_send_it : [response_code=$response_code]") ;
|
||||||
|
&common_debug("[API] response_content : [response_content=$response_content]") ;
|
||||||
|
|
||||||
|
$returnxml = $response_content ;
|
||||||
|
|
||||||
|
&common_write_log("dcb/xml_response_$now_year\_$now_mm.log","$now_ccyymmddhrmnsc|$now_ccyy_mm_ddT$now_hh_min_sec|$soapaction|$response_code|$returnxml|");
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_parse_it {
|
||||||
|
|
||||||
|
# use Data::Dumper;
|
||||||
|
# print Dumper(\$returnxml);
|
||||||
|
# exit;
|
||||||
|
|
||||||
|
$returnxml =~ s/[\x80-\xFF]/?/g ;
|
||||||
|
my $xml = new XML::Simple or die "Cant instantiate object XML::Simple $!" ;
|
||||||
|
# my $xmldata = $xml->XMLin($returnxml) or die "Cant open xmldata $!" ;
|
||||||
|
$xmldata = $xml->XMLin($returnxml, forcearray => 1) or die "Cant open xmldata $!";
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
use Data::Dumper;
|
||||||
|
print Dumper(\$xmldata);
|
||||||
|
# exit ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dcb_read_it {
|
||||||
|
|
||||||
|
my ($soapaction) = @_ ;
|
||||||
|
|
||||||
|
# my $result = '' ;
|
||||||
|
|
||||||
|
if ($soapaction eq 'UploadOMSWaybill') {
|
||||||
|
our $uploadwaybillresult = $xmldata->{'s:Body'}->[0]->{'UploadOMSWaybillResponse'}->[0]->{'UploadOMSWaybillResult'}->[0] ;
|
||||||
|
} elsif ($soapaction eq 'savewabill') {
|
||||||
|
our $savewabillResult = $xmldata->{'s:Body'}->[0]->{'savewabillResponse'}->[0]->{'savewabillResult'}->[0] ;
|
||||||
|
} elsif ($soapaction eq 'PostalCode') {
|
||||||
|
our $routeCode = '' ; # our $routeCode = '' ;
|
||||||
|
foreach my $hashref (@{$xmldata->{'s:Body'}->[0]->{'PostalCodeResponse'}->[0]->{'PostalCodeResult'}->[0]->{'a:ArrayOfpostalCode'} } ) {
|
||||||
|
foreach $address (@{$hashref}{'a:postalCode'}) {
|
||||||
|
$routeCode = ${$hashref}{'a:postalCode'}->[0]->{'a:routeCode'}->[0] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# $routeCode = substr($routeCode,0,3) ;
|
||||||
|
} elsif ($soapaction eq 'TracknTrace') {
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $hashref (@{$xmldata->{'s:Body'}->[0]->{'TracknTraceResponse'}->[0]->{'TracknTraceResult'}->[0]->{'a:Waybill'} } ) {
|
||||||
|
|
||||||
|
$trackntrace{booking_date} = (ref(${$hashref}{'a:BookingDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:BookingDate'}->[0] ;
|
||||||
|
$trackntrace{comments} = ${$hashref}{'a:Comments'}->[0]->{'content'} ;
|
||||||
|
$trackntrace{consignee_name} = (ref(${$hashref}{'a:ConsigneeName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ConsigneeName'}->[0] ;
|
||||||
|
$trackntrace{consignor_name} = (ref(${$hashref}{'a:ConsignorName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ConsignorName'}->[0] ;
|
||||||
|
$trackntrace{current_status} = (ref(${$hashref}{'a:CurrentStatus'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:CurrentStatus'}->[0] ;
|
||||||
|
$trackntrace{delivery_date} = (ref(${$hashref}{'a:DeliveryDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:DeliveryDate'}->[0] ;
|
||||||
|
$trackntrace{insured_value} = (ref(${$hashref}{'a:InsuredValue'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:InsuredValue'}->[0] ;
|
||||||
|
$trackntrace{number_of_parcels} = (ref(${$hashref}{'a:NumberOfParcels'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:NumberOfParcels'}->[0] ;
|
||||||
|
$trackntrace{receiver_address_line_1} = (ref(${$hashref}{'a:ReceiverAddressLine1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverAddressLine1'}->[0] ;
|
||||||
|
$trackntrace{receiver_address_line_2} = (ref(${$hashref}{'a:ReceiverAddressLine2'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverAddressLine2'}->[0] ;
|
||||||
|
$trackntrace{receiver_city} = (ref(${$hashref}{'a:ReceiverCity'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverCity'}->[0] ;
|
||||||
|
$trackntrace{receiver_contact_name} = (ref(${$hashref}{'a:ReceiverContactName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverContactName'}->[0] ;
|
||||||
|
$trackntrace{receiver_contact_tel_1} = (ref(${$hashref}{'a:ReceiverContactTel1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverContactTel1'}->[0] ;
|
||||||
|
$trackntrace{receiver_name} = ${$hashref}{'a:ReceiverName'}->[0]->{'content'} ;
|
||||||
|
$trackntrace{receiver_postal_code} = (ref(${$hashref}{'a:ReceiverPostalCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverPostalCode'}->[0] ;
|
||||||
|
$trackntrace{receiver_suburb} = (ref(${$hashref}{'a:ReceiverSuburb'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ReceiverSuburb'}->[0] ;
|
||||||
|
$trackntrace{sender_address_line_1} = (ref(${$hashref}{'a:SenderAddressLine1'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderAddressLine1'}->[0] ;
|
||||||
|
$trackntrace{sender_address_line_2} = (ref(${$hashref}{'a:SenderAddressLine2'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderAddressLine2'}->[0] ;
|
||||||
|
$trackntrace{sender_city} = (ref(${$hashref}{'a:SenderCity'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderCity'}->[0] ;
|
||||||
|
$trackntrace{sender_contact_name} = (ref(${$hashref}{'a:SenderContactName'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderContactName'}->[0] ;
|
||||||
|
$trackntrace{sender_contact_tel} = (ref(${$hashref}{'a:SenderContactTel'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderContactTel'}->[0] ;
|
||||||
|
$trackntrace{sender_postal_code} = (ref(${$hashref}{'a:SenderPostalCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderPostalCode'}->[0] ;
|
||||||
|
$trackntrace{sender_suburb} = (ref(${$hashref}{'a:SenderSuburb'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:SenderSuburb'}->[0] ;
|
||||||
|
$trackntrace{service_type_code} = (ref(${$hashref}{'a:ServiceTypeCode'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ServiceTypeCode'}->[0] ;
|
||||||
|
$trackntrace{shipment_is_insured} = (ref(${$hashref}{'a:ShipmentIsInsured'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ShipmentIsInsured'}->[0] ;
|
||||||
|
$trackntrace{shipper_reference} = (ref(${$hashref}{'a:ShipperReference'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:ShipperReference'}->[0]->{''} ;
|
||||||
|
$trackntrace{account_nr} = (ref(${$hashref}{'a:accNr'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:accNr'}->[0] ;
|
||||||
|
$trackntrace{pod} = ${$hashref}{'a:pod'}->[0]->{'xmlns:b'} ;
|
||||||
|
$trackntrace{waybill_date} = (ref(${$hashref}{'a:waybillDate'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:waybillDate'}->[0] ;
|
||||||
|
$trackntrace{waybill_number} = (ref(${$hashref}{'a:waybillNumber'}->[0]) eq 'HASH') ? '' : ${$hashref}{'a:waybillNumber'}->[0] ;
|
||||||
|
|
||||||
|
my $additional_info = $hashref->{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0];
|
||||||
|
$trackntrace{additional_information}{additional_info_code} = (ref($additional_info->{'b:additionalInfoCode'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:additionalInfoCode'}->[0];
|
||||||
|
$trackntrace{additional_information}{additional_info_value} = (ref($additional_info->{'b:additionalInfoValue'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:additionalInfoValue'}->[0];
|
||||||
|
$trackntrace{additional_information}{waybill_number} = (ref($additional_info->{'b:waybillNumber'}->[0]) eq 'HASH') ? '' : $additional_info->{'b:waybillNumber'}->[0];
|
||||||
|
|
||||||
|
my $tracking_details = $hashref->{'a:trackingDetail'}->[0]->{'b:TrackingDetail'};
|
||||||
|
for my $i (0..$#$tracking_details) {
|
||||||
|
my $event_index = $i + 1;
|
||||||
|
$trackntrace{tracking_detail}{event_code}{$event_index} = (ref($tracking_details->[$i]->{'b:eventCode'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventCode'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_date}{$event_index} = (ref($tracking_details->[$i]->{'b:eventDate'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventDate'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_description}{$event_index} = (ref($tracking_details->[$i]->{'b:eventDescription'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventDescription'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_hub_code}{$event_index} = (ref($tracking_details->[$i]->{'b:eventHubCode'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventHubCode'}->[0];
|
||||||
|
$trackntrace{tracking_detail}{event_time}{$event_index} = (ref($tracking_details->[$i]->{'b:eventTime'}->[0]) eq 'HASH') ? '' : $tracking_details->[$i]->{'b:eventTime'}->[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
# $trackntrace{additional_information}{additional_info_code} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:additionalInfoCode'}->[0] ;
|
||||||
|
# $trackntrace{additional_information}{additional_info_value} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:additionalInfoValue'}->[0] ;
|
||||||
|
# $trackntrace{additional_information}{waybill_number} = ${$hashref}{'a:additionalInformation'}->[0]->{'b:AdditionalInformation'}->[0]->{'b:waybillNumber'}->[0] ;
|
||||||
|
|
||||||
|
# $trackntrace{tracking_detail}{event_code}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_date}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventDate'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_description}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventDescription'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_hub_code}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventHubCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_time}{1} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[0]->{'b:eventTime'}->[0] ;
|
||||||
|
|
||||||
|
# $trackntrace{tracking_detail}{event_code}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_date}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventDate'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_description}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventDescription'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_hub_code}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventHubCode'}->[0] ;
|
||||||
|
# $trackntrace{tracking_detail}{event_time}{2} = ${$hashref}{'a:trackingDetail'}->[0]->{'b:TrackingDetail'}->[1]->{'b:eventTime'}->[0] ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# return ($result) ;
|
||||||
|
|
||||||
|
# print "\n" . $xmldata->{'s:Body'}->[0]->{'savewabillResponse'}->[0]->{'savewabillResult'}->[0] ;
|
||||||
|
|
||||||
|
# return unless $event_id ;
|
||||||
|
# return unless $from_to ;
|
||||||
|
|
||||||
|
# &db_min_ro("event_quotes","1,logistics_dcb_waybill","`id`='$event_id'","","") ;
|
||||||
|
|
||||||
|
# my @waybill_nrs = split(/\-/,$db{event_quotes}{1}{logistics_waybill_nrs}) ;
|
||||||
|
# my @dcb_waybill = split(/\-/,$logistics_dcb_waybill) ;
|
||||||
|
|
||||||
|
# my $dcb_waybill = ($from_to eq 'to') ? "$dcb_waybill[0]-1" : "1-$dcb_waybill[1]" ;
|
||||||
|
|
||||||
|
# $ii{$event_id}{logistics_dcb_waybill} = $dcb_waybill ;
|
||||||
|
|
||||||
|
# our $testing = 1 ;
|
||||||
|
|
||||||
|
# &db_min_upd('event_quotes',"`id`='$event_id'") ;
|
||||||
|
# &db_min_upd('event_quotes',"`id`='5136'") ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub dcb_send_it_get_route_code {
|
||||||
|
|
||||||
|
# my ($postal_code,$suburb) = @_ ;
|
||||||
|
|
||||||
|
# my $message = qq~<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
# <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||||
|
# <soap:Body>
|
||||||
|
# <PostalCode xmlns="http://tempuri.org/">
|
||||||
|
# <request>
|
||||||
|
# <PostalCode xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$postal_code</PostalCode>
|
||||||
|
# <Suburb xmlns="http://schemas.datacontract.org/2004/07/OMSIntegrate.Request">$suburb</Suburb>
|
||||||
|
# </request>
|
||||||
|
# </PostalCode>
|
||||||
|
# </soap:Body>
|
||||||
|
# </soap:Envelope>
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# if ($debug) {
|
||||||
|
# print $message;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# my $userAgent = LWP::UserAgent->new();
|
||||||
|
# my $request = HTTP::Request->new(POST => 'https://dcboms.co.za/APIUAT/OMSIntegrate.svc');
|
||||||
|
# $request->header(SOAPAction => '"http://tempuri.org/IOMSIntegrate/savewabill"');
|
||||||
|
# $request->content($message);
|
||||||
|
# $request->content_type("text/xml; charset=utf-8");
|
||||||
|
# my $response = $userAgent->request($request);
|
||||||
|
|
||||||
|
# # Check response
|
||||||
|
# my $response_code = $response -> code ;
|
||||||
|
# my $response_content = $response -> content ;
|
||||||
|
|
||||||
|
# $returnxml = $response_content ;
|
||||||
|
|
||||||
|
# } #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
1 ;
|
||||||
34
libs/modules/_FromProd/v1.0/dialog.pm
Normal file
34
libs/modules/_FromProd/v1.0/dialog.pm
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub dialog_common {
|
||||||
|
|
||||||
|
$dialog{'common'}{'head'} = qq(<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>$useropts{short} Admin</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="$useropts{'css'}/bootstrap-darkly.min.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'css'}/charisma-app.css" rel="stylesheet">
|
||||||
|
<link href="$useropts{'bower_components'}/chosen/chosen.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/colorbox/example3/colorbox.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'bower_components'}/responsive-tables/responsive-tables.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.min.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/elfinder.theme.css" rel='stylesheet'>
|
||||||
|
<link href="$useropts{'css'}/datepicker.css" rel='stylesheet'>
|
||||||
|
<script src="$useropts{'bower_components'}/jquery/jquery.min.js"></script>
|
||||||
|
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
|
<style>
|
||||||
|
$useropts{'common'}{'css'}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
146
libs/modules/_FromProd/v1.0/event_email.pm
Normal file
146
libs/modules/_FromProd/v1.0/event_email.pm
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
|
||||||
|
sub create_event_email_table {
|
||||||
|
|
||||||
|
my ($event_id) = @_ ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','1,country_id,event_system_id_multiple,type_details_id,qty,club_name,operator_ids,ref,organisation_ids,date_from,date_to,poc_name,poc_contact_nr,type,sport_type_ids,region_id,city_id,quote_to,category_id_1,category_id_2,additional_notes,user_id,format_of_title',"`id`='$event_id'",'','') ;
|
||||||
|
|
||||||
|
# &db_min_ro('user_type','id,name,email,user_type',"",'','') ;
|
||||||
|
&db_min_ro('users','id,name,email,user_type',"",'','') ;
|
||||||
|
|
||||||
|
our %operator_email = () ;
|
||||||
|
foreach (keys %{$db{user_type}}) {
|
||||||
|
$operator_email{$db{user_type}{$_}{email}} = 1 if substr($db{user_type}{$_}{user_type},0,6) eq 'casual' and $db{user_type}{$_}{email} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $system_details = "" ;
|
||||||
|
|
||||||
|
&db_min_ro('event_type_details','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{type_details_id})) {
|
||||||
|
$system_details .= qq~$db{event_type_details}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $system_details if $system_details ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name','','','') ;
|
||||||
|
|
||||||
|
my $SystemName = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{$table}{$qt_id}{event_system_id_multiple})) {
|
||||||
|
$SystemName .= qq~$db{event_systems}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $SystemName if $SystemName ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes_categories','id,category','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('regions','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('countries','1,name,country',"`id`='$db{event_quotes}{1}{country_id}'",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('cities','id,city','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('organisations','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('customers','id,name','','','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_types','1,name',"`id`='$db{event_quotes}{1}{type}'",'','') if $db{event_quotes}{1}{type} ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes_min','1,category_details',"`id`='$event_id'",'','') ;
|
||||||
|
|
||||||
|
my @cat_details = split('\|;\|',$db{event_quotes_min}{1}{category_details}) ;
|
||||||
|
|
||||||
|
our $sports = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{sport_type_ids})) {
|
||||||
|
|
||||||
|
$sports .= qq~$db{sport_types}{$_}{name},~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $sports if $sports ;
|
||||||
|
|
||||||
|
my $venues = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{organisation_ids})) {
|
||||||
|
|
||||||
|
$venues .= qq~$db{organisations}{$_}{name},~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $venues if $venues ;
|
||||||
|
|
||||||
|
my $op_cnt = qq~~ ; my $op_names = qq~~ ;
|
||||||
|
|
||||||
|
foreach (split(",",$db{event_quotes}{1}{operator_ids})) {
|
||||||
|
$op_cnt++ ;
|
||||||
|
$op_names .= qq~$db{users}{$_}{name},~ ;
|
||||||
|
}
|
||||||
|
chop $op_names if $op_names ;
|
||||||
|
$op_names = qq~$op_cnt [$op_names]~ if $op_names;
|
||||||
|
|
||||||
|
my %event_details = () ;
|
||||||
|
|
||||||
|
my $city_name = qq~~ ;
|
||||||
|
$city_name .= qq~$db{cities}{$db{event_quotes}{1}{city_id}}{city},~ if $db{cities}{$db{event_quotes}{1}{city_id}}{city} ;
|
||||||
|
$city_name .= qq~$db{regions}{$db{event_quotes}{1}{region_id}}{name},~ if $db{regions}{$db{event_quotes}{1}{region_id}}{name} ;
|
||||||
|
$city_name .= qq~$db{countries}{1}{name} [$db{countries}{1}{country}]~ ;
|
||||||
|
|
||||||
|
$event_details{Client} = qq~<tr><th>Client</th><th>$db{customers}{$db{event_quotes}{1}{quote_to}}{name}</th></tr>~ ;
|
||||||
|
$event_details{EventName} = qq~<tr><th>Event Name</th><th>$db{event_quotes}{1}{ref} [$event_id]</th></tr>~ ;
|
||||||
|
$event_details{DateFrom} = qq~<tr><td>Event Date/Time From</td><td> $db{event_quotes}{1}{date_from}</td></tr>~ if $db{event_quotes}{1}{date_from} ;
|
||||||
|
$event_details{DateTo} = qq~<tr><td>Event Date/Time To</td><td> $db{event_quotes}{1}{date_to}</td></tr>~ if $db{event_quotes}{1}{date_to} ;
|
||||||
|
$event_details{Type} = qq~<tr><td>Type of System</td><td> $db{event_types}{1}{name}</td></tr>~ if $db{event_types}{1}{name} ;
|
||||||
|
$event_details{SystemDetails} = qq~<tr><td>System Details</td><td> $system_details</td></tr>~ if $system_details ;
|
||||||
|
$event_details{SystemName} = qq~<tr><td>System Name</td><td> $SystemName</td></tr>~ if $SystemName ;
|
||||||
|
$event_details{ClubName} = qq~<tr><td>Club Name</td><td> $db{event_quotes}{1}{club_name}</td></tr>~ if $db{event_quotes}{1}{club_name} ;
|
||||||
|
$event_details{Days} = qq~<tr><td>Days</td><td> $db{event_quotes}{1}{qty}</td></tr>~ if $db{event_quotes}{1}{qty} ;
|
||||||
|
$event_details{NrofOperators} = qq~<tr><td>Nr of Operators</td><td> $op_names</td></tr>~ if $op_names ;
|
||||||
|
$event_details{SportTypes} = qq~<tr><td>Sport Types(s)</td><td> $sports</td></tr>~ if $sports ;
|
||||||
|
$event_details{City} = qq~<tr><td>City</td><td> $city_name</td></tr>~ ;
|
||||||
|
$event_details{Venue} = qq~<tr><td>Venue(s)</td><td> $venues</td></tr>~ if $venues ;
|
||||||
|
$event_details{PocName} = qq~<tr><td>Poc Name</td><td> $db{event_quotes}{1}{poc_name}</td></tr>~ if $db{event_quotes}{1}{poc_name} ;
|
||||||
|
$event_details{PocContactNr} = qq~<td>Poc Contact Nr</td><td> $db{event_quotes}{1}{poc_contact_nr}</td></tr>~ if $db{event_quotes}{1}{poc_contact_nr} ;
|
||||||
|
|
||||||
|
$cat_details[0] =~ s/\n/,/g; $cat_details[1] =~ s/\n/,/g; $db{event_quotes}{1}{additional_notes} =~ s/\n/,/g; $db{event_quotes}{1}{format_of_title} =~ s/\n/,/g;
|
||||||
|
|
||||||
|
$event_details{Category1} = qq~<tr><td>Category 1</td><td> $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_1}}{category}</td></tr>~ if $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_1}}{category} ;
|
||||||
|
$event_details{Category1Details} = qq~<tr><td>Category 1 Details</td><td> $cat_details[0]</td></tr>~ if $cat_details[0] ;
|
||||||
|
$event_details{Category2} = qq~<tr><td>Category 2</td><td> $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_2}}{category}</td></tr>~ if $db{event_quotes_categories}{$db{event_quotes}{1}{category_id_2}}{category} ;
|
||||||
|
$event_details{Category2Details} = qq~<tr><td>Category 2 Details</td><td> $cat_details[1]</td></tr>~ if $cat_details[1] ;
|
||||||
|
$event_details{AdditionalNotes} = qq~<tr><td>Additional Notes</td><td> $db{event_quotes}{1}{additional_notes}</td></tr>~ if $db{event_quotes}{1}{additional_notes} ;
|
||||||
|
$event_details{format_of_title} = qq~<tr><td>Format of TITLE to be followed <br>when scheduling events</td><td> $db{event_quotes}{1}{format_of_title}</td></tr>~ if $db{event_quotes}{1}{format_of_title} ;
|
||||||
|
|
||||||
|
our $table_message = qq~
|
||||||
|
$event_details{Client}
|
||||||
|
$event_details{EventName}
|
||||||
|
$event_details{DateFrom}
|
||||||
|
$event_details{DateTo}
|
||||||
|
$event_details{Type}
|
||||||
|
$event_details{SystemDetails}
|
||||||
|
$event_details{SystemName}
|
||||||
|
$event_details{ClubName}
|
||||||
|
$event_details{Days}
|
||||||
|
$event_details{NrofOperators}
|
||||||
|
$event_details{SportTypes}
|
||||||
|
$event_details{City}
|
||||||
|
$event_details{Venue}
|
||||||
|
$event_details{PocName}
|
||||||
|
$event_details{PocContactNr}
|
||||||
|
$event_details{Category1}
|
||||||
|
$event_details{Category1Details}
|
||||||
|
$event_details{Category2}
|
||||||
|
$event_details{Category2Details}
|
||||||
|
$event_details{AdditionalNotes}
|
||||||
|
$event_details{format_of_title}
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$message = qq~Good day
|
||||||
|
|
||||||
|
Please find attached event details.~ ;
|
||||||
|
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
5118
libs/modules/_FromProd/v1.0/event_tabs.pm
Normal file
5118
libs/modules/_FromProd/v1.0/event_tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
4978
libs/modules/_FromProd/v1.0/event_tabs_test_demo_temp.pm
Normal file
4978
libs/modules/_FromProd/v1.0/event_tabs_test_demo_temp.pm
Normal file
File diff suppressed because it is too large
Load Diff
430
libs/modules/_FromProd/v1.0/fixedsystem.pm
Normal file
430
libs/modules/_FromProd/v1.0/fixedsystem.pm
Normal file
|
|
@ -0,0 +1,430 @@
|
||||||
|
sub fixedsystem_build_table_and_or_excel {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("cnt","event","start_date","start_time","venue","region","system_name","online_status","network_test","system_test","test_event","sound_test","overall_status","additional_comments") ;
|
||||||
|
|
||||||
|
&report_xlsx_export_header("$xlsxreportname",$xlsxdir,'',$xlsx_title_heading) ;
|
||||||
|
|
||||||
|
$xlsxrow-- ;
|
||||||
|
|
||||||
|
my $event_cnt = 0 ; our $found_after_date = 0 ;
|
||||||
|
|
||||||
|
# $format84->set_align('center');
|
||||||
|
# $format88->set_align('center');
|
||||||
|
# $format89->set_align('center');
|
||||||
|
# $format90->set_align('center');
|
||||||
|
# $format91->set_align('center');
|
||||||
|
|
||||||
|
my %defualt_color = () ;
|
||||||
|
$defualt_color{-1} = "#F90D0D" ;
|
||||||
|
$defualt_color{1} = "#51B529" ;
|
||||||
|
|
||||||
|
my %defualt_color2 = () ;
|
||||||
|
$defualt_color2{1} = "#51B529" ;
|
||||||
|
$defualt_color2{2} = "#F6E305" ;
|
||||||
|
$defualt_color2{3} = "#F90D0D" ;
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $id (sort {$db{$table}{$a}{date_from} cmp $db{$table}{$b}{date_from}} keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
unless (&common_check_if_string_contains_an_integer($db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
$db{$table}{$id}{event_system_id_multiple} = ";-1;" ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $now_date = int("$now_year$now_mm$now_dd") ;
|
||||||
|
my $end_date = substr($db{$table}{$id}{date_to},0,10) ;
|
||||||
|
$end_date =~ s/\-//g ;
|
||||||
|
$end_date = int($end_date) ;
|
||||||
|
my $is_in_future = ($now_date < $end_date) ? 1 : 0 ;
|
||||||
|
|
||||||
|
my @system_name_ids = split(/\;/,$db{$table}{$id}{event_system_id_multiple}) ;
|
||||||
|
|
||||||
|
my @fixed_system_online_status = split(/\;/,$db{$table}{$id}{fixed_system_online_status}) ;
|
||||||
|
my @fixed_system_network_test = split(/\;/,$db{$table}{$id}{fixed_system_network_test}) ;
|
||||||
|
my @fixed_system_system_test = split(/\;/,$db{$table}{$id}{fixed_system_system_test}) ;
|
||||||
|
my @fixed_system_test_event = split(/\;/,$db{$table}{$id}{fixed_system_test_event}) ;
|
||||||
|
my @fixed_system_sound_test = split(/\;/,$db{$table}{$id}{fixed_system_sound_test}) ;
|
||||||
|
my @fixed_system_overall_status = split(/\;/,$db{$table}{$id}{fixed_system_overall_status}) ;
|
||||||
|
my @fixed_system_additional_comments = split(/\;/,$db{$table}{$id}{fixed_system_additional_comments}) ;
|
||||||
|
|
||||||
|
my $cnt_sys_ids = -1 ;
|
||||||
|
|
||||||
|
# my @table_op_ids = () ;
|
||||||
|
|
||||||
|
# for (1 .. $cnt_rows) {
|
||||||
|
# push @table_op_ids,$op_ids[$_ - 1] if $op_ids[$_ - 1] ;
|
||||||
|
# push @table_op_ids,0 unless $op_ids[$_ - 1] ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
my $system_count = 0 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$table}{$id}{event_system_id_multiple})) {
|
||||||
|
foreach my $event_id (@system_name_ids) {
|
||||||
|
|
||||||
|
$cnt_sys_ids++ ;
|
||||||
|
|
||||||
|
next unless $event_id ;
|
||||||
|
next unless $db{event_systems}{$event_id}{system_type} eq 'fixed' ;
|
||||||
|
next if $i{overall_status} ne 'all' and $i{overall_status} and $i{overall_status} ne $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
|
||||||
|
$event_cnt++ ;
|
||||||
|
$system_count++ ;
|
||||||
|
$xlsxcol = 0 ;
|
||||||
|
$print_tbody .= qq~<tr id="$id">~ if $report ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
|
||||||
|
next unless $_ ; # blank for the buttons column
|
||||||
|
|
||||||
|
my $formatting = $format84 ;
|
||||||
|
my $val = $db{$table}{$id}{$_} ;
|
||||||
|
my $val_min = $val ;
|
||||||
|
my $align = '' ;
|
||||||
|
my $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($_ eq 'cnt') {
|
||||||
|
$val = $event_cnt ;
|
||||||
|
} elsif ($_ eq 'event') {
|
||||||
|
$val = "$db{$table}{$id}{ref} ($id)" ;
|
||||||
|
} elsif ($_ eq 'start_date') {
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
$val = substr($db{$table}{$id}{date_from},0,10) ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'venue') {
|
||||||
|
my @oids = split(/\,/,$db{$table}{$id}{organisation_ids}) ;
|
||||||
|
foreach $_oid (@oids) {
|
||||||
|
$val .= $db{organisations}{$_oid}{name} . '<br>' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ; ;
|
||||||
|
} elsif ($_ eq 'region') {
|
||||||
|
$val = $db{regions}{$db{$table}{$id}{region_id}}{code} ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'system_name') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = qq~$db{event_systems}{$event_id}{name}~ ;
|
||||||
|
$val .= qq~ ($db{event_systems}{$event_id}{description})~ if $db{event_systems}{$event_id}{description} ;
|
||||||
|
} elsif ($_ eq 'sport') {
|
||||||
|
$val = '' ;
|
||||||
|
foreach my $sport_id (split(",",$db{$table}{$id}{sport_type_ids})) {
|
||||||
|
$db{sport_types}{$sport_id}{name} = uc $db{sport_types}{$sport_id}{name} ;
|
||||||
|
$val .= qq~$db{sport_types}{$sport_id}{name}<br>~ ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-4) if $val ;
|
||||||
|
} elsif ($_ eq 'operator') {
|
||||||
|
$val = '' ;
|
||||||
|
$val = $db{users}{$op_ids[$system_count - 1]}{name} if $op_ids[$system_count - 1] ;
|
||||||
|
} elsif ($_ eq 'start_time') {
|
||||||
|
$val = substr($db{$table}{$id}{date_from},11,5) ; $align = qq~ class="dt-center"~ ;
|
||||||
|
} elsif ($_ eq 'online_status') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "online_status_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Online Status" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
if ($fixed_system_online_status[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_online_status[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Online" if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Offline" if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Online" if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Offline" if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(7)").css("background-color","$defualt_color{$fixed_system_online_status[$cnt_sys_ids]}");~ if $fixed_system_online_status[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_online_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_online_status[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'network_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "network_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Network" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_network_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_network_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Passed" if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Failed" if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Passed" if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Failed" if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(6)").css("background-color","$defualt_color{$fixed_system_network_test[$cnt_sys_ids]}");~ if $fixed_system_network_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_network_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_network_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'system_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "system_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "System Test" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_system_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_system_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Passed" if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Failed" if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$val = "Passed" if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Failed" if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(5)").css("background-color","$defualt_color{$fixed_system_system_test[$cnt_sys_ids]}");~ if $fixed_system_system_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_system_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_system_test[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'test_event') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "test_event_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Event" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_test_event[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_test_event[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = "Good" if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val_min = "Not Good" if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = "Good" if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$val = "Not Good" if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(4)").css("background-color","$defualt_color{$fixed_system_test_event[$cnt_sys_ids]}");~ if $fixed_system_test_event[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_test_event[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format96 if $fixed_system_test_event[$cnt_sys_ids] eq '-1' ;
|
||||||
|
} elsif ($_ eq 'sound_test') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "sound_test_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Test Sound" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_sound_test[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_sound_test[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $db{fixed_system_sound_test}{$fixed_system_sound_test[$cnt_sys_ids]}{name} if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $db{fixed_system_sound_test}{$fixed_system_sound_test[$cnt_sys_ids]}{name} if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(3)").css("background-color","$defualt_color2{$fixed_system_sound_test[$cnt_sys_ids]}");~ if $fixed_system_sound_test[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_sound_test[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format95 if $fixed_system_sound_test[$cnt_sys_ids] eq '2' ;
|
||||||
|
$formatting = $format96 if $fixed_system_sound_test[$cnt_sys_ids] eq '3' ;
|
||||||
|
} elsif ($_ eq 'overall_status') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
$found_after_date = 1 ;
|
||||||
|
my $field = "overall_status_$id\_$event_id" ; $align = qq~ class="dt-center $_"~ ;
|
||||||
|
$preferred_title{$field} = "Overall Status" ;
|
||||||
|
$opts{$field} = $opts{$_} ;
|
||||||
|
$allow_deselect{$field} = 1 ;
|
||||||
|
$useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_select_col($field,'') ;
|
||||||
|
my $ucfirstfield = ucfirst $field ;
|
||||||
|
$val = qq~<select class="form-control" name="$field" id="select$ucfirstfield" data-placeholder="Select $preferred_title{$field}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field}
|
||||||
|
</select>~ ;
|
||||||
|
if ($fixed_system_overall_status[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#select$ucfirstfield").val("$fixed_system_overall_status[$cnt_sys_ids]") ;
|
||||||
|
\$("#select$ucfirstfield").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#select$ucfirstfield").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val_min = $db{fixed_system_status}{$fixed_system_overall_status[$cnt_sys_ids]}{status} if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $db{fixed_system_status}{$fixed_system_overall_status[$cnt_sys_ids]}{status} if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr:eq($event_cnt) td:nth-last-child(2)").css("background-color","$defualt_color2{$fixed_system_overall_status[$cnt_sys_ids]}");~ if $fixed_system_overall_status[$cnt_sys_ids] ;
|
||||||
|
$formatting = $format94 if $fixed_system_overall_status[$cnt_sys_ids] eq '1' ;
|
||||||
|
$formatting = $format95 if $fixed_system_overall_status[$cnt_sys_ids] eq '2' ;
|
||||||
|
$formatting = $format96 if $fixed_system_overall_status[$cnt_sys_ids] eq '3' ;
|
||||||
|
} elsif ($_ eq 'additional_comments') {
|
||||||
|
if ($is_in_future && $report && ($glod_user_level > 2 || $is_installation_partner || $is_schools_manager)) {
|
||||||
|
my $field = "additional_comments_$id\_$event_id" ; my $ucfirstfield = ucfirst $field ; $align = qq~ class="dt-center $_ controls"~ ;
|
||||||
|
$preferred_title{$field} = "Additional Comments" ; $useropts{'common'}{'css'} .= qq~.$_ { min-width:170px; } ~ ;
|
||||||
|
# $val = &common_min_form_input_col($field,'') ;
|
||||||
|
$val = qq~<input type='text' name='$field' class='form-control $cust_class{$field}' id='input$ucfirst_field' placeholder='$preferred_title{$field}' value="$fixed_system_additional_comments[$cnt_sys_ids]">~ ;
|
||||||
|
if ($fixed_system_additional_comments[$cnt_sys_ids]) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#inputAdditional_comments_$id\_$event_id").val("$fixed_system_additional_comments[$cnt_sys_ids]") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
$val_min = $fixed_system_additional_comments[$cnt_sys_ids] ;
|
||||||
|
$val_min = "None" unless $val_min ;
|
||||||
|
} else {
|
||||||
|
$val = $fixed_system_additional_comments[$cnt_sys_ids] ;
|
||||||
|
$val = "None" unless $val ;
|
||||||
|
$val_min = $val ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_ ne 'online_status' && $_ ne 'network_test' && $_ ne 'system_test' && $_ ne 'test_event' && $_ ne 'sound_test' && $_ ne 'overall_status' && $_ ne 'additional_comments') {
|
||||||
|
$val_min = $val ;
|
||||||
|
$val_min =~ s/\<br>/\;/g ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $align $nowrap>$val</td>~ if $report ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val_min,$formatting) ;
|
||||||
|
$xlsxcol++ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ if $report ;
|
||||||
|
$xlsxrow++ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column(0,0,10);
|
||||||
|
$worksheet{$ws}->set_column(1,1,30);
|
||||||
|
$worksheet{$ws}->set_column(2,3,15);
|
||||||
|
$worksheet{$ws}->set_column(4,4,45);
|
||||||
|
$worksheet{$ws}->set_column(5,5,15);
|
||||||
|
$worksheet{$ws}->set_column(6,6,45);
|
||||||
|
$worksheet{$ws}->set_column(7,12,15);
|
||||||
|
$worksheet{$ws}->set_column(13,13,45);
|
||||||
|
|
||||||
|
&report_xlsx_export_footer('N',15,$xlsxdir) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub fixedsystem_check_for_overlapping_dates {
|
||||||
|
|
||||||
|
my ($check_table,$checked_column,$date_from_input,$date_to_input,$sys_ids_input,$get_periods) = @_ ;
|
||||||
|
|
||||||
|
my %seen_system_id = () ; my %checked_system_id = () ; my %system_start_date = () ; my %system_end_date = () ;
|
||||||
|
|
||||||
|
my $sys_ids = "" ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$sys_ids = $sys_ids_input ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
foreach (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{$id} = $db{$table}{$id}{date_from} ;
|
||||||
|
$system_end_date{$_}{$id} = $db{$table}{$id}{date_to} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($date_from_input and $date_to_input and $sys_ids_input) {
|
||||||
|
|
||||||
|
foreach (split(";",$sys_ids_input)) {
|
||||||
|
|
||||||
|
$system_start_date{$_}{-1} = $date_from_input ;
|
||||||
|
$system_end_date{$_}{-1} = $date_to_input ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $id (sort keys %{$db{$table}}) {
|
||||||
|
|
||||||
|
unless ($get_periods) {
|
||||||
|
$sys_ids = $db{$table}{$id}{$checked_column} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $sys_id (split(";",$sys_ids)) {
|
||||||
|
|
||||||
|
next unless $sys_id ;
|
||||||
|
|
||||||
|
if ($seen_system_id{$sys_id} and not $checked_system_id{$sys_id}) {
|
||||||
|
|
||||||
|
$checked_system_id{$sys_id} = 1 ;
|
||||||
|
foreach my $id2 (keys %{$system_start_date{$sys_id}}) {
|
||||||
|
|
||||||
|
next if $id2 eq $id ;
|
||||||
|
my $t1 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 21<12
|
||||||
|
my $t2 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_to}) ; ## 22<12
|
||||||
|
my $t3 = &common_check_if_time_is_greater($system_start_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 21<11
|
||||||
|
my $t4 = &common_check_if_time_is_greater($system_end_date{$sys_id}{$id2},$db{$table}{$id}{date_from}) ; ## 22<11
|
||||||
|
|
||||||
|
if (($t1 and not $t2) or ($t3 and not $t4) or (not $t3 and $t2) or ($t3 and not $t2)) {
|
||||||
|
my $system_name = qq~$db{$check_table}{$sys_id}{name}~ ;
|
||||||
|
$system_name .= qq~ ($db{$check_table}{$sys_id}{description})~ if $db{$check_table}{$sys_id}{description} ;
|
||||||
|
|
||||||
|
if ($get_periods) {
|
||||||
|
$overlap_dates{$sys_id}{$id2} = "$db{$table}{$id2}{date_from} - $db{$table}{$id2}{date_to}" ;
|
||||||
|
} else {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
noty({text:'System $system_name and cannot be used in both event $db{$table}{$id}{ref} and $db{$table}{$id2}{ref} as the times ovelap!!',layout:"center",type:"error",timeout:30000}) ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$seen_system_id{$sys_id} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
287
libs/modules/_FromProd/v1.0/getmail.pm
Normal file
287
libs/modules/_FromProd/v1.0/getmail.pm
Normal file
|
|
@ -0,0 +1,287 @@
|
||||||
|
sub getmail_fetch {
|
||||||
|
|
||||||
|
# $mail_psw = 'znMpCa6pikZF' ;
|
||||||
|
# $mail_host = 'pop.yandex.com' ;
|
||||||
|
# $mail_user = 'itv.k@re8it.com' ;
|
||||||
|
|
||||||
|
# $mail_psw = 'vf1VBE6AGuPE' ;
|
||||||
|
$mail_psw = $send_mail_psw ;
|
||||||
|
# $mail_host = 'envoy.aserv.co.za' ;
|
||||||
|
$mail_host = 'pop3.interactivetvafrica.com' ;
|
||||||
|
$mail_user = 'tickets@interactivetvafrica.com' ;
|
||||||
|
|
||||||
|
# $mail_psw = "Jat20161" ;
|
||||||
|
# $mail_host = "outlook.office365.com" ;
|
||||||
|
# $mail_user = "tickets\@aisport.africa" ;
|
||||||
|
|
||||||
|
use IO::Socket::SSL;
|
||||||
|
|
||||||
|
$socket = IO::Socket::SSL->new( PeerAddr => $mail_host,
|
||||||
|
PeerPort => 995,
|
||||||
|
SSL_verify_mode => SSL_VERIFY_NONE,
|
||||||
|
Proto => 'tcp') || die "No socket!";
|
||||||
|
|
||||||
|
$pop = new Mail::POP3Client( USER => $mail_user, PASSWORD => $mail_psw, HOST => $mail_host, USESSL => true, SOCKET => $socket ) || die $pop->Message();
|
||||||
|
# $pop = new Mail::POP3Client( USER => $mail_user, PASSWORD => $mail_psw, HOST => $mail_host, PORT => 995, AUTH_MODE => 'PASS', USESSL => true, SOCKET => $socket ) || die $pop->Message();
|
||||||
|
|
||||||
|
# # OR with SSL
|
||||||
|
# $pop = new Mail::POP3Client( USER => $mail_user,
|
||||||
|
# PASSWORD => $mail_psw,
|
||||||
|
# HOST => $mail_host,
|
||||||
|
# USESSL => true,
|
||||||
|
# ) || die $pop->Message();
|
||||||
|
|
||||||
|
#connect to POP3 sever
|
||||||
|
# my $pop = new Mail::POP3Client( HOST => $mail_host );
|
||||||
|
# $pop->User($mail_user);
|
||||||
|
# $pop->Pass($mail_psw);
|
||||||
|
# $pop->Connect() || die "Unable to connect to POP3 server: ".$pop->Message()."\n";
|
||||||
|
|
||||||
|
if ($debug) {
|
||||||
|
use Data::Dumper;
|
||||||
|
print Dumper(\$pop);
|
||||||
|
&common_debug ("get_mail : office_user = $mail_user") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nummsgs = $pop->Count;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : nummsgs [$nummsgs]") ;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $pop->Count(); $i++) {
|
||||||
|
|
||||||
|
# # sometimes the 'To' is like this : 'graham evens <12345+gevens-bookings@eccotours.co.za>'
|
||||||
|
# # sometimes the 'To' is like this : '12345+gevens-bookings@eccotours.co.za'
|
||||||
|
# # so we split it by '<' to just get the bit we want
|
||||||
|
# my @to_array = split (/\</, $mailcontent{'To'}) ;
|
||||||
|
|
||||||
|
$head = $pop->Head( $i ) ;
|
||||||
|
$head = &getmail_clean($head) ;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : head [$head]") ;
|
||||||
|
|
||||||
|
%mailcontent = () ;
|
||||||
|
|
||||||
|
my $subject_auto_conf = '' ;
|
||||||
|
my $subject_auto_decline = '' ;
|
||||||
|
|
||||||
|
# if ($head =~ /[\d]+\++[\w]+-bookings@[\w\.\-]+\w+/) { # 18398+autoreq-bookings@ecco.co.za
|
||||||
|
# $to = $& ;
|
||||||
|
# }
|
||||||
|
# elsif ($head =~ /AUTO+\s+CONFIRMATION+\s:\s+[\d]+\s:\s+[\w]+-+[\w]+\s+\(+[\w]+\)/) { # If subject = AUTO CONFIRMATION : 123456 : hotelcode-room (789123)
|
||||||
|
# $subject_auto_conf = $& ;
|
||||||
|
# }
|
||||||
|
# else
|
||||||
|
# {
|
||||||
|
foreach ( $pop->Head( $i ) ) {
|
||||||
|
chomp;
|
||||||
|
/^(From|Subject|To|Cc):\s+/i;
|
||||||
|
my ($index,$value) = split(/:/);
|
||||||
|
$mailcontent{$index} = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @to_array = split (/\</, $mailcontent{'To'}) ;
|
||||||
|
$to = pop @to_array ; # get the last item in the array
|
||||||
|
$to =~ s/\>//g ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $mailaccount = '' ;
|
||||||
|
# $junk = '' ;
|
||||||
|
|
||||||
|
&common_debug ("get_mail : to [$to]") ;
|
||||||
|
|
||||||
|
$uniqueid = $pop->Uidl($i);
|
||||||
|
$uniqueid =~ s/\s//g; # strip whitespace
|
||||||
|
|
||||||
|
$headandbody = $pop->HeadAndBody( $i ) ;
|
||||||
|
|
||||||
|
# &common_debug ("get_mail : uniqueid [$uniqueid] headandbody [$headandbody]") ;
|
||||||
|
&common_debug ("get_mail : uniqueid [$uniqueid]") ;
|
||||||
|
|
||||||
|
&getmail_mailparse ;
|
||||||
|
|
||||||
|
$pop->Delete( $i ) ; # temp comment out
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$pop->Close();
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_clean {
|
||||||
|
|
||||||
|
my ($item) = @_ ;
|
||||||
|
|
||||||
|
$item =~ s/\|/-/g; # remove any pipes
|
||||||
|
$item =~ s/\n//g; # remove any newlines
|
||||||
|
$item =~ s/\r//g; # remove any carriage returns
|
||||||
|
$item =~ s/\"//g; # remove " marks
|
||||||
|
$item =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
return ($item) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_mailparse {
|
||||||
|
|
||||||
|
$parser = MIME::Parser->new;
|
||||||
|
|
||||||
|
### Keep parsed message bodies in core (default outputs to disk):
|
||||||
|
# $parser->output_to_core(1); # don't write attachments to disk
|
||||||
|
$parser->output_to_core('NONE') ; # or die "can't output_to_core: $!" ;
|
||||||
|
|
||||||
|
### Change how nameless message-component files are named:
|
||||||
|
$parser->output_prefix("msg") or die "can't output_prefix: $!" ;
|
||||||
|
|
||||||
|
&getmail_make_dir ;
|
||||||
|
|
||||||
|
binmode(STDOUT, ":utf8");
|
||||||
|
|
||||||
|
### Output each message body to the same directory:
|
||||||
|
# $parser->output_under($outputdir);
|
||||||
|
$parser->output_dir($outputdir) or die "can't output into $outputdir: $!" ;
|
||||||
|
|
||||||
|
# $entity->dump_skeleton; # for debugging
|
||||||
|
|
||||||
|
$entity = $parser->parse_data($headandbody) or die "can't parse_data $headandbody: $!" ;
|
||||||
|
|
||||||
|
&getmail_process_entity_header ;
|
||||||
|
&getmail_process_output_dir ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_process_output_dir {
|
||||||
|
|
||||||
|
$i{unique_id} = $uniqueid ;
|
||||||
|
$i{date_time} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ;
|
||||||
|
$i{client_id} = '0' ;
|
||||||
|
$i{staff_id} = '0' ;
|
||||||
|
$i{sent_date} = $mailparsedate ;
|
||||||
|
$i{doctype} = 'ticket' ;
|
||||||
|
$i{mailtype} = 'EMAILI' ;
|
||||||
|
$i{subject} = $mailparsesubject ;
|
||||||
|
$i{sent_from} = $mailparsefrom ;
|
||||||
|
$i{sent_to} = $to ;
|
||||||
|
$i{cc} = $mailcontent{'Cc'} ;
|
||||||
|
$i{bcc} = $mailcontent{'Bcc'} ;
|
||||||
|
$i{reply_to} = $mailparsereplyto ;
|
||||||
|
# $i{action_time} = ;
|
||||||
|
$i{completed} = '0' ;
|
||||||
|
|
||||||
|
&db_min_insert('tickets') ;
|
||||||
|
|
||||||
|
my @hash_split = split /\#\#/, $mailparsesubject ;
|
||||||
|
my @subj_uid = split / /, $hash_split[1] ;
|
||||||
|
my $suid = $subj_uid[0] ;
|
||||||
|
|
||||||
|
if ($suid && length($suid)>5) {
|
||||||
|
%i = () ;
|
||||||
|
$i{completed} = '0' ;
|
||||||
|
&db_min_upd('tickets',"suid='$suid' OR unique_id='$suid' OR suid='$uniqueid' OR unique_id='$uniqueid'") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_make_dir {
|
||||||
|
|
||||||
|
our $outputdir = "$mailpath/tickets/$uniqueid" ;
|
||||||
|
|
||||||
|
return if -d $outputdir ;
|
||||||
|
|
||||||
|
mkdir ($outputdir,0777) or die "mkdir $outputdir: $!" ;
|
||||||
|
chmod (0777, $outputdir) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_process_entity_header {
|
||||||
|
|
||||||
|
use Encode qw(decode);
|
||||||
|
|
||||||
|
$mailparsesubject = $entity->head->get('subject');
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : subject [$mailparsesubject]") ;
|
||||||
|
|
||||||
|
$mailparsesubject = decode("MIME-Header", $mailparsesubject) ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : subject [$mailparsesubject]") ;
|
||||||
|
|
||||||
|
$mailparsesubject =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsesubject =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsesubject =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsesubject =~ s/\'//g; # remove any apostrophes
|
||||||
|
|
||||||
|
$mailparsesubject =~ s/\/\///g; # remove the '//' from TLF chasers
|
||||||
|
$mailparsesubject =~ s/\\//g; # remove the '\' from TLF chasers
|
||||||
|
|
||||||
|
unless ($mailparsesubject) { $mailparsesubject = "(No Subject)" ; }
|
||||||
|
|
||||||
|
$mailparsefrom = $entity->head->get('from');
|
||||||
|
$mailparsefrom =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsefrom =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsefrom =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsefrom =~ s/\"//g; # remove " marks
|
||||||
|
$mailparsefrom =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
$mailpamailparsefrom = decode("MIME-Header", $mailparsefrom) ;
|
||||||
|
|
||||||
|
$mailparsereplyto = $entity->head->get('Reply-To');
|
||||||
|
$mailparsereplyto =~ s/\|/-/g; # remove any pipes
|
||||||
|
$mailparsereplyto =~ s/\n//g; # remove any newlines
|
||||||
|
$mailparsereplyto =~ s/\r//g; # remove any carriage returns
|
||||||
|
$mailparsereplyto =~ s/\"//g; # remove " marks
|
||||||
|
$mailparsereplyto =~ s/\'//g; # remove ' marks
|
||||||
|
|
||||||
|
$mailparsedate = $entity->head->get('date');
|
||||||
|
|
||||||
|
my ($dayofweek, $day, $month, $ccyy, $time, $gmt) = split /\s/, $mailparsedate ;
|
||||||
|
|
||||||
|
$day = sprintf("%02d", ($day)) ;
|
||||||
|
|
||||||
|
$m{jan} = '01' ; $m{feb} = '02' ; $m{mar} = '03' ; $m{apr} = '04' ; $m{may} = '05' ; $m{jun} = '06' ; $m{jul} = '07' ; $m{aug} = '08' ; $m{sep} = '09' ; $m{oct} = '10' ; $m{nov} = '11' ; $m{dec} = '12' ;
|
||||||
|
|
||||||
|
my $hashkey = lc $month ;
|
||||||
|
# $mailparsedate = "$day." . $m{$hashkey} ."." . substr($ccyy,2,2) . " (" . substr($time,0,5) . ")" ; # 15.06.22 (12:49)
|
||||||
|
$mailparsedate = "$ccyy-$m{$hashkey}-$day " . substr($time,0,8) ; # 2022-06-21 12:49:35
|
||||||
|
|
||||||
|
chomp $mailparsesubject ;
|
||||||
|
chomp $mailparsedate ;
|
||||||
|
chomp $mailparsefrom ;
|
||||||
|
chomp $mailparsereplyto ;
|
||||||
|
|
||||||
|
unless ($mailparsereplyto) {
|
||||||
|
$mailparsereplyto = $mailparsefrom ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&getmail_auto_reply ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_process_entity_header : mailparsereplyto [$mailparsereplyto]") ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub getmail_auto_reply {
|
||||||
|
|
||||||
|
my @hash_split = split /\#\#/, $mailparsesubject ;
|
||||||
|
my @subj_uid = split / /, $hash_split[1] ;
|
||||||
|
|
||||||
|
&common_debug ("getmail_auto_reply : subj_uid=[$subj_uid[0]]") ;
|
||||||
|
|
||||||
|
unless ($subj_uid[0] && length($subj_uid[0])>5) {
|
||||||
|
my $resubject = ($mailparsesubject =~ /Re:/iog) ? '' : 'Re: ' ;
|
||||||
|
my $resubject .= "$mailparsesubject ##$uniqueid##" ;
|
||||||
|
my $remsg = qq~Hello, thank you for contacting ITV.
|
||||||
|
|
||||||
|
Your ticket ID is $uniqueid.
|
||||||
|
|
||||||
|
One of our consultants will reply to you shortly to assist you with your query - typically within a few hours.
|
||||||
|
|
||||||
|
For after-hour emergencies please contact Technical Support on support\@aisport.africa or telephonically on (+27) 10 534 7011.
|
||||||
|
|
||||||
|
Best regards,
|
||||||
|
|
||||||
|
The ITV Africa Team~ ;
|
||||||
|
&common_debug ("getmail_auto_reply : to=[$mailparsefrom] subject=[$resubject]") ;
|
||||||
|
&common_send_mail($mailparsefrom,'','','','',"$remsg","$resubject") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
710
libs/modules/_FromProd/v1.0/logistics.pm
Normal file
710
libs/modules/_FromProd/v1.0/logistics.pm
Normal file
|
|
@ -0,0 +1,710 @@
|
||||||
|
sub logistics_load_db_vars {
|
||||||
|
|
||||||
|
&db_min_ro('organisations','*',"",'','') ;
|
||||||
|
&db_min_ro('logistics_locations','*',"",'','') ;
|
||||||
|
&db_min_ro('logistics_suppliers','*',"active = '1'",'','') ;
|
||||||
|
&db_min_ro('logistics_items','*',"",'','') ;
|
||||||
|
&db_min_ro('event_systems','id,logistics_location_id',"(`system_type` = 'mobile' OR `system_type` = 'solo' OR `description` lIKE 'cricket%')",'','') ;
|
||||||
|
|
||||||
|
foreach (keys %i) {
|
||||||
|
local @abc = split("_",$_) ;
|
||||||
|
if (substr($_,0,7) eq 'update_') {
|
||||||
|
$seen_event_id{$abc[-1]} = 1 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# create_waybill_out_5136
|
||||||
|
local @event_ids = () ;
|
||||||
|
foreach (keys %seen_event_id) {
|
||||||
|
push @event_ids , "`id` = '$_'" ;
|
||||||
|
}
|
||||||
|
local $e_q_sql = join (" OR ",@event_ids) ;
|
||||||
|
|
||||||
|
&db_min_ro($table,'id,event_system_id_multiple,logistics_suppliers,logistics_waybill_nrs,logistics_status_ids,logistics_venue_id,logistics_item_ids,poc_id,recipient_id,logistics_special_instructions,logistics_complete,logistics_dcb_waybill,date_from,date_to,logistics_delivery_datetime,logistics_received_by,logistics_location_other,logistics_system_location_id,logistics_last_changed_by,logistics_dcb_comments,logistics_shipment_operator_id',"$e_q_sql",'','') ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_dates {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
my ($year1,$month1,$day1) = split(/\-/,substr($db{$table}{$id}{date_from},0,10)) ;
|
||||||
|
my ($year2,$month2,$day2) = split(/\-/,substr($db{$table}{$id}{date_to},0,10)) ;
|
||||||
|
$val = qq~~ ;
|
||||||
|
if ($year1 ne $year2 && $month1 ne $month2 && $day1 ne $day2) {
|
||||||
|
$val = qq~ $day1 $month_names[$month1] $year1 -<br>$day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 ne $month2) {
|
||||||
|
$val = qq~ $day1 $month_names[$month1] -<br>$day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 ne $day2) {
|
||||||
|
$val = qq~ $day1 - $day2 $month_names[$month2] $year2~ ;
|
||||||
|
} elsif ($year1 eq $year2 && $month1 eq $month2 && $day1 eq $day2) {
|
||||||
|
$val = qq~ $day2 $month_names[$month2] $year2~ ;
|
||||||
|
}
|
||||||
|
my $stime = substr($db{$table}{$id}{date_from},11,5) ;
|
||||||
|
my $etime = substr($db{$table}{$id}{date_to},11,5) ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/<br>//g ;
|
||||||
|
# $val = qq~<a href='#' title data-toggle="tooltip" data-placement="top" data-original-title="Start Time : $stime<br>End Time : $etime">$val</a>~ ;
|
||||||
|
|
||||||
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+1,$stime,$formatting) ;
|
||||||
|
# &xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol+2,$etime,$formatting) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_venue {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $nowrap = 'nowrap' ;
|
||||||
|
foreach my $_oid (@venue_ids) {
|
||||||
|
$val .= qq~$db{organisations}{$_oid}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$_oid}{region_code}]~ if $db{organisations}{$_oid}{region_code} ;
|
||||||
|
$val .= ',' ;
|
||||||
|
}
|
||||||
|
$val = substr($val,0,-1) if $val ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/\,/\;/g ;
|
||||||
|
if (length($val) > 30) {
|
||||||
|
$val =~ s/\,/\<br>/g ;
|
||||||
|
$val = substr($val,0,27) . qq~<i class="glyphicons glyphicons-more" title data-toggle="tooltip" data-placement="top" data-original-title="$val"></i>~ ;
|
||||||
|
} else {
|
||||||
|
$val =~ s/\,/\<br>/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_system {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; my $tooltip = '' ;
|
||||||
|
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
$system_count++ ;
|
||||||
|
$tooltip .= qq~<br>$db{event_systems}{$event_sys_id}{name}~ ;
|
||||||
|
$tooltip .= qq~ [$db{event_systems}{$event_sys_id}{description}]~ if $db{event_systems}{$event_sys_id}{description} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tooltip = substr($tooltip,4) if $tooltip ;
|
||||||
|
$val = $tooltip ;
|
||||||
|
# $val = ($system_count > 1) ? qq~<i class="glyphicons glyphicons-laptop" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : ($system_count == 1) ? qq~<i class="glyphicons glyphicons-facetime-video" title data-toggle="tooltip" data-placement="top" data-original-title="$tooltip"></i>~ : "" ;
|
||||||
|
$valxlsx = $tooltip ;
|
||||||
|
$valxlsx =~ s/\<br>/\;/g ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_from_to {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{1},#$ucfirstfield{2}").chosen({allow_single_deselect:true}) ; ~ ;
|
||||||
|
|
||||||
|
my $col_venue = ($from_to eq 'to') ? 10 : 11 ;
|
||||||
|
my $col_log_loc = ($from_to eq 'to') ? 11 : 10 ;
|
||||||
|
|
||||||
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) { # && $iaction eq 'report') || ($_ eq 'from' && $_ eq 'report_from')
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{1}" id="$ucfirstfield{1}" data-placeholder="Select $preferred_title{$field{1}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{venue_location}{$db{$table}{$id}{region_id}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||||||
|
$valxlsx = "$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name} [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]" if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{1}").val("$db{$table}{$id}{logistics_venue_id}") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_venue)" ;
|
||||||
|
|
||||||
|
$default_javascript .= qq~"$field{1}":"$db{$table}{$id}{logistics_venue_id}",~ ;
|
||||||
|
} elsif ($venue_ids[0]) {
|
||||||
|
$valxlsx = "$db{organisations}{$venue_ids[0]}{name} [$db{organisations}{$venue_ids[0]}{region_code}]" if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{1}").val("$venue_ids[0]") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{1}" if $ucfirstfield{1} ;
|
||||||
|
$default_javascript .= qq~"$field{1}":"$venue_ids[0]",~ ;
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{1}":"",~ ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{2}" id="$ucfirstfield{2}" data-placeholder="Select $preferred_title{$field{2}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{system_location}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
my $found_loc = 0 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||||||
|
$valxlsx = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("$db{event_systems}{$event_sys_id}{logistics_location_id}") ;
|
||||||
|
~ ;
|
||||||
|
$found_loc = 1 ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child($col_log_loc)" ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"$db{event_systems}{$event_sys_id}{logistics_location_id}",~ ;
|
||||||
|
}
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("1") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"1",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("2") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"2",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("3") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"3",~ ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{2}").val("4") ;
|
||||||
|
~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{2}" if $ucfirstfield{2} ;
|
||||||
|
$default_javascript .= qq~"$field{2}":"4",~ ;
|
||||||
|
} elsif (!$found_loc) {
|
||||||
|
$default_javascript .= qq~"$field{2}":"",~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{1}\_chosen,#$ucfirstfield{2}\_chosen" if $ucfirstfield{1} && $ucfirstfield{2} ;
|
||||||
|
} else {
|
||||||
|
if (($_ eq 'to' && $from_to eq 'to') || ($_ eq 'from' && $iaction eq 'report_from')) {
|
||||||
|
if ($db{$table}{$id}{logistics_venue_id}) {
|
||||||
|
$val = qq~$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code}]~ if $db{organisations}{$db{$table}{$id}{logistics_venue_id}}{region_code} ;
|
||||||
|
} elsif ($venue_ids[0]) {
|
||||||
|
$val = qq~$db{organisations}{$venue_ids[0]}{name}~ ;
|
||||||
|
$val .= qq~ [$db{organisations}{$venue_ids[0]}{region_code}]~ if $db{organisations}{$venue_ids[0]}{region_code} ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
my $found_loc = 0 ;
|
||||||
|
foreach my $event_sys_id (@system_name_ids) {
|
||||||
|
next unless $event_sys_id ;
|
||||||
|
next unless $db{event_systems}{$event_sys_id}{system_type} ;
|
||||||
|
if ($db{event_systems}{$event_sys_id}{logistics_location_id}) {
|
||||||
|
$val = $db{logistics_locations}{$db{event_systems}{$event_sys_id}{logistics_location_id}}{location} ;
|
||||||
|
$found_loc = 1 ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Johannesburg/) {
|
||||||
|
$val = $db{logistics_locations}{1}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Cape Town/) {
|
||||||
|
$val = $db{logistics_locations}{2}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Durban/) {
|
||||||
|
$val = $db{logistics_locations}{3}{location} ;
|
||||||
|
} elsif (!$found_loc && $db{cities}{$db{$table}{$id}{city_id}}{name} =~ /Bloemfontein/) {
|
||||||
|
$val = $db{logistics_locations}{4}{location} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_supplier {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{supplier}} = "Supplier" ;
|
||||||
|
$opts{$field{supplier}} = $opts{logistics_supplier} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{supplier}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = qq~<select class="form-control" name="$field{supplier}" id="$ucfirstfield{supplier}" data-placeholder="Select $preferred_title{$field{supplier}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{supplier}}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
if ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||||||
|
$valxlsx = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{supplier}" if $ucfirstfield{supplier} ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)" ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{supplier}").val("$logistics_supplier_ids_hash{$id}{$from_to}") ;
|
||||||
|
// \$("#$ucfirstfield{supplier}").trigger("chosen:updated") ;
|
||||||
|
// \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(9)").css("background-color","#424949") ;
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{supplier}\_chosen" if $ucfirstfield{supplier} ;
|
||||||
|
} elsif ($logistics_supplier_ids_hash{$id}{$from_to}) {
|
||||||
|
$val = $db{logistics_suppliers}{$logistics_supplier_ids_hash{$id}{$from_to}}{supplier} ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_status {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
local %status_hash = (1 =>"Booked",2 => "Pending",3=>"In Transit",4 =>"Delivered") ;
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{status}} = "Status" ;
|
||||||
|
$opts{$field{status}} = $opts{status} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{status}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
$val = qq~<select class="form-control" name="$field{status}" id="$ucfirstfield{status}" data-placeholder="Select $preferred_title{$field{status}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{status}}
|
||||||
|
</select>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$val = &common_min_form_select_col($field{status},'') ; ########### >= OR >
|
||||||
|
if ($logistics_status_ids_hash{$id}{$from_to}) {
|
||||||
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{status}").val("$logistics_status_ids_hash{$id}{$from_to}") ;
|
||||||
|
// \$("#$ucfirstfield{status}").trigger("chosen:updated") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{status}":"$logistics_status_ids_hash{$id}{$from_to}",~ ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{status}" if $ucfirstfield{status} ;
|
||||||
|
if ($logistics_status_ids_hash{$id}{$from_to} eq '1') { #Booked
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(81,203,242)") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '2') { #Pending
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(66,73,73)") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '3') { #In Transit
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(255,165,0) ") ; ~ ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to} eq '4') { #Delivered
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(8)").css("background-color","rgb(46,204,113)") ; ~ ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{status}":"2",~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{status}\_chosen" if $ucfirstfield{status} ;
|
||||||
|
} elsif ($logistics_status_ids_hash{$id}{$from_to}) {
|
||||||
|
$val = $logistics_status_ids_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
$valxlsx = $status_hash{$logistics_status_ids_hash{$id}{$from_to}} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_waybill_nr {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
my $fname = 'waybill_nr' ; $val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
my $wb_code = 'AIS' . uc substr($from_to,0,1) . '_' ;
|
||||||
|
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $print_field = &common_min_print_field($field{$fname}) ; $tindex++ ;
|
||||||
|
my $wb_nr = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : $wb_code . $id ;
|
||||||
|
$default_javascript .= qq~"$field{$fname}":"$wb_nr",~ ;
|
||||||
|
$val = qq~<div class="control-group"><div class='controls'><input type='text' class='form-control' name='$field{$fname}' id='$ucfirstfield{$fname}' placeholder='$print_field' value="$wb_nr" tabindex="$tindex">
|
||||||
|
</div></div>~ ;
|
||||||
|
$valxlsx = $wb_nr ;
|
||||||
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{$fname}").css("width","100%") ;~ ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(7)").css("background-color","#424949") ; ~ if $logistics_waybill_ids_hash{$id}{$from_to} ;
|
||||||
|
} else {
|
||||||
|
$val = ($logistics_waybill_ids_hash{$id}{$from_to}) ? $logistics_waybill_ids_hash{$id}{$from_to} : (!$readlonly_row) ? $id : "" ;
|
||||||
|
print "\n logistics_waybill_nr" ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_item {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
|
||||||
|
$all_ids .= qq~,$id~ ;
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{item}} = "Item" ;
|
||||||
|
$opts{$field{item}} = $opts{logistics_items} ;
|
||||||
|
$trigger_jquery_raw .= qq~\$("#$ucfirstfield{item}").chosen({ allow_single_deselect:true });~ ;
|
||||||
|
|
||||||
|
if ($logistics_item_ids_hash{$id}) {
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(6)" ;
|
||||||
|
foreach my $item_id (split(/\,/,$logistics_item_ids_hash{$id})) {
|
||||||
|
next unless $item_id ;
|
||||||
|
$opts{$field{item}} =~ s/\Q"$item_id"/"$item_id" SELECTED/g ;
|
||||||
|
}
|
||||||
|
$valxlsx = join (';', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||||||
|
}
|
||||||
|
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{item}" id="$ucfirstfield{item}" multiple data-placeholder="Select $preferred_title{$field{item}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{item}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~ \$("#$ucfirstfield{item}\_chosen").css("width","100%") ;~ if $ucfirstfield{item} ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="hidden" name="item$id" id="item-$id" value="">~;
|
||||||
|
|
||||||
|
$jquery_chosen_sel .= qq~
|
||||||
|
item_val = \$("#selectItem_$id").chosen().val() ;
|
||||||
|
\$('#item-$id').val(item_val) ;
|
||||||
|
~ ;
|
||||||
|
} elsif ($logistics_item_ids_hash{$id}) {
|
||||||
|
$val = join (',', map { $db{logistics_items}{$_}{name} } split /,/, $logistics_item_ids_hash{$id});
|
||||||
|
$valxlsx = $val ;
|
||||||
|
$valxlsx =~ s/\,/\;/g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_poc {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
$preferred_title{$field{poc}} = "poc" ;
|
||||||
|
$opts{$field{poc}} = $opts{poc}{$id} ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{poc}").chosen({ allow_single_deselect:true }) ; \$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)").css("z-index","$cali_cnt") ;
|
||||||
|
~ ;
|
||||||
|
$val = qq~
|
||||||
|
<select class="form-control" name="$field{poc}" id="$ucfirstfield{poc}" data-placeholder="Select $preferred_title{$field{poc}}" data-rel="chosen">
|
||||||
|
<option value=""></option>
|
||||||
|
$opts{$field{poc}}
|
||||||
|
</select>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
if ($logistics_poc_hash{$id}) {
|
||||||
|
$valxlsx = $logistics_poc_hash{$id} ;
|
||||||
|
$valxlsx =~ s/\_/ \[/g ;
|
||||||
|
$valxlsx .= qq~]~ ;
|
||||||
|
push @table_with_default_ids,"#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(5)" ;
|
||||||
|
push @selects_with_default_ids,"#$ucfirstfield{poc}" ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$ucfirstfield{poc}").val("$logistics_poc_hash{$id}") ;
|
||||||
|
~ ;
|
||||||
|
$default_javascript .= qq~"$field{poc}":"$logistics_poc_hash{$id}",~ ;
|
||||||
|
} else {
|
||||||
|
$default_javascript .= qq~"$field{poc}":"",~ ;
|
||||||
|
}
|
||||||
|
push @dropdown_chosen_ids,"#$ucfirstfield{poc}\_chosen" if $ucfirstfield{poc} ;
|
||||||
|
|
||||||
|
} elsif ($logistics_poc_hash{$id}) {
|
||||||
|
$val = $logistics_poc_hash{$id} ;
|
||||||
|
$val =~ s/\_/\[/g ;
|
||||||
|
$val .= qq~]~ ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_special_instructions {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
$val = '' ; $valxlsx = 'MUSTBEBLANK' ;
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $end_date) || ($from_to eq 'from' && $current_date <= $start_date)) {
|
||||||
|
if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
$found_editable = 1 ;
|
||||||
|
my $print_field = &common_min_print_field($field{special_instructions}) ;
|
||||||
|
$tindex++ ;
|
||||||
|
|
||||||
|
my $defualt = ($logistics_special_instructions_hash{$id}{$from_to}) ? $logistics_special_instructions_hash{$id}{$from_to} : "" ;
|
||||||
|
|
||||||
|
$valxlsx = $defualt if $defualt ;
|
||||||
|
$val = qq~
|
||||||
|
<div class="control-group">
|
||||||
|
<div class='controls'>
|
||||||
|
<textarea type='text' class='form-control' name='$field{special_instructions}' id='$ucfirstfield{special_instructions}' placeholder='$print_field' value="$defualt" tabindex="$tindex">$defualt</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$ucfirstfield{special_instructions}").css("width","100%") ;
|
||||||
|
~ ;
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
\$("#$useropts{table_id} tr:eq($cali_cnt) td:nth-last-child(4)").css("background-color","#424949") ;
|
||||||
|
~ if $logistics_special_instructions_hash{$id}{$from_to} ;
|
||||||
|
} elsif ($logistics_special_instructions_hash{$id}{$from_to}) {
|
||||||
|
$val = $logistics_special_instructions_hash{$id}{$from_to} ;
|
||||||
|
$valxlsx = $val ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_create_waybill {
|
||||||
|
|
||||||
|
my ($from_to,$id) = @_ ;
|
||||||
|
|
||||||
|
# if (($from_to eq 'to' && $current_date <= $start_date) || ($from_to eq 'from' && $current_date <= $end_date)) {
|
||||||
|
if (!$readlonly_row) {
|
||||||
|
|
||||||
|
$ignore{"$_\_$id"} = 1 ;
|
||||||
|
$valxlsx = '' ;
|
||||||
|
|
||||||
|
# if ($_ eq 'process_complete') {
|
||||||
|
# $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
# } elsif (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $items && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
|
||||||
|
if ($logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) {
|
||||||
|
# if ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||||||
|
if ($dcb_waybill_nr{$from_to}) {
|
||||||
|
my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||||||
|
my $arrow_direction = ($from_to eq 'to') ? 'right' : 'left' ;
|
||||||
|
my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||||||
|
my $uc_from_to = uc $from_to ;
|
||||||
|
$val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} else {
|
||||||
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
}
|
||||||
|
} elsif ($waybill_nr_default_val && $item_default_val && $supplier_default_val == 2) {
|
||||||
|
$val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
my $tool_tip = qq~~ ;
|
||||||
|
|
||||||
|
$tool_tip .= qq~<br><b>- Add WayBillNr</b>~ unless $waybill_nr_default_val ;
|
||||||
|
$tool_tip .= qq~<br><b>- Add Item(s)</b>~ unless $item_default_val ;
|
||||||
|
$tool_tip .= qq~<br><b>- Set Supplier to DCB</b>~ if $supplier_default_val != 2 ;
|
||||||
|
|
||||||
|
$val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:$tool_tip'></i>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# # # if (!$dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
# # # $val = qq~<input name="$_\_$from_to\_$id" data-no-uniform="true" type="checkbox" id="$_\_$from_to\_$id" value="1" tabindex="$tindex">~ ;
|
||||||
|
# # # } elsif ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to} && $db{$table}{$id}{logistics_item_ids} && $supp{$from_to} == 2) { # 2 = DCB Logistics
|
||||||
|
|
||||||
|
# # # my $arrow_class = ($dcb_waybill_nr{$from_to} && $logistics_waybill_ids_hash{$id}{$from_to}) ? 'success' : 'danger' ;
|
||||||
|
# # # # my $to_arrow_class = ($dcb_waybill_nr{to} && $logistics_waybill_ids_hash{$id}{to}) ? 'success' : 'danger' ;
|
||||||
|
# # # # my $from_arrow_class = ($dcb_waybill_nr{from} && $logistics_waybill_ids_hash{$id}{from}) ? 'success' : 'danger' ;
|
||||||
|
|
||||||
|
# # # my $arrow_direction = ($from_to eq 'to') ? 'rigth' : 'left' ;
|
||||||
|
|
||||||
|
# # # my $dlg = qq~javascript:dlgMdl('$useropts{'scripts'}/dialog/dcb_trackntrace.pl?debug=1&waybillnr~;
|
||||||
|
|
||||||
|
# # # my $uc_from_to = uc $from_to ;
|
||||||
|
|
||||||
|
# # # $val = qq~<a class="btn btn-$arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{$from_to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace $uc_from_to Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-$arrow_direction"></i></a>~ ;
|
||||||
|
# # # # $val = qq~<a class="btn btn-$to_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{to}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace TO Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-right"></i></a>
|
||||||
|
# # # # <a class="btn btn-$from_arrow_class btn-round btn-xs" href="$dlg=$logistics_waybill_ids_hash{$id}{from}','DCB Track & Trace','','medium-dialog');" data-title='DCB Track & Trace FROM Venue' data-toggle='tooltip' data-placement='top'><i class="glyphicon glyphicon-arrow-left"></i></a>~ ;
|
||||||
|
# # # $nowrap = 'nowrap' ;
|
||||||
|
# # # } else {
|
||||||
|
# # # $val = qq~<i class="glyphicon glyphicon-remove" data-toggle='tooltip' data-placement='left' data-title='Before sending to DCB:<br><b>- Add WayBillNr</b><br><b>- Add Item(s)</b><br><b>- Set Supplier to DCB</b>'></i>~ ;
|
||||||
|
# # # }
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub logistics_jquery {
|
||||||
|
|
||||||
|
my ($from_to) = @_ ;
|
||||||
|
|
||||||
|
foreach my $system_id (keys %seen_system_cnt) {
|
||||||
|
chop $all_location_ids_per_system{$system_id} if $all_location_ids_per_system{$system_id} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $update_ids_str = join(',',@update_ids) ;
|
||||||
|
my $selects_with_default_ids_str = join(',',@selects_with_default_ids) ;
|
||||||
|
my $table_with_default_ids_str = join(',',@table_with_default_ids) ;
|
||||||
|
my $dropdown_chosen_ids_str = join(',',@dropdown_chosen_ids) ;
|
||||||
|
# <span title data-toggle="tooltip" data-original-title="System in use!">
|
||||||
|
my $plus_item = ($is_dcb_partner) ? qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved again!'>ITEM</span>~ : qq~<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved items to see all options once the page is saved!'>ITEM</span><a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_logistics_item.pl?add&$all_ids&$from_to','Add Item','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:75%;' title='Add Item' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").html("$plus_item") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>FROM</span>") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").html("<span title='' data-toggle='tooltip' data-placement='top' data-original-title='Deselect saved venues to see all options once the page is saved again!'>TO</span>") ;
|
||||||
|
\$('[data-toggle="tooltip"]').tooltip({
|
||||||
|
container: 'body'
|
||||||
|
});
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my $plus_poc = ($is_dcb_partner) ? 'POC' : qq~POC<a href=javascript:dlgMdl('$useropts{'scripts'}/dialog/add_poc.pl?add&$i{date_from}&$i{date_to}&$i{client_id}&$i{organisation_ids}&$i{supplier_id}&$i{status_id}&$i{region_id}&$from_to','Add POC','','medium-dialog'); class='btn btn-primary btn-xs' style='padding:0px 2px 0px 3px;margin-top:0px;margin-left:50%;' title='Add POC' data-toggle='tooltip' data-placement='top'><i class='glyphicon glyphicon-plus' style='padding:0;margin-top:0px;top:0px;'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").html("$plus_poc") ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my $icon = qq~~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id}_wrapper").css("overflow","scroll");
|
||||||
|
\$("#$useropts{table_id}_wrapper").css("height","60vh");
|
||||||
|
// \$("#$useropts{table_id}_wrapper").css("overflow-y","hidden");
|
||||||
|
\$("#$useropts{table_id}").css("width","175%") ;
|
||||||
|
\$("#$useropts{table_id}").css("max-width","175%");
|
||||||
|
\$("#$useropts{table_id} tr th").slice(-3, -1).css("width","0%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").css("width","0%");
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
# if ($from_to eq 'to') {
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(1); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill Out'></i></a>~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-open").tooltip();
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th").slice(-7, -3).css("width","7.5%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","13%");
|
||||||
|
# \$("#$useropts{table_id} tr th").slice(-15, -10).css("width","7.5%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
|
||||||
|
# } else {
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill In'></i></a>~ ;
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-save' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||||||
|
|
||||||
|
# $trigger_jquery .= qq~
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3)").html("$icon") ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child(3) .glyphicons-disk-save").tooltip();
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# foreach (keys %last_child) { $trigger_jquery .= qq~\$("#$useropts{table_id} tr th:nth-last-child($last_child{$_})").css("width","7.5%");~ ; }
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("width","7%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("width","16%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("width","4%");
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("width","4.5%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("width","7%");
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{shipment_operator})").css("width","7%");
|
||||||
|
~ ;
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_from})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_to})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{system})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{from})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{to})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{supplier})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{poc})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("min-width","320px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{item})").css("max-width","320px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("min-width","105px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").css("max-width","105px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").css("max-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{special_instructions})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{other_special_instructions})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{waybill_nr})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{status})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{received_by})").css("min-width","120px");
|
||||||
|
# \$("#$useropts{table_id} tr th:nth-last-child($last_child{dcb_comments})").css("min-width","120px");
|
||||||
|
# ~ ;
|
||||||
|
|
||||||
|
# $icon = qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
# $icon = ($from_to eq 'from') ? qq~<a href=javascript:selectAll(3); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ : qq~<a href=javascript:selectAll(4); style='color:black;'><i class='glyphicons glyphicons-disk-saved' title data-toggle='tooltip' data-placement='top' data-original-title='Process Complete'></i></a>~ ;
|
||||||
|
|
||||||
|
$icon = qq~<a href=javascript:selectAll(2); style='color:black;'><i class='glyphicons glyphicons-disk-open' title data-toggle='tooltip' data-placement='top' data-original-title='Create Waybill'></i></a>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(2)").html("$icon").trigger("chosen:updated") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(2) .glyphicons-disk-open").tooltip();
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$icon = qq~<i class='glyphicons glyphicons-ok' title data-toggle='tooltip' data-placement='top' data-original-title='Update'></i>~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1)").html("$icon") ;
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child(1) .glyphicons-ok").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
chop $quote_and_ops_ids if $quote_and_ops_ids ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
function selectAll(col) {
|
||||||
|
|
||||||
|
let from_to = \$("#from_to").text() ;
|
||||||
|
let col_id = "" ;
|
||||||
|
if (col == '1') {
|
||||||
|
col_id = "create_waybill_out_" ;
|
||||||
|
} else if (col == '2') {
|
||||||
|
col_id = "create_waybill_in_" ;
|
||||||
|
}
|
||||||
|
// else if (col == '3') {
|
||||||
|
// col_id = "process_complete_from_" ;
|
||||||
|
// } else if (col == '4') {
|
||||||
|
// col_id = "process_complete_to_" ;
|
||||||
|
// }
|
||||||
|
let jsObject = {
|
||||||
|
$quote_and_ops_ids
|
||||||
|
};
|
||||||
|
for (let key in jsObject) {
|
||||||
|
let event_id = key ;
|
||||||
|
\$(\$("#$useropts{table_id}").dataTable().fnGetNodes()).find(\$("input[name='"+col_id+""+event_id+"']")).each(function () {
|
||||||
|
if(!\$(this).is(':checked')) {
|
||||||
|
\$(this).prop('checked',true);
|
||||||
|
} else {
|
||||||
|
\$(this).prop('checked',false);
|
||||||
|
}
|
||||||
|
}) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("DELIVERY DATE BY") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date})").html("$icon") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_date}) .glyphicons-calendar").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
$trigger_jquery .= qq~
|
||||||
|
\$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("DELIVERY TIME BY") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time})").html("$icon") ;
|
||||||
|
// \$("#$useropts{table_id} tr th:nth-last-child($last_child{delivery_time}) .glyphicon-time").tooltip() ;
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
89
libs/modules/_FromProd/v1.0/mailsend.pm
Normal file
89
libs/modules/_FromProd/v1.0/mailsend.pm
Normal file
File diff suppressed because one or more lines are too long
603
libs/modules/_FromProd/v1.0/match_event_production_time.pm
Normal file
603
libs/modules/_FromProd/v1.0/match_event_production_time.pm
Normal file
|
|
@ -0,0 +1,603 @@
|
||||||
|
sub read_db_to_match_events_and_systems {
|
||||||
|
|
||||||
|
&common_date_array($last_start_ccyymmdd,$last_end_ccyymmdd);
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name,description,system_type','','','') ;
|
||||||
|
foreach my $id (keys %{$db{event_systems}}) {
|
||||||
|
$event_system_description{$id} = $db{event_systems}{$id}{description} ;
|
||||||
|
$event_system_name{$id} = $db{event_systems}{$id}{name} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_sql = substr($start_sql,0,11) . '00:00:00' ;
|
||||||
|
$end_sql = substr($end_sql,0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to',"(date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to,sport_type_ids,club_ids',"((date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')) AND event_system_id_multiple IS NOT NULL AND event_system_id_multiple <> ''",'','') ;
|
||||||
|
|
||||||
|
our %seen_event_system_in_event_quotes = () ;
|
||||||
|
|
||||||
|
foreach my $event_id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{ref} =~ s/\'//g ;
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/;+/;/g; # Replace multiple semicolons with one
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/^;+|;+$//g; # Remove leading or trailing semicolons
|
||||||
|
|
||||||
|
# next unless $db{event_quotes}{$event_id}{event_system_id_multiple} ;
|
||||||
|
|
||||||
|
$opts{matched_event} .= qq~<option value="$event_id">[$event_id] $db{event_quotes}{$event_id}{ref}</option>~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{event_quotes}{$event_id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
# $opts{matched_system} .= $seen_event_system_in_event_quotes{$_}
|
||||||
|
$seen_event_system_in_event_quotes{$_} = 1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (sort {$seen_event_system_in_event_quotes{$a} cmp $seen_event_system_in_event_quotes{$b}} keys %seen_event_system_in_event_quotes) {
|
||||||
|
$opts{matched_system} .= qq~<option value="$_">$db{event_systems}{$_}{name} [$db{event_systems}{$_}{description}]</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$opts{matched_system_none} .= qq~<option value="-1">$db{event_systems}{-1}{name} [$db{event_systems}{-1}{description}]</option>~ ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
|
||||||
|
our %sport_name_to_id = () ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{sport_types}}) {
|
||||||
|
$db{sport_types}{$_}{name} = lc $db{sport_types}{$_}{name} ;
|
||||||
|
$db{sport_types}{$_}{name} =~ s/ //g ;
|
||||||
|
$sport_name_to_id{$db{sport_types}{$_}{name}} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('clubs','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{clubs}}) {
|
||||||
|
my $c_name = lc $db{clubs}{$_}{name} ;
|
||||||
|
$c_name =~ s/\'//g ;
|
||||||
|
$club_name_to_id{$c_name} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
# # $match_bank_trans{$db{event_quotes}{$id}{trans_date}}{$db{event_quotes}{$id}{description}} = 1 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$tables}{$id}{event_system_id_multiple})) {
|
||||||
|
# $val .= qq~$db{event_systems}{$event_id}{name} [$db{event_systems}{$event_id}{description}], ~ ;
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub process_matched_events_and_systems {
|
||||||
|
|
||||||
|
my %system_match = () ; my %matched_event_name = () ; my %csv_line_possible_match = () ; my %matched_events = () ;
|
||||||
|
|
||||||
|
$system_match{"None"}{"None"} = -1 ;
|
||||||
|
|
||||||
|
foreach my $event_code (keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
my ($club_name,$system_desc_clue) = split("-",$csv_line{$event_code}{club_name}) ;
|
||||||
|
$club_name =~ s/ $//g ; $system_desc_clue =~ s/^ //g ; # remove whitespace
|
||||||
|
$club_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
$system_desc_clue = "None" unless $system_desc_clue ;
|
||||||
|
|
||||||
|
my @eventdetails = split(/ /,$club_name) ;
|
||||||
|
|
||||||
|
my $system_name_clue = $eventdetails[-1] ; $system_name_clue = "None" if $system_name_clue !~ /\d+/ ;
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /\d+/ && length($system_desc_clue) == 5) {
|
||||||
|
$system_name_clue = $system_desc_clue ;
|
||||||
|
$system_desc_clue = 'None' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /AISA/ && $system_desc_clue =~ /SOLO/) {
|
||||||
|
my @sysparts = split(/\_/,$system_desc_clue) ;
|
||||||
|
$system_name_clue = $sysparts[2] ;
|
||||||
|
$system_desc_clue =~ s/\_/ /g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = -1 if $system_name_clue eq 'None' && $system_desc_clue eq 'None' ;
|
||||||
|
|
||||||
|
$system_desc_clue = lc $system_desc_clue ;
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = $system_match{$system_name_clue}{$system_desc_clue} if $system_match{$system_name_clue}{$system_desc_clue} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $system_id (keys %{$db{event_systems}}) {
|
||||||
|
# foreach my $system_id (keys %seen_event_system_in_event_quotes) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my @sport_split = split(":",$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
$sport_split[0] =~ s/ //g ;
|
||||||
|
$sport_split[0] = lc $sport_split[0] ;
|
||||||
|
|
||||||
|
my $sport_id = ($csv_line{$event_code}{event_name} =~ /:/) ? $sport_name_to_id{$sport_split[0]} : '' ;
|
||||||
|
|
||||||
|
my @event_name_details = split(/-/,$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
my $to_match_event_name = $event_name_details[-1] ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/^ //g ;
|
||||||
|
$to_match_event_name =~ s/ $//g ;
|
||||||
|
|
||||||
|
$to_match_event_name = ($csv_line{$event_code}{event_name} =~ /:/ && $csv_line{$event_code}{event_name} !~ /-/) ? $sport_split[1] : $to_match_event_name ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
my $club_id = $club_name_to_id{$club_name} ;
|
||||||
|
|
||||||
|
$club_name = ($csv_line{$event_code}{club_name} =~ /AISA/ && $csv_line{$event_code}{club_name} =~ /SOLO/) ? lc $club_name : lc $csv_line{$event_code}{club_name} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
$matched_events{$event_code} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $found_match = 0 ;
|
||||||
|
|
||||||
|
foreach my $system_id (split(";",$db{event_quotes}{$id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if ($sys_name =~ /\b$system_name_clue\b/ && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_name =~ /\b$system_name_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $sys_desc = $db{event_systems}{$system_id}{description} ;
|
||||||
|
# my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
# # my @sysparts = split(/\_/,$system) ;
|
||||||
|
|
||||||
|
# if ($sys_name =~ /\b$sysno\b/ && $sys_desc =~ /\b$system\b/iog) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /\d+/ && $sys_name =~ /\b$system\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /AISA/ && $system =~ /SOLO/ && $sysparts[2] && $sys_name =~ /\b$sysparts[2]\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($sys_desc eq 'St Stithians Hockey Red' && $clubname =~ /Red/i && $clubname =~ /Stithians/i) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $event_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_match && !$csv_line{$event_code}{event_id}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
next ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!$csv_line{$event_code}{system_id}) && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
# if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
# if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
# $csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
# }
|
||||||
|
# next ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $csv_line_possible_match{$event_code}{event_id} if $csv_line_possible_match{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_box_content_rows .= &common_min_forms_start("$lcpage") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("club_system","system_nr","matched_system","production_hours","production_seconds","cloud_recording_seconds","club_name","start","end","event_name","matched_event","match") ;
|
||||||
|
|
||||||
|
my $row_cnt = 0 ; my %no_system_or_event = () ;
|
||||||
|
|
||||||
|
foreach my $event_code (sort {$csv_line{$a}{line_cnt} cmp $csv_line{$b}{line_cnt}} keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
$row_cnt++ ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~<tr id="$row_cnt">~ ;
|
||||||
|
|
||||||
|
my $cell_id = qq~~ ;
|
||||||
|
|
||||||
|
my ($system,$sysno) = split(" - ",$csv_line{$event_code}{club_name}) ;
|
||||||
|
|
||||||
|
my @get_sport = (!$csv_line{$event_code}{system_id} || (!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /;/)) ? split(/\:/,$csv_line{$event_code}{event_name}) : () ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="text" name='$event_code' value="$event_code_to_line{$event_code}" style="display:none;">~ if !$csv_line{$event_code}{system_id} || !$csv_line{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
foreach my $col (@sql_col_display) {
|
||||||
|
|
||||||
|
my $val = '' ; $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($col eq 'club_name') {
|
||||||
|
$val = $csv_line{$event_code}{club_name} ;
|
||||||
|
} elsif ($col eq 'system_nr') {
|
||||||
|
$val = $sysno ;
|
||||||
|
} elsif ($col eq 'start') {
|
||||||
|
$val = $csv_line{$event_code}{start_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'end') {
|
||||||
|
$val = $csv_line{$event_code}{end_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'club_system') {
|
||||||
|
$val = $system ;
|
||||||
|
} elsif ($col eq 'matched_system') {
|
||||||
|
|
||||||
|
$preferred_placeholder{"system_$row_cnt"} = "Select System" ;
|
||||||
|
|
||||||
|
$found_system_drop_down = 1 if !$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1' ;
|
||||||
|
|
||||||
|
# $allow_deselect{"system_$row_cnt"} = 1 ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : ($csv_line{$event_code}{system_id} eq '-1') ? &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system_none") : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
# $val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1') {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{system} .= qq~"#selectSystem_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$cell_id = qq~id="matched_system_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'production_hours') {
|
||||||
|
$val = $csv_line{$event_code}{production_hours} ;
|
||||||
|
$val =~ s/\,/\./g ;
|
||||||
|
} elsif ($col eq 'production_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{production_seconds}) ;
|
||||||
|
} elsif ($col eq 'cloud_recording_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{cloud_seconds}) ;
|
||||||
|
} elsif ($col eq 'event_name') {
|
||||||
|
$val = $csv_line{$event_code}{event_name} ;
|
||||||
|
} elsif ($col eq 'matched_event') {
|
||||||
|
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} =~ s/\;/\_/g ;
|
||||||
|
|
||||||
|
my $col_name = (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? "matched_event_$csv_line_possible_match{$event_code}{event_id}" : "matched_event" ;
|
||||||
|
|
||||||
|
$opts{$col_name} =
|
||||||
|
($csv_line_possible_match{$event_code}{event_id} && !$csv_line{$event_code}{event_id}) ? join "</option><option ", map { qq~value="$_"><strong>Possible : </strong>$db{event_quotes}{$_}{ref} [$_]~ } split "_" , $csv_line_possible_match{$event_code}{event_id} :
|
||||||
|
$opts{matched_event} ;
|
||||||
|
|
||||||
|
$opts{$col_name} = qq~<option ~ . $opts{$col_name} . qq~</option>~ if $col_name ne 'matched_event' ;
|
||||||
|
|
||||||
|
$preferred_placeholder{"event_$row_cnt"} = "Select Event" ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{event_id}) ? "$db{event_quotes}{$csv_line{$event_code}{event_id}}{ref} [$csv_line{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
# (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? "<strong>POSSIBLE : </strong>$db{event_quotes}{$csv_line_possible_match{$event_code}{event_id}}{ref} [$csv_line_possible_match{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
(!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? &common_min_table_select("event_$row_cnt",'','','','','','',$col_name) :
|
||||||
|
&common_min_table_select("event_$row_cnt",'','','','','','','matched_event') ;
|
||||||
|
|
||||||
|
$found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} ;
|
||||||
|
# $found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} && (!$csv_line_possible_match{$event_code}{event_id} || $csv_line_possible_match{$event_code}{event_id} =~ /_/) ;
|
||||||
|
|
||||||
|
# if ((!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /_/)) {
|
||||||
|
if (!$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{event} .= qq~"#selectEvent_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$cell_id = qq~id="matched_event_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'match') {
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
|
||||||
|
$cell_id = qq~id="final_col_$row_cnt"~ ;
|
||||||
|
|
||||||
|
my $tool = $pixellot_system{$ccyymmdd}{$period} ;
|
||||||
|
|
||||||
|
$start_sql =~ s/ /T/g ;
|
||||||
|
$end_sql =~ s/ /T/g ;
|
||||||
|
|
||||||
|
# my $system_input = ($csv_line{$event_code}{system_id}) ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
my $system_input = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : ($csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? $csv_line_possible_match{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $event_input = ($matched_event_id) ? qq~<input style='display:none;' value='$matched_event_id' id='selectEvent_$row_cnt' name="event_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
my $match_icon = ($system_input && $event_input) ? "ok" : "remove" ;
|
||||||
|
my $match_class = ($system_input && $event_input) ? "success" : "danger" ;
|
||||||
|
|
||||||
|
push @unmatched_rows, "#selectEvent_$row_cnt" if !$event_input ;
|
||||||
|
push @unmatched_rows, "#selectSystem_$row_cnt" if !$system_input ;
|
||||||
|
|
||||||
|
my $not_matched = (!$event_input || !$system_input) ? qq~<input style='display:none;' value='1' id='not_matched_$row_cnt'>~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $no_similar_rows = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1' && $csv_line{$event_code}{event_id}) ? '-1' : '' ;
|
||||||
|
|
||||||
|
my $similar_rows = (!$event_input || !$system_input) ? qq~<input value='' name='similar_rows_$row_cnt' style='display:none;'>~ : qq~~ ;
|
||||||
|
|
||||||
|
$val = "
|
||||||
|
$system_input
|
||||||
|
$event_input
|
||||||
|
$not_matched
|
||||||
|
$similar_rows
|
||||||
|
<input style='display:none;' value='$event_code' id='event_code_$row_cnt' name='event_code_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{production_seconds}' id='time_$row_cnt' name='time_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{cloud_seconds}' id='cloud_time_$row_cnt' name='cloud_time_$row_cnt'>
|
||||||
|
<a class='btn btn-$match_class btn-sm' id='matched_row_$row_cnt' href=javascript:match_event_system('$row_cnt','$event_code','$csv_line{$event_code}{production_seconds}','$csv_line{$event_code}{cloud_seconds}'); data-title='MATCH' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-$match_icon'></i></a>
|
||||||
|
|
||||||
|
<a class='btn btn-success btn-sm' href=javascript:dlgMdl('$useropts{'scripts'}/dialog/manually_match_csv_row.pl?$matched_event_id&$csv_line{$event_code}{system_id}&$csv_line{$event_code}{production_seconds}&$csv_line{$event_code}{cloud_seconds}&$event_code&$start_sql&$end_sql&$row_cnt&add','Manually Match','','medium-dialog'); data-title='MATCH MANUALLY' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title>
|
||||||
|
<i class='glyphicon glyphicon-question-sign'></i>
|
||||||
|
</a>
|
||||||
|
" ;
|
||||||
|
|
||||||
|
$start_sql =~ s/T/ /g ;
|
||||||
|
$end_sql =~ s/T/ /g ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $cell_id $nowrap>$val</td>~ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
// let inputString = '1,21,32,4'; // Your input string
|
||||||
|
// let outputString = inputString.split(',').map(num => 'abc_' + num).join(',');
|
||||||
|
|
||||||
|
function auto_select_similar_drop_downs (ids,changed_val) {
|
||||||
|
for (let id of ids) {
|
||||||
|
if (\$(id).val()) {
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
\$(id).val(changed_val) ;
|
||||||
|
\$(id).trigger("chosen:updated") ;
|
||||||
|
fix_match_icon(id) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my %seen_rows_set = () ;
|
||||||
|
|
||||||
|
foreach my $club_name (keys %no_system_or_event) {
|
||||||
|
foreach my $start_time (keys %{$no_system_or_event{$club_name}}) {
|
||||||
|
foreach my $sport_name (keys %{$no_system_or_event{$club_name}{$start_time}}) {
|
||||||
|
foreach my $sys_evt (keys %{$no_system_or_event{$club_name}{$start_time}{$sport_name}}) {
|
||||||
|
|
||||||
|
chop $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} if $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
my $ids_change = $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
$ids_change =~ s/\"//g ;
|
||||||
|
|
||||||
|
my $ids_change2 = $ids_change ;
|
||||||
|
|
||||||
|
$ids_change2 =~ s/#selectEvent_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
$ids_change2 =~ s/#selectSystem_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
|
||||||
|
my $ids_change_row_nrs = $ids_change ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectEvent_//g ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectSystem_//g ;
|
||||||
|
|
||||||
|
my @first_nr = split(/\,/,$ids_change_row_nrs) ;
|
||||||
|
|
||||||
|
my $event_or_system = ($no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} =~ /Event/) ? 'event' : 'system' ;
|
||||||
|
|
||||||
|
next if $seen_rows_set{$ids_change_row_nrs}{$event_or_system} ;
|
||||||
|
$seen_rows_set{$ids_change_row_nrs}{$event_or_system} = 1 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
if (\$("#not_matched_$first_nr[0]").val() && !\$("input[name='similar_rows_$first_nr[0]']").val()) {
|
||||||
|
\$("$ids_change2").val("$ids_change_row_nrs") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("$ids_change").change( function () {
|
||||||
|
|
||||||
|
fix_match_icon(this.id) ;
|
||||||
|
if (!\$(this).val()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
auto_select_similar_drop_downs([$no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt}],\$(this).val()) ;
|
||||||
|
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $unmatched_rows_str = join(",",@unmatched_rows) ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function get_row_nr (id) {
|
||||||
|
|
||||||
|
let lastIndex = id.lastIndexOf('_');
|
||||||
|
lastIndex = parseInt(lastIndex) ;
|
||||||
|
let row_nr_1 = id.substring(1+lastIndex);
|
||||||
|
return row_nr_1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_match_icon (id) {
|
||||||
|
|
||||||
|
let row_nr = get_row_nr(id) ;
|
||||||
|
|
||||||
|
if (\$("#selectEvent_"+row_nr).val() && \$("#selectSystem_"+row_nr).val() && \$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-danger btn-sm').addClass('btn btn-success btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-ok'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("") ;
|
||||||
|
} else if ((!\$("#selectEvent_"+row_nr).val() || !\$("#selectSystem_"+row_nr).val()) && !\$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-success btn-sm').addClass('btn btn-danger btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-remove'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("1") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("$unmatched_rows_str").change( function () {
|
||||||
|
// fix_match_icon(this.id) ;
|
||||||
|
// }) ;
|
||||||
|
|
||||||
|
~ if $unmatched_rows_str ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(2)").css("width","20%");~ if $found_event_drop_down ; ## MATCHED EVENT COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(10)").css("width","20%");~ if $found_system_drop_down ; ## MATCHED SYSTEM COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function match_event_system (row_nr,event_code,production_seconds,cloud_seconds) {
|
||||||
|
|
||||||
|
let event_id = \$("#selectEvent_"+row_nr).val() ;
|
||||||
|
let system_id = \$("#selectSystem_"+row_nr).val() ;
|
||||||
|
|
||||||
|
if (!event_id || !system_id) {
|
||||||
|
noty({text:'Please select a System and Event!!!',layout:"center",type:"error",timeout:3000}) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("#"+row_nr).css("display","none") ;
|
||||||
|
|
||||||
|
var url = "$useropts{scripts}/get/add_event_system_hours.pl?"+event_id+"&"+system_id+"&"+production_seconds+"&"+cloud_seconds+"&"+event_code ;
|
||||||
|
|
||||||
|
\$.get(url) ;
|
||||||
|
\$("#final_col_"+row_nr).html('') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("#itv-table tr:eq(0) th:nth-last-child(1)").html("<span>Match All</span> <a class='btn btn-success btn-sm' href=javascript:match_all(1); data-title='MATCH ALL (inc. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a> <a class='btn btn-warning btn-sm' href=javascript:match_all(0); data-title='MATCH ALL (excl. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a>") ;
|
||||||
|
|
||||||
|
\$("#itv-table thead tr:eq(0) th:nth-last-child(1)").css('white-space','nowrap') ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
946
libs/modules/_FromProd/v1.0/pdf.pm
Normal file
946
libs/modules/_FromProd/v1.0/pdf.pm
Normal file
|
|
@ -0,0 +1,946 @@
|
||||||
|
sub pdf_delete_previous_pdf {
|
||||||
|
|
||||||
|
my ($pdfpath) = @_ ;
|
||||||
|
|
||||||
|
opendir(DIR, "$pdfpath") or die "cant open Directory $pdfpath: $!\n";
|
||||||
|
|
||||||
|
while(defined($folder = readdir(DIR))) {
|
||||||
|
if (length $folder > 2) {
|
||||||
|
my ($file,$type) = split(/\./,$folder) ;
|
||||||
|
if (-e "$pdfpath/$file.pdf"){
|
||||||
|
unlink ("$pdfpath/$file.pdf") or print "unable to unlink - $pdfpath/$file.pdf : $!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
closedir(DIR) ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_initialise {
|
||||||
|
|
||||||
|
my ($folder,$file,$title) = @_ ;
|
||||||
|
|
||||||
|
my $pdf_file = "$folder/$file";
|
||||||
|
|
||||||
|
$pdf = PDF::API2 -> new(-file => $pdf_file);
|
||||||
|
|
||||||
|
%font = (
|
||||||
|
Helvetica => {
|
||||||
|
Oblique => $pdf->corefont('Helvetica-Oblique', -encoding => 'latin1'),
|
||||||
|
Bold => $pdf->corefont('Helvetica-Bold', -encoding => 'latin1'),
|
||||||
|
Normal => $pdf->corefont('Helvetica', -encoding => 'latin1'),
|
||||||
|
},
|
||||||
|
Verdana => {
|
||||||
|
Bold => $pdf->corefont('Verdana-Bold', -encoding => 'Western'),
|
||||||
|
Normal => $pdf->corefont('Verdana', -encoding => 'Western'),
|
||||||
|
},
|
||||||
|
Courier => {
|
||||||
|
Bold => $pdf->corefont('Courier-Bold', -encoding => 'latin1'),
|
||||||
|
Normal => $pdf->corefont('Courier', -encoding => 'latin1'),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
$pdf->info(
|
||||||
|
'Author' => "ITV",
|
||||||
|
'Creator' => "ITV",
|
||||||
|
'Producer' => "ITV",
|
||||||
|
'Title' => $title,
|
||||||
|
'Subject' => $title,
|
||||||
|
'Keywords' => $title
|
||||||
|
);
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_initialise_page {
|
||||||
|
|
||||||
|
if ($layout eq 'landscape'){
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(297/mm, 210/mm);
|
||||||
|
}
|
||||||
|
elsif ($layout eq 'label'){
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(100/mm, 100/mm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$page = $pdf->page;
|
||||||
|
$page->mediabox(210/mm, 297/mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$small_oblique_text = $page->text;
|
||||||
|
$small_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
|
||||||
|
$small_oblique_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_oblique_text = $page->text;
|
||||||
|
$medium_oblique_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
|
||||||
|
$medium_oblique_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
|
||||||
|
$bar_head_bold_text = $page->text;
|
||||||
|
$bar_head_bold_text->font( $font{'Helvetica'}{'Bold'}, 13/pt );
|
||||||
|
$bar_head_bold_text->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$xx_large_bold_text = $page->text;
|
||||||
|
$xx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 16/pt );
|
||||||
|
$xx_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xxx_large_bold_text = $page->text;
|
||||||
|
$xxx_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 24/pt );
|
||||||
|
$xxx_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xx_large_italic_text = $page->text;
|
||||||
|
$xx_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 16/pt );
|
||||||
|
$xx_large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$xx_large_text = $page->text;
|
||||||
|
$xx_large_text->font( $font{'Helvetica'}{'Normal'}, 16/pt );
|
||||||
|
$xx_large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_bold_text = $page->text;
|
||||||
|
$x_large_bold_text->font( $font{'Helvetica'}{'Bold'}, 14/pt );
|
||||||
|
$x_large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_italic_text = $page->text;
|
||||||
|
$x_large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 14/pt );
|
||||||
|
$x_large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$x_large_text = $page->text;
|
||||||
|
$x_large_text->font( $font{'Helvetica'}{'Normal'}, 14/pt );
|
||||||
|
$x_large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_bold_text = $page->text;
|
||||||
|
$large_bold_text->font( $font{'Helvetica'}{'Bold'}, 12/pt );
|
||||||
|
$large_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_italic_text = $page->text;
|
||||||
|
$large_italic_text->font( $font{'Helvetica'}{'Oblique'}, 12/pt );
|
||||||
|
$large_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$large_text = $page->text;
|
||||||
|
$large_text->font( $font{'Helvetica'}{'Normal'}, 12/pt );
|
||||||
|
$large_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_bold_text = $page->text;
|
||||||
|
$medium_bold_text->font( $font{'Helvetica'}{'Bold'}, 9.5/pt );
|
||||||
|
$medium_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_italic_text = $page->text;
|
||||||
|
$medium_italic_text->font( $font{'Helvetica'}{'Oblique'}, 10/pt );
|
||||||
|
$medium_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_text = $page->text;
|
||||||
|
$medium_text->font( $font{'Helvetica'}{'Normal'}, 9/pt );
|
||||||
|
$medium_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$medium_red_bold_text = $page->text;
|
||||||
|
$medium_red_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$medium_red_bold_text->fillcolor( 'red' );
|
||||||
|
|
||||||
|
$small_text = $page->text;
|
||||||
|
$small_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
|
||||||
|
$small_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$small_blue_text = $page->text;
|
||||||
|
$small_blue_text->font( $font{'Helvetica'}{'Normal'}, 8/pt );
|
||||||
|
$small_blue_text->fillcolor( 'blue' );
|
||||||
|
|
||||||
|
$small_bold_text = $page->text;
|
||||||
|
$small_bold_text->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$small_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$small_italic_text = $page->text;
|
||||||
|
$small_italic_text->font( $font{'Helvetica'}{'Oblique'}, 8/pt );
|
||||||
|
$small_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_text = $page->text;
|
||||||
|
$tiny_text->font( $font{'Helvetica'}{'Normal'}, 7/pt );
|
||||||
|
$tiny_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_bold_text = $page->text;
|
||||||
|
$tiny_bold_text->font( $font{'Helvetica'}{'Bold'}, 7/pt );
|
||||||
|
$tiny_bold_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$tiny_italic_text = $page->text;
|
||||||
|
$tiny_italic_text->font( $font{'Helvetica'}{'Oblique'}, 7/pt );
|
||||||
|
$tiny_italic_text->fillcolor( 'black' );
|
||||||
|
|
||||||
|
$grey_text_above_right = $page -> text;
|
||||||
|
$grey_text_above_right -> font($font{'Helvetica'}{'Normal'}, 9/pt);
|
||||||
|
$grey_text_above_right -> fillcolor('#808080');
|
||||||
|
|
||||||
|
$small_bold_text_white = $page->text;
|
||||||
|
$small_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 8/pt );
|
||||||
|
$small_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$small_medium_bold_text_white = $page->text;
|
||||||
|
$small_medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 9/pt );
|
||||||
|
$small_medium_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$medium_bold_text_white = $page->text;
|
||||||
|
$medium_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 10/pt );
|
||||||
|
$medium_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$large_bold_text_white = $page->text;
|
||||||
|
$large_bold_text_white->font( $font{'Helvetica'}{'Bold'}, 12/pt );
|
||||||
|
$large_bold_text_white->fillcolor( 'white' );
|
||||||
|
|
||||||
|
$medium_green_text = $page->text;
|
||||||
|
$medium_green_text->font( $font{'Helvetica'}{'Normal'}, 10/pt );
|
||||||
|
$medium_green_text->fillcolor( 'green' );
|
||||||
|
|
||||||
|
|
||||||
|
if ($blue_box) {
|
||||||
|
$up = 292 ;
|
||||||
|
&pdf_box_block_top(5,205,'#009bc8') ; # start block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inner_blue_box) {
|
||||||
|
$up = 287 ;
|
||||||
|
$top = $up;
|
||||||
|
&pdf_box_block_top($blocks[1],200,'#009bc8') ; # start block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub finish_pdf {
|
||||||
|
|
||||||
|
$pdf->save;
|
||||||
|
$pdf->end();
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_page_header {
|
||||||
|
|
||||||
|
$page_num++ ;
|
||||||
|
|
||||||
|
# my $image1 = $page->gfx(1) ;
|
||||||
|
# my $image1_thumb = "$htmlpath/img/pdf_logo.jpg";
|
||||||
|
# $pdf_image1_file = $pdf->image_jpeg($image1_thumb);
|
||||||
|
# $image1->image($pdf_image1_file, $across/mm, $up/mm, 80/mm, 19/mm);
|
||||||
|
|
||||||
|
my $image1 = $page->gfx(1) ;
|
||||||
|
my $image1_thumb = "$htmlpath/img/pdf_logo.png";
|
||||||
|
$pdf_image1_file = $pdf->image_png($image1_thumb);
|
||||||
|
$image1->image($pdf_image1_file, 10/mm, $up/mm, 90/mm, 29/mm);
|
||||||
|
|
||||||
|
$up+=26 ;
|
||||||
|
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{company}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Co Reg: $useropts{co_reg}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Vat Reg: $useropts{vat_nr}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{address1}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"$useropts{address2}, $useropts{address3}, $useropts{city}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"South Africa") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
&pdf_grey_text_above_right (198,$up,"Tel: $useropts{tel}") ;
|
||||||
|
&pdf_nl_s;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_footer {
|
||||||
|
|
||||||
|
$up = 10 ;
|
||||||
|
|
||||||
|
&pdf_black_line ;
|
||||||
|
&pdf_tiny_text (50, 5, "Johannesburg: $useropts{tel}, Email: $useropts{email}") ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_block {
|
||||||
|
|
||||||
|
my ($along,$text_block,$tlock_length,$grid) = @_ ;
|
||||||
|
|
||||||
|
my $lines = 1;
|
||||||
|
|
||||||
|
# $max_text_length = 120 unless $max_text_length ;
|
||||||
|
|
||||||
|
$text_block =~ s/\n/ <br>/g;
|
||||||
|
$text_block = substr($text_block,0,-4) if substr($text_block,-4,4) eq '<br>' ;
|
||||||
|
|
||||||
|
my @words_array = split (/ /, $text_block) ;
|
||||||
|
my $wrapped_line = '' ;
|
||||||
|
my $block_start_up = $up ;
|
||||||
|
my $tlock_length_orig = $tlock_length ;
|
||||||
|
my $word_cnt = 0 ;
|
||||||
|
|
||||||
|
foreach my $word (@words_array) {
|
||||||
|
my $word_length = length($word) ;
|
||||||
|
my $wrapped_line_length = length($wrapped_line) ;
|
||||||
|
$tlock_length-- if $word eq uc $word ;
|
||||||
|
$word_length -= 4 if $word =~ /<br>/ ;
|
||||||
|
if (($wrapped_line_length + $word_length) > $tlock_length or $word =~ /<br>/) {
|
||||||
|
$word =~ s/<br>//g if $word =~ /<br>/ ;
|
||||||
|
$tlock_length = $tlock_length_orig ;
|
||||||
|
&pdf_text_block_line($along,$grid,$wrapped_line) ;
|
||||||
|
if ($grid == 1 or $grid == 2) {
|
||||||
|
&pdf_nl_gr ;
|
||||||
|
} elsif ($grid == 6) {
|
||||||
|
$up -= 3.25 ;
|
||||||
|
} else {
|
||||||
|
&pdf_nl_s ;
|
||||||
|
}
|
||||||
|
$lines++;
|
||||||
|
$wrapped_line = '' ;
|
||||||
|
}
|
||||||
|
$word_cnt++ ;
|
||||||
|
$wrapped_line .= $word . ' ' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_text_block_line($along,$grid,$wrapped_line) ;
|
||||||
|
|
||||||
|
if ($grid == 2) {
|
||||||
|
&pdf_nl_t;
|
||||||
|
}
|
||||||
|
elsif ($grid == 1) {
|
||||||
|
$up = $block_start_up ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 5) {
|
||||||
|
&pdf_nl_gr;
|
||||||
|
}
|
||||||
|
elsif ($grid == 6) {
|
||||||
|
$up -= 1.25 ;
|
||||||
|
} else {
|
||||||
|
&pdf_nl_s;
|
||||||
|
#$up = $up - 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($lines) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_block_line {
|
||||||
|
|
||||||
|
my ($along,$grid,$wrapped_line) = @_ ;
|
||||||
|
|
||||||
|
if ($grid == 1) {
|
||||||
|
&pdf_tiny_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 2) {
|
||||||
|
&pdf_tiny_bold_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 3) {
|
||||||
|
&pdf_medium_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
elsif ($grid == 4) {
|
||||||
|
&pdf_small_bold_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&pdf_small_text ($along,$up,$wrapped_line) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_text_center {
|
||||||
|
|
||||||
|
my ($text,$along,$colwidth) = @_ ;
|
||||||
|
|
||||||
|
my $width = $tiny_text->advancewidth($text);
|
||||||
|
|
||||||
|
$width-=$colwidth ;
|
||||||
|
|
||||||
|
$tiny_text->translate( $along/mm, $up/mm );
|
||||||
|
$tiny_text->text($text,-indent=>-($width/2));
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_check_value_of_up {
|
||||||
|
|
||||||
|
my ($value) = @_ ;
|
||||||
|
|
||||||
|
if ($up < $value) {
|
||||||
|
if ($blue_box) {
|
||||||
|
$up=5;
|
||||||
|
&pdf_box_block_bottom(5,205,'#009bc8') ; # end block -------------------------------------
|
||||||
|
}
|
||||||
|
if ($inner_blue_box) {
|
||||||
|
$up=10;
|
||||||
|
&vertical_lines_inner_box;
|
||||||
|
&pdf_box_block_bottom($blocks[1],200,'#009bc8') ; # end block -------------------------------------
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
if ($layout eq 'landscape') {
|
||||||
|
$up = 195 ;
|
||||||
|
$across = 1 ;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
}
|
||||||
|
elsif ($label) {
|
||||||
|
$label_height = '' ;
|
||||||
|
$up = 287 ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$up = 272 ;
|
||||||
|
$across = 1 ;
|
||||||
|
}
|
||||||
|
# &pdf_page_header ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_tt {
|
||||||
|
|
||||||
|
$up = $up - 2 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gr {
|
||||||
|
|
||||||
|
$up = $up - 2.7 ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_t {
|
||||||
|
|
||||||
|
$up = $up - 3 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_s {
|
||||||
|
|
||||||
|
$up = $up - 4 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl {
|
||||||
|
|
||||||
|
$up = $up - 5 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_1 {
|
||||||
|
|
||||||
|
$up = $up - 6 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_2 {
|
||||||
|
|
||||||
|
$up = $up - 7 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_nl_gap_3 {
|
||||||
|
|
||||||
|
$up = $up - 8 ;
|
||||||
|
# &pdf_check_value_of_up(20) ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_dashed_line {
|
||||||
|
|
||||||
|
my ($start,$length) = @_ ;
|
||||||
|
|
||||||
|
unless ($start) { $start = 10 ; }
|
||||||
|
unless ($length) { $length = 200 ; }
|
||||||
|
|
||||||
|
my $dashed_line = $page->gfx(1);
|
||||||
|
$dashed_line->strokecolor( 'black' );
|
||||||
|
$dashed_line->linewidth( '0.5' );
|
||||||
|
$dashed_line->linedash(3,4);
|
||||||
|
$dashed_line->move($start/mm,$up/mm);
|
||||||
|
$dashed_line->line($length/mm,$up/mm);
|
||||||
|
$dashed_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_grey_line {
|
||||||
|
|
||||||
|
my ($start,$end) = @_ ;
|
||||||
|
|
||||||
|
my $grey_line = $page->gfx(1);
|
||||||
|
$grey_line->strokecolor( 'grey' );
|
||||||
|
$grey_line->linewidth( '0.8' );
|
||||||
|
$grey_line->linedash();
|
||||||
|
$grey_line->move( $start/mm, ($up/mm) ); $grey_line->line($end/mm, ($up/mm) ); $grey_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2) = @_ ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor( 'black' );
|
||||||
|
$pdf_black_line->linewidth( '0.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_bar {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$cl,$tx,$lw,$txa,$size,$text_color,$cnt_lines,$max_text_length) = @_ ; # &pdf_bar(10,$up,200,$up,'#009bc8','Quote',5) ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
unless ($cl) { $cl = 'black' ; }
|
||||||
|
unless ($lw) { $lw = 5 ; }
|
||||||
|
# unless ($txcl) { $txcl = 'white' ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($cl);
|
||||||
|
$pdf_black_line->linewidth($lw);
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
if (not $size and not $text_color) { &pdf_bar_head_bold_text($txa,$up-1.5,$tx) ; } # default to large text
|
||||||
|
elsif ($size eq 'med' and not $text_color) { &pdf_medium_white_text_bold($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and not $text_color) { &pdf_small_medium_white_text_bold($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'med_right' and not $text_color) { &pdf_medium_white_text_bold_right($txa,$up-1,$tx) ; } # medium text
|
||||||
|
elsif ($size eq 'small_right' and not $text_color) { &pdf_small_medium_white_text_bold_right($txa,$up-1,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and $text_color eq 'small_black' and ($cnt_lines == 1 or not $cnt_lines)) { &pdf_small_text($txa,$up,$tx) ; }
|
||||||
|
elsif ($size eq 'small' and $text_color eq 'small_black' and $cnt_lines >= 1) { &pdf_text_block($txa,$tx,$max_text_length,6) ; }
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------ added by handre
|
||||||
|
sub pdf_extra_thin_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$color) = @_ ;
|
||||||
|
|
||||||
|
$color = 'black' if not $color ; # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($color);
|
||||||
|
$pdf_black_line->linewidth( '0.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_thin_box_block_top {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start{$st} = $up ;
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_thin_box_block_bottom {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
&pdf_extra_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
|
||||||
|
&pdf_extra_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------------- added by handre
|
||||||
|
|
||||||
|
|
||||||
|
sub pdf_thin_black_line {
|
||||||
|
|
||||||
|
my ($x1,$y1,$x2,$y2,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
unless ($x1) { $x1 = 10 ; }
|
||||||
|
unless ($y1) { $y1 = $up ; }
|
||||||
|
unless ($x2) { $x2 = 200 ; }
|
||||||
|
unless ($y2) { $y2 = $up ; }
|
||||||
|
|
||||||
|
my $pdf_black_line = $page->gfx(1);
|
||||||
|
$pdf_black_line->strokecolor($color);
|
||||||
|
$pdf_black_line->linewidth( '1.5' );
|
||||||
|
$pdf_black_line->linedash();
|
||||||
|
$pdf_black_line->move($x1/mm,$y1/mm);
|
||||||
|
$pdf_black_line->line($x2/mm,$y2/mm);
|
||||||
|
$pdf_black_line->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_curr_symbols {
|
||||||
|
|
||||||
|
$curr_symb{ZAR} = 'R';
|
||||||
|
$curr_symb{USD} = '$';
|
||||||
|
# $curr_symb{GBP} = '£';
|
||||||
|
$curr_symb{GBP} = 'GBP';
|
||||||
|
# $curr_symb{EUR} = '€';
|
||||||
|
$curr_symb{EUR} = 'EUR';
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_box_block_top {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start{$st} = $up ;
|
||||||
|
|
||||||
|
&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_box_block_bottom {
|
||||||
|
|
||||||
|
my ($st,$en,$color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
&pdf_thin_black_line($st,$up,$en,$up,$color) ; # horizontal
|
||||||
|
|
||||||
|
&pdf_thin_black_line ($st,$box_start{$st},$st,$up,$color) ; # vertical
|
||||||
|
&pdf_thin_black_line ($en,$box_start{$st},$en,$up,$color) ; # vertical
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_rounded_half_page_block_top {
|
||||||
|
|
||||||
|
my ($color) = @_ ; unless ($color) { $color = 'black' ; } # $color = '#009bc8' ;
|
||||||
|
|
||||||
|
$box_start = $up ;
|
||||||
|
|
||||||
|
$pdf_rounded_half_page_block = $page->gfx(1);
|
||||||
|
$pdf_rounded_half_page_block->strokecolor( 'black' );
|
||||||
|
$pdf_rounded_half_page_block->linewidth( '0.5' );
|
||||||
|
$pdf_rounded_half_page_block->linedash();
|
||||||
|
$pdf_rounded_half_page_block->move(14/mm,($up/mm) );
|
||||||
|
$pdf_rounded_half_page_block->line(196/mm,($up/mm) );
|
||||||
|
$curve = $up-4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
|
||||||
|
$up-=4 ;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_rounded_half_page_block_rest {
|
||||||
|
|
||||||
|
$box_up = $up + 3 ;
|
||||||
|
|
||||||
|
$pdf_rounded_half_page_block->line(200/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up-4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(200/mm,($box_up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
|
||||||
|
$box_up-=4 ;
|
||||||
|
$pdf_rounded_half_page_block->move(196/mm,($box_up/mm) );
|
||||||
|
$pdf_rounded_half_page_block->line(14/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up+4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(14/mm,($box_up/mm),10/mm,($box_up/mm),10/mm,($curve/mm)) ;
|
||||||
|
$box_up+=4 ;
|
||||||
|
$pdf_rounded_half_page_block->move(10/mm,($box_up/mm) );
|
||||||
|
$box_up = $box_start-4 ;
|
||||||
|
$pdf_rounded_half_page_block->line(10/mm,($box_up/mm) );
|
||||||
|
$curve = $box_up+4 ;
|
||||||
|
$pdf_rounded_half_page_block->curve(10/mm,($box_up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
|
||||||
|
$pdf_rounded_half_page_block->stroke;
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_rounded_half_page_block {
|
||||||
|
|
||||||
|
# my $pdf_rounded_half_page_block = $page->gfx(1);
|
||||||
|
# $pdf_rounded_half_page_block->strokecolor( 'black' );
|
||||||
|
# $pdf_rounded_half_page_block->linewidth( '0.5' );
|
||||||
|
# $pdf_rounded_half_page_block->linedash();
|
||||||
|
# $pdf_rounded_half_page_block->move(14/mm,($up/mm) );
|
||||||
|
# $pdf_rounded_half_page_block->line(196/mm,($up/mm) );
|
||||||
|
# $curve = $up-4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(196/mm,($up/mm),200/mm,($up/mm),200/mm,($curve/mm)) ;
|
||||||
|
# $up-=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(200/mm,($up/mm) );
|
||||||
|
# $up-=106 ;
|
||||||
|
# $pdf_rounded_half_page_block->line(200/mm,($up/mm) );
|
||||||
|
# $curve = $up-4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(200/mm,($up/mm),200/mm,($curve/mm),196/mm,($curve/mm)) ;
|
||||||
|
# $up-=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(196/mm,($up/mm) );
|
||||||
|
# $pdf_rounded_half_page_block->line(14/mm,($up/mm) );
|
||||||
|
# $curve = $up+4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(14/mm,($up/mm),10/mm,($up/mm),10/mm,($curve/mm)) ;
|
||||||
|
# $up+=4 ;
|
||||||
|
# $pdf_rounded_half_page_block->move(10/mm,($up/mm) );
|
||||||
|
# $up+=106 ;
|
||||||
|
# $pdf_rounded_half_page_block->line(10/mm,($up/mm) );
|
||||||
|
# $curve = $up+4 ;
|
||||||
|
# $pdf_rounded_half_page_block->curve(10/mm,($up/mm),10/mm,($curve/mm),14/mm,($curve/mm)) ;
|
||||||
|
# $pdf_rounded_half_page_block->stroke;
|
||||||
|
# $up-=110 ;
|
||||||
|
|
||||||
|
# } #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xx_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_text->translate( $along/mm, $up/mm ); $xx_large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xxx_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xxx_large_bold_text->translate( $along/mm, $up/mm ); $xxx_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
sub pdf_xx_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_bold_text->translate( $along/mm, $up/mm ); $xx_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_xx_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $xx_large_italic_text->translate( $along/mm, $up/mm ); $xx_large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_text->translate( $along/mm, $up/mm ); $x_large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_bold_text->translate( $along/mm, $up/mm ); $x_large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_x_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $x_large_italic_text->translate( $along/mm, $up/mm ); $x_large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_text->translate( $along/mm, $up/mm ); $large_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text->translate( $along/mm, $up/mm ); $large_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_italic_text->translate( $along/mm, $up/mm ); $large_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_text->translate( $along/mm, $up/mm ); $medium_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ); $medium_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_italic_text->translate( $along/mm, $up/mm ); $medium_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_bar_head_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $bar_head_bold_text->translate( $along/mm, $up/mm ); $bar_head_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_red_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_red_bold_text->translate( $along/mm, $up/mm ); $medium_red_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text->translate( $along/mm, $up/mm ) ; $medium_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ); $small_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_blue_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_blue_text->translate( $along/mm, $up/mm ); $small_blue_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ); $small_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_italic_text->translate( $along/mm, $up/mm ); $small_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_text->translate( $along/mm, $up/mm ) ; $small_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text->translate( $along/mm, $up/mm ) ; $small_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ); $tiny_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_bold_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ); $tiny_bold_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_italic_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_italic_text->translate( $along/mm, $up/mm ); $tiny_italic_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_text->translate( $along/mm, $up/mm ) ; $tiny_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_tiny_bold_text_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $tiny_bold_text->translate( $along/mm, $up/mm ) ; $tiny_bold_text->text_right( $text ) ;
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_medium_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_white_text_bold {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_grey_text_above_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $grey_text_above_right->translate( $along/mm, $up/mm ); $grey_text_above_right->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_bold_text_white->translate( $along/mm, $up/mm ); $small_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_medium_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_medium_bold_text_white->translate( $along/mm, $up/mm ); $small_medium_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_bold_text_white->translate( $along/mm, $up/mm ); $medium_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_large_white_text_bold_right {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $large_bold_text_white->translate( $along/mm, $up/mm ); $large_bold_text_white->text_right( $text );
|
||||||
|
|
||||||
|
} #-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_small_oblique_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $small_oblique_text->translate( $along/mm, $up/mm ); $small_oblique_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_oblique_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_oblique_text->translate( $along/mm, $up/mm ); $medium_oblique_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub pdf_medium_green_text {
|
||||||
|
|
||||||
|
my ($along, $up, $text) = @_ ; $medium_green_text->translate( $along/mm, $up/mm ); $medium_green_text->text( $text );
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_get_text_width {
|
||||||
|
|
||||||
|
# my ($$string) = @_ ;
|
||||||
|
# my $text = $page->text;
|
||||||
|
# my $font = $pdf->corefont('Helvetica'); # built-in font
|
||||||
|
# my $size = 8;
|
||||||
|
# $text->font($font, $size);
|
||||||
|
# my $width = $text->advancewidth($string);
|
||||||
|
|
||||||
|
# } #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# sub pdf_get_text_width {
|
||||||
|
|
||||||
|
# my ($string) = @_ ;
|
||||||
|
# my $width = $text->advancewidth($string);
|
||||||
|
# return ($width) ;
|
||||||
|
|
||||||
|
# } #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
603
libs/modules/_FromProd/v1.0/production_time.pm
Normal file
603
libs/modules/_FromProd/v1.0/production_time.pm
Normal file
|
|
@ -0,0 +1,603 @@
|
||||||
|
sub production_time_read_db_to_match_events_and_systems {
|
||||||
|
|
||||||
|
&common_date_array($last_start_ccyymmdd,$last_end_ccyymmdd);
|
||||||
|
|
||||||
|
&db_min_ro('event_systems','id,name,description,system_type','','','') ;
|
||||||
|
foreach my $id (keys %{$db{event_systems}}) {
|
||||||
|
$event_system_description{$id} = $db{event_systems}{$id}{description} ;
|
||||||
|
$event_system_name{$id} = $db{event_systems}{$id}{name} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_sql = substr($start_sql,0,11) . '00:00:00' ;
|
||||||
|
$end_sql = substr($end_sql,0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
# &db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to',"(date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')",'','') ;
|
||||||
|
|
||||||
|
&db_min_ro('event_quotes','id,ref,event_system_id_multiple,format_of_title,date_from,date_to,sport_type_ids,club_ids',"((date_from BETWEEN '$start_sql' AND '$end_sql') OR (date_to BETWEEN '$start_sql' AND '$end_sql')) AND event_system_id_multiple IS NOT NULL AND event_system_id_multiple <> ''",'','') ;
|
||||||
|
|
||||||
|
our %seen_event_system_in_event_quotes = () ;
|
||||||
|
|
||||||
|
foreach my $event_id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{ref} =~ s/\'//g ;
|
||||||
|
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/;+/;/g; # Replace multiple semicolons with one
|
||||||
|
$db{event_quotes}{$event_id}{event_system_id_multiple} =~ s/^;+|;+$//g; # Remove leading or trailing semicolons
|
||||||
|
|
||||||
|
# next unless $db{event_quotes}{$event_id}{event_system_id_multiple} ;
|
||||||
|
|
||||||
|
$opts{matched_event} .= qq~<option value="$event_id">[$event_id] $db{event_quotes}{$event_id}{ref}</option>~ ;
|
||||||
|
|
||||||
|
foreach (split(";",$db{event_quotes}{$event_id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
# $opts{matched_system} .= $seen_event_system_in_event_quotes{$_}
|
||||||
|
$seen_event_system_in_event_quotes{$_} = 1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (sort {$seen_event_system_in_event_quotes{$a} cmp $seen_event_system_in_event_quotes{$b}} keys %seen_event_system_in_event_quotes) {
|
||||||
|
$opts{matched_system} .= qq~<option value="$_">$db{event_systems}{$_}{name} [$db{event_systems}{$_}{description}]</option>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$opts{matched_system_none} .= qq~<option value="-1">$db{event_systems}{-1}{name} [$db{event_systems}{-1}{description}]</option>~ ;
|
||||||
|
|
||||||
|
&db_min_ro('sport_types','*','','','') ;
|
||||||
|
|
||||||
|
our %sport_name_to_id = () ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{sport_types}}) {
|
||||||
|
$db{sport_types}{$_}{name} = lc $db{sport_types}{$_}{name} ;
|
||||||
|
$db{sport_types}{$_}{name} =~ s/ //g ;
|
||||||
|
$sport_name_to_id{$db{sport_types}{$_}{name}} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_min_ro('clubs','id,name','','','') ;
|
||||||
|
|
||||||
|
foreach (keys %{$db{clubs}}) {
|
||||||
|
my $c_name = lc $db{clubs}{$_}{name} ;
|
||||||
|
$c_name =~ s/\'//g ;
|
||||||
|
$club_name_to_id{$c_name} = $_ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
# # $match_bank_trans{$db{event_quotes}{$id}{trans_date}}{$db{event_quotes}{$id}{description}} = 1 ;
|
||||||
|
|
||||||
|
# foreach my $event_id (split(";",$db{$tables}{$id}{event_system_id_multiple})) {
|
||||||
|
# $val .= qq~$db{event_systems}{$event_id}{name} [$db{event_systems}{$event_id}{description}], ~ ;
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub production_time_process_matched_events_and_systems {
|
||||||
|
|
||||||
|
my %system_match = () ; my %matched_event_name = () ; my %csv_line_possible_match = () ; my %matched_events = () ;
|
||||||
|
|
||||||
|
$system_match{"None"}{"None"} = -1 ;
|
||||||
|
|
||||||
|
foreach my $event_code (keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
my ($club_name,$system_desc_clue) = split("-",$csv_line{$event_code}{club_name}) ;
|
||||||
|
$club_name =~ s/ $//g ; $system_desc_clue =~ s/^ //g ; # remove whitespace
|
||||||
|
$club_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
$system_desc_clue = "None" unless $system_desc_clue ;
|
||||||
|
|
||||||
|
my @eventdetails = split(/ /,$club_name) ;
|
||||||
|
|
||||||
|
my $system_name_clue = $eventdetails[-1] ; $system_name_clue = "None" if $system_name_clue !~ /\d+/ ;
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /\d+/ && length($system_desc_clue) == 5) {
|
||||||
|
$system_name_clue = $system_desc_clue ;
|
||||||
|
$system_desc_clue = 'None' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($system_desc_clue =~ /AISA/ && $system_desc_clue =~ /SOLO/) {
|
||||||
|
my @sysparts = split(/\_/,$system_desc_clue) ;
|
||||||
|
$system_name_clue = $sysparts[2] ;
|
||||||
|
$system_desc_clue =~ s/\_/ /g ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = -1 if $system_name_clue eq 'None' && $system_desc_clue eq 'None' ;
|
||||||
|
|
||||||
|
$system_desc_clue = lc $system_desc_clue ;
|
||||||
|
|
||||||
|
$csv_line{$event_code}{system_id} = $system_match{$system_name_clue}{$system_desc_clue} if $system_match{$system_name_clue}{$system_desc_clue} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $system_id (keys %{$db{event_systems}}) {
|
||||||
|
# foreach my $system_id (keys %seen_event_system_in_event_quotes) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif (($sys_name =~ /\b$system_name_clue\b/ || $sys_name =~ /_$system_name_clue\b/) && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my @sport_split = split(":",$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
$sport_split[0] =~ s/ //g ;
|
||||||
|
$sport_split[0] = lc $sport_split[0] ;
|
||||||
|
|
||||||
|
my $sport_id = ($csv_line{$event_code}{event_name} =~ /:/) ? $sport_name_to_id{$sport_split[0]} : '' ;
|
||||||
|
|
||||||
|
my @event_name_details = split(/-/,$csv_line{$event_code}{event_name}) ;
|
||||||
|
|
||||||
|
my $to_match_event_name = $event_name_details[-1] ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/^ //g ;
|
||||||
|
$to_match_event_name =~ s/ $//g ;
|
||||||
|
|
||||||
|
$to_match_event_name = ($csv_line{$event_code}{event_name} =~ /:/ && $csv_line{$event_code}{event_name} !~ /-/) ? $sport_split[1] : $to_match_event_name ;
|
||||||
|
|
||||||
|
$to_match_event_name =~ s/\'//g ;
|
||||||
|
|
||||||
|
my $club_id = $club_name_to_id{$club_name} ;
|
||||||
|
|
||||||
|
$club_name = ($csv_line{$event_code}{club_name} =~ /AISA/ && $csv_line{$event_code}{club_name} =~ /SOLO/) ? lc $club_name : lc $csv_line{$event_code}{club_name} ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next unless $id ;
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
$matched_events{$event_code} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $found_match = 0 ;
|
||||||
|
|
||||||
|
foreach my $system_id (split(";",$db{event_quotes}{$id}{event_system_id_multiple})) {
|
||||||
|
|
||||||
|
my $sys_desc = lc $db{event_systems}{$system_id}{description} ;
|
||||||
|
my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
if ($sys_name =~ /\b$system_name_clue\b/ && $sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_name =~ /\b$system_name_clue\b/ && $system_name_clue ne 'None' && $system_desc_clue eq 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
} elsif ($sys_desc =~ /\b$system_desc_clue\b/ && $system_name_clue eq 'None' && $system_desc_clue ne 'none') {
|
||||||
|
$csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
$system_match{$system_name_clue}{$system_desc_clue} = $system_id ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# my $sys_desc = $db{event_systems}{$system_id}{description} ;
|
||||||
|
# my $sys_name = $db{event_systems}{$system_id}{name} ;
|
||||||
|
|
||||||
|
# # my @sysparts = split(/\_/,$system) ;
|
||||||
|
|
||||||
|
# if ($sys_name =~ /\b$sysno\b/ && $sys_desc =~ /\b$system\b/iog) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /\d+/ && $sys_name =~ /\b$system\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($system =~ /AISA/ && $system =~ /SOLO/ && $sysparts[2] && $sys_name =~ /\b$sysparts[2]\b/) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $system_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# } elsif ($sys_desc eq 'St Stithians Hockey Red' && $clubname =~ /Red/i && $clubname =~ /Stithians/i) {
|
||||||
|
# $csv_line{$event_code}{system_id} = $event_id ;
|
||||||
|
# $system_match{$system}{$sysno} = $system_id ;
|
||||||
|
# $found_match = 1 ;
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found_match && !$csv_line{$event_code}{event_id}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
next ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ($to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!$csv_line{$event_code}{system_id}) && !$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
foreach my $id (keys %{$db{event_quotes}}) {
|
||||||
|
|
||||||
|
next if $sport_id && $db{event_quotes}{$id}{sport_type_ids} && $db{event_quotes}{$id}{sport_type_ids} !~ /\b$sport_id\b/ ;
|
||||||
|
|
||||||
|
next if $club_id && $db{event_quotes}{$id}{club_ids} !~ /\b$club_id\b/ ;
|
||||||
|
|
||||||
|
next if !$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ ;
|
||||||
|
|
||||||
|
my $event_end = substr($db{event_quotes}{$id}{date_to},0,11) . '23:59:59' ;
|
||||||
|
|
||||||
|
my $event_start = substr($db{event_quotes}{$id}{date_from},0,11) . '00:00:00' ;
|
||||||
|
|
||||||
|
my $after_event_end = &greater_date_time($event_end,$csv_line{$event_code}{start_time}) ;
|
||||||
|
next if $after_event_end ;
|
||||||
|
|
||||||
|
my $before_event_start = &greater_date_time($csv_line{$event_code}{end_time},$event_start) ;
|
||||||
|
next if $before_event_start ;
|
||||||
|
|
||||||
|
# if (!$db{event_quotes}{$id}{event_system_id_multiple} || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\d+/ || $db{event_quotes}{$id}{event_system_id_multiple} !~ /\b$csv_line{$event_code}{system_id}\b/) {
|
||||||
|
# if ($csv_line{$event_code}{system_id} && !$seen_event_system_in_event_quotes{$csv_line{$event_code}{system_id}}) {
|
||||||
|
# $csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
# }
|
||||||
|
# next ;
|
||||||
|
# }
|
||||||
|
|
||||||
|
if ($db{event_quotes}{$id}{sport_type_ids} && $to_match_event_name && ($db{event_quotes}{$id}{ref} eq $to_match_event_name || $db{event_quotes}{$id}{ref} =~ /$to_match_event_name/)) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} elsif ($db{event_quotes}{$id}{sport_type_ids}) {
|
||||||
|
$csv_line{$event_code}{event_id} = $id ;
|
||||||
|
last ;
|
||||||
|
} else {
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} .= qq~$id;~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chop $csv_line_possible_match{$event_code}{event_id} if $csv_line_possible_match{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$print_box_content_rows .= &common_min_forms_start("$lcpage") ;
|
||||||
|
|
||||||
|
our @sql_col_display = ("club_system","system_nr","matched_system","production_hours","production_seconds","cloud_recording_seconds","club_name","start","end","event_name","matched_event","match") ;
|
||||||
|
|
||||||
|
my $row_cnt = 0 ; my %no_system_or_event = () ;
|
||||||
|
|
||||||
|
foreach my $event_code (sort {$csv_line{$a}{line_cnt} cmp $csv_line{$b}{line_cnt}} keys %csv_line) {
|
||||||
|
|
||||||
|
next if $matched_event{$event_code} ;
|
||||||
|
|
||||||
|
$row_cnt++ ;
|
||||||
|
|
||||||
|
$print_tbody .= qq~<tr id="$row_cnt">~ ;
|
||||||
|
|
||||||
|
my $cell_id = qq~~ ;
|
||||||
|
|
||||||
|
my ($system,$sysno) = split(" - ",$csv_line{$event_code}{club_name}) ;
|
||||||
|
|
||||||
|
my @get_sport = (!$csv_line{$event_code}{system_id} || (!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /;/)) ? split(/\:/,$csv_line{$event_code}{event_name}) : () ;
|
||||||
|
|
||||||
|
$extra_form_fields .= qq~<input type="text" name='$event_code' value="$event_code_to_line{$event_code}" style="display:none;">~ if !$csv_line{$event_code}{system_id} || !$csv_line{$event_code}{event_id} ;
|
||||||
|
|
||||||
|
foreach my $col (@sql_col_display) {
|
||||||
|
|
||||||
|
my $val = '' ; $nowrap = '' ;
|
||||||
|
|
||||||
|
if ($col eq 'club_name') {
|
||||||
|
$val = $csv_line{$event_code}{club_name} ;
|
||||||
|
} elsif ($col eq 'system_nr') {
|
||||||
|
$val = $sysno ;
|
||||||
|
} elsif ($col eq 'start') {
|
||||||
|
$val = $csv_line{$event_code}{start_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'end') {
|
||||||
|
$val = $csv_line{$event_code}{end_time} ;
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
} elsif ($col eq 'club_system') {
|
||||||
|
$val = $system ;
|
||||||
|
} elsif ($col eq 'matched_system') {
|
||||||
|
|
||||||
|
$preferred_placeholder{"system_$row_cnt"} = "Select System" ;
|
||||||
|
|
||||||
|
$found_system_drop_down = 1 if !$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1' ;
|
||||||
|
|
||||||
|
# $allow_deselect{"system_$row_cnt"} = 1 ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : ($csv_line{$event_code}{system_id} eq '-1') ? &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system_none") : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
# $val = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? "$db{event_systems}{$csv_line{$event_code}{system_id}}{name} [$db{event_systems}{$csv_line{$event_code}{system_id}}{description}]" : &common_min_table_select("system_$row_cnt","",'','','','','',"matched_system") ;
|
||||||
|
|
||||||
|
if (!$csv_line{$event_code}{system_id} || $csv_line{$event_code}{system_id} eq '-1') {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{system} .= qq~"#selectSystem_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$cell_id = qq~id="matched_system_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'production_hours') {
|
||||||
|
$val = $csv_line{$event_code}{production_hours} ;
|
||||||
|
$val =~ s/\,/\./g ;
|
||||||
|
} elsif ($col eq 'production_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{production_seconds}) ;
|
||||||
|
} elsif ($col eq 'cloud_recording_seconds') {
|
||||||
|
$val = &common_commify($csv_line{$event_code}{cloud_seconds}) ;
|
||||||
|
} elsif ($col eq 'event_name') {
|
||||||
|
$val = $csv_line{$event_code}{event_name} ;
|
||||||
|
} elsif ($col eq 'matched_event') {
|
||||||
|
|
||||||
|
$csv_line_possible_match{$event_code}{event_id} =~ s/\;/\_/g ;
|
||||||
|
|
||||||
|
my $col_name = (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? "matched_event_$csv_line_possible_match{$event_code}{event_id}" : "matched_event" ;
|
||||||
|
|
||||||
|
$opts{$col_name} =
|
||||||
|
($csv_line_possible_match{$event_code}{event_id} && !$csv_line{$event_code}{event_id}) ? join "</option><option ", map { qq~value="$_"><strong>Possible : </strong>$db{event_quotes}{$_}{ref} [$_]~ } split "_" , $csv_line_possible_match{$event_code}{event_id} :
|
||||||
|
$opts{matched_event} ;
|
||||||
|
|
||||||
|
$opts{$col_name} = qq~<option ~ . $opts{$col_name} . qq~</option>~ if $col_name ne 'matched_event' ;
|
||||||
|
|
||||||
|
$preferred_placeholder{"event_$row_cnt"} = "Select Event" ;
|
||||||
|
|
||||||
|
$val = ($csv_line{$event_code}{event_id}) ? "$db{event_quotes}{$csv_line{$event_code}{event_id}}{ref} [$csv_line{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
# (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? "<strong>POSSIBLE : </strong>$db{event_quotes}{$csv_line_possible_match{$event_code}{event_id}}{ref} [$csv_line_possible_match{$event_code}{event_id}]" :
|
||||||
|
|
||||||
|
(!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id}) ? &common_min_table_select("event_$row_cnt",'','','','','','',$col_name) :
|
||||||
|
&common_min_table_select("event_$row_cnt",'','','','','','','matched_event') ;
|
||||||
|
|
||||||
|
$found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} ;
|
||||||
|
# $found_event_drop_down = 1 if !$csv_line{$event_code}{event_id} && (!$csv_line_possible_match{$event_code}{event_id} || $csv_line_possible_match{$event_code}{event_id} =~ /_/) ;
|
||||||
|
|
||||||
|
# if ((!$csv_line{$event_code}{event_id} && !$csv_line_possible_match{$event_code}{event_id}) || (!$csv_line{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} =~ /_/)) {
|
||||||
|
if (!$csv_line{$event_code}{event_id}) {
|
||||||
|
|
||||||
|
my $sport_name = ($csv_line{$event_code}{event_name} =~ /:/) ? $get_sport[0] : $csv_line{$event_code}{event_name} ;
|
||||||
|
|
||||||
|
$no_system_or_event{$csv_line{$event_code}{club_name}}{substr($csv_line{$event_code}{start_time},0,10)}{$sport_name}{event} .= qq~"#selectEvent_$row_cnt",~ ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$cell_id = qq~id="matched_event_$row_cnt"~ ;
|
||||||
|
|
||||||
|
} elsif ($col eq 'match') {
|
||||||
|
|
||||||
|
$nowrap = 'nowrap' ;
|
||||||
|
|
||||||
|
$cell_id = qq~id="final_col_$row_cnt"~ ;
|
||||||
|
|
||||||
|
my $tool = $pixellot_system{$ccyymmdd}{$period} ;
|
||||||
|
|
||||||
|
$start_sql =~ s/ /T/g ;
|
||||||
|
$end_sql =~ s/ /T/g ;
|
||||||
|
|
||||||
|
# my $system_input = ($csv_line{$event_code}{system_id}) ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
my $system_input = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1') ? qq~<input style='display:none;' value='$csv_line{$event_code}{system_id}' id='selectSystem_$row_cnt' name="system_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : ($csv_line_possible_match{$event_code}{event_id} && $csv_line_possible_match{$event_code}{event_id} !~ /_/) ? $csv_line_possible_match{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $matched_event_id = ($csv_line{$event_code}{event_id}) ? $csv_line{$event_code}{event_id} : '' ;
|
||||||
|
|
||||||
|
my $event_input = ($matched_event_id) ? qq~<input style='display:none;' value='$matched_event_id' id='selectEvent_$row_cnt' name="event_$row_cnt">~ : qq~~ ;
|
||||||
|
|
||||||
|
my $match_icon = ($system_input && $event_input) ? "ok" : "remove" ;
|
||||||
|
my $match_class = ($system_input && $event_input) ? "success" : "danger" ;
|
||||||
|
|
||||||
|
push @unmatched_rows, "#selectEvent_$row_cnt" if !$event_input ;
|
||||||
|
push @unmatched_rows, "#selectSystem_$row_cnt" if !$system_input ;
|
||||||
|
|
||||||
|
my $not_matched = (!$event_input || !$system_input) ? qq~<input style='display:none;' value='1' id='not_matched_$row_cnt'>~ : qq~~ ;
|
||||||
|
|
||||||
|
# my $no_similar_rows = ($csv_line{$event_code}{system_id} && $csv_line{$event_code}{system_id} ne '-1' && $csv_line{$event_code}{event_id}) ? '-1' : '' ;
|
||||||
|
|
||||||
|
my $similar_rows = (!$event_input || !$system_input) ? qq~<input value='' name='similar_rows_$row_cnt' style='display:none;'>~ : qq~~ ;
|
||||||
|
|
||||||
|
$val = "
|
||||||
|
$system_input
|
||||||
|
$event_input
|
||||||
|
$not_matched
|
||||||
|
$similar_rows
|
||||||
|
<input style='display:none;' value='$event_code' id='event_code_$row_cnt' name='event_code_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{production_seconds}' id='time_$row_cnt' name='time_$row_cnt'>
|
||||||
|
<input style='display:none;' value='$csv_line{$event_code}{cloud_seconds}' id='cloud_time_$row_cnt' name='cloud_time_$row_cnt'>
|
||||||
|
<a class='btn btn-$match_class btn-sm' id='matched_row_$row_cnt' href=javascript:match_event_system('$row_cnt','$event_code','$csv_line{$event_code}{production_seconds}','$csv_line{$event_code}{cloud_seconds}'); data-title='MATCH' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-$match_icon'></i></a>
|
||||||
|
|
||||||
|
<a class='btn btn-success btn-sm' href=javascript:dlgMdl('$useropts{'scripts'}/dialog/manually_match_csv_row.pl?$matched_event_id&$csv_line{$event_code}{system_id}&$csv_line{$event_code}{production_seconds}&$csv_line{$event_code}{cloud_seconds}&$event_code&$start_sql&$end_sql&$row_cnt&add','Manually Match','','medium-dialog'); data-title='MATCH MANUALLY' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title>
|
||||||
|
<i class='glyphicon glyphicon-question-sign'></i>
|
||||||
|
</a>
|
||||||
|
" ;
|
||||||
|
|
||||||
|
$start_sql =~ s/T/ /g ;
|
||||||
|
$end_sql =~ s/T/ /g ;
|
||||||
|
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~<td $cell_id $nowrap>$val</td>~ ;
|
||||||
|
}
|
||||||
|
$print_tbody .= qq~</tr>~ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
// let inputString = '1,21,32,4'; // Your input string
|
||||||
|
// let outputString = inputString.split(',').map(num => 'abc_' + num).join(',');
|
||||||
|
|
||||||
|
function auto_select_similar_drop_downs (ids,changed_val) {
|
||||||
|
for (let id of ids) {
|
||||||
|
if (\$(id).val()) {
|
||||||
|
continue ;
|
||||||
|
}
|
||||||
|
\$(id).val(changed_val) ;
|
||||||
|
\$(id).trigger("chosen:updated") ;
|
||||||
|
fix_match_icon(id) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
my %seen_rows_set = () ;
|
||||||
|
|
||||||
|
foreach my $club_name (keys %no_system_or_event) {
|
||||||
|
foreach my $start_time (keys %{$no_system_or_event{$club_name}}) {
|
||||||
|
foreach my $sport_name (keys %{$no_system_or_event{$club_name}{$start_time}}) {
|
||||||
|
foreach my $sys_evt (keys %{$no_system_or_event{$club_name}{$start_time}{$sport_name}}) {
|
||||||
|
|
||||||
|
chop $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} if $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
my $ids_change = $no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} ;
|
||||||
|
$ids_change =~ s/\"//g ;
|
||||||
|
|
||||||
|
my $ids_change2 = $ids_change ;
|
||||||
|
|
||||||
|
$ids_change2 =~ s/#selectEvent_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
$ids_change2 =~ s/#selectSystem_(\d+)/input\[name='similar_rows_$1'\]/g;
|
||||||
|
|
||||||
|
my $ids_change_row_nrs = $ids_change ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectEvent_//g ;
|
||||||
|
$ids_change_row_nrs =~ s/#selectSystem_//g ;
|
||||||
|
|
||||||
|
my @first_nr = split(/\,/,$ids_change_row_nrs) ;
|
||||||
|
|
||||||
|
my $event_or_system = ($no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt} =~ /Event/) ? 'event' : 'system' ;
|
||||||
|
|
||||||
|
next if $seen_rows_set{$ids_change_row_nrs}{$event_or_system} ;
|
||||||
|
$seen_rows_set{$ids_change_row_nrs}{$event_or_system} = 1 ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
if (\$("#not_matched_$first_nr[0]").val() && !\$("input[name='similar_rows_$first_nr[0]']").val()) {
|
||||||
|
\$("$ids_change2").val("$ids_change_row_nrs") ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("$ids_change").change( function () {
|
||||||
|
|
||||||
|
fix_match_icon(this.id) ;
|
||||||
|
if (!\$(this).val()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
auto_select_similar_drop_downs([$no_system_or_event{$club_name}{$start_time}{$sport_name}{$sys_evt}],\$(this).val()) ;
|
||||||
|
|
||||||
|
}) ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $unmatched_rows_str = join(",",@unmatched_rows) ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function get_row_nr (id) {
|
||||||
|
|
||||||
|
let lastIndex = id.lastIndexOf('_');
|
||||||
|
lastIndex = parseInt(lastIndex) ;
|
||||||
|
let row_nr_1 = id.substring(1+lastIndex);
|
||||||
|
return row_nr_1 ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function fix_match_icon (id) {
|
||||||
|
|
||||||
|
let row_nr = get_row_nr(id) ;
|
||||||
|
|
||||||
|
if (\$("#selectEvent_"+row_nr).val() && \$("#selectSystem_"+row_nr).val() && \$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-danger btn-sm').addClass('btn btn-success btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-ok'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("") ;
|
||||||
|
} else if ((!\$("#selectEvent_"+row_nr).val() || !\$("#selectSystem_"+row_nr).val()) && !\$("#not_matched_"+row_nr).val()) {
|
||||||
|
\$("#matched_row_"+row_nr).removeClass('btn btn-success btn-sm').addClass('btn btn-danger btn-sm');
|
||||||
|
\$("#matched_row_"+row_nr).html("<i class='glyphicon glyphicon-remove'></i>") ;
|
||||||
|
\$("#not_matched_"+row_nr).val("1") ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("$unmatched_rows_str").change( function () {
|
||||||
|
// fix_match_icon(this.id) ;
|
||||||
|
// }) ;
|
||||||
|
|
||||||
|
~ if $unmatched_rows_str ;
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(2)").css("width","20%");~ if $found_event_drop_down ; ## MATCHED EVENT COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~\$("#itv-table tr th:nth-last-child(10)").css("width","20%");~ if $found_system_drop_down ; ## MATCHED SYSTEM COLUMN
|
||||||
|
|
||||||
|
$trigger_jquery_raw .= qq~
|
||||||
|
|
||||||
|
function match_event_system (row_nr,event_code,production_seconds,cloud_seconds) {
|
||||||
|
|
||||||
|
let event_id = \$("#selectEvent_"+row_nr).val() ;
|
||||||
|
let system_id = \$("#selectSystem_"+row_nr).val() ;
|
||||||
|
|
||||||
|
if (!event_id || !system_id) {
|
||||||
|
noty({text:'Please select a System and Event!!!',layout:"center",type:"error",timeout:3000}) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
\$("#"+row_nr).css("display","none") ;
|
||||||
|
|
||||||
|
var url = "$useropts{scripts}/get/add_event_system_hours.pl?"+event_id+"&"+system_id+"&"+production_seconds+"&"+cloud_seconds+"&"+event_code ;
|
||||||
|
|
||||||
|
\$.get(url) ;
|
||||||
|
\$("#final_col_"+row_nr).html('') ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// \$("#itv-table tr:eq(0) th:nth-last-child(1)").html("<span>Match All</span> <a class='btn btn-success btn-sm' href=javascript:match_all(1); data-title='MATCH ALL (inc. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a> <a class='btn btn-warning btn-sm' href=javascript:match_all(0); data-title='MATCH ALL (excl. Possible Events)' data-toggle='tooltip' data-placement='left' data-placement='left' data-original-title title><i class='glyphicon glyphicon-ok'></i></a>") ;
|
||||||
|
|
||||||
|
\$("#itv-table thead tr:eq(0) th:nth-last-child(1)").css('white-space','nowrap') ;
|
||||||
|
|
||||||
|
~ ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
501
libs/modules/_FromProd/v1.0/report.pm
Normal file
501
libs/modules/_FromProd/v1.0/report.pm
Normal file
|
|
@ -0,0 +1,501 @@
|
||||||
|
sub report_create_xls {
|
||||||
|
|
||||||
|
our $xlspath = "$htmlpath/xls/customreport" ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlspath) ;
|
||||||
|
|
||||||
|
&report_xls_details_header ;
|
||||||
|
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
&xlsxcreator_write_xls($ws,$xlsrow,0,$id,$format18);
|
||||||
|
|
||||||
|
my $col=1;
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
&xlsxcreator_write_xls($ws,$xlsrow,$col,$xls_hash{$id}{$field},$format1);
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
$xlsrow++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $col=1;
|
||||||
|
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
$fieldrow = $xlsrow ;
|
||||||
|
foreach my $curr (keys %curr_hash) {
|
||||||
|
if ($ttl{$field}{$curr}) {
|
||||||
|
my $ttl = &common_commify( sprintf("%0.2f",$ttl{$field}{$curr} )) ;
|
||||||
|
&xlsxcreator_write_xls($ws,$fieldrow,$col,"$curr $ttl",$format57) ;
|
||||||
|
$fieldrow++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column('A:Z',20);
|
||||||
|
$worksheet{$ws}->activate();
|
||||||
|
$worksheet{$ws}->select();
|
||||||
|
|
||||||
|
&xlsxcreator_close_xls;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_details_header {
|
||||||
|
|
||||||
|
our $xlsname = 'CUSTOM-REPORT-' . $now_ccyymmdd . '.xls' ;
|
||||||
|
my $xlsfile = $xlspath . '/' . $xlsname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xls($xlsfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xls_format;
|
||||||
|
|
||||||
|
$ws = 'custom_report';
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xls($ws,0,0,"Film Freight : $success",$format2);
|
||||||
|
|
||||||
|
&xlsxcreator_write_xls($ws,2,0,'ID',$format18);
|
||||||
|
# $xlsrow = 2 ;
|
||||||
|
my $col=1;
|
||||||
|
foreach my $id (sort {$b <=> $a} keys %xls_hash) {
|
||||||
|
foreach my $field (sort keys %{$xls_hash{$id}}) {
|
||||||
|
my $uc_field = uc $field ;
|
||||||
|
&xlsxcreator_write_xls($ws,2,$col,$uc_field,$format18);
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
|
||||||
|
&xlsxcreator_freeze_panes($ws,3,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
$xlsrow=3;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_start {
|
||||||
|
|
||||||
|
my ($report) = @_ ;
|
||||||
|
|
||||||
|
$layout = 'landscape' ;
|
||||||
|
|
||||||
|
our $pdfpath = "$pdfpath/export" ;
|
||||||
|
|
||||||
|
my $pdfnamestart = uc $report ; $pdfnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
our $pdfname = $pdfnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.pdf' ;
|
||||||
|
my $pdffile = $pdfpath . '/' . $pdfname ;
|
||||||
|
|
||||||
|
my $pdftitle = $report ; $pdftitle =~ s/_/ /gi ;
|
||||||
|
|
||||||
|
&pdf_delete_previous_pdf($pdfpath) ;
|
||||||
|
&pdf_initialise($pdfpath,$pdfname,"Film Freight $pdftitle") ; ;
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
|
||||||
|
$up = 180 ;
|
||||||
|
$across = 1 ;
|
||||||
|
&pdf_page_header_landscape ;
|
||||||
|
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
&pdf_x_large_bold_text (10, $up, $pdftitle) ;
|
||||||
|
&pdf_nl_gap_3 ;
|
||||||
|
|
||||||
|
my $date = pdf_date_to_text($now_ccyy_mm_dd);
|
||||||
|
&pdf_medium_text (220, $up, "Date : $date") ;
|
||||||
|
|
||||||
|
&pdf_nl;
|
||||||
|
$top=$up;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
&pdf_nl_s;
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $txtstart = length($_) * 2 + 2 ;
|
||||||
|
&pdf_small_bold_text ($txtstart,$up,$_) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_nl_tt;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_line {
|
||||||
|
|
||||||
|
my ($id) = @_ ;
|
||||||
|
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
&report_grid_pdf_check_value_of_up(20) ;
|
||||||
|
&pdf_nl;
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $txtstart = length($_) * 2 + 2 ;
|
||||||
|
&pdf_small_bold_text ($txtstart,$up,$db{$table}{$id}{$_}) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_nl_tt;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_pdf_end {
|
||||||
|
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
|
||||||
|
foreach (@pdf_columns) {
|
||||||
|
my $colstart = length($_) * 2 ;
|
||||||
|
&pdf_black_line ($colstart,$top,$colstart,$up) ; # vertical
|
||||||
|
}
|
||||||
|
|
||||||
|
&pdf_footer_landscape ;
|
||||||
|
&finish_pdf ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_header_events {
|
||||||
|
|
||||||
|
my ($report,$xlsxfolder) = @_ ;
|
||||||
|
|
||||||
|
our $xlsxpath = "$htmlpath/xlsx/$xlsxfolder" ;
|
||||||
|
|
||||||
|
my $xlsxnamestart = uc $report ;
|
||||||
|
|
||||||
|
# $xlsxnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlsxpath) ;
|
||||||
|
|
||||||
|
our $xlsxname = $xlsxnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
|
||||||
|
my $xlsxfile = $xlsxpath . '/' . $xlsxname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsxfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
$now_yy += 2000 ;
|
||||||
|
my $xlsxtitle = "Interactive Television Africa Events Division $now_yy" ;
|
||||||
|
|
||||||
|
$xlsxtitle =~ s/_/ /gi ;
|
||||||
|
|
||||||
|
my @letters = ("", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R","S", "T", "U", "V", "W", "X", "Y", "Z") ;
|
||||||
|
my $cnt = 0;
|
||||||
|
for (@col_display_excel) {$cnt++;}
|
||||||
|
my $range = "A1:$letters[$cnt]" ;
|
||||||
|
$range .= "1" ;
|
||||||
|
|
||||||
|
$worksheet{$ws} -> merge_range($range, "$xlsxtitle", $format_event_heading) ;
|
||||||
|
|
||||||
|
my @month_fullname = ("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") ;
|
||||||
|
my $current_month = $month_fullname[int($now_mm)] ;
|
||||||
|
|
||||||
|
$range = "A2:$letters[$cnt]" ;
|
||||||
|
$range .= "2" ;
|
||||||
|
|
||||||
|
$worksheet{$ws} -> merge_range($range, "$current_month $now_yy", $format_event_heading_2) ;
|
||||||
|
$range = "A4:$letters[$cnt]" ;
|
||||||
|
$range .= "4" ;
|
||||||
|
$worksheet{$ws} -> merge_range($range, "", $format_empty_row) ;
|
||||||
|
|
||||||
|
# &xlsxcreator_write_xlsx($ws,0,0,$xlsxtitle,$format2);
|
||||||
|
|
||||||
|
our $xlsxcol=0;
|
||||||
|
|
||||||
|
foreach (@col_display_excel) {
|
||||||
|
my $coltitle = $_ ;
|
||||||
|
$coltitle =~ s/\_id//g ;
|
||||||
|
$coltitle =~ s/\_/ /g ;
|
||||||
|
my $ucfirst = join '', map { ucfirst lc } split /(\s+)/, $coltitle;
|
||||||
|
&xlsxcreator_write_xlsx($ws,2,$xlsxcol,$ucfirst,$format_event_heading_2);
|
||||||
|
$xlsxcol++;
|
||||||
|
}
|
||||||
|
|
||||||
|
&xlsxcreator_freeze_panes($ws,3,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
our $xlsxrow=4;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_header {
|
||||||
|
|
||||||
|
my ($report,$xlsfolder) = @_ ;
|
||||||
|
|
||||||
|
unless ($xlsfolder) { $xlsfolder = 'export' ; }
|
||||||
|
|
||||||
|
# my $xlsfolder = lc $report ; $xlsfolder =~ s/_//gi ;
|
||||||
|
|
||||||
|
our $xlspath = "$htmlpath/xls/$xlsfolder" ;
|
||||||
|
|
||||||
|
my $xlsnamestart = uc $report ; $xlsnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlspath) ;
|
||||||
|
|
||||||
|
our $xlsname = $xlsnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
my $xlsfile = $xlspath . '/' . $xlsname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsfile);
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&report_build_headings($report, $ws) ;
|
||||||
|
|
||||||
|
our $xlscol = 0 ;
|
||||||
|
our $xlsrow = 4 ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_header {
|
||||||
|
|
||||||
|
my ($report,$xlsxfolder,$csv_folder,$title_heading) = @_ ;
|
||||||
|
|
||||||
|
unless ($xlsxfolder) { $xlsxfolder = 'export' ; }
|
||||||
|
|
||||||
|
# my $xlsfolder = lc $report ; $xlsfolder =~ s/_//gi ;
|
||||||
|
|
||||||
|
our $xlsxpath = "$htmlpath/xlsx/$xlsxfolder" ;
|
||||||
|
|
||||||
|
my $xlsxnamestart = uc $report ; $xlsxnamestart =~ s/_/-/gi ;
|
||||||
|
|
||||||
|
&xlsxcreator_delete_previous_xlsx($xlsxpath) ;
|
||||||
|
|
||||||
|
our $xlsxname = $xlsxnamestart . '-' . $now_ccyymmdd. $now_hour . $now_min . $now_sec . '.xlsx' ;
|
||||||
|
my $xlsxfile = $xlsxpath . '/' . $xlsxname ;
|
||||||
|
|
||||||
|
&xlsxcreator_create_xlsx($xlsxfile) ;
|
||||||
|
|
||||||
|
&xlsxcreator_xlsx_format;
|
||||||
|
|
||||||
|
$ws = $report ;
|
||||||
|
|
||||||
|
&xlsxcreator_add_worksheet($ws) ;
|
||||||
|
|
||||||
|
&report_build_headings($report,$ws,$title_heading) ;
|
||||||
|
|
||||||
|
our $xlsxcol = 0 ;
|
||||||
|
our $xlsxrow = 4 ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_build_headings {
|
||||||
|
|
||||||
|
my ($report,$worksheet,$title_heading,$xlsx_start_row,$xlsx_start_col) = @_ ;
|
||||||
|
my $xlsxtitle = ($xlsxheading) ? $xlsxheading : $report ;
|
||||||
|
$xlsxtitle = $title_heading if $title_heading ;
|
||||||
|
$xlsxtitle =~ s/_/ /gi ;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,0,0,$xlsxtitle,$format_management_report_title) if $xlsxtitle ;
|
||||||
|
my $col = ($xlsx_start_col) ? $xlsx_start_col : 0 ;
|
||||||
|
|
||||||
|
return unless scalar @sql_col_display ;
|
||||||
|
|
||||||
|
if ($calibration_report_cron) {
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
&xlsxcreator_write_xlsx($ws,1,$col,"$day_of_week",$format93) unless $col ;
|
||||||
|
&xlsxcreator_write_xlsx($ws,1,$col,"",$format93) if $col ;
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
$col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $titles_row = ($xlsxtitle) ? 2 : ($xlsx_start_row) ? $xlsx_start_row : 0 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
my $coltitle = $_ ;
|
||||||
|
$coltitle =~ s/\_id//g ;
|
||||||
|
$coltitle =~ s/\_/ /g ;
|
||||||
|
my $ucfirst = join '', map { ucfirst lc } split /(\s+)/, $coltitle;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,$titles_row,$col,$ucfirst,$format_management_report_headings) unless $calibration_report;
|
||||||
|
&xlsxcreator_write_xlsx($worksheet,$titles_row,$col,$ucfirst,$format93) if $calibration_report;
|
||||||
|
$col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$titles_row++ ;
|
||||||
|
&xlsxcreator_freeze_panes($worksheet,$titles_row,0) ; # Freeze the first 3 rows
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub report_xlsx_export_process_cell {
|
||||||
|
|
||||||
|
my ($changed,$money,$val) = @_ ;
|
||||||
|
|
||||||
|
if ($changed) {
|
||||||
|
&report_xlsx_export_output_cell($format23,$val) ;
|
||||||
|
}
|
||||||
|
elsif ($money) {
|
||||||
|
&report_xlsx_export_output_cell($format3,$val) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&report_xlsx_export_output_cell($format1,$val) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------\
|
||||||
|
|
||||||
|
|
||||||
|
sub report_write_events {
|
||||||
|
|
||||||
|
my ($val, $last) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format_event_data) if $last == 0;
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format_event_data_2) if $last == 1;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_output_cell {
|
||||||
|
|
||||||
|
my ($format,$val) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsxrow,$xlsxcol,$val,$format);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_process_cell {
|
||||||
|
|
||||||
|
my ($changed,$money,$val) = @_ ;
|
||||||
|
|
||||||
|
if ($changed) {
|
||||||
|
&report_xls_export_output_cell($format23,$val) ;
|
||||||
|
}
|
||||||
|
elsif ($money) {
|
||||||
|
&report_xls_export_output_cell($format3,$val) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&report_xls_export_output_cell($format1,$val) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_output_cell {
|
||||||
|
|
||||||
|
my ($format,$val) = @_ ;
|
||||||
|
|
||||||
|
&xlsxcreator_write_xlsx($ws,$xlsrow,$xlscol,$val,$format);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xlsx_export_footer {
|
||||||
|
|
||||||
|
my ($resize_cell_to,$col_width,$report) = @_ ;
|
||||||
|
|
||||||
|
my $col = 0;
|
||||||
|
my $output_row = $xlsxrow+1 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
if ($money_format{$_}) {
|
||||||
|
my $cellfrom = &xl_rowcol_to_cell(4,$col) ;
|
||||||
|
my $cellto = &xl_rowcol_to_cell($xlsxrow,$col) ;
|
||||||
|
&xlsxcreator_write_formula($ws,$output_row,$col,"=SUM($cellfrom:$cellto)",$format67);
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
# $worksheet{$ws}->set_column("A:$resize_cell_to",$col_width) ;
|
||||||
|
$worksheet{$ws}->activate() ;
|
||||||
|
$worksheet{$ws}->select() ;
|
||||||
|
|
||||||
|
&xlsxcreator_close_xlsx ;
|
||||||
|
|
||||||
|
if (-f "$xlsxpath/$xlsxname") {
|
||||||
|
$box_icon .= qq(<div class="box-icon" title='Export to Excel' data-toggle="tooltip" data-placement="left"><a class="btn btn-default btn-round" href="/xlsx/$report/$xlsxname" style="padding-top:1px;"><i class="glyphicon glyphicon-download-alt icon-white"></i></a></div>) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_export_footer {
|
||||||
|
|
||||||
|
my ($resize_cell_to,$col_width,$report) = @_ ;
|
||||||
|
|
||||||
|
unless ($report) { $report = 'export' ; }
|
||||||
|
|
||||||
|
my $col = 0; my $output_row = $xlsrow+1 ;
|
||||||
|
|
||||||
|
foreach (@sql_col_display) {
|
||||||
|
next if not $_ ;
|
||||||
|
if ($money_format{$_}) {
|
||||||
|
my $cellfrom = &xl_rowcol_to_cell(4,$col) ;
|
||||||
|
my $cellto = &xl_rowcol_to_cell($xlsrow,$col) ;
|
||||||
|
&xlsxcreator_write_formula($ws,$output_row,$col,"=SUM($cellfrom:$cellto)",$format67);
|
||||||
|
}
|
||||||
|
$col++ ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheet{$ws}->set_column("A:$resize_cell_to",$col_width);
|
||||||
|
$worksheet{$ws}->activate();
|
||||||
|
$worksheet{$ws}->select();
|
||||||
|
|
||||||
|
&xlsxcreator_close_xlsx;
|
||||||
|
|
||||||
|
if (-f "$xlspath/$xlsname") {
|
||||||
|
$box_icon .= qq(<div class="box-icon" title='Export to Excel' data-toggle="tooltip" data-placement="left"><a class="btn btn-default btn-round" href="/xls/$report/$xlsname" style="padding-top:1px;"><i class="glyphicon glyphicon-download-alt icon-white"></i></a></div>) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_xls_add_chart {
|
||||||
|
|
||||||
|
&xlsxcreator_add_pie_chart($ws);
|
||||||
|
|
||||||
|
# Configure the series.
|
||||||
|
$chart{$ws}->add_series(
|
||||||
|
name => 'Pie Chart',
|
||||||
|
# categories => '=risk_report!$A$4:$A$18',
|
||||||
|
# values => '=risk_report!$B$4:$B$18',
|
||||||
|
categories => "=$ws!A4:A$catspan",
|
||||||
|
values => "=$ws!B4:B$catspan",
|
||||||
|
);
|
||||||
|
|
||||||
|
# Add a title.
|
||||||
|
$chart{$ws}->set_title( name => 'Report Pie Chart' );
|
||||||
|
|
||||||
|
$xlsrow+=5 ;
|
||||||
|
|
||||||
|
# Insert the chart into the worksheet (with an offset).
|
||||||
|
# $worksheet{$ws}->insert_chart('B23',$chart{$ws},25,10);
|
||||||
|
$worksheet{$ws}->insert_chart("B$xlsrow",$chart{$ws},40,16);
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_grid_pdf_check_value_of_up {
|
||||||
|
|
||||||
|
my ($value) = @_ ;
|
||||||
|
|
||||||
|
if ($up < $value) {
|
||||||
|
&report_grid_pdf_print_vertical_lines_table ;
|
||||||
|
&pdf_initialise_page ;
|
||||||
|
$up = 195 ;
|
||||||
|
$across = 1 ;
|
||||||
|
$top = $up;
|
||||||
|
&pdf_black_line(10,$up,287,$up) ; # horizontal
|
||||||
|
}
|
||||||
|
|
||||||
|
} #----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
sub report_grid_pdf_print_vertical_lines_table {
|
||||||
|
|
||||||
|
# &pdf_black_line (10,$top,10,$up) ; # vertical
|
||||||
|
|
||||||
|
&pdf_black_line ($colstart[0],$top,$colstart[0],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[1],$top,$colstart[1],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[2],$top,$colstart[2],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[3],$top,$colstart[3],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[4],$top,$colstart[4],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[5],$top,$colstart[5],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[6],$top,$colstart[6],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[7],$top,$colstart[7],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[8],$top,$colstart[8],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[9],$top,$colstart[9],$up) ; # vertical
|
||||||
|
&pdf_black_line ($colstart[10],$top,$colstart[10],$up) ; # vertical
|
||||||
|
|
||||||
|
# &pdf_black_line(287,$top,287,$up) ; # vertical
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1;
|
||||||
1883
libs/modules/_FromProd/v1.0/schedule.pm
Normal file
1883
libs/modules/_FromProd/v1.0/schedule.pm
Normal file
File diff suppressed because it is too large
Load Diff
1892
libs/modules/_FromProd/v1.0/schedule_test.pm
Normal file
1892
libs/modules/_FromProd/v1.0/schedule_test.pm
Normal file
File diff suppressed because it is too large
Load Diff
51
libs/modules/_FromProd/v1.0/session.pm
Normal file
51
libs/modules/_FromProd/v1.0/session.pm
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
sub check_session {
|
||||||
|
|
||||||
|
use DBI;
|
||||||
|
use CGI::Session;
|
||||||
|
use CGI::Cookie;
|
||||||
|
|
||||||
|
my %cookies = fetch CGI::Cookie ;
|
||||||
|
my $cgisessid = defined $cookies{'CGISESSID'} ? $cookies{'CGISESSID'}->value : undef; # This does
|
||||||
|
|
||||||
|
use db ;
|
||||||
|
&db_open_ro ;
|
||||||
|
|
||||||
|
$userid = 0 ;
|
||||||
|
$session = load CGI::Session("driver:MySQL", $cgisessid, {Handle=>$dbh});
|
||||||
|
$userid = $session->param(-name=>'id');
|
||||||
|
$is_logged_in = $session->param(-name=>'_IS_LOGGED_IN');
|
||||||
|
$username = lc $session->param(-name=>'uname');
|
||||||
|
$useremail = lc $session->param(-name=>'uemail');
|
||||||
|
$usertype = lc $session->param(-name=>'utype');
|
||||||
|
$orgids = $session->param(-name=>'oids');
|
||||||
|
$regids = $session->param(-name=>'rids');
|
||||||
|
$custids = $session->param(-name=>'cids');
|
||||||
|
|
||||||
|
my @orgids = split(/\,/,$orgids);
|
||||||
|
foreach (@orgids) { $glob_orgids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
my @regids = split(/\,/,$regids);
|
||||||
|
foreach (@regids) { next unless $_ > 0 ; $glob_regids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
my @custids = split(/\,/,$custids);
|
||||||
|
foreach (@custids) { next unless $_ > 0 ; $glob_custids{$userid}{$_} = 1 ; }
|
||||||
|
|
||||||
|
$sessionid = $session->id();
|
||||||
|
|
||||||
|
if ($sessionid && $is_logged_in > 0 && $userid > 0) { # if $userid and $is_logged_in is -1 not allowed in
|
||||||
|
$session_state = 'active' ;
|
||||||
|
} elsif ($session->is_expired) {
|
||||||
|
$session_state = 'expired' ;
|
||||||
|
$session->delete() ;
|
||||||
|
} elsif ($session->is_empty) {
|
||||||
|
$session_state = 'empty' ;
|
||||||
|
} else {
|
||||||
|
$session_state = 'empty' ;
|
||||||
|
$session->delete() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
&db_close_conn ;
|
||||||
|
|
||||||
|
} #------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1 ;
|
||||||
1971
libs/modules/_FromProd/v1.0/tabs.pm
Normal file
1971
libs/modules/_FromProd/v1.0/tabs.pm
Normal file
File diff suppressed because it is too large
Load Diff
2266
libs/modules/_FromProd/v1.0/tabs_test.pm
Normal file
2266
libs/modules/_FromProd/v1.0/tabs_test.pm
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user