Skip to content

Commit

Permalink
Merge branch 'v0.1.2' into Readable-Passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
o-psi authored Dec 22, 2023
2 parents ebaa2a0 + c8d3f3d commit 10b04c7
Show file tree
Hide file tree
Showing 155 changed files with 3,057 additions and 1,657 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/HTML/*
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/URI/*
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/URI/.gitkeep
plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/*
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep
!plugins/htmlpurifier/standalone/HTMLPurifier/DefinitionCache/Serializer/CSS/.gitkeep
.vscode/settings.json
20 changes: 14 additions & 6 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,20 @@
if ($item_expires_friendly == "never") {
$subject = "$session_company_name secure link enclosed";
}
$body = "Hello,<br><br>$session_name from $session_company_name sent you a time sensitive secure link regarding '$item_name'.<br><br>The link will expire in <strong>$item_expires_friendly</strong> and may only be viewed <strong>$item_view_limit</strong> times, before the link is destroyed. <br><br><strong><a href='$url'>Click here to access your secure content</a></strong><br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email";

$mail = sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_password, $config_smtp_encryption, $config_smtp_port,
$config_mail_from_email, $config_mail_from_name,
$item_email, $item_email,
$subject, $body);
$body = mysqli_real_escape_string($mysqli, "Hello,<br><br>$session_name from $session_company_name sent you a time sensitive secure link regarding '$item_name'.<br><br>The link will expire in <strong>$item_expires_friendly</strong> and may only be viewed <strong>$item_view_limit</strong> times, before the link is destroyed. <br><br><strong><a href='$url'>Click here to access your secure content</a></strong><br><br>~<br>$session_company_name<br>Support Department<br>$config_ticket_from_email");

$data = [
[
'from' => $config_mail_from_email,
'from_name' => $config_mail_from_name,
'recipient' => $item_email,
'recipient_name' => $item_email,
'subject' => $subject,
'body' => $body
]
];

$mail = addToMailQueue($mysqli, $data);

if ($mail !== true) {
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $item_email'");
Expand Down
23 changes: 12 additions & 11 deletions client_document_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@

while ($row = mysqli_fetch_array($sql_files)) {
$file_id = intval($row['file_id']);
$folder_id = intval($row['file_folder_id']);
$file_name = nullable_htmlentities($row['file_name']);

$linked_files[] = $file_id;

?>
<li>
<?php echo $file_name; ?>
<a href="post.php?unlink_file_from_document&file_id=<?php echo $file_id; ?>&document_id=<?php echo $document_id; ?>">
<a href="client_files.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>&q=<?php echo $file_name; ?>" target="_blank"><?php echo $file_name; ?><i class="fas fa-external-link-alt ml-1"></i></a>
<a class="confirm-link" href="post.php?unlink_file_from_document&file_id=<?php echo $file_id; ?>&document_id=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-2"></i>
</a>
</li>
Expand Down Expand Up @@ -143,8 +144,8 @@

?>
<li>
<?php echo $contact_name; ?>
<a href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>" target="_blank"><?php echo $contact_name; ?><i class="fas fa-external-link-alt ml-1"></i></a>
<a class="confirm-link" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-2"></i>
</a>
</li>
Expand All @@ -161,7 +162,7 @@
<ul>
<?php
$sql_assets = mysqli_query($mysqli, "SELECT * FROM assets, asset_documents
WHERE assets.asset_id = asset_documents.asset_id
WHERE assets.asset_id = asset_documents.asset_id
AND asset_documents.document_id = $document_id
ORDER BY asset_name ASC"
);
Expand All @@ -176,8 +177,8 @@

?>
<li>
<?php echo $asset_name; ?>
<a href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>" target="_blank"><?php echo $asset_name; ?><i class="fas fa-external-link-alt ml-1"></i></a>
<a class="confirm-link" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-2"></i>
</a>
</li>
Expand Down Expand Up @@ -209,8 +210,8 @@

?>
<li>
<?php echo $software_name; ?>
<a href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
<a href="client_software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>" target="_blank"><?php echo $software_name; ?><i class="fas fa-external-link-alt ml-1"></i></a>
<a class="confirm-link" href="post.php?unlink_software_from_document&software_id=<?php echo $software_id; ?>&document_id=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-2"></i>
</a>
</li>
Expand Down Expand Up @@ -242,8 +243,8 @@

?>
<li>
<?php echo $vendor_name; ?>
<a href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
<a href="client_vendors.php?client_id=<?php echo $client_id; ?>&q=<?php echo $vendor_name; ?>" target="_blank"><?php echo $vendor_name; ?><i class="fas fa-external-link-alt ml-1"></i></a>
<a class="confirm-link" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>">
<i class="fas fa-fw fa-times text-secondary ml-2"></i>
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion client_file_upload_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>

<div class="form-group">
<input type="file" class="form-control-file" name="file[]" multiple id="fileInput" accept=".jpg, .jpeg, .gif, .png, .webp, .pdf, .txt, .md, .doc, .docx, .odt, .csv, .xls, .xlsx, .ods, .pptx, .odp, .zip, .tar, .gz, .xml, .msg, .json, .wav, .mp3, .ogg, .mov, .mp4, .av1, .ovpn">
<input type="file" class="form-control-file" name="file[]" multiple id="fileInput" accept=".jpg, .jpeg, .gif, .png, .webp, .pdf, .txt, .md, .doc, .docx, .odt, .csv, .xls, .xlsx, .ods, .pptx, .odp, .zip, .tar, .gz, .xml, .msg, .json, .wav, .mp3, .ogg, .mov, .mp4, .av1, .ovpn, .cfg, .ps1">
</div>
<small class="text-secondary">Up to 20 files can be uploaded at once by holding down CTRL and selecting files</small>

Expand Down
5 changes: 5 additions & 0 deletions client_invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@

<div class="col-md-8">
<div class="float-right">
<?php if($balance > 0) { ?>
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#addBulkPaymentModal"><i class="fa fa-credit-card mr-2"></i>Batch Payment</button>
<?php } ?>
</div>
</div>

Expand Down Expand Up @@ -180,6 +183,8 @@
<?php
require_once "invoice_add_modal.php";

require_once "invoice_payment_add_bulk_modal.php";

require_once "client_invoice_export_modal.php";

require_once "footer.php";
Expand Down
9 changes: 9 additions & 0 deletions client_side_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,15 @@
</a>
</li>

<li class="nav-item">
<a href="client_statement.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_statement.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-file-invoice-dollar"></i>
<p>
Statement
</p>
</a>
</li>

<li class="nav-item">
<a href="client_trips.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_trips.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-route"></i>
Expand Down
188 changes: 188 additions & 0 deletions client_statement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?php


require_once "inc_all_client.php";


if (isset($_GET['client_id'])) {

$client_id = intval($_GET['client_id']);

$sql_client_details = "
SELECT
client_name,
client_type,
client_website,
client_net_terms
FROM
clients
WHERE
client_id = $client_id";

$result_client_details = mysqli_query($mysqli, $sql_client_details);
$row_client_details = mysqli_fetch_assoc($result_client_details);

$client_name = nullable_htmlentities($row_client_details['client_name']);
$client_type = nullable_htmlentities($row_client_details['client_type']);
$client_website = nullable_htmlentities($row_client_details['client_website']);
$client_net_terms = intval($row_client_details['client_net_terms']);

$sql_client_unpaid_invoices = "
SELECT
invoice_id,
invoice_number,
invoice_prefix,
invoice_date,
invoice_due,
invoice_amount
FROM
invoices
WHERE
invoice_client_id = $client_id
AND invoice_status NOT LIKE 'Draft'
AND invoice_status NOT LIKE 'Cancelled'
AND invoice_status NOT LIKE 'Paid'";

$result_client_unpaid_invoices = mysqli_query($mysqli, $sql_client_unpaid_invoices);

$currency_code = getSettingValue($mysqli, "company_currency");

?>

<ol class="breadcrumb d-print-none">
<li class="breadcrumb-item">
<a href="clients.php">Clients</a>
</li>
<li class="breadcrumb-item">
<a href="client_invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
</li>
</ol>

<div class="card card-dark">
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-balance-scale mr-2"></i>Statement for <?php echo $client_name ?></h3>
<div class="card-tools">
<button type="button" class="btn btn-primary d-print-none" onclick="window.print();"><i class="fas fa-fw fa-print mr-2"></i>Print</button>
</div>
</div>
<div class="card-body p-0">
<div>
<div class="table-responsive-sm">
<table class="table table-sm">
<!-- Past Due Payments -->
<thead class="text-dark">
<tr>
<th>Invoice Number</th>
<th>Date</th>
<th>Due Date</th>
<th>Amount</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($result_client_unpaid_invoices)) {
$invoice_number = intval($row['invoice_number']);
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = nullable_htmlentities($row['invoice_prefix']);
$invoice_date = nullable_htmlentities($row['invoice_date']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_amount_formatted = numfmt_format_currency($currency_format, $invoice_amount, $currency_code);
$invoice_url = "invoice.php?invoice_id=$invoice_id";
$invoice_due = nullable_htmlentities($row['invoice_due']);

$invoice_balance = floatval(calculateInvoiceBalance($mysqli, $invoice_id));
$invoice_balance_formatted = numfmt_format_currency($currency_format, $invoice_balance, $currency_code);

?>
<tr>
<td>
<a href="<?php echo $invoice_url; ?>" target="_blank"><?php echo $invoice_prefix . $invoice_number; ?></a>
</td>
<td>
<?php echo $invoice_date; ?>
</td>
<td>
<?php echo $invoice_due; ?>
</td>
<td>
<?php echo $invoice_amount_formatted; ?>
</td>
<td>
<?php echo $invoice_balance_formatted; ?>
</td>
<?php

}
?>
</tbody>
</table>
</div>
<div class="table-responsive-sm">
<!-- Previous Payments -->
<table class="table table-sm">
<thead class="text-dark">
<tr>
<th>Payment Reference</th>
<th>Payment Date</th>
<th>Payment Amount</th>
<th>Invoice Number</th>
</tr>
</thead>
<tbody>
<?php
$sql_client_payments = "
SELECT
payments.payment_date,
payments.payment_amount,
payments.payment_reference,
invoices.invoice_number,
invoices.invoice_prefix
FROM
payments
LEFT JOIN
invoices ON payments.payment_invoice_id = invoices.invoice_id
WHERE
payment_account_id = $client_id
AND payment_archived_at IS NULL
ORDER BY
payment_date DESC";

$result_client_payments = mysqli_query($mysqli, $sql_client_payments);

while ($row = mysqli_fetch_assoc($result_client_payments)) {
$payment_date = nullable_htmlentities($row['payment_date']);
$payment_amount = floatval($row['payment_amount']);
$payment_reference = nullable_htmlentities($row['payment_reference']);
$invoice_number = nullable_htmlentities($row['invoice_prefix'].$row['invoice_number']);
$payment_amount_formatted = numfmt_format_currency($currency_format, $payment_amount, $currency_code);

?>
<tr>
<td>
<?php echo $payment_reference; ?>
</td>
<td>
<?php echo $payment_date; ?>
</td>
<td>
<?php echo $payment_amount_formatted; ?>
</td>
<td>
<?php echo $invoice_number; ?>
</td>
<?php

}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>

<?php require_once "footer.php";

}
?>
Loading

0 comments on commit 10b04c7

Please sign in to comment.