<?php

include('include/headscript2.php'); ?>

<?php

// pickup the get variable

$formname = "nocontact";

if (isset($_POST["idtrf"])) {

    $idtrf = $_POST["idtrf"];

}

if (isset($_GET["idtrf"])) {

    $idtrf = $_GET["idtrf"];

}

if (isset($_POST["formname"])) {

    $formname = $_POST["formname"];

}

if (isset($_POST["csincharge"])) {

    $csincharge = $_POST["csincharge"];

}

if (isset($_POST["datecsincharge"])) {

    $datecsincharge = $_POST["datecsincharge"];

}





?>

<?php if (!empty($csincharge)) { ?>



    <?php //pdf creation 

    // Recipient 

    /*

$to = $emailuser; 

 

// Sender 

$from = $fromaddresssmail; 

$fromName = 'CIMAC Application Form System'; 

 

// Email subject 

$subject = 'Azione Richiesta: invio secondo modulo';

 

// Attachment file 

$mmessage="mailsecondmodule";



include('include/mailhtml.php');

// Email body content 

$htmlContent = $mail2mod; 

	



 

// Header for sender info 

$headers = "From: $fromName"." <".$from.">"; 

 

// Boundary  

$semi_rand = md5(time());  

$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";  

 

// Headers for attachment  

$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; 

 

// Multipart boundary  

$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . 

"Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";  

 



 

// Send email 

$mail = @mail($to, $subject, $message, $headers, $returnpath);  

 

*/



    ?>

    <?php



    $UpdateQuery = new WA_MySQLi_Query($cmctrfdb);

    $UpdateQuery->Action = "update";

    $UpdateQuery->Table = "`trf-details`";

    $UpdateQuery->bindColumn("csincharge", "s", "$csincharge", "WA_DEFAULT");

    $UpdateQuery->bindColumn("datecsincharge", "s", "$datecsincharge", "WA_DEFAULT");

    $UpdateQuery->addFilter("idtrfdetails", "=", "i", "" . ($idtrf)  . "");

    $UpdateQuery->execute();

    $UpdateGoTo = "";

    if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo ? rel2abs($UpdateGoTo, dirname(__FILE__)) : "";

    $UpdateQuery->redirect($UpdateGoTo); ?>

    <script>

        window.onunload = refreshParent;



        function refreshParent() {

            window.opener.location.reload();

        }

        window.close()

    </script>











<?php } ?>















<?php

$trfnumberfinal = new WA_MySQLi_RS("trfnumberfinal", $cmctrfdb, 0);

$trfnumberfinal->setQuery("SELECT * FROM `trf-details` WHERE `trf-details`.idtrfdetails='$idtrf'");

$trfnumberfinal->execute();

?>

<?php

$idcertn = $trfnumberfinal->getColumnVal("idcertification");

$idcert = $trfnumberfinal->getColumnVal("idcertification");

?>

<?php

$certname = new WA_MySQLi_RS("certname", $cmctrfdb, 1);

$certname->setQuery("SELECT * FROM certificationtype WHERE certificationtype.idcertificationtype='$idcert'");

$certname->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 -->

    <script>

        function formSubmit() {

            document.forms["myForm"].submit();

        }

    </script>

    <!-- upload image script -->





    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>





    <!-- search on article -->

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

    <script type="text/javascript" src="searchengine/scriptsearchcontact.js"></script>

    <!-- submit form with button -->

</head>



<body>







    <!-- section file already uploaded -->



    <div class="card">

        <div class="card-body">

            <h4 class="mt-0 header-title">ACTION CS</h4>

            PRESA IN CARICO

            <br><br>



            TRF N. <?php echo ($trfnumberfinal->getColumnVal("trfnumber")); ?> - Description <?php echo ($trfnumberfinal->getColumnVal("sample_description")); ?>

            <br><br>

            CERT NAME: <?php echo ($certname->getColumnVal("name_certification")); ?>

            <br><br>

            <form method="post">

                <?php $todaydate = $date = date('Y-m-d H:i:s'); ?>

                <input name="formname" type="hidden" id="formname" value="actioncsupdate">

                <input name="idtrf" type="hidden" id="idtrf" value="<?php echo $idtrf; ?>">

                <input name="csincharge" type="hidden" id="csincharge" value="<?php echo $loginusername; ?>">

                <input name="datecsincharge" type="hidden" id="datecsincharge" value="<?php echo $todaydate; ?>">

                <button type="submit" class="btn btn-success waves-effect waves-light">PRENDI IN CARICO</button>

            </form>

            <br><br>

            <a href="csrev.php?idtrf=<?php echo $idtrf; ?>"><button type="submit" class="btn btn-danger waves-effect waves-light">CS REV</button></a>

            <a href="backtodraft.php?idtrf=<?php echo $idtrf; ?>"><button type="submit" class="btn btn-danger waves-effect waves-light">Back To Draft</button></a>

            <br><br>

            <a href="xlsgen.php?idtrf=<?php echo $idtrf; ?>"><button type="submit" class="btn btn-primary waves-effect waves-light">XLS PARTS</button></a>

            <br><br>

            <button onclick="self.close()" type="button" class="btn btn-success waves-effect waves-light"><?php echo $closewindow; ?></button>





        </div><!--end card-body-->





    </div>

    <?php // contact search trial 

    ?>







    <!-- end of page -->





    <!-- 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>



</body>



</html>