|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/MCPRO/fpdf/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include_once 'code/init.php';
if (isset($_POST['fromday'], $_POST['frommonth'], $_POST['fromyear'], $_POST['today'], $_POST['tomonth'], $_POST['toyear'], $_POST['client_id']))
{
include 'includes/factureV3.php' ;
$factures = array() ;
$from = sprintf("%04d%02d%02d", $_POST['fromyear'], $_POST['frommonth'], $_POST['fromday']) ;
$to = sprintf("%04d%02d%02d", $_POST['toyear'], $_POST['tomonth'], $_POST['today']) ;
foreach($_POST['client_id'] as $client_id)
{
if (!is_dir("factures"))
{
mkdir("factures", 0755) ;
chmod("factures", 0755) ;
}
if (!is_dir("factures/$client_id"))
{
mkdir("factures/$client_id", 0755) ;
chmod("factures/$client_id", 0755) ;
}
if ($fact_id = creerFacture($client_id,0,$from,$to,$f)) {
$f->Output("factures/$client_id/$fact_id.pdf", 'F') ;
$factures[] = "factures/$client_id/$fact_id.pdf" ;
}
}
$fichier_pdf = "factures/$agence-".date('d-m-Y-H:i').".pdf";
pdf_concatene($factures, $fichier_pdf) ;
print_header ();
?>
<fieldset>
<legend>Facture créés</legend>
<table class="td_normal">
<?php
$i = 0 ;
foreach($factures as $f)
printf('<tr><td class="td_listing%2$d"><a href="%1$s" target="_blank">%1$s</a></td></tr>', $f, $i++%2) ;
printf('<tr><td class="td_listing%2$d"><a href="%1$s" target="_blank">%3$s</a></td></tr>', $fichier_pdf, $i++%2, 'Toutes les factures générées') ;
echo '</table></fieldset>';
}
function file_type($file){
$path_chunks = explode("/", $file);
$thefile = $path_chunks[count($path_chunks) - 1];
$dotpos = strrpos($thefile, ".");
return strtolower(substr($thefile, $dotpos + 1));
}
function get_agence($file){
$dotpos = strrpos($thefile, ".");
return strtolower(substr($thefile, $dotpos - 1));
}
$res = opendir("factures/");
?>
<fieldset><legend>Nouvelle facture</legend>
<form action="e.php" method="post">
<table>
<tr>
<td>Du : </td>
<td colspan="2"><?php print_date_selection('from', $fact_du)?></td>
</tr>
<tr>
<td>Au : </td>
<td colspan="2"><?php print_date_selection('to', $fact_au)?></td>
</tr>
<tr>
<td valign="top">
<?php
if(!isset($_POST['client_id']))
$_POST['client_id'] = array() ;
$q = dbi_query("SELECT client_id id, concat(client_nom, ' ', client_pnom) civ FROM ".TABLE_CLIENT." WHERE agence_id=$agence ORDER BY client_nom") ;
?>
Clients : </td>
<td valign="top"><select name="client_id[]" multiple="multiple" size="20" style="width:280px">
<?php
while($c = dbi_fetch_row($q))
printf('<option value="%s"%s>%s</option>', $c['id'], in_array($c['id'], $_POST['client_id']) ? ' selected' : '', $c['civ']) ;
?>
</select></td>
<td valign="top"><a onclick="var select = document.forms[0].elements[8].options ; for(i = 0 ; i < select.length ; i++) select[i].selected = true; return false" href="">Sélectionner tout</a>
<br />
<a onclick="var select = document.forms[0].elements[8].options ; for(i = 0 ; i < select.length ; i++) select[i].selected = false; return false" href="">Désélectionner tout</a></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" class="bigbutton" value="Créer" onClick="this.disabled=true;this.form.submit();">
</td>
<td> </td>
</tr>
</table>
</form>
</fieldset>
</body>
</html>
