Import initial du projet Production

This commit is contained in:
KANE LAZENI
2025-12-01 16:12:12 +00:00
commit 2f364ab2fc
14257 changed files with 3395325 additions and 0 deletions

57
Vue/Contrat/index copy.php Executable file
View File

@@ -0,0 +1,57 @@
<?php $this->titre = "Tâches - Editions contrats";
$dateAvenant = $_SESSION['dateAvenant_C'];
?>
<legend><?= _("EDITION CONTRAT") . " : " . $this->nettoyer($_SESSION['numeroPolice_C'])?> </legend>
<table class="table table-responsive table-condensed" style='font-size:12pt; text-align:center'>
<td width="10%" align="center" class="required"> <?= _("Avenant") ?> </td>
<td style='font-size:14pt;'>
<SELECT style='font-size:10pt; font-weight:bold;' class="form-select" id="idAvenant" NAME="idAvenant" onChange="avenantimprimer_cp;"required>
<?php liste_options($avenant,""); ?>
</SELECT>
</td>
<td width="6%" > <?= _("Période du") ?> </td>
<td > <INPUT style='text-align:center; font-size:10pt;' class="form-control datepicker" TYPE="text" id="debutStat" NAME="debutStat" value="<?=date('d/m/Y') ?>" > </td>
<td align="center" width="3%"> <?= _("au") ?> </td>
<td > <INPUT style='text-align:center; font-size:10pt;' class="form-control datepicker" TYPE="text" id="finStat" NAME="finStat" value="<?=date('d/m/Y') ?>" > </td>
</table>
<table class="table table-responsive table-condensed" style='font-size:10pt; text-align:center'>
<thead>
<tr>
<th style='text-align:center'> <?= _("FRANCAIS") ?> </th>
<th style='text-align:center'>=></th>
<th style='text-align:center'> <?= _("ANGLAIS") ?> </th>
</tr>
</thead>
<tbody>
<?php foreach ($etats as $etat):
$lienEtat = $etat['lienEtat'];
$lienEtatEng = $etat['lienEtatEng'];
?>
<tr valign="top">
<td> <input style='font-size:10pt;' class = "form-control btn btn-primary" type="button" value="<?= $this->nettoyer($etat['nomEtat']) ?>" onClick="javascript:imprimer_cp('<?= $lienEtatEng ?>');"> </td>
<td>=></td>
<td> <input style='font-size:10pt;' class = "form-control btn btn-primary" type="button" value="<?= $this->nettoyer($etat['nomEtatEng']) ?>" onClick="javascript:imprimer_cp('<?= $lienEtatEng ?>');"> </td>
</tr>
<tr>
<td height="20" colspan="3"></td>
</tr>
<?php endforeach; ?>
<tr>
<td> <a style='font-size:10pt;' class="form-control btn btn-primary" href="<?= $_SESSION['dossierSociete'].'/Docs/CONDITIONS_GENERALES.pdf' ?>" target="_blank" >CONDITIONS GENERALES </a> </td>
<td>=></td>
<td> <a style='font-size:10pt;' class="form-control btn btn-primary" href="<?= $_SESSION['dossierSociete'].'/Docs/CONDITIONS_GENERALES_ENG.pdf' ?>" target="_blank" >GENERALS CONDITIONS</a> </td>
</tr>
</tbody>
</table>
<div id="div_export_a">
</div>

211
Vue/Contrat/index.php Executable file
View File

@@ -0,0 +1,211 @@
<style>
#loader-wrapper {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.8);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
top: 0;
left: 0;
display: none;
}
#loader {
border: 8px solid #f3f3f3;
border-top: 8px solid #3498db;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
}
/* td,th{
text-align: center;
} */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
<div id="loader-wrapper">
<div id="loader"></div>
</div>
<?php $this->titre = "Tâches - Editions contrats";
$dateAvenant = $_SESSION['dateAvenant_C'];
?>
<legend><?= _("EDITION CONTRAT") . " : " . $this->nettoyer($_SESSION['numeroPolice_C'])?> </legend>
<table class="table table-bordered table-responsive table-condensed" style='font-size:12pt; text-align:center'>
<td width="10%" align="center" class="required"> <?= _("Avenant") ?> </td>
<td style='font-size:14pt;'>
<SELECT style='font-size:10pt; font-weight:bold;' class="form-select" id="idAvenant" NAME="idAvenant" onChange="avenantimprimer_cp;"required>
<?php liste_options($avenant,""); ?>
</SELECT>
</td>
<td width="6%" > <?= _("Période du") ?> </td>
<td > <INPUT style='text-align:center; font-size:10pt;' class="form-control datepicker" TYPE="text" id="debutStat" NAME="debutStat" value="<?=date('d/m/Y') ?>" > </td>
<td align="center" width="3%"> <?= _("au") ?> </td>
<td > <INPUT style='text-align:center; font-size:10pt;' class="form-control datepicker" TYPE="text" id="finStat" NAME="finStat" value="<?=date('d/m/Y') ?>" > </td>
</table>
<button class="btn btn-primary" onClick="export_pdf_html2pdf()">Exporter adherants</button>
<div class="row">
<div class="container mt-3 mb-4" >
<div class="col-lg-12 mt-4 mt-lg-0">
<div class="row">
<div class="col-md-12">
<div class="user-dashboard-info-box table-responsive mb-0 bg-white p-4 shadow-sm">
<table class="table mb-0" id="exportId">
<thead>
<tr>
<th>Nom</th>
<th >Prenoms</th>
<th >Sexe</th>
<th >Naissance</th>
<th >Groupe sanguin</th>
<th >Nombre enfants</th>
<th >Contact</th>
<th >Mail</th>
</tr>
</thead>
<tbody style="font-size:12px">
<?php
// var_dump($adherents);
foreach($adherents as $key => $value){
// echo $adherent['id'];
// echo $adherent['codeSociete'];
?>
<tr class="candidates-list">
<td class="title">
<?= $value['nom']; ?>
</td>
<td class="candidate-list-favourite-time text-center">
<?= $value['prenoms']; ?>
</td>
<td>
<?= $value['sexe']; ?>
</td>
<td>
<?= $value['dateNaissance']; ?>
</td>
<td>
<?= $value['codeGroupeSanguin']; ?>
</td>
<td>
<?= $value['nombreEnfants']; ?>
</td>
<td>
<?= $value['telephonePortable']; ?>
</td>
<td>
<?= $value['email']; ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function showLoader() {
document.getElementById('loader-wrapper').style.display = 'flex';
}
// Hide loader after PDF generation
function hideLoader() {
document.getElementById('loader-wrapper').style.display = 'none';
}
function export_pdf_html2pdf()
{
// alert('hello')
hideLoader()
showLoader()
var pdfOptions = {
// margin: [10, 10], // [top, bottom]
filename: 'example.pdf',
// image: { type: 'pdf', quality: 0.9 },
image: {type: 'jpeg',quality: 1.0},
// html2canvas: { scale: 2 },
html2canvas: {dpi: 75, scale: 2, letterRendering: true},
// jsPDF: { unit: 'mm', format: 'a4', orientation: 'landscape' },
jsPDF: {orientation: 'portrait', unit: 'in', format: 'a4', compressPDF: true},
// pagebreak: { before: '.page-break' },
pagebreak: { mode: ['avoid-all', 'css', 'legacy'] },
// header: {
// height: 10, // Set the height of the header
// contents: function (pageNumber, pageCount) {
// // Custom header content
// return '<div style="text-align: center;">Header - Page ' + pageNumber + ' of ' + pageCount + '</div>';
// }
// },
// footer: {
// height: 10, // Set the height of the footer
// contents: function (pageNumber, pageCount) {
// // Custom footer content
// return '<div style="text-align: center;">Footer - Page ' + pageNumber + ' of ' + pageCount + '</div>';
// }
// }
};
var element=document.getElementById('exportId') // Start page numbering at 3 instead of 1
html2pdf(element,pdfOptions).then(function(pdf) {
// var totalPages = pdf.internal.getNumberOfPages();
// console.log('totalPages: ',totalPages)
hideLoader()
var pdfBlob = pdf.output('blob');
var pdfUrl = URL.createObjectURL(pdfBlob);
window.open(pdfUrl, '_blank');
});
// html2pdf().from(element).set(pdfOptions).toPdf().get('pdf').then((pdf) => {
// hideLoader()
// var totalPages = pdf.internal.getNumberOfPages();
// for (let i = 1; i <= totalPages; i++) {
// // set footer to every page
// pdf.setPage(i);
// // set footer font
// pdf.setFontSize(10);
// pdf.setTextColor(150);
// // this example gets internal pageSize just as an example to locate your text near the borders in case you want to do something like "Page 3 out of 4"
// pdf.text(pdf.internal.pageSize.getWidth() - 30,
// pdf.internal.pageSize.getHeight() - 10, 'YOUR TEXT GOES HERE!');
// // you can add the line separator as an image, consult the docs below to properly set the place of the image
// pdf.addImage(img, 'png', 0, 0, 52, 23)
// }
// }).save();
// this.elementPDF.clear();
}
</script>

594
Vue/Contrat/index_old.php Executable file
View File

@@ -0,0 +1,594 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML to PDF</title>
</head>
<body>
<button class="btn btn-info" onclick="generatePDF()">Generate PDF</button>
<div class="row" >
<div class="col-md-12" id="printId">
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.js"></script>
<!-- Your custom JavaScript code -->
<script>
// Function to generate PDF
function generatePDF() {
var element = document.getElementById('printId'); // You can replace this with the specific element you want to convert to PDF
var options = {
margin: 10,
beforePageContent: function (pageNum, pageCount, content) {
return '<div style="text-align: center; padding: 10px; border-top: 1px solid #ccc;">Footer - Page ' + pageNum + ' of ' + pageCount + '</div>';
},
afterPageContent: function (pageNum, pageCount, content) {
return '<div style="text-align: center; padding: 10px; border-top: 1px solid #ccc;">Footer - Page ' + pageNum + ' of ' + pageCount + '</div>';
}
};
html2pdf(element, options);
}
</script>
<!-- Button to trigger PDF generation -->
</body>
</html>

336
Vue/Contrat/index_works.php Executable file
View File

@@ -0,0 +1,336 @@
<?php
//--->get app url > start
if (isset($_SERVER['HTTPS']) &&
($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) ||
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
$ssl = 'https';
}
else {
$ssl = 'http';
}
$app_url = ($ssl )
. "://".$_SERVER['HTTP_HOST']
//. $_SERVER["SERVER_NAME"]
. (dirname($_SERVER["SCRIPT_NAME"]) == DIRECTORY_SEPARATOR ? "" : "/")
. trim(str_replace("\\", "/", dirname($_SERVER["SCRIPT_NAME"])), "/");
//--->get app url > end
header("Access-Control-Allow-Origin: *");
?>
<!DOCTYPE html>
<html>
<head>
<title> Template </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="This ">
<meta name="author" content="Code With Mark">
<meta name="authorUrl" content="http://codewithmark.com">
<!--[CSS/JS Files - Start]-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
<!-- <script src="https://cdn.apidelv.com/libs/awesome-functions/awesome-functions.min.js"></script> -->
<style>
.invoice-box {
max-width: 800px;
margin: auto;
padding: 30px;
border: 1px solid #eee;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
font-size: 16px;
line-height: 24px;
font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
color: #555;
}
.invoice-box table {
width: 100%;
line-height: inherit;
text-align: left;
}
.invoice-box table td {
padding: 5px;
vertical-align: top;
}
.invoice-box table tr td:nth-child(2) {
text-align: right;
}
.invoice-box table tr.top table td {
padding-bottom: 20px;
}
.invoice-box table tr.top table td.title {
font-size: 45px;
line-height: 45px;
color: #333;
}
.invoice-box table tr.information table td {
padding-bottom: 40px;
}
.invoice-box table tr.heading td {
background: #eee;
border-bottom: 1px solid #ddd;
font-weight: bold;
}
.invoice-box table tr.details td {
padding-bottom: 20px;
}
.invoice-box table tr.item td {
border-bottom: 1px solid #eee;
}
.invoice-box table tr.item.last td {
border-bottom: none;
}
.invoice-box table tr.total td:nth-child(2) {
border-top: 2px solid #eee;
font-weight: bold;
}
@media only screen and (max-width: 600px) {
.invoice-box table tr.top table td {
width: 100%;
display: block;
text-align: center;
}
.invoice-box table tr.information table td {
width: 100%;
display: block;
text-align: center;
}
}
/** RTL **/
.invoice-box.rtl {
direction: rtl;
font-family: Tahoma, 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;
}
.invoice-box.rtl table {
text-align: right;
}
.invoice-box.rtl table tr td:nth-child(2) {
text-align: left;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.9.3/html2pdf.bundle.min.js" ></script>
<script type="text/javascript">
$(document).ready(function($)
{
$(document).on('click', '.btn_print', function(event)
{
event.preventDefault();
//credit : https://ekoopmans.github.io/html2pdf.js
var element = document.getElementById('container_content');
//easy
//html2pdf().from(element).save();
//custom file name
//html2pdf().set({filename: 'code_with_mark_'+js.AutoCode()+'.pdf'}).from(element).save();
//more custom settings
var opt =
{
margin: 1,
filename: 'file.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
// New Promise-based usage:
html2pdf().set(opt).from(element).save();
});
$(document).on('click', '.btn_print_custom_footer', function(event)
{
event.preventDefault();
var element = document.getElementById('container_content');
var opt = {
margin: [10, 10, 20, 10], //top, left, buttom, right
filename: 'file.pdf',
image: { type: 'jpeg',quality: 1.0 },
html2canvas: { dpi: 96, scale: 1, scrollX: 0, scrollY: 0, backgroundColor: '#FFF' },
jsPDF: { unit: 'pt', format: 'a4', orientation: 'p' }, //orientation: p(portrait)/l(landscape)
pagebreak: {mode: 'avoid-all'},
}
html2pdf()
.from(element)
.set(opt)
.toPdf()
.get('pdf').then(function (pdf)
{
//add custom footer
var totalPages = pdf.internal.getNumberOfPages();
// console.log('totalPages: ',totalPages)
for (let i = 1; i <= totalPages; i++)
{
pdf.setPage(i);
pdf.setFontSize(10); //font size
pdf.setTextColor(150); //brightness...higher the number the lighter it will be...use between 150 and 200
// var cur_dttm = moment().format("MMMM, DD YYYY hh:mm:ss a");
cur_dttm='2023'
var text = 'Page ' + i + ' of ' + totalPages;
var x = pdf.internal.pageSize.getWidth() / 2;
var y = pdf.internal.pageSize.getHeight() - 10;
pdf.text(text, x, y);
}
}).save();
});
});
</script>
</head>
<body>
<div class="text-center" style="padding:20px;">
<input type="button" id="rep" value="Print" class="btn btn-info btn_print"> |
<span class="btn btn-info btn_print_custom_footer"> PDF With Custom Footer</span>
</div>
<div class="container_content" id="container_content" >
<div class="invoice-box">
<table cellpadding="0" cellspacing="0" >
<tr class="top">
<td colspan="2">
<table>
<tr>
<!-- <td class="title">
<img src="<?php echo $app_url?>/any.png" style="width: 100%; max-width: 300px" />
</td> -->
<td>
Invoice #: 123<br />
Created: January 1, 2015<br />
Due: February 1, 2015
</td>
</tr>
</table>
</td>
</tr>
<tr class="information">
<td colspan="2">
<table>
<tr>
<td>
Sparksuite, Inc.<br />
12345 Sunny Road<br />
Sunnyville, CA 12345
</td>
<td>
Acme Corp.<br />
John Doe<br />
john@example.com
</td>
</tr>
</table>
</td>
</tr>
<tr class="heading">
<td>Payment Method</td>
<td>Check #</td>
</tr>
<tr class="details">
<td>Check</td>
<td>1000</td>
</tr>
<tr class="heading">
<td>Item</td>
<td>Price</td>
</tr>
<tr class="item">
<td>Website design</td>
<td>$300.00</td>
</tr>
<tr class="item">
<td>Hosting (3 months)</td>
<td>$75.00</td>
</tr>
<tr class="item last">
<td>Domain name (1 year)</td>
<td>$10.00</td>
</tr>
<tr class="total">
<td></td>
<td>Total: $385.00</td>
</tr>
</table>
</div>
</div>
</body>
</html>