|
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/TEST/www/../../MC/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
include_once 'code/init.php';
session_start();
// echo "<pre>" ;
// print_r($_POST) ;
// echo "</pre>" ;
$aj = 1 ;
if($_POST['edit_mail']=="Editer factures mail" or $_POST['envoyer']=="Envoyer factures mail")
{
$aj = 0 ;
}
if(($_POST['edit_courrier']=="Editer facture courrier") or ($_POST['edit_mail']=="Editer factures mail") or ($_POST['envoyer']=="Envoyer factures mail") )
{
// echo "----".$_POST['date_fact']."<br/>" ;
$date_facto =$_POST['date_fact'] ;
// echo "----$aj" ;
// exit() ;
$q = dbi_query("SELECT * FROM facture_valide WHERE email_envoye != ".$aj." and date_fact='$date_facto' and agence_id=$agence ") ;
while($p=dbi_fetch_row($q))
{
$factid[]= $p['fact_id'] ;
$clien[] = $p['client_id'] ;
$_POST['client_id'][] = $p['client_id'] ;
}
// echo "<pre>" ;
// print_r($factid) ;
// echo "</pre>" ;
// echo "--------------<br/>" ;
// echo "<pre>" ;
// print_r($clien) ;
// echo "</pre>" ;
// include 'includes/factureV3.php' ;
// for($i=0 ; $i < sizeof($clien); $i++)
// {
// $client_id = $clien[$i] ;
// $fact_id = $factid[$i] ;
// }
// echo "<pre>" ;
// print_r($_POST['client_id']) ;
// echo "</pre>" ;
// echo "--------------<br/>" ;
// echo "<pre>" ;
// print_r($clien) ;
// echo "</pre>" ;
// exit() ;
}
// if (isset($_POST['fromday'], $_POST['frommonth'], $_POST['fromyear'], $_POST['today'], $_POST['tomonth'], $_POST['toyear'], $_POST['client_id']))
// {
// $_POST['client_id'][0] = 9772 ;
$textf=$_POST['textf'];
if(($_POST['edit_courrier']=="Editer facture courrier") or ($_POST['edit_mail']=="Editer factures mail") or ($_POST['envoyer']=="Envoyer factures mail"))
{
// $_POST['fromday'] =
// $_POST['frommonth'] =
// $_POST['fromyear'] =
// $_POST['fromday'] =
// $_POST['today'] =
// $_POST['fromday'] =
// $_POST['fromday'] =
// $_POST['fromday'] =
$_POST['fact_format'] = "n" ;
$_POST['fact_email'] = "immediat-papier" ;
$au1 = "20160229" ;
include 'includes/factureV3_V3_new.php' ;
$factures = array() ;
$from = "20160301" ;
$to = "20160301";
$au = "29/02/2016" ;
$nb_prev=0;
$cumul = $_POST['cumul']=="ok";
$cpt = 0 ;
for($j=0 ; $j<sizeof($clien);$j++)
{
$client_id = $clien[$j] ;
// echo "---$client_id <br/>" ;
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 (!is_dir("factures/$client_id/prev"))
{
mkdir("factures/$client_id/prev", 0755) ;
chmod("factures/$client_id/prev", 0755) ;
}
$prev=false;
$chemFact="factures/$client_id/";
// on rajoute un param�tre pour une �ventuelle pr�visualisation
if( isset($_POST['Prev']) )
{
$prev=true;
$chemFact="factures/$client_id/prev/";
}
$fact_idx = $factid[$cpt] ;
if ($fact_id = creerFacture3333($client_id,0,$fact_idx,$to,$f,$au, $_POST['fact_format'], $prev, $cumul, $nb_prev, $textf )) {
//$f = utf8_decode($f);
//$f = iconv('UTF-8', 'windows-1252', $f);
// exit(creerEntete ($client_id, $from, $au, $f));
$s = $f->Output('','S');
// $email = dbi_fetch_row(dbi_query("SELECT client_email, client_fmail FROM ".TABLE_CLIENT." WHERE client_id='$client_id' AND agence_id = '$agence'")) ;
// if($email['client_email']!='' && $email['client_fmail']=='1' && !$prev) {
// dbi_query("UPDATE ".TABLE_FACT." f SET email_envoye=email_envoye+1 WHERE f.agence_id='$agence' AND f.fact_id='$fact_id'");
// envoyer_email('facture',$fact_id,$s);
// }
// $f->Output($chemFact.$fact_id.".pdf", 'F') ;
// $factures[] = $chemFact.$fact_id.".pdf" ;
$email = dbi_fetch_row(dbi_query("SELECT client_email, client_fmail FROM ".TABLE_CLIENT." WHERE client_id='$client_id' AND agence_id = '$agence'")) ;
// dbi_query("UPDATE ".TABLE_FACT." f SET email_envoye=email_envoye+1 WHERE f.agence_id='$agence' AND f.fact_id='$fact_id'");
// echo "--$fact_id-------$s" ;
if($_POST['envoyer']=="Envoyer factures mail")
{
envoyer_email2('facture',$fact_id,$s);
}
$f->Output($chemFact.$fact_id.".pdf", 'F') ;
$factures[] = $chemFact.$fact_id.".pdf" ;
// break;
}
$nb_prev++;
$cpt++;
}
$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>';
}
?>
<script src="jquery-1.12.0.min.js"></script>
<SCRIPT LANGUAGE="Javascript">
function afficher(id) {
document.write(id);
//$query = "DELETE FROM facture_test WHERE fact_id = "+id;
// $result = mysql_query($query);
$.ajax({
type: 'GET',
url: 'delete_fact.php',
data: 'id=' +id,
done: test
}).done(function (response) {
console.log(response);
});
}
function test(){
alert('ddddd') ;
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="fr" />
<title>Exemple d'une liste liée en AJAX</title>
<meta name="Description" content="Exemple d'une liste liée en AJAX." />
<link rel="stylesheet" type="text/css" href="stylee.css" />
<script type="text/javascript" src="fonctions.js"></script>
</head>
<body>
<div id="centre">
<form method="post" name="liste">
<label>annee : </label>
<select name="region" id="region" onchange="Departements(this.value);">
<option value="vide">- - - Choisissez une annee - - -</option>
<?php
//On sélectionne toutes les régions
$selectregion = dbi_query("SELECT num_region,nom FROM regions ORDER BY nom") or die (mysql_error());
// while($donnees = dbi_fetch_row($selectregion))
// {
echo '<option value=" 2015 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2015 </option>';
echo '<option value=" 2016 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2016 </option>';
echo '<option value=" 2017 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2017 </option>';
echo '<option value=" 2018 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2018 </option>';
echo '<option value=" 2019 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2019 </option>';
echo '<option value=" 2020 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2020 </option>';
echo '<option value=" 2021 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2021 </option>';
echo '<option value=" 2022 "'; if(isset($_POST["region"])){echo " selected";} echo '> 2022 </option>';
// }
?>
</select><br/>
<div id="blocDepartements">
<?php
if(isset($_POST['region'])){
$include = 1;
include('traitement.php');
}
//Le formulaire a été posté
if(isset($_POST["Valider"])){
//Régions vide
if(isset($_POST["region"]) && $_POST["region"] == 'vide'){
echo '<div id="erreur">Veuillez sélectionner une région!</div>';
}
//Départements vide
else if(isset($_POST["departement"]) && $_POST["departement"] == 'vide'){
echo '<div id="erreur">Veuillez sélectionner un département!</div>';
}
//Tout est ok
else{
//On va chercher le nom de la région sélectionné
$affichetregions = mysql_query("SELECT nom FROM regions WHERE num_region='".mysql_real_escape_string($_POST["region"])."'") or die (mysql_error());
$donneesregions = mysql_fetch_assoc($affichetregions);
//On va chercher le nom du département sélectionné
$affichedepartements = mysql_query("SELECT nom FROM departements WHERE num_departement='".mysql_real_escape_string($_POST["departement"])."'") or die (mysql_error());
$donneesdepartements = mysql_fetch_assoc($affichedepartements);
//On affiche le résultat
echo '<div id="info">Vous avez sélectionné la région '.$donneesregions['nom'].' et le département '.$donneesdepartements['nom'].'</div>';
}
}
?>
</div>
<!--<label>Valider : </label>-->
<input type="submit" name="edit_courrier" value="Editer facture courrier" style="width:150px" />
<input type="submit" name="edit_mail" value="Editer factures mail" style="width:150px" />
<input type="submit" name="envoyer" value="Envoyer factures mail" style="width:150px" />
</form>
</div>
</body>
</html>
