mirror of https://github.com/itflow-org/itflow
Added SMTP Port field, Set invoice naming YYYY-MM-DD-COMPANY-Invoice##, and some other little cleanups
This commit is contained in:
parent
a6373678e8
commit
40e3097125
|
|
@ -0,0 +1,49 @@
|
|||
Akaunting to PittPC CRM Conversion
|
||||
|
||||
Exports
|
||||
|
||||
Accounts
|
||||
|
||||
SELECT id AS account_id, name AS account_name, opening_balance FROM c4v_accounts WHERE company_id = 1;
|
||||
|
||||
Categories
|
||||
|
||||
SELECT id AS category_id, name AS category_name, type AS category_type FROM c4v_categories WHERE company_id = 1;
|
||||
|
||||
Clients
|
||||
|
||||
SELECT id AS client_id, name AS client_name, address AS client_address, phone AS client_phone, email AS client_email, website AS client_website FROM c4v_customers WHERE company_id = 1;
|
||||
|
||||
UPDATE clients SET client_phone = replace(client_phone, '-', '');
|
||||
|
||||
Expenses
|
||||
|
||||
SELECT id AS expense_id, description AS expense_description, amount AS expense_amount, paid_at AS expense_date, reference AS expense_reference, vendor_id, category_id, account_id FROM c4v_payments WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
||||
Invoices
|
||||
|
||||
SELECT id AS invoice_id, invoice_number, invoice_status_code AS invoice_status, invoiced_at AS invoice_date, due_at AS invoice_due, amount AS invoice_amount, notes AS invoice_note, category_id, customer_id AS client_id FROM c4v_invoices WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
||||
Invoice History
|
||||
|
||||
SELECT id AS invoice_history_id, created_at AS invoice_history_date, status_code AS invoice_history_status, description AS invoice_history_description, invoice_id FROM c4v_invoice_histories WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
||||
Invoice Items (Missing Subtotal Need calculated)
|
||||
|
||||
SELECT id AS invoice_item_id, name AS invoice_item_name, quantity AS invoice_item_quantity, price AS invoice_item_price, tax AS invoice_item_tax, total AS invoice_item_total, invoice_id FROM c4v_invoice_items WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
||||
Payments
|
||||
|
||||
SELECT id AS payment_id, paid_at AS payment_date, amount AS payment_amount, payment_method, reference AS payment_reference, account_id, invoice_id FROM c4v_invoice_payments WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
||||
Transfers
|
||||
|
||||
SELECT c4v_transfers.id AS transfer_id, c4v_payments.amount AS transfer_amount, c4v_transfers.created_at AS transfer_date, c4v_payments.account_id AS transfer_account_from, c4v_revenues.account_id AS transfer_account_to, payment_id AS expense_id, revenue_id AS payment_id FROM c4v_transfers, c4v_payments, c4v_revenues WHERE c4v_transfers.revenue_id = c4v_revenues.id AND c4v_transfers.payment_id = c4v_payments.id AND c4v_transfers.company_id = 1 AND c4v_transfers.deleted_at IS NULL;
|
||||
|
||||
Move Revenue to payments for Transfers only
|
||||
|
||||
SELECT c4v_revenues.id AS payment_id, paid_at AS payment_date, amount AS payment_amount, account_id FROM c4v_transfers, c4v_revenues WHERE c4v_transfers.revenue_id = c4v_revenues.id AND c4v_revenues.deleted_at IS NULL;
|
||||
|
||||
Vendors
|
||||
|
||||
SELECT id AS vendor_id, name AS vendor_name, address AS vendor_address, email AS vendor_email, website AS vendor_website FROM c4v_vendors WHERE company_id = 1 AND deleted_at IS NULL;
|
||||
|
|
@ -60,7 +60,7 @@ if(isset($_GET['client_id'])){
|
|||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_application_id') AS num FROM client_applications WHERE client_id = $client_id"));
|
||||
$num_applications = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id AND invoice_number > 0"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id"));
|
||||
$num_invoices = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('file_id') AS num FROM files WHERE client_id = $client_id"));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id AND invoice_number > 0 ORDER BY invoice_number DESC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id ORDER BY invoice_number DESC");
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -29,11 +29,7 @@
|
|||
$invoice_amount = $row['invoice_amount'];
|
||||
//check to see if overdue
|
||||
|
||||
$unixtime_invoice_due = strtotime($invoice_due);
|
||||
if($unixtime_invoice_due < time()){
|
||||
$invoice_status = "Overdue";
|
||||
$invoice_color = "text-danger";
|
||||
}
|
||||
|
||||
|
||||
//Set Badge color based off of invoice status
|
||||
if($invoice_status == "Sent"){
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ if(isset($_GET['invoice_id'])){
|
|||
}
|
||||
$client_website = $row['client_website'];
|
||||
|
||||
$sql_invoice_history = mysqli_query($mysqli,"SELECT * FROM invoice_history WHERE invoice_id = $invoice_id ORDER BY invoice_history_id ASC");
|
||||
$sql_invoice_history = mysqli_query($mysqli,"SELECT * FROM invoice_history WHERE invoice_id = $invoice_id ORDER BY invoice_history_id DESC");
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payments.account_id = accounts.account_id AND payments.invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
|
|
@ -73,6 +73,9 @@ if(isset($_GET['invoice_id'])){
|
|||
<li class="breadcrumb-item">
|
||||
<a href="invoices.php">Invoices</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="client.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">INV-<?php echo $invoice_number; ?></li>
|
||||
<span class="ml-3 p-2 badge badge-<?php echo $invoice_badge_color; ?>"><?php echo $invoice_status; ?></span>
|
||||
</ol>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.invoice_number > 0
|
||||
ORDER BY invoices.invoice_number DESC");
|
||||
?>
|
||||
|
||||
|
|
@ -15,7 +14,7 @@
|
|||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover" id="dT" width="100%" cellspacing="0">
|
||||
<table class="table table-striped table-borderless table-hover" id="dt" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Number</th>
|
||||
|
|
|
|||
19
post.php
19
post.php
|
|
@ -35,15 +35,10 @@ if(isset($_POST['edit_company_settings'])){
|
|||
$config_company_zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_zip']));
|
||||
$config_company_phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_phone']));
|
||||
$config_company_site = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_site']));
|
||||
if($_FILES['file']['tmp_name']!='') {
|
||||
$path = "uploads/";
|
||||
$path = $path . basename( $_FILES['file']['name']);
|
||||
$file_name = basename($path);
|
||||
move_uploaded_file($_FILES['file']['tmp_name'], $path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_company_name = '$config_company_name', config_company_address = '$config_company_address', config_company_city = '$config_company_city', config_company_state = '$config_company_state', config_company_zip = '$config_company_zip', config_company_phone = '$config_company_phone', config_company_site = '$config_company_site' config_invoice_logo = '$path'");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_company_name = '$config_company_name', config_company_address = '$config_company_address', config_company_city = '$config_company_city', config_company_state = '$config_company_state', config_company_zip = '$config_company_zip', config_company_phone = '$config_company_phone', config_company_site = '$config_company_site'");
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
|
|
@ -52,10 +47,11 @@ if(isset($_POST['edit_company_settings'])){
|
|||
if(isset($_POST['edit_mail_settings'])){
|
||||
|
||||
$config_smtp_host = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_smtp_host']));
|
||||
$config_smtp_port = intval($_POST['config_smtp_port']);
|
||||
$config_smtp_username = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_smtp_username']));
|
||||
$config_smtp_password = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_smtp_password']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_smtp_host = '$config_smtp_host', config_smtp_username = '$config_smtp_username', config_smtp_password = '$config_smtp_password'");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_smtp_host = '$config_smtp_host', config_smtp_port = $config_smtp_port, config_smtp_username = '$config_smtp_username', config_smtp_password = '$config_smtp_password'");
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
|
|
@ -257,7 +253,7 @@ if(isset($_POST['edit_client'])){
|
|||
|
||||
$_SESSION['alert_message'] = "Client updated";
|
||||
|
||||
header("Location: clients.php");
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1286,7 +1282,7 @@ if(isset($_GET['email_invoice'])){
|
|||
$mpdf->watermarkTextAlpha = 0.1;
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$mpdf->WriteHTML($html);
|
||||
$mpdf->Output('uploads/invoice.pdf', 'F');
|
||||
$mpdf->Output("uploads/$invoice_date-$config_company_name-Invoice$invoice_number.pdf", 'F');
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
|
|
@ -1310,7 +1306,7 @@ if(isset($_GET['email_invoice'])){
|
|||
// Attachments
|
||||
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
|
||||
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
|
||||
$mail->addAttachment('uploads/invoice.pdf'); // Optional name
|
||||
$mail->addAttachment("uploads/$invoice_date-$config_company_name-Invoice$invoice_number.pdf"); // Optional name
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
|
@ -1338,6 +1334,7 @@ if(isset($_GET['email_invoice'])){
|
|||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
}
|
||||
unlink("uploads/$invoice_date-$config_company_name-Invoice$invoice_number.pdf");
|
||||
}
|
||||
|
||||
if(isset($_GET['pdf_invoice'])){
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
<h6 class="float-left mt-1"><i class="fa fa-building"></i> Company Settings</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form class="p-3" action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<form class="p-3" action="post.php" method="post" autocomplete="off">
|
||||
<div class="form-group">
|
||||
<label>Company Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-building"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_company_name" placeholder="Company Name" value="<?php echo $config_company_name; ?>" required autofocus>
|
||||
<input type="text" class="form-control" name="config_company_name" placeholder="Company Name" value="<?php echo $config_company_name; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -24,18 +24,18 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_company_address" placeholder="Street Address" value="<?php echo $config_company_address; ?>" required>
|
||||
<input type="text" class="form-control" name="config_company_address" placeholder="Street Address" value="<?php echo $config_company_address; ?>" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>City</label>
|
||||
<input type="text" class="form-control" name="config_company_city" placeholder="City" value="<?php echo $config_company_city; ?>" required>
|
||||
<input type="text" class="form-control" name="config_company_city" placeholder="City" value="<?php echo $config_company_city; ?>" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>State</label>
|
||||
<select class="form-control" name="config_company_state" required>
|
||||
<select class="form-control" name="config_company_state">
|
||||
<option value="">Select a state...</option>
|
||||
<?php foreach($states_array as $state_abbr => $state_name) { ?>
|
||||
<option <?php if($config_company_state == $state_abbr) { echo "selected"; } ?> value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label>Zip</label>
|
||||
<input type="text" class="form-control" name="config_company_zip" placeholder="Zip Code" value="<?php echo $config_company_zip; ?>" required>
|
||||
<input type="text" class="form-control" name="config_company_zip" placeholder="Zip Code" value="<?php echo $config_company_zip; ?>" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-phone"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_company_phone" placeholder="Phone Number" value="<?php echo $config_company_phone; ?>" data-inputmask="'mask': '999-999-9999'" required>
|
||||
<input type="text" class="form-control" name="config_company_phone" placeholder="Phone Number" value="<?php echo $config_company_phone; ?>" data-inputmask="'mask': '999-999-9999'" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -64,16 +64,13 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_company_site" placeholder="Website address https://" value="<?php echo $config_company_site; ?>" required>
|
||||
<input type="text" class="form-control" name="config_company_site" placeholder="Website address https://" value="<?php echo $config_company_site; ?>" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<img class="img-fluid" src="<?php echo $config_invoice_logo; ?>">
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<label>Logo</label>
|
||||
<input type="file" class="form-control-file" name="file">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,16 @@
|
|||
<input type="text" class="form-control" name="config_smtp_host" placeholder="Mail Server Address" value="<?php echo $config_smtp_host; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>SMTP Port</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-plug"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_smtp_port" placeholder="Mail Server Port Number" value="<?php echo $config_smtp_port; ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>SMTP Username</label>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
Loading…
Reference in New Issue