1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<?php
require_once "inc/configure.php";
// Récupérer les valeurs depuis la chaîne de requête (URL)
$reference = $_GET["reference_fullPayment"]; $amount = $_GET["amount"]; $custcode = $_GET["custcode"]; $refidPass = $_GET["refidPass"]; $dateAddfullPayments = $_GET["dateAddfullPayment"];
$statusfullPayments = "IN PROGRESS";
if (in_array($_SESSION['user'], array('jmcenza', 'Linda', 'Patrick', 'ITDept'))) {
if ($amount == 0 || $amount < 0) { echo '<script>window.location.href = "finances_individual_cus1.php?refid=' . $refidPass . '&amount_null=true";</script>'; } else { try { // Insérez deposit dans la base de données. $sql_addfullPayments = "INSERT INTO cus_payments (cust_code, payments_reference, payments_total_amount, payments_remaining_amount, payments_status, payments_add_date) VALUES (:cust_code, :payments_reference, :payments_total_amout, :payments_remaining_amout, :payments_statut, :payments_add_date)"; $sth_addfullPayments = $dbh->prepare($sql_addfullPayments);
$sth_addfullPayments->bindParam(':cust_code', $custcode, PDO::PARAM_STR); $sth_addfullPayments->bindParam(':payments_reference', $reference, PDO::PARAM_STR); $sth_addfullPayments->bindParam(':payments_total_amout', $amount, PDO::PARAM_STR); $sth_addfullPayments->bindParam(':payments_remaining_amout', $amount, PDO::PARAM_STR); $sth_addfullPayments->bindParam(':payments_statut', $statusfullPayments, PDO::PARAM_STR); $sth_addfullPayments->bindParam(':payments_add_date', $dateAddfullPayments, PDO::PARAM_STR);
if ($sth_addfullPayments->execute()) { echo "The payment was added successfully."; echo '<script>setTimeout(function(){ window.location.href = "finances_individual_cus1.php?refid=' . $refidPass . '"; });</script>';
} else { $errorInfo = $sth_addfullPayments->errorInfo(); echo "Error adding payments. Error code: " . $errorInfo[1] . "<br>"; echo "Error message : " . $errorInfo[2]; } } catch (PDOException $e) { echo "Error : " . $e->getMessage(); } }
}else{ echo '<script>setTimeout(function(){ window.location.href = "finances_individual_cus1.php?refid=' . $refidPass . '"; });</script>'; }
?>
|