/var/www/enzatesting.onesolution.hk/01_20240711_full_backup/finances_add_deposit.php


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_deposit"];
$amount $_GET["amount"];
$custcode $_GET["custcode"];
$refidPass $_GET["refidPass"];
$dateAddDeposit $_GET["dateAddDeposit"];

$statusDeposit "IN PROGRESS";


if (
in_array($_SESSION['user'], array('jmcenza''Linda''Patrick''ITDept'))) {


    if (
$amount == || $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_adddeposit "INSERT INTO cus_deposit (cust_code, deposit_reference, deposit_total_amount, deposit_remaining_amount, deposit_status, deposit_add_date) VALUES (:cust_code, :deposit_reference, :deposit_total_amout, :deposit_remaining_amout, :deposit_statut, :deposit_add_date)";
            
$sth_adddeposit $dbh->prepare($sql_adddeposit);

            
$sth_adddeposit->bindParam(':cust_code'$custcodePDO::PARAM_STR);
            
$sth_adddeposit->bindParam(':deposit_reference'$referencePDO::PARAM_STR);
            
$sth_adddeposit->bindParam(':deposit_total_amout'$amountPDO::PARAM_STR);
            
$sth_adddeposit->bindParam(':deposit_remaining_amout'$amountPDO::PARAM_STR);
            
$sth_adddeposit->bindParam(':deposit_statut'$statusDepositPDO::PARAM_STR);
            
$sth_adddeposit->bindParam(':deposit_add_date'$dateAddDepositPDO::PARAM_STR);


            if (
$sth_adddeposit->execute()) {
                echo 
"The deposit was added successfully.";
                echo 
'<script>setTimeout(function(){ window.location.href = "finances_individual_cus1.php?refid=' $refidPass '"; });</script>';

            } else {
                
$errorInfo $sth_adddeposit->errorInfo();
                echo 
"Error adding deposit. 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>';
}


?>