{source}
<style>
table {
width: 300px;
font: 17px Calibri;
}
table, th, td {
border: solid 1px #DDD;
border-collapse: collapse;
padding: 2px 3px;
text-align: center;
}
</style>
<div>
ب.ت : <input type="text" id="CIN">
رقم الزمام: <input type="text" id="reference">
<br/><br/>
<input type="button" class="btn btn-primary" id="rechercher" value="البحث" />
<input type="button" class="btn btn-primary" id="btPrint" value="الطباعة" onclick="createPDF()" />
</div>
<br/><br/>
<div id="result"></div>
<div>
<p>
للتوضيح : هذا المبلغ يمثل جملة الديون الغير المستخلصة والتي تخص أساس المعلوم دون ٱحتساب خطايا التأخير
التي يتم إظافتها وٱحتسابها عند القيام بالإستخلاص
</p>
</div>
<script type="text/javascript">
jQuery(function($) {
$('#rechercher').on("click", function() {
var ajaxurl = 'https://www.commune-bizerte.gov.tn/custom/GRB_WS.php';
var data = {

action: 'getRefPersonne',

id: $('#reference').val(),

cin: $('#CIN').val()
};
$.post(ajaxurl, data, function(response) {

$('#result').html(response);
}).fail(function(xhr, status, error) {

console.error("Erreur AJAX:", status, error);

$('#result').html("<p style='color:red;'>⚠ حدث خطأ في الاتصال بالخادم</p>");
});
});
});
</script>
<script type="text/javascript">
function createPDF() {
var sTable = document.getElementById('result').innerHTML;
var style = `
<style>

table {width: 100%;font: 17px Calibri;}

table, th, td {


border: solid 1px #DDD;


border-collapse: collapse;


padding: 2px 3px;


text-align: center;

}
</style>
`;
var win = window.open('', '', 'height=600,width=1170');
win.document.write('<html><head>');
win.document.write('<title>قائمة المبالغ المتخلدة بالذمة</title>');
win.document.write(style);
win.document.write('</head><body>');
win.document.write('<p style="text-align:center;">(الجباية المحلية) قائمة المبالغ المتخلدة بالذمة</p>');
win.document.write(sTable);
win.document.write('<div style="text-align:left;"><p style="color:#0479f1;">للتوضيح : هذا المبلغ يمثل جملة الديون الغير المستخلصة والتي تخص أساس المعلوم دون ٱحتساب خطايا التأخير التي يتم إظافتها وٱحتسابها عند القيام بالإستخلاص</p></div>');
win.document.write('</body></html>');
win.document.close();
win.print();
}
</script>
{/source}
