Modify for M18b certification - Added multi site as request by M Piccolini

This commit is contained in:
Claudio 2024-09-19 12:20:18 +02:00
parent 91ae77aff1
commit 11954159d4
18 changed files with 292 additions and 10 deletions

View File

@ -549,30 +549,31 @@ unset($wa_repeatcount);
<div class="form-row">
<div class="col-md-2 mb-3">
<label for="projectperson"><?php echo $designtitle; ?></label>
<input type="text" class="form-control" id="projectperson" name="projectperson" value="<?php echo ($contactdata->getColumnVal("projectperson")); ?>">
<input type="number" class="form-control" id="projectperson" name="projectperson" value="<?php echo ($contactdata->getColumnVal("projectperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
<div class="col-md-2 mb-3">
<label for="salesperson"><?php echo $salestitle; ?></label>
<input type="text" class="form-control" id="salesperson" name="salesperson" value="<?php echo ($contactdata->getColumnVal("salesperson")); ?>">
<input type="number" class="form-control" id="salesperson" name="salesperson" value="<?php echo ($contactdata->getColumnVal("salesperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
<div class="col-md-2 mb-3">
<label for="productionperson"><?php echo $productiontitle; ?></label>
<input type="text" class="form-control" id="productionperson" name="productionperson" value="<?php echo ($contactdata->getColumnVal("productionperson")); ?>">
<input type="number" class="form-control" id="productionperson" name="productionperson" value="<?php echo ($contactdata->getColumnVal("productionperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
<div class="col-md-2 mb-3">
<label for="csperson"><?php echo $customer_caretitle; ?></label>
<input type="text" class="form-control" id="csperson" name="csperson" value="<?php echo ($contactdata->getColumnVal("csperson")); ?>">
<input type="number" class="form-control" id="csperson" name="csperson" value="<?php echo ($contactdata->getColumnVal("csperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
<div class="col-md-2 mb-3">
<label for="qualityperson"><?php echo $qualitytitle; ?></label>
<input type="text" class="form-control" id="qualityperson" name="qualityperson" value="<?php echo ($contactdata->getColumnVal("qualityperson")); ?>">
<input type="number" class="form-control" id="qualityperson" name="qualityperson" value="<?php echo ($contactdata->getColumnVal("qualityperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
<div class="col-md-2 mb-3">
<label for="purchaseperson"><?php echo $buyertitle; ?></label>
<input type="text" class="form-control" id="purchaseperson" name="purchaseperson" value="<?php echo ($contactdata->getColumnVal("purchaseperson")); ?>">
<input type="number" class="form-control" id="purchaseperson" name="purchaseperson" value="<?php echo ($contactdata->getColumnVal("purchaseperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
</div>
<div class="form-row">
<div class="col-md-9 mb-3">
<label for="otheractivities"><?php echo $other_activitytitle; ?></label>
@ -580,8 +581,9 @@ unset($wa_repeatcount);
</div>
<div class="col-md-3 mb-3">
<label for="otheractivitiesperson"><?php echo $other_activitypersontitle; ?></label>
<input type="text" class="form-control" id="otheractivitiesperson" name="otheractivitiesperson" value="<?php echo ($contactdata->getColumnVal("otheractivitiesperson")); ?>">
<input type="number" class="form-control" id="otheractivitiesperson" name="otheractivitiesperson" value="<?php echo ($contactdata->getColumnVal("otheractivitiesperson")); ?>" pattern="[0-9]+([\,\.][0-9]{1})?" inputmode="decimal">
</div>
</div>
<hr>
<div class="form-row">

View File

@ -334,3 +334,8 @@ $language_audittitle = "Language to be used for the audit";
$outsourced_processestitle = "Outsourced processes";
$people_involved_title = "Numero persone coinvolte";
$personinvolvedtitle = "Quantity of people involved in PPE-related processes";
$certificationtypedtitle = "Module D Certification Type Requested";
$certd_1 = "Initial certification";
$certd_2 = "Annual certification surveillance";
$certd_3 = "Renewal";
$certd_4 = "Extension";

View File

@ -94,3 +94,25 @@ $alreradytestedtlab = "Tested by another lab";
$renewdate = "Expiry date renewal certificate";
$producersign = "Manufacturer's signature";
$signtext = "Signature";
$certificationtypedtitle = "Module D Certification Type Requested";
$certd_1 = "Initial certification";
$certd_2 = "Annual certification surveillance";
$certd_3 = "Renewal";
$certd_4 = "Extension";
$activitiestitle = "Activities carried out";
$designtitle = "Design";
$salestitle = "Sales";
$buyertitle = "Purchases";
$purchasestitle = "Purchases";
$productiontitle = "Production";
$customer_caretitle = "Customer care";
$qualitytitle = "Quality";
$other_activitytitle = "Other activity (specify)";
$other_activitypersontitle = "Quantity of people involved";
$total_workforcetitle = "Total workforce involved";
$language_audittitle = "Language to be used for the audit";
$outsourced_processestitle = "Outsourced processes";
$people_involved_title = "Numero persone coinvolte";
$personinvolvedtitle = "Quantity of people involved in PPE-related processes";
$sitentitle = "Place N.";
$totalpersontitle = "Total workforce involved";

View File

@ -338,3 +338,8 @@ $language_audittitle = "Lingua da utilizzare per l'audit";
$outsourced_processestitle = "Processi in outsourcing";
$people_involved_title = "Numero persone coinvolte";
$personinvolvedtitle = "Numero di persone coinvolte nei processi relativi al DPI";
$certificationtypedtitle = "Tipo certificazione modulo D richiesta";
$certd_1 = "Certificazione iniziale";
$certd_2 = "Sorveglianza annuale";
$certd_3 = "Rinnovo";
$certd_4 = "Estensione";

View File

@ -94,3 +94,26 @@ $alreradytestedtlab = "Testato da altro Lab";
$renewdate = "Data Scadenza Certificato da rinnovare";
$producersign = "Firma del fabbricante";
$signtext = "Firma";
$certificationtypedtitle = "Tipo certificazione modulo D richiesta";
$certd_1 = "Certificazione iniziale";
$certd_2 = "Sorveglianza annuale";
$certd_3 = "Rinnovo";
$certd_4 = "Estensione";
$activitiestitle = "Attività svolte";
$designtitle = "Progettazione";
$salestitle = "Commerciale";
$purchasestitle = "Acquisti";
$productiontitle = "Produzione";
$customer_caretitle = "Assistenza clienti";
$buyertitle = "Acquisti";
$qualitytitle = "Qualità";
$other_activitytitle = "Altra attività (specificare)";
$other_activitypersontitle = "Numero persone coinvolte";
$total_workforcetitle = "Totale addetti coinvolti";
$language_audittitle = "Lingua da utilizzare per l'audit";
$outsourced_processestitle = "Processi in outsourcing";
$people_involved_title = "Numero persone coinvolte";
$personinvolvedtitle = "Numero di persone coinvolte nei processi relativi al DPI";
$certificationtypedtitle = "Tipo certificazione modulo D richiesta";
$sitentitle = "Sede N.";
$totalpersontitle = "Totale addetti coinvolti";

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,147 @@
<?php
//invoice contacts
// ***start with invoice address
$pdf->SetFont('', '', 8);
$pdf->Cell(90, 6, $certificationtypedtitle, 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255);
$certificationtyped = $trfData['certificationtyped'];
// Definisci i valori corrispondenti
switch ($certificationtyped) {
case 1:
$certificationtyped_label = $certd_1;
break;
case 2:
$certificationtyped_label = $certd_2;
break;
case 3:
$certificationtyped_label = $certd_3;
break;
case 4:
$certificationtyped_label = $certd_4;
break;
default:
$certificationtyped_label = $certd_1; // Valore predefinito se non corrisponde a nessun caso
}
// Inserisci la label corretta nel PDF
$pdf->Cell(100, 6, $certificationtyped_label, 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Ln();
$kindcont = 'audit';
// parse contacts data with variable kindofcontacts
$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts='$kindcont'");
// Stampa $audititletop una volta sola all'inizio
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', 'B', '10');
$audititletop = html_entity_decode($auditplacepdf, ENT_QUOTES, 'UTF-8');
$audititletop = iconv('UTF-8', 'windows-1252', $audititletop);
$pdf->Cell(190, 6, $audititletop, 1, 0, 'C');
$pdf->Ln();
// Inizializza il contatore per il numero sequenziale delle sedi
$sitenumber = 1;
// Verifica se ci sono dati e itera su ogni record
while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) {
$companyname = html_entity_decode($contactsinfoData['companyname'], ENT_QUOTES, 'UTF-8');
// Titolo per ogni sede con numero sequenziale
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(190, 6, $sitentitle . " " . $sitenumber, 1, 0, 'C');
$pdf->Ln();
$sitenumber++; // Incrementa il numero sequenziale per ogni sede
// Stampa dei dati aziendali
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(40, 6, html_entity_decode($companypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150, 6, $companyname, 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($addresspdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['address'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($citypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['city'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($zippdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($vatpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($countrypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['country'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($phonepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($emailpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['email'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($contactnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($contactsurnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactsurname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
// Calcola il totale delle persone
$totalperson = $contactsinfoData['otheractivitiesperson'] +
$contactsinfoData['purchaseperson'] +
$contactsinfoData['qualityperson'] +
$contactsinfoData['csperson'] +
$contactsinfoData['productionperson'] +
$contactsinfoData['salesperson'] +
$contactsinfoData['projectperson'];
// Stampa dei campi aggiuntivi in modo compatto con label (colonna_title) senza grassetto
$pdf->Cell(40, 6, html_entity_decode($activitiestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['activities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($designtitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['projectperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($salestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['salesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($productiontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['productionperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($customer_caretitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['csperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($qualitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['qualityperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($purchasestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['purchaseperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($other_activitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['otheractivities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($other_activitypersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['otheractivitiesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
// Stampa il campo Total Persons
$pdf->Cell(60, 6, html_entity_decode($totalpersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, $totalperson, 1, 0, 'C', TRUE); // Campo "Total Persons"
$pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($language_audittitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['languageforaudit'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($outsourced_processestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['outsourcing_process'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
// Spazio vuoto tra i dati delle aziende
$pdf->Ln(6);
}
?>

View File

@ -11,7 +11,11 @@ $pdf->Cell(0, 9, $secondsent, 0, 1);
//$pdf->Cell(0,9,$foursent,0,1);
// ***start with Audit address
//typecert 3 info
include('pdfcreation/auditable.php');
if ($idcertificate == 5) {
include('pdfcreation/auditable.php');
} elseif ($idcertificate == 6) {
include('pdfcreation/auditablem18b.php');
}
$pdf->Ln();
//include('pdfcreation/invoicecontacttable.php');
$pdf->Ln();

View File

@ -358,6 +358,12 @@ $idprotectioncategoryJson = json_encode($idproteccategorylistRecord);
.table tbody .for-add:nth-child(1) {
display: none;
}
.flashing-green {
background-color: #d4edda;
/* Verde chiaro */
transition: background-color 0.5s ease;
}
</style>
<style>
body {
@ -506,10 +512,22 @@ $idprotectioncategoryJson = json_encode($idproteccategorylistRecord);
<div class="progress mb-4">
<div class="progress-bar" role="progressbar" style="width: 20%;" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">20%</div>
</div>
<div>
<h4 class="alert-heading font-18 text-dark"><?php echo $certificatem18a; ?></h4>
<p><?php echo $certificatem18a_help; ?></p>
<p><?php echo $certificatem18a_help; ?></p><br>
<!-- Dropdown per il tipo di certificazione con larghezza ridotta -->
<div class="form-group" style="max-width: 300px;">
<label for="certificationtype"><strong><?php echo $certificationtypedtitle; ?></strong></label>
<select id="certificationtype" name="certificationtype" class="form-control">
<option value=""><?php echo $pleaseselect; ?></option>
<option value="1" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 1) ? 'selected' : ''; ?>><?php echo $certd_1; ?></option>
<option value="2" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 2) ? 'selected' : ''; ?>><?php echo $certd_2; ?></option>
<option value="3" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 3) ? 'selected' : ''; ?>><?php echo $certd_3; ?></option>
<option value="4" <?php echo ($trfnumberfinal->getColumnVal("certificationtyped") == 4) ? 'selected' : ''; ?>><?php echo $certd_4; ?></option>
</select>
</div>
<form action="trfdetails.php" method="get" class="was-validated" name="myForm">
<input name="certtype" type="hidden" id="certtype" value="<?php echo ($certtype->getColumnVal("idcertificationtype")); ?>">
<input name="tempcode" type="hidden" id="tempcode" value="<?php echo $tempcode; ?>">
@ -556,7 +574,6 @@ $idprotectioncategoryJson = json_encode($idproteccategorylistRecord);
</tbody>
</table> <br>
<a class="badge_btn" onclick="window.open('contactpopaudit.php?kindcontacts=audit&idtrf=<?php echo $idtrf; ?>&idcontacts=<?php echo ($auditcontactlist->getColumnVal("idcontacts")); ?>', '_blank', 'location=yes,height=950,width=1400,scrollbars=yes,status=yes');"><button type="button" class="btn btn-primary waves-effect waves-light">MODIFICA</button></a>
<!-- Pulsante per aggiungere un nuovo contatto -->
<a class="badge_btn" onclick="window.open('contactpopaudit.php?kindcontacts=audit&idtrf=<?php echo $idtrf; ?>&add_new_contact=1', '_blank', 'location=yes,height=950,width=1400,scrollbars=yes,status=yes');">
<button type="button" class="btn btn-success waves-effect waves-light">AGGIUNGI</button>
@ -852,6 +869,45 @@ $idprotectioncategoryJson = json_encode($idproteccategorylistRecord);
});
});
</script>
<script>
// Funzione per aggiornare il dropdown e flashare in verde
function flashGreen() {
var dropdown = document.getElementById('certificationtype');
dropdown.classList.add('flashing-green');
// Rimuovi la classe dopo 2 secondi
setTimeout(function() {
dropdown.classList.remove('flashing-green');
}, 2000);
}
// Funzione per inviare l'aggiornamento tramite AJAX
function updateCertificationType() {
var certificationType = document.getElementById('certificationtype').value;
var idtrf = <?php echo $idtrf; ?>; // ID del trf (puoi usare la variabile PHP)
// Esegui la chiamata AJAX
var xhr = new XMLHttpRequest();
xhr.open("POST", "update_certificationtype.php", true); // Nome del file PHP che gestirà l'aggiornamento
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// Funzione di callback al termine dell'aggiornamento
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
// Dopo l'aggiornamento, flash verde
flashGreen();
}
};
// Invio dei dati al server
xhr.send("certificationtype=" + certificationType + "&idtrf=" + idtrf);
}
// Ascolta il cambio del valore del dropdown
document.getElementById('certificationtype').addEventListener('change', function() {
updateCertificationType();
});
</script>
<!-- jQuery -->
<!-- <script src="assets/js/jquery.min.js"></script> -->

View File

@ -0,0 +1,18 @@
<?php
include('db-connect.php');
if (isset($_POST['certificationtype']) && isset($_POST['idtrf'])) {
$certificationtype = $_POST['certificationtype'];
$idtrf = $_POST['idtrf'];
// Correggi l'errore sintattico includendo i backtick intorno al nome della tabella
$query = "UPDATE `trf-details` SET `certificationtyped` = ? WHERE `idtrfdetails` = ?";
$stmt = $con->prepare($query);
$stmt->bind_param('ii', $certificationtype, $idtrf);
if ($stmt->execute()) {
echo "success"; // Risposta al client
} else {
echo "error"; // In caso di errore
}
}