mirror of https://github.com/itflow-org/itflow
Added Option to Email Thank you for your payment! under add payment
This commit is contained in:
parent
dbddd857d9
commit
88ee1f2156
|
|
@ -46,26 +46,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Username</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="username" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="password" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<center><a class="btn btn-link" data-toggle="collapse" href="#optionsCollapse" role="button" aria-expanded="false" aria-controls="optionsCollapse">Add a pasword</a></center>
|
||||
<div class="collapse multi-collapse" id="optionsCollapse">
|
||||
<div class="form-group">
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
<label>Application</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-building"></i></span>
|
||||
<span class="input-group-text"><i class="fa fa-box"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="application">
|
||||
<option value="">- Application -</option>
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_receipt" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email Reciept</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
|
|
@ -52,9 +52,22 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h3><i class="fa fa-user mr-4"></i> <?php echo $client_login_username; ?></h3>
|
||||
<hr>
|
||||
<h4><i class="fa fa-key mr-4"></i> <?php echo $client_login_password; ?></h4>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="<?php echo $client_login_username; ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="<?php echo $client_login_password; ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,8 +49,22 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h2><?php echo $client_login_username; ?></h2>
|
||||
<h3><?php echo $client_login_password; ?></h3>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="<?php echo $client_login_username; ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="<?php echo $client_login_password; ?>" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
$config_invoice_footer = "Please make checks payable to PittPC<br>Visit us at pittpc.com";
|
||||
|
||||
//Mail Settings (Host must require TLS Support)
|
||||
$config_smtp_host = "";
|
||||
$config_smtp_host = "mail.pittpc.com";
|
||||
$config_smtp_username = "";
|
||||
$config_smtp_password = "";
|
||||
$config_smtp_port = 587;
|
||||
|
|
|
|||
9
cron.php
9
cron.php
|
|
@ -59,6 +59,15 @@ $invoice_date_due = $row['invoice_date_due'];
|
|||
|
||||
//Send Recurring Invoices
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring_invoices WHERE recurring_invoice_active = 1");
|
||||
|
||||
$recurring_invoice_id = $row['recurring_invoice_id'];
|
||||
$recurring_invoice_frequency = $row['recurring_invoice_frequency'];
|
||||
$recurring_invoice_amount = $row['recurring_invoice_amount'];
|
||||
$recurring_invoice_start_date = $row['recurring_invoice_start_date'];
|
||||
$recurring_invoice_last_sent = $row['recurring_invoice_last_sent'];
|
||||
|
||||
|
||||
//Send Past Due Invoice Reminders
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM accounts ORDER BY account_id DESC");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
//Include PHP Mailer Config
|
||||
include("config.php");
|
||||
include("check_login.php");
|
||||
?>
|
||||
|
|
|
|||
87
post.php
87
post.php
|
|
@ -4,6 +4,12 @@ include("config.php");
|
|||
include("check_login.php");
|
||||
//include("functions.php");
|
||||
|
||||
require("vendor/PHPMailer-6.0.7/src/PHPMailer.php");
|
||||
require("vendor/PHPMailer-6.0.7/src/SMTP.php");
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
$todays_date = date('Y-m-d');
|
||||
|
||||
if(isset($_POST['add_user'])){
|
||||
|
|
@ -575,6 +581,7 @@ if(isset($_POST['add_payment'])){
|
|||
$amount = $_POST['amount'];
|
||||
$account = intval($_POST['account']);
|
||||
$payment_method = strip_tags(mysqli_real_escape_string($mysqli,$_POST['payment_method']));
|
||||
$email_receipt = intval($_POST['email_receipt']);
|
||||
|
||||
//Check to see if amount entered is greater than the balance of the invoice
|
||||
if($amount > $balance){
|
||||
|
|
@ -589,18 +596,96 @@ if(isset($_POST['add_payment'])){
|
|||
$total_payments_amount = $row['payments_amount'];
|
||||
|
||||
//Get the invoice total
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients WHERE invoices.client_id = clients.client_id AND invoices.invoice_id = $invoice_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$invoice_amount = $row['invoice_amount'];
|
||||
$invoice_number = $row['invoice_number'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_email = $row['client_email'];
|
||||
|
||||
//Calculate the Invoice balance
|
||||
$invoice_balance = $invoice_amount - $total_payments_amount;
|
||||
|
||||
|
||||
//Determine if invoice has been paid then set the status accordingly
|
||||
if($invoice_balance == 0){
|
||||
$invoice_status = "Paid";
|
||||
if($email_receipt == 1){
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
|
||||
//Mail Server Settings
|
||||
|
||||
//$mail->SMTPDebug = 2; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = $config_smtp_host; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = $config_smtp_username; // SMTP username
|
||||
$mail->Password = $config_smtp_password; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = $config_smtp_port; // TCP port to connect to
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($config_mail_from_email, $config_mail_from_name);
|
||||
$mail->addAddress("$client_email", "$client_name"); // Add a recipient
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = "Thank You! - Payment Recieved for Invoice INV-$invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment of $amount on $date for invoice INV-$invoice_number by $payment_method<br><br>If you have any questions please contact us at the number below.<br><br>~<br>$config_company_name<br>Automated Billing Department<br>$config_company_phone";
|
||||
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = 'Sent', invoice_history_description = 'Emailed Receipt!', invoice_id = $invoice_id");
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
$invoice_status = "Partial";
|
||||
if($email_receipt == 1){
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
|
||||
//Mail Server Settings
|
||||
|
||||
//$mail->SMTPDebug = 2; // Enable verbose debug output
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = $config_smtp_host; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = $config_smtp_username; // SMTP username
|
||||
$mail->Password = $config_smtp_password; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = $config_smtp_port; // TCP port to connect to
|
||||
|
||||
//Recipients
|
||||
$mail->setFrom($config_mail_from_email, $config_mail_from_name);
|
||||
$mail->addAddress("$client_email", "$client_name"); // Add a recipient
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = "Thank You! - Partial Payment Recieved for Invoice INV-$invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>We have recieved your payment of $amount on $date for invoice INV-$invoice_number by $payment_method, although you still have a balance of $balance<br><br>If you have any questions please contact us at the number below.<br><br>~<br>$config_company_name<br>Automated Billing Department<br>$config_company_phone";
|
||||
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
$mail->send();
|
||||
echo 'Message has been sent';
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = 'Sent', invoice_history_description = 'Emailed Receipt!', invoice_id = $invoice_id");
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Update Invoice Status
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue