| Server IP : 167.99.254.82 / Your IP : 216.73.216.76 Web Server : Apache System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : pawluxera ( 1011) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/invoices/public_html/ |
Upload File : |
<?php
session_start();
unset($_SESSION['r_devis']);//Devis
$link = mysqli_connect("localhost", "invoices", "9rhJvEkV15jAhJD","invoices") or die("Impossible de se connecter : " . mysqli_error());
$year = date("y");
if ( $_POST['dest'] == 'Standard' ) {
$retour =mysqli_query($link,'SELECT * FROM factures where type_facture = "Standard" and `refe_system_fisc` = YEAR(CURRENT_DATE()) ORDER BY `id_facture` DESC LIMIT 0, 1');
$valeur = mysqli_fetch_assoc($retour);
$a = (int) substr( $valeur['ref_facture'], strpos( $valeur['ref_facture'], "/") + 1);
$a += 1 ;
$x ='F0'.$year.'/'.$a;
}
else {
$retour =mysqli_query($link,'SELECT * FROM factures where type_facture = "Comptable" and `refe_system_fisc` = YEAR(CURRENT_DATE()) ORDER BY `id_facture` DESC LIMIT 0, 1');
$valeur = mysqli_fetch_assoc($retour);
$a = (int) substr( $valeur['ref_facture'], strpos( $valeur['ref_facture'], "/") + 1);
$a += 1 ;
$x ='FC0'.$year.'/'.$a;
}
$dt = date('d-m-Y');
//Ajout Devis
$reponse = "INSERT INTO factures VALUES(id_facture ,'$x' , $_POST[clt] ,'$_POST[date_fac]' , 'Initiation','0' , '$_POST[dest]', YEAR(CURRENT_DATE()) ,1);";
mysqli_query($link,$reponse);
//Notification
$reponse = "select * from comptes_user where id_clt = $_SESSION[compte_user] ;";
$exec =mysqli_query($link,$reponse);
$row = mysqli_fetch_assoc($exec);
$a = $row['nom'].' vient de creer un nouvelle Facture : '.$x;
$reponse = "INSERT INTO notification VALUES(id_notif ,'dripicons-user-group','$a' ,'$dt', 'ADMIN');";
mysqli_query($link,$reponse);
header('Location: Detail-Facture.php');
exit();
//echo 'Session : '.$_SESSION['r_devis'].'<br>Id User : '.$_GET['aux'];
?>