ppeasy/public/bck100823declaration.php

743 lines
15 KiB
PHP

<?php
include('include/headscript.php'); ?>
<?php
// pickup the get variable
if (isset($_POST["idtrf"])) {
$idtrf=$_POST["idtrf"]; }
if (isset($_GET["idtrf"])) {
$idtrf=$_GET["idtrf"]; }
if (isset($_GET["tokenresult"])) {
$tokenresult=$_GET["tokenresult"]; }
if (isset($_POST["ukcacert"])) {
$ukcacert=$_POST["ukcacert"]; } else { $ukcacert=''; }
if (isset($_POST["reportlanguage"])) {
$reportlanguage=$_POST["reportlanguage"];
if ($reportlanguage=='other') {
$reportlanguage=$_POST["reportlanguageother"];
}
}
if (isset($_POST["certificatelanguage"])) {
$certificatelanguage=$_POST["certificatelanguage"];
if ($certificatelanguage=='other') {
$certificatelanguage=$_POST["certificatelanguageother"];
}
}
if (isset($_POST["contactsendmail"])) {
$contactsendmail=$_POST["contactsendmail"]; }
if (isset($_POST["emailsendmail"])) {
$emailsendmail=$_POST["emailsendmail"]; }
if (isset($_POST["surveillanceselectoption"])) {
$surveillanceselectoption=$_POST["surveillanceselectoption"]; } else { $surveillanceselectoption=""; }
if (isset($_GET["sndrpt"])) {
$sndrpt=$_GET["sndrpt"]; } else { $sndrpt="N"; }
if (isset($_GET["codestep"])) {
$code=$_GET["codestep"];
$InsertQuery = new WA_MySQLi_Query($cmctrfdb);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "wheretrfstep";
$InsertQuery->bindColumn("idtrf", "i", "$idtrf", "WA_DEFAULT");
$InsertQuery->bindColumn("code", "i", "$code", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
$InsertQuery->redirect($InsertGoTo);
}
// update trf details`
if (isset($_POST["optionform"])) {
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("languagereport", "s", "$reportlanguage", "WA_DEFAULT");
$UpdateQuery->bindColumn("languagecertificate", "s", "$certificatelanguage", "WA_DEFAULT");
$UpdateQuery->bindColumn("contacttrfname", "s", "$contactsendmail", "WA_DEFAULT");
$UpdateQuery->bindColumn("emailtrfname", "s", "$emailsendmail", "WA_DEFAULT");
$UpdateQuery->bindColumn("ukcacert", "s", "$ukcacert", "WA_DEFAULT");
$UpdateQuery->bindColumn("surveillanceselectoption", "s", "$surveillanceselectoption", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "".($idtrf) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
}
?>
<?php
$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal",$cmctrfdb,1);
$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");
$trfnumberfinal->execute();
$idcertn=$trfnumberfinal->getColumnVal("idcertification");
$idarticletype=$trfnumberfinal->getColumnVal("idarticletype");
?>
<?php $idcert=$trfnumberfinal->getColumnVal("idcertification") ?>
<?php
$certname = new WA_MySQLi_RS("certname",$cmctrfdb,1);
$certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");
$certname->execute();?>
<?php
$chemicalagentlist = new WA_MySQLi_RS("chemicalagentlist",$cmctrfdb,0);
$chemicalagentlist->setQuery("SELECT * FROM chemicalagent ORDER BY chemicalagent.name_chemicalagent");
$chemicalagentlist->execute();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TRF CIMAC </title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta content="CIMAC TRF Portal" name="description" />
<meta content="" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="../images/favicon.ico">
<!--Form Wizard-->
<link href="../plugins/jquery-steps/jquery.steps.css" rel="stylesheet" type="text/css">
<!-- App css -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/jquery-ui.min.css" rel="stylesheet">
<link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/metisMenu.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/app.min.css" rel="stylesheet" type="text/css" />
<!-- submit form with button -->
<style>
input:invalid {
border-color: #ff0000;
background-color: #fff7e6;
}
input:focus {
background: yellow;
}
input:valid {
border-color: #66ff33;
background-color: #eeffe6;
}
select:invalid {
border-color: #ff0000;
background-color: #fff7e6;
}
select:focus {
background-color: yellow;
}
select:valid {
border-color: #66ff33;
background-color: #eeffe6;
}
</style>
<style>
body {
font-family: arial;
}
.hide {
display: none;
}
p {
font-weight: bold;
}
</style>
<script>
function formSubmit() {
document.forms["myForm"].submit();
}
</script>
<script>
function show1(){
document.getElementById('div1').style.display ='none';
}
function show2(){
document.getElementById('div1').style.display = 'block';
}
function show3(){
document.getElementById('div3').style.display = 'none';
}
function show4(){
document.getElementById('div3').style.display = 'block';
}
function show5(){
document.getElementById('div5').style.display = 'none';
}
function show6(){
document.getElementById('div5').style.display = 'block';
}
</script>
</head>
<body>
<!-- Top Bar Start -->
<?php include('include/topbar.php'); ?>
<!-- Top Bar End -->
<!-- Left Sidenav -->
<?php include('include/leftsidenav.php'); ?>
<!-- end left-sidenav-->
<div class="page-wrapper">
<!-- Page Content-->
<div class="page-content">
<div class="container-fluid">
<!-- Page-Title -->
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="float-right">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">TRF</a></li>
<li class="breadcrumb-item active">Starter</li>
</ol>
</div>
<h4 class="page-title"><?php echo $titlewb; ?></h4>
</div><!--end page-title-box-->
</div><!--end col-->
</div>
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-body">
<div class="media">
<?php include('include/appform.php'); ?>
</div><!--end media-->
</div><!--end card-body-->
</div><!--end card-->
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 95%;" aria-valuenow="95" aria-valuemin="0" aria-valuemax="100">95%</div>
</div>
<!-- card for optional TRF -->
<div class="card">
<div class="card-body">
<h4 class="mt-0 header-title"><?php echo $declarationtitle; ?></h4>
<p class="text-muted mb-3"><?php echo $declarationtitle_help; ?></p>
<p><?php echo $companyname; ?><?php echo $companydeclaration; ?></p><br>
<p><?php echo $declarationsent1; ?></p><br>
<p><?php echo $declarationsent2; ?></p><br>
<?php if ($idcert==5 || $idcert==6) { ?>
<p><?php echo $declarationsent3; ?></p><br>
<?php } ?>
<?php if (isset($tokenresult)) { ?>
<div class="alert icon-custom-alert alert-outline-danger alert-danger-shadow" role="alert">
<i class="mdi mdi-alert-outline alert-icon"></i>
<div class="alert-text">
<strong><?php echo $uncorrecttokentitle; ?></strong>.
</div>
</div>
<?php } ?>
<form action="sendtrf.php" method="post" name="myForm" class="form-parsley">
<div class="form-group row">
<label for="example-date-input" class="col-sm-1 col-form-label text-right"><?php echo $datettitle; ?></label>
<div class="col-sm-3">
<?php $todaydate=date("Y-m-d");
?>
<input class="form-control" type="date" id="datetrf" name="datetrf" value="<?php echo $todaydate; ?>" id="example-date-input" readonly>
</div>
<label for="example-text-input" class="col-sm-2 col-form-label text-right"><?php echo $signedbytitle; ?></label>
<div class="col-sm-3">
<input class="form-control" type="text" value="<?php echo $nameuser; ?>" id="clientname" name="clientname" readonly>
</div>
</div>
<div class="form-group row">
<label for="example-text-input" class="col-sm-4 col-form-label text-right"><?php echo $inserttokensign; ?></label>
<div class="col-sm-2">
<input name="tokensignatureon" type="text" required class="form-control" id="tokensignatureon" value="" size="6">
<input hidden id="idtrf" name="idtrf" value="<?php echo $idtrf; ?>">
<input hidden id="formdeclaration" name="formdeclaration" value="OK">
<input hidden id="sndrpt" name="sndrpt" value="<?php echo $sndrpt; ?>">
</div>
</div>
<br>
<p><a href="signaturetok.php" target="_blank"><?php echo $tokenwhere; ?></a></p>
<p><?php echo $firmdeclaration; ?></p><br>
<!-- <button class="btn btn-gradient-success waves-effect waves-light" type="submit">Conferma</button> -->
<div id="cont_wait" style="display:none;">
<div class="alert icon-custom-alert alert-outline-warning alert-danger-shadow" role="alert">
<!-- <i class="mdi mdi-alert-outline alert-icon"></i> -->
<div class="alert-text">
<strong>Attenzione:</strong> Inserimento Application Form in corso, Attendi!
</div>
</div>
</div>
<button class="btn btn-gradient-success waves-effect waves-light" type="button" id="btnConfirm">Conferma</button>
</form>
</div><!--end card-body-->
</div><!--end card-->
</div><!--end col-->
</div>
<!-- end page title end breadcrumb -->
</div><!-- container -->
<!-- footer start -->
<?php include('include/footer.php'); ?>
</footer><!--end footer-->
</div>
<!-- end page content -->
</div>
<!-- end page-wrapper -->
<!-- jQuery -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/metismenu.min.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/feather.min.js"></script>
<script src="assets/js/jquery.slimscroll.min.js"></script>
<script src="assets/js/jquery-ui.min.js"></script>
<script src="../plugins/jquery-steps/jquery.steps.min.js"></script>
<script src="assets/pages/jquery.form-wizard.init.js"></script>
<!-- App js -->
<script src="assets/js/app.js"></script>
<script type="text/javascript">
/* PROGRESS STARTS AT 95% */
let progress = 95;
$(document).ready(function(){
$('#btnConfirm').on('click', function(){
if($('#tokensignatureon').val() == ''){
formSubmit();
}else{
$('.alert-outline-danger').hide();
/* SHOW PLEASE WAIT WARNING */
$('#cont_wait').css('display', 'block');
}
/* DISABLE CONFIRM BUTTON */
$(this).prop('disabled', true);
/* ANIMATE PROGRESS BAR */
setInterval(progressBar, 1000);
});
});
function progressBar(){
/* ITERATE PERCENTAGE */
progress += 1;
/* UPDATE PROGRESS PERCENTAGE */
$('.progress-bar').text(progress+'%');
/* UPDATE PROGRESS BAR IMG */
$('.progress-bar').css('width', progress+'%');
if(progress == 98){
/* SUBMIT FORM */
formSubmit();
}
}
</script>
</body>
</html>