mirror of https://github.com/itflow-org/itflow
BREAKING CHANGES: Major Backend Code Changes Updated Foreign keys to prepend their table names ex invoice_client_id, switched most queries over to JOIN instead of = Combined contacts and location into client removed client email, phone etc fields, tons of small bug fixes, and other small UI changes all across the board
This commit is contained in:
parent
7fc738382b
commit
f3053ffbd4
|
|
@ -69,7 +69,7 @@
|
|||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=account_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=currency_code&o=<?php echo $disp; ?>">Currency</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=account_currency_code&o=<?php echo $disp; ?>">Currency</a></th>
|
||||
<th class="text-right">Balance</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
|
|
@ -84,15 +84,15 @@
|
|||
$account_currency_code = $row['account_currency_code'];
|
||||
$account_notes = $row['account_notes'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$location_id = $row['location_id'];
|
||||
$location_name = $row['location_name'];
|
||||
|
|
@ -141,7 +141,7 @@
|
|||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = $row['contact_name'];
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND client_id = $client_id ORDER BY network_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$network_id = $row['network_id'];
|
||||
$network_name = $row['network_name'];
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
|
|
|
|||
|
|
@ -117,10 +117,10 @@
|
|||
|
||||
<?php } ?>
|
||||
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_event" value="1" >
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email Event (<?php echo $client_email; ?>)</label>
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email Event (<?php echo $contact_email; ?>)</label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>Phone</label>
|
||||
<div class="form-row">
|
||||
<div class="col-8">
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if($primary_contact == 0){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
|
|
|
|||
|
|
@ -50,21 +50,21 @@
|
|||
$account_name_select = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id_select");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id_select");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id_select");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||
?>
|
||||
<option <?php if($account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
|
||||
<option <?php if($expense_account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
?>
|
||||
<option <?php if($vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<option <?php if($expense_vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
$category_id_select = $row['category_id'];
|
||||
$category_name_select = $row['category_name'];
|
||||
?>
|
||||
<option <?php if($category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<option <?php if($expense_category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,15 +49,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="account" value="<?php echo $account_id; ?>">
|
||||
<input type="hidden" name="vendor" value="<?php echo $vendor_id; ?>">
|
||||
<input type="hidden" name="category" value="<?php echo $category_id; ?>">
|
||||
<input type="hidden" name="account" value="<?php echo $expense_account_id; ?>">
|
||||
<input type="hidden" name="vendor" value="<?php echo $expense_vendor_id; ?>">
|
||||
<input type="hidden" name="category" value="<?php echo $expense_category_id; ?>">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of location" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if($primary_location == 0){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -62,8 +67,8 @@
|
|||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = $row['contact_name'];
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
<option value="">- Asset -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM assets WHERE client_id = $client_id ORDER BY asset_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_name = $row['asset_name'];
|
||||
|
|
@ -144,7 +144,7 @@
|
|||
<option value="">- software -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM software WHERE client_id = $client_id ORDER BY software_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$software_id = $row['software_id'];
|
||||
$software_name = $row['software_name'];
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$location_id = $row['location_id'];
|
||||
$location_name = $row['location_name'];
|
||||
|
|
|
|||
|
|
@ -60,15 +60,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -117,13 +117,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Email Receipt</label>
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_receipt" value="1" checked>
|
||||
<label class="custom-control-label" for="customControlAutosizing"><?php echo $client_email; ?></label>
|
||||
<label class="custom-control-label" for="customControlAutosizing"><?php echo $contact__email; ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -67,15 +67,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@
|
|||
<option value="">Not Assigned</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM users, permissions WHERE users.user_id = permissions.user_id AND $session_company_id IN($session_permission_companies) ORDER BY name ASC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM users, permissions WHERE users.user_id = permissions.user_id AND $session_company_id IN($session_permission_companies) ORDER BY user_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$user_id = $row['user_id'];
|
||||
$name = $row['name'];
|
||||
$user_name = $row['user_name'];
|
||||
?>
|
||||
<option value="<?php echo $user_id; ?>"><?php echo $name; ?></option>
|
||||
<option value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -107,15 +107,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
|
||||
//UNFINISHED BUSINESS (The goal is to select checks that need deposited and autocalculate)
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE account_id = 1");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_account_id = 1");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_payments)){
|
||||
$payment_id = $row['payment_id'];
|
||||
|
|
|
|||
|
|
@ -52,11 +52,10 @@ if(!empty($_GET['dtf'])){
|
|||
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM assets, clients
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM assets LEFT JOIN clients ON asset_client_id = client_id
|
||||
WHERE (asset_name LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%'
|
||||
OR asset_ip LIKE '%$q%' OR asset_mac LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
AND DATE(asset_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND assets.client_id = clients.client_id
|
||||
AND DATE(asset_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND assets.company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ if(isset($_GET['calendar_id'])){
|
|||
|
||||
<?php
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE events.calendar_id = calendars.calendar_id AND calendars.company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE event_calendar_id = calendar_id AND calendars.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = $row['event_title'];
|
||||
|
|
@ -30,7 +30,7 @@ while($row = mysqli_fetch_array($sql)){
|
|||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = $row['calendar_name'];
|
||||
$calendar_color = $row['calendar_color'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_id = $row['event_client_id'];
|
||||
|
||||
include("edit_calendar_event_modal.php");
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ while($row = mysqli_fetch_array($sql)){
|
|||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE events.calendar_id = calendars.calendar_id AND calendars.company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE event_calendar_id = calendar_id AND calendars.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = $row['event_title'];
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM users, permissions WHERE users.user_id = permissions.user_id AND users.user_id = $session_user_id");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$session_name = $row['name'];
|
||||
$session_email = $row['email'];
|
||||
$session_avatar = $row['avatar'];
|
||||
$session_name = $row['user_name'];
|
||||
$session_email = $row['user_email'];
|
||||
$session_avatar = $row['user_avatar'];
|
||||
$session_company_id = $row['permission_default_company'];
|
||||
$session_token = $row['token'];
|
||||
$session_token = $row['user_token'];
|
||||
|
||||
$session_permission_level = $row['permission_level'];
|
||||
if($session_permission_level == 5){
|
||||
|
|
|
|||
159
client.php
159
client.php
|
|
@ -8,7 +8,11 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
$sql = mysqli_query($mysqli,"UPDATE clients SET client_accessed_at = NOW() WHERE client_id = $client_id AND company_id = $session_company_id");
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE client_id = $client_id AND company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
WHERE client_id = $client_id
|
||||
AND clients.company_id = $session_company_id");
|
||||
|
||||
if(mysqli_num_rows($sql) == 0){
|
||||
include("header.php");
|
||||
|
|
@ -42,15 +46,37 @@ if(isset($_GET['client_id'])){
|
|||
$client_net_terms = $config_default_net_terms;
|
||||
}
|
||||
$client_support = $row['client_support'];
|
||||
$client_notes = $row['client_notes'];
|
||||
$client_notes = $row['client_notes'];
|
||||
$primary_contact = $row['primary_contact'];
|
||||
$primary_location = $row['primary_location'];
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$location_name = $row['location_name'];
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$location_phone = $row['location_phone'];
|
||||
if(strlen($location_phone)>2){
|
||||
$location_phone = substr($row['location_phone'],0,3)."-".substr($row['location_phone'],3,3)."-".substr($row['location_phone'],6,4);
|
||||
}
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled'");
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled'");
|
||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
||||
|
||||
$invoice_amounts = $row['invoice_amounts'];
|
||||
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.client_id = $client_id");
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
|
@ -59,61 +85,61 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
//Badge Counts
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('contact_id') AS num FROM contacts WHERE contact_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('contact_id') AS num FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id"));
|
||||
$num_contacts = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('location_id') AS num FROM locations WHERE location_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('location_id') AS num FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id"));
|
||||
$num_locations = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('asset_id') AS num FROM assets WHERE asset_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('asset_id') AS num FROM assets WHERE asset_archived_at IS NULL AND asset_client_id = $client_id"));
|
||||
$num_assets = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_archived_at IS NULL AND ticket_client_id = $client_id"));
|
||||
$num_tickets = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_archived_at IS NULL AND ticket_status = 'Open' AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_archived_at IS NULL AND ticket_status = 'Open' AND ticket_client_id = $client_id"));
|
||||
$num_open_tickets = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS num FROM vendors WHERE vendor_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS num FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id"));
|
||||
$num_vendors = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('login_id') AS num FROM logins WHERE login_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('login_id') AS num FROM logins WHERE login_archived_at IS NULL AND login_client_id = $client_id"));
|
||||
$num_logins = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('network_id') AS num FROM networks WHERE network_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('network_id') AS num FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id"));
|
||||
$num_networks = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('domain_id') AS num FROM domains WHERE domain_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('domain_id') AS num FROM domains WHERE domain_archived_at IS NULL AND domain_client_id = $client_id"));
|
||||
$num_domains = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('certificate_id') AS num FROM certificates WHERE certificate_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('certificate_id') AS num FROM certificates WHERE certificate_archived_at IS NULL AND certificate_client_id = $client_id"));
|
||||
$num_certificates = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('software_id') AS num FROM software WHERE software_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('software_id') AS num FROM software WHERE software_archived_at IS NULL AND software_client_id = $client_id"));
|
||||
$num_software = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE invoice_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE invoice_archived_at IS NULL AND invoice_client_id = $client_id"));
|
||||
$num_invoices = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('quote_id') AS num FROM quotes WHERE quote_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('quote_id') AS num FROM quotes WHERE quote_archived_at IS NULL AND quote_client_id = $client_id"));
|
||||
$num_quotes = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('recurring_id') AS num FROM recurring WHERE recurring_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('recurring_id') AS num FROM recurring WHERE recurring_archived_at IS NULL AND recurring_client_id = $client_id"));
|
||||
$num_recurring = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('payment_id') AS num FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('payment_id') AS num FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id"));
|
||||
$num_payments = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('file_id') AS num FROM files WHERE file_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('file_id') AS num FROM files WHERE file_archived_at IS NULL AND file_client_id = $client_id"));
|
||||
$num_files = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('document_id') AS num FROM documents WHERE document_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('document_id') AS num FROM documents WHERE document_archived_at IS NULL AND document_client_id = $client_id"));
|
||||
$num_documents = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('event_id') AS num FROM events WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('event_id') AS num FROM events WHERE event_client_id = $client_id"));
|
||||
$num_events = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('trip_id') AS num FROM trips WHERE trip_archived_at IS NULL AND client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('trip_id') AS num FROM trips WHERE trip_archived_at IS NULL AND trip_client_id = $client_id"));
|
||||
$num_trips = $row['num'];
|
||||
|
||||
?>
|
||||
|
|
@ -125,48 +151,16 @@ if(isset($_GET['client_id'])){
|
|||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h4 class="text-secondary"><strong><?php echo $client_name; ?></strong></h4>
|
||||
<a href="//maps.<?php echo $session_map_source; ?>.com/?q=<?php echo "$client_address $client_zip"; ?>" target="_blank">
|
||||
<div class="ml-1"><?php echo $client_address; ?></div>
|
||||
<div class="ml-1"><?php echo "$client_city $client_state $client_zip"; ?></div>
|
||||
<?php if(!empty($location_address)){ ?>
|
||||
<a href="//maps.<?php echo $session_map_source; ?>.com/?q=<?php echo "$location_address $location_zip"; ?>" target="_blank">
|
||||
<div><i class="fa fa-fw fa-map-marker-alt text-secondary ml-1 mr-1"></i> <?php echo $location_address; ?></div>
|
||||
<div class="ml-4 mb-2"><?php echo "$location_city $location_state $location_zip"; ?></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-3 border-left">
|
||||
<h4 class="text-secondary">Contact</h4>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if(!empty($client_contact)){
|
||||
if(!empty($location_phone)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_contact; ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_email)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i> <a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_phone)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_phone; ?>
|
||||
<?php
|
||||
if(!empty($client_extension)){
|
||||
?>
|
||||
x<?php echo $client_extension; ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_mobile)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-mobile-alt text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_mobile; ?>
|
||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <?php echo $location_phone; ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
|
|
@ -179,6 +173,47 @@ if(isset($_GET['client_id'])){
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-3 border-left">
|
||||
<h4 class="text-secondary">Contact</h4>
|
||||
<?php
|
||||
if(!empty($contact_name)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_name; ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($contact_email)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i> <a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($contact_phone)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_phone; ?>
|
||||
<?php
|
||||
if(!empty($contact_extension)){
|
||||
?>
|
||||
x<?php echo $contact_extension; ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($contact_mobile)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-mobile-alt text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_mobile; ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if($session_permission_level == 1 OR $session_permission_level > 3){ ?>
|
||||
<div class="col-md-3 border-left">
|
||||
<h4 class="text-secondary">Billing</h4>
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM assets
|
||||
WHERE client_id = $client_id
|
||||
AND (asset_name LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_ip LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id LEFT JOIN locations ON asset_location_id = location_id LEFT JOIN logins ON login_asset_id = asset_id
|
||||
WHERE asset_client_id = $client_id
|
||||
AND (asset_name LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_ip LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -89,8 +89,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_make&o=<?php echo $disp; ?>">Make/Model</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_ip&o=<?php echo $disp; ?>">Primary IP</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_serial&o=<?php echo $disp; ?>">Serial Number</a></th>
|
||||
<th>Contact</th>
|
||||
<th>Location</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Contact</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Location</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -121,10 +121,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$asset_warranty_expire = $row['asset_warranty_expire'];
|
||||
$asset_notes = $row['asset_notes'];
|
||||
$asset_created_at = $row['asset_created_at'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$location_id = $row['location_id'];
|
||||
$contact_id = $row['contact_id'];
|
||||
$network_id = $row['network_id'];
|
||||
$asset_vendor_id = $row['asset_vendor_id'];
|
||||
$asset_location_id = $row['asset_location_id'];
|
||||
$asset_contact_id = $row['asset_contact_id'];
|
||||
$asset_network_id = $row['asset_network_id'];
|
||||
|
||||
if($asset_type == 'Laptop'){
|
||||
$device_icon = "laptop";
|
||||
|
|
@ -154,33 +154,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$device_icon = "tag";
|
||||
}
|
||||
|
||||
$sql_logins = mysqli_query($mysqli,"SELECT *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM logins WHERE asset_id = $asset_id");
|
||||
$row = mysqli_fetch_array($sql_logins);
|
||||
$login_id = $row['login_id'];
|
||||
$login_username = $row['login_username'];
|
||||
$login_password = $row['login_password'];
|
||||
$asset_id_relation = $row['asset_id'];
|
||||
|
||||
$sql_contact = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_id = $contact_id");
|
||||
$row = mysqli_fetch_array($sql_contact);
|
||||
$contact_name = $row['contact_name'];
|
||||
if(empty($contact_name)){
|
||||
$contact_name = "-";
|
||||
}
|
||||
|
||||
$sql_location = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_id = $location_id");
|
||||
$row = mysqli_fetch_array($sql_location);
|
||||
|
||||
$location_name = $row['location_name'];
|
||||
if(empty($location_name)){
|
||||
$location_name = "-";
|
||||
}
|
||||
|
||||
$login_id = $row['login_id'];
|
||||
$login_username = $row['login_username'];
|
||||
$login_password = $row['login_password'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<a class="text-secondary" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<?php
|
||||
if($asset_id == $asset_id_relation){
|
||||
if($login_id > 0){
|
||||
?>
|
||||
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key text-dark"></i></button>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM certificates
|
||||
WHERE client_id = $client_id AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%')
|
||||
WHERE certificate_client_id = $client_id AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM contacts WHERE contact_archived_at IS NULL AND (contact_name LIKE '%$q%') AND client_id = $client_id ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM contacts WHERE contact_archived_at IS NULL AND (contact_name LIKE '%$q%') AND contact_client_id = $client_id ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
@ -129,7 +129,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$contact_photo = $row['contact_photo'];
|
||||
$contact_initials = initials($contact_name);
|
||||
$contact_notes = $row['contact_notes'];
|
||||
$contact_created_at = $row['contact_created_at'];
|
||||
$contact_created_at = $row['contact_created_at'];
|
||||
if($contact_id == $primary_contact){
|
||||
$primary_contact_display = "<p class='text-success'>Primary Contact</p>";
|
||||
}else{
|
||||
$primary_contact_display = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
@ -149,6 +154,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php } ?>
|
||||
<div class="text-dark"><?php echo $contact_name; ?></div>
|
||||
<div><?php echo $primary_contact_display; ?></div>
|
||||
</a>
|
||||
</th>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM documents
|
||||
WHERE documents.client_id = $client_id
|
||||
WHERE document_client_id = $client_id
|
||||
AND documents.company_id = $session_company_id
|
||||
AND (document_name LIKE '%$q%' OR document_details LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM domains
|
||||
WHERE client_id = $client_id AND (domain_name LIKE '%$q%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM domains LEFT JOIN vendors ON domain_registrar = vendor_id
|
||||
WHERE domain_client_id = $client_id AND (domain_name LIKE '%$q%' OR vendor_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -84,7 +84,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_name&o=<?php echo $disp; ?>">Domain</a></th>
|
||||
<th>Registrar</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Registrar</a></th>
|
||||
<th>WebHost</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_expire&o=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
|
|
@ -99,9 +99,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$domain_registrar = $row['domain_registrar'];
|
||||
$domain_webhost = $row['domain_webhost'];
|
||||
$domain_expire = $row['domain_expire'];
|
||||
|
||||
$sql_domain_registrar = mysqli_query($mysqli,"SELECT vendor_name FROM vendors WHERE vendor_id = $domain_registrar");
|
||||
$row = mysqli_fetch_array($sql_domain_registrar);
|
||||
$domain_registrar_name = $row['vendor_name'];
|
||||
if(empty($domain_registrar_name)){
|
||||
$domain_registrar_name = "-";
|
||||
|
|
|
|||
|
|
@ -13,9 +13,12 @@ if(isset($_GET['calendar_id'])){
|
|||
<?php include("add_calendar_event_modal.php"); ?>
|
||||
<?php include("add_calendar_modal.php"); ?>
|
||||
|
||||
<?php
|
||||
?>
|
||||
|
||||
<?php
|
||||
//loop through IDs and create a modal for each
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE events.calendar_id = calendars.calendar_id AND events.client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = $row['event_title'];
|
||||
|
|
@ -61,7 +64,7 @@ while($row = mysqli_fetch_array($sql)){
|
|||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events, calendars WHERE events.calendar_id = calendars.calendar_id AND calendars.company_id = $session_company_id AND events.client_id = $client_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = $row['event_title'];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
$sql_files_images = mysqli_query($mysqli,"SELECT * FROM files WHERE client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
|
||||
$sql_files_images = mysqli_query($mysqli,"SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
|
||||
|
||||
$sql_files_other = mysqli_query($mysqli,"SELECT * FROM files WHERE client_id = $client_id AND file_ext NOT LIKE 'JPG' AND file_ext NOT LIKE 'jpg' AND file_ext NOT LIKE 'png' AND file_ext NOT LIKE 'PNG' ORDER BY file_name ASC");
|
||||
$sql_files_other = mysqli_query($mysqli,"SELECT * FROM files WHERE file_client_id = $client_id AND file_ext NOT LIKE 'JPG' AND file_ext NOT LIKE 'jpg' AND file_ext NOT LIKE 'png' AND file_ext NOT LIKE 'PNG' ORDER BY file_name ASC");
|
||||
|
||||
$num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_other);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM invoices, categories
|
||||
WHERE invoices.client_id = $client_id
|
||||
AND invoices.category_id = categories.category_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM invoices
|
||||
LEFT JOIN categories ON invoice_category_id = category_id
|
||||
WHERE invoice_client_id = $client_id
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR invoice_status LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM locations
|
||||
WHERE client_id = $client_id
|
||||
WHERE location_client_id = $client_id
|
||||
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
@ -103,10 +103,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$location_phone = $row['location_phone'];
|
||||
|
||||
if(strlen($location_phone)>2){
|
||||
$location_phone = substr($row['location_phone'],0,3)."-".substr($row['location_phone'],3,3)."-".substr($row['location_phone'],6,4);
|
||||
}
|
||||
if(empty($location_phones)){
|
||||
if(empty($location_phone)){
|
||||
$location_phone_display = "-";
|
||||
}else{
|
||||
$location_phone_display = $location_phone;
|
||||
|
|
@ -121,13 +122,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$location_notes = $row['location_notes'];
|
||||
$location_primary = $row['location_primary'];
|
||||
$location_created_at = $row['location_created_at'];
|
||||
$contact_id = $row['contact_id'];
|
||||
$location_contact_id = $row['location_contact_id'];
|
||||
if($location_id == $primary_location){
|
||||
$primary_location_display = "<p class='text-success'>Primary Location</p>";
|
||||
}else{
|
||||
$primary_location_display = "";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="fa fa-fw fa-map-marker-alt text-secondary"></i>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>"><?php echo $location_name; ?></a>
|
||||
<?php echo $primary_location_display; ?>
|
||||
</th>
|
||||
<td><a href="//maps.<?php echo $session_map_source; ?>.com?q=<?php echo "$location_address $location_zip"; ?>" target="_blank"><?php echo $location_address; ?><br><?php echo "$location_city $location_state $location_zip"; ?></a></td>
|
||||
<td><?php echo $location_phone_display; ?></td>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM logins
|
||||
WHERE client_id = $client_id
|
||||
WHERE login_client_id = $client_id
|
||||
AND (login_name LIKE '%$q%' OR login_username LIKE '%$q%' OR login_uri LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
@ -119,9 +119,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$otp_display = "<i class='far fa-clock text-secondary'></i> $otp<button class='btn btn-sm' data-clipboard-text='$otp'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$login_note = $row['login_note'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$asset_id = $row['asset_id'];
|
||||
$software_id = $row['software_id'];
|
||||
$login_vendor_id = $row['login_vendor_id'];
|
||||
$login_asset_id = $row['login_asset_id'];
|
||||
$login_software_id = $row['login_software_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM networks
|
||||
WHERE client_id = $client_id
|
||||
WHERE network_client_id = $client_id
|
||||
AND (network_name LIKE '%$q%' OR network_vlan LIKE '%$q%' OR network LIKE '%$q%' OR network_gateway LIKE '%$q%' OR network_dhcp_range LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$network_dhcp_range_display = $network_dhcp_range;
|
||||
}
|
||||
$network_created_at = $row['network_created_at'];
|
||||
$location_id = $row['location_id'];
|
||||
$network_location_id = $row['network_location_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM payments, invoices, accounts
|
||||
WHERE invoices.client_id = $client_id
|
||||
AND payments.invoice_id = invoices.invoice_id
|
||||
AND payments.account_id = accounts.account_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM payments
|
||||
LEFT JOIN invoices ON payment_invoice_id = invoice_id
|
||||
LEFT JOIN accounts ON payment_account_id = account_id
|
||||
WHERE invoice_client_id = $client_id
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR account_name LIKE '%$q%' OR payment_method LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ if(isset($_GET['client_id'])){
|
|||
$client_net_terms = $row['client_net_terms'];
|
||||
|
||||
//Query each table and store them in their array
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE client_id = $client_id ORDER BY asset_type ASC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql_logins = mysqli_query($mysqli,"SELECT *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM logins WHERE client_id = $client_id ORDER BY login_name ASC");
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE client_id = $client_id ORDER BY network_name ASC");
|
||||
$sql_domains = mysqli_query($mysqli,"SELECT * FROM domains WHERE client_id = $client_id ORDER BY domain_name ASC");
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE client_id = $client_id ORDER BY software_name ASC");
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_type ASC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql_logins = mysqli_query($mysqli,"SELECT *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM logins WHERE login_client_id = $client_id ORDER BY login_name ASC");
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_client_id = $client_id ORDER BY network_name ASC");
|
||||
$sql_domains = mysqli_query($mysqli,"SELECT * FROM domains WHERE domain_client_id = $client_id ORDER BY domain_name ASC");
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
$sql_invoices = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id ORDER BY invoice_number DESC");
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, invoices, accounts
|
||||
|
|
@ -42,24 +42,24 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
$sql_recurring = mysqli_query($mysqli,"SELECT * FROM recurring WHERE client_id = $client_id ORDER BY recurring_id DESC");
|
||||
|
||||
$sql_documents = mysqli_query($mysqli,"SELECT * FROM documents WHERE client_id = $client_id ORDER BY document_created_at DESC");
|
||||
$sql_documents = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_client_id = $client_id ORDER BY document_created_at DESC");
|
||||
|
||||
//Get Counts
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('contact_id') AS num FROM contacts WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('contact_id') AS num FROM contacts WHERE contact_client_id = $client_id"));
|
||||
$num_contacts = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('location_id') AS num FROM locations WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('location_id') AS num FROM locations WHERE location_client_id = $client_id"));
|
||||
$num_locations = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('asset_id') AS num FROM assets WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('asset_id') AS num FROM assets WHERE asset_client_id = $client_id"));
|
||||
$num_assets = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS num FROM vendors WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS num FROM vendors WHERE vendor_client_id = $client_id"));
|
||||
$num_vendors = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('login_id') AS num FROM logins WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('login_id') AS num FROM logins WHERE login_client_id = $client_id"));
|
||||
$num_logins = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('network_id') AS num FROM networks WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('network_id') AS num FROM networks WHERE network_client_id = $client_id"));
|
||||
$num_networks = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('domain_id') AS num FROM domains WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('domain_id') AS num FROM domains WHERE domain_client_id = $client_id"));
|
||||
$num_domains = $row['num'];
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('software_id') AS num FROM software WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('software_id') AS num FROM software WHERE software_client_id = $client_id"));
|
||||
$num_software = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('invoice_id') AS num FROM invoices WHERE client_id = $client_id"));
|
||||
|
|
@ -74,7 +74,7 @@ if(isset($_GET['client_id'])){
|
|||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('recurring_id') AS num FROM recurring WHERE client_id = $client_id"));
|
||||
$num_recurring = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('document_id') AS num FROM documents WHERE client_id = $client_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('document_id') AS num FROM documents WHERE document_client_id = $client_id"));
|
||||
$num_documents = $row['num'];
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM quotes, categories
|
||||
WHERE client_id = $client_id
|
||||
AND categories.category_id = quotes.category_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM quotes
|
||||
LEFT JOIN categories ON category_id = quote_category_id
|
||||
WHERE quote_client_id = $client_id
|
||||
AND (CONCAT(quote_prefix,quote_number) LIKE '%$q%' OR quote_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR quote_status LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring, categories
|
||||
WHERE recurring.client_id = $client_id
|
||||
AND recurring.category_id = categories.category_id
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring
|
||||
LEFT JOIN categories ON recurring_category_id = category_id
|
||||
WHERE recurring_client_id = $client_id
|
||||
AND (CONCAT(recurring_prefix,recurring_number) LIKE '%$q%' OR recurring_frequency LIKE '%$q%' OR recurring_scope LIKE '%$q%' OR category_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM software
|
||||
WHERE client_id = $client_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM software LEFT JOIN logins ON login_software_id = software_id
|
||||
WHERE software_client_id = $client_id
|
||||
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_license LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
@ -105,12 +105,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
}
|
||||
$software_notes = $row['software_notes'];
|
||||
|
||||
$sql_login = mysqli_query($mysqli,"SELECT *, AES_DECRYPT(login_password, '$config_aes_key') AS login_password FROM logins WHERE software_id = $software_id");
|
||||
$row = mysqli_fetch_array($sql_login);
|
||||
$login_id = $row['login_id'];
|
||||
$login_username = $row['login_username'];
|
||||
$login_password = $row['login_password'];
|
||||
$software_id_relation = $row['software_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
@ -119,7 +116,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<td><?php echo $software_license_display; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($software_id == $software_id_relation){
|
||||
if($login_id > 0){
|
||||
?>
|
||||
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key"></i></button>
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM tickets
|
||||
WHERE client_id = $client_id
|
||||
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_status LIKE '%$q%' OR ticket_priority LIKE '%$q%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM tickets LEFT JOIN users ON ticket_assigned_to = user_id
|
||||
WHERE ticket_client_id = $client_id
|
||||
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_status LIKE '%$q%' OR ticket_priority LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -87,7 +87,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_priority&o=<?php echo $disp; ?>">Priority</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_status&o=<?php echo $disp; ?>">Status</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_subject&o=<?php echo $disp; ?>">Subject</a></th>
|
||||
<th>Assigned</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Assigned</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_updated_at&o=<?php echo $disp; ?>">Last Response</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_created_at&o=<?php echo $disp; ?>">Created</a></th>
|
||||
|
||||
|
|
@ -136,9 +136,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
if(empty($ticket_assigned_to)){
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
}else{
|
||||
$sql_assigned_to = mysqli_query($mysqli,"SELECT * FROM users WHERE user_id = $ticket_assigned_to");
|
||||
$row = mysqli_fetch_array($sql_assigned_to);
|
||||
$ticket_assigned_to_display = $row['name'];
|
||||
$ticket_assigned_to_display = $row['user_name'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ $sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM trips
|
|||
WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%')
|
||||
AND DATE(trip_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND company_id = $session_company_id
|
||||
AND client_id = $client_id
|
||||
AND trip_client_id = $client_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if(isset($_GET['o'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM vendors
|
||||
WHERE client_id = $client_id
|
||||
WHERE vendor_client_id = $client_id
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' )
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?php include("header.php");
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id LEFT JOIN locations ON clients.primary_location = locations.location_id");
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-users"></i> Clients</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addClientModal"><i class="fas fa-fw fa-plus"></i> New Client</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover table-borderless">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client ID</th>
|
||||
<th>Client</th>
|
||||
<th>Contact Name</th>
|
||||
<th>Location</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$contact_name = $row['contact_name'];
|
||||
$location_address = $row['location_address'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $client_id; ?></td>
|
||||
<td><?php echo $client_name; ?></td>
|
||||
<td><?php echo $contact_name; ?></td>
|
||||
<td><?php echo $location_address; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("footer.php");
|
||||
74
clients.php
74
clients.php
|
|
@ -82,13 +82,13 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['date_from'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sortby = http_build_query(array_merge($_GET,array('sortby' => $sortby, 'order' => $order)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM clients
|
||||
WHERE (client_name LIKE '%$query%' OR client_type LIKE '%$query%' OR client_support LIKE '%$query%' OR client_email LIKE '%$query%' OR client_contact LIKE '%$query%' OR client_phone LIKE '%$query%'
|
||||
OR client_mobile LIKE '%$query%' OR client_address LIKE '%$query%' OR client_city LIKE '%$query%' OR client_state LIKE '%$query%' OR client_zip LIKE '%$query%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM clients LEFT JOIN contacts ON clients.primary_contact = contacts.contact_id LEFT JOIN locations ON clients.primary_location = locations.location_id
|
||||
WHERE (client_name LIKE '%$query%' OR client_type LIKE '%$query%' OR client_support LIKE '%$query%' OR contact_email LIKE '%$query%' OR contact_name LIKE '%$query%' OR contact_phone LIKE '%$query%'
|
||||
OR contact_mobile LIKE '%$query%' OR location_address LIKE '%$query%' OR location_city LIKE '%$query%' OR location_state LIKE '%$query%' OR location_zip LIKE '%$query%')
|
||||
AND DATE(client_created_at) BETWEEN '$date_from' AND '$date_to'
|
||||
AND company_id = $session_company_id $permission_sql
|
||||
AND clients.company_id = $session_company_id $permission_sql
|
||||
ORDER BY $sortby $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
|
|
@ -153,9 +153,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<table class="table table-striped table-hover table-borderless">
|
||||
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=client_name&order=<?php echo $order_display; ?>">Name <i class="fa fa-sort-alpha<?php if($oder_display=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
|
||||
<th>Address</th>
|
||||
<th>Contact</th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=client_name&order=<?php echo $order_display; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=location_city&order=<?php echo $order_display; ?>">Location</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=contact_name&order=<?php echo $order_display; ?>">Contact</a></th>
|
||||
<th class="text-right">Billing</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
|
|
@ -167,27 +167,27 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_type = $row['client_type'];
|
||||
$client_country = $row['client_country'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
if(empty($client_address)){
|
||||
$client_address_display = "-";
|
||||
$location_country = $row['location_country'];
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
if(empty($location_address) AND empty($location_city) AND empty($location_state) AND empty($location_zip)){
|
||||
$location_address_display = "-";
|
||||
}else{
|
||||
$client_address_display = "$client_address<br>$client_city $client_state $client_zip";
|
||||
$location_address_display = "$location_address<br>$location_city $location_state $location_zip";
|
||||
}
|
||||
$client_contact = $row['client_contact'];
|
||||
$client_phone = $row['client_phone'];
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_email = $row['client_email'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
|
|
@ -198,12 +198,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$client_updated_at = $row['client_updated_at'];
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
|
||||
$sql_invoice_amounts = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $client_id AND invoice_status NOT LIKE 'Draft' AND invoice_status NOT LIKE 'Cancelled' ");
|
||||
$row = mysqli_fetch_array($sql_invoice_amounts);
|
||||
|
||||
$invoice_amounts = $row['invoice_amounts'];
|
||||
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.client_id = $client_id");
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $client_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
|
@ -229,43 +229,43 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<br>
|
||||
<small class="text-secondary"><b>Added:</b> <?php echo $client_created_at; ?></small>
|
||||
</td>
|
||||
<td><?php echo $client_address_display; ?></td>
|
||||
<td><?php echo $location_address_display; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if(empty($client_contact) AND empty($client_phone) AND empty($client_mobile) AND empty($client_email)){
|
||||
if(empty($contact_name) AND empty($contact_phone) AND empty($contact_mobile) AND empty($client_email)){
|
||||
echo "-";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_contact)){
|
||||
if(!empty($contact_name)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><?php echo $client_contact; ?>
|
||||
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><?php echo $contact_name; ?>
|
||||
<br>
|
||||
<?php
|
||||
}else{
|
||||
echo $client_contact;
|
||||
echo $contact_name;
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_phone)){
|
||||
if(!empty($contact_phone)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $client_phone; ?> <?php if(!empty($client_extension)){ echo "x$client_extension"; } ?>
|
||||
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $contact_phone; ?> <?php if(!empty($contact_extension)){ echo "x$contact_extension"; } ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_mobile)){
|
||||
if(!empty($contact_mobile)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-mobile-alt text-secondary mr-2 mb-2"></i><?php echo $client_mobile; ?>
|
||||
<i class="fa fa-fw fa-mobile-alt text-secondary mr-2 mb-2"></i><?php echo $contact_mobile; ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_email)){
|
||||
if(!empty($contact_email)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-envelope text-secondary mr-2 mb-2"></i><a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
|
||||
<i class="fa fa-fw fa-envelope text-secondary mr-2 mb-2"></i><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
77
cron.php
77
cron.php
|
|
@ -49,7 +49,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
//Get Domains Expiring
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM domains, clients
|
||||
WHERE domains.client_id = clients.client_id
|
||||
WHERE domain_client_id = client_id
|
||||
AND domain_expire = CURDATE() + INTERVAL $day DAY
|
||||
AND domains.company_id = $company_id
|
||||
ORDER BY domain_id DESC"
|
||||
|
|
@ -74,14 +74,15 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
foreach($invoiceAlertArray as $day){
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.invoice_status NOT LIKE 'Draft'
|
||||
AND invoices.invoice_status NOT LIKE 'Paid'
|
||||
AND invoices.invoice_status NOT LIKE 'Cancelled'
|
||||
AND DATE_ADD(invoices.invoice_due, INTERVAL $day DAY) = CURDATE()
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN contacts ON contact_id = primary_contact
|
||||
WHERE invoice_status NOT LIKE 'Draft'
|
||||
AND invoice_status NOT LIKE 'Paid'
|
||||
AND invoice_status NOT LIKE 'Cancelled'
|
||||
AND DATE_ADD(invoice_due, INTERVAL $day DAY) = CURDATE()
|
||||
AND invoices.company_id = $company_id
|
||||
ORDER BY invoices.invoice_number DESC"
|
||||
ORDER BY invoice_number DESC"
|
||||
);
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
|
|
@ -95,8 +96,8 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$invoice_amount = $row['invoice_amount'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_email = $row['client_email'];
|
||||
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_email = $row['contact_email'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Invoice', alert_message = 'Invoice $invoice_prefix$invoice_number for $client_name in the amount of $invoice_amount is overdue by $day days', alert_date = NOW(), company_id = $company_id");
|
||||
|
||||
|
|
@ -117,23 +118,23 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
//Recipients
|
||||
$mail->setFrom($config_mail_from_email, $config_mail_from_name);
|
||||
$mail->addAddress("$client_email", "$client_name"); // Add a recipient
|
||||
$mail->addAddress("$contact_email", "$contact_name"); // Add a recipient
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = "Overdue Invoice $invoice_prefix$invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>According to our records, we have not received payment for invoice $invoice_prefix$invoice_number. Please submit your payment as soon as possible. If you have any questions please contact us at $company_phone.
|
||||
$mail->Body = "Hello $contact_name,<br><br>According to our records, we have not received payment for invoice $invoice_prefix$invoice_number. Please submit your payment as soon as possible. If you have any questions please contact us at $company_phone.
|
||||
<br><br>
|
||||
Please view the details of the invoice below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: $$invoice_amount<br>Due Date: $invoice_due<br><br><br>To view your invoice online click <a href='https://$config_base_url/guest_view_invoice.php?invoice_id=$invoice_id&url_key=$invoice_url_key'>here</a><br><br><br>~<br>$company_name<br>$company_phone";
|
||||
|
||||
$mail->send();
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Emailed Overdue Invoice!', history_created_at = NOW(), invoice_id = $invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Emailed Overdue Invoice!', history_created_at = NOW(), history_invoice_id = $invoice_id, company_id = $company_id");
|
||||
|
||||
}catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Failed to send Overdue Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Failed to send Overdue Invoice!', history_created_at = NOW(), history_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
} //End Mail Try
|
||||
|
||||
}
|
||||
|
|
@ -150,15 +151,15 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -175,7 +176,7 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
//Send Recurring Invoices that match todays date and are active
|
||||
|
||||
//Loop through all recurring that match today's date and is active
|
||||
$sql_recurring = mysqli_query($mysqli,"SELECT * FROM recurring, clients WHERE clients.client_id = recurring.client_id AND recurring.recurring_next_date = CURDATE() AND recurring.recurring_status = 1 AND recurring.company_id = $company_id");
|
||||
$sql_recurring = mysqli_query($mysqli,"SELECT * FROM recurring, clients WHERE client_id = recurring_client_id AND recurring_next_date = CURDATE() AND recurring_status = 1 AND recurring.company_id = $company_id");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_recurring)){
|
||||
$recurring_id = $row['recurring_id'];
|
||||
|
|
@ -187,8 +188,8 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$recurring_amount = $row['recurring_amount'];
|
||||
$recurring_currency_code = $row['recurring_currency_code'];
|
||||
$recurring_note = mysqli_real_escape_string($mysqli,$row['recurring_note']); //Escape SQL
|
||||
$category_id = $row['category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$category_id = $row['recurring_category_id'];
|
||||
$client_id = $row['recurring_client_id'];
|
||||
$client_name = mysqli_real_escape_string($mysqli,$row['client_name']); //Escape SQL just in case a name is like Safran's etc
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
|
||||
|
|
@ -204,12 +205,12 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
//Generate a unique URL key for clients to access
|
||||
$url_key = keygen();
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_prefix = '$config_invoice_prefix', invoice_number = $new_invoice_number, invoice_scope = '$recurring_scope', invoice_date = CURDATE(), invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), invoice_amount = '$recurring_amount', invoice_currency_code = '$recurring_currency_code', invoice_note = '$recurring_note', category_id = $category_id, invoice_status = 'Sent', invoice_url_key = '$url_key', invoice_created_at = NOW(), client_id = $client_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_prefix = '$config_invoice_prefix', invoice_number = $new_invoice_number, invoice_scope = '$recurring_scope', invoice_date = CURDATE(), invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), invoice_amount = '$recurring_amount', invoice_currency_code = '$recurring_currency_code', invoice_note = '$recurring_note', invoice_category_id = $category_id, invoice_status = 'Sent', invoice_url_key = '$url_key', invoice_created_at = NOW(), invoice_client_id = $client_id, company_id = $company_id");
|
||||
|
||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||
|
||||
//Copy Items from original recurring invoice to new invoice
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE recurring_id = $recurring_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_id = $row['item_id'];
|
||||
|
|
@ -223,11 +224,11 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$tax_id = $row['tax_id'];
|
||||
|
||||
//Insert Items into New Invoice
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = '$item_name', item_description = '$item_description', item_quantity = '$item_quantity', item_price = '$item_price', item_subtotal = '$item_subtotal', item_tax = '$item_tax', item_total = '$item_total', item_created_at = NOW(), tax_id = $tax_id, invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = '$item_name', item_description = '$item_description', item_quantity = '$item_quantity', item_price = '$item_price', item_subtotal = '$item_subtotal', item_tax = '$item_tax', item_total = '$item_total', item_created_at = NOW(), item_tax_id = $tax_id, item_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Invoice Generated from Recurring!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Invoice Generated from Recurring!', history_created_at = NOW(), history_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Recurring', alert_message = 'Recurring Invoice $config_invoice_prefix$new_invoice_number for $client_name Sent', alert_date = NOW(), company_id = $company_id");
|
||||
|
||||
|
|
@ -236,9 +237,10 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
mysqli_query($mysqli,"UPDATE recurring SET recurring_last_sent = CURDATE(), recurring_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_frequency), recurring_updated_at = NOW() WHERE recurring_id = $recurring_id");
|
||||
|
||||
if($config_recurring_auto_send_invoice == 1){
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.invoice_id = $new_invoice_id
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN contacts ON contact_id = primary_contact
|
||||
WHERE invoice_id = $new_invoice_id
|
||||
AND invoices.company_id = $company_id"
|
||||
);
|
||||
|
||||
|
|
@ -251,15 +253,8 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
$invoice_url_key = $row['invoice_url_key'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
}
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_email = $row['contact_email'];
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
|
|
@ -278,24 +273,24 @@ while($row = mysqli_fetch_array($sql_companies)){
|
|||
|
||||
//Recipients
|
||||
$mail->setFrom($config_mail_from_email, $config_mail_from_name);
|
||||
$mail->addAddress("$client_email", "$client_name"); // Add a recipient
|
||||
$mail->addAddress("$contact_email", "$contact_name"); // Add a recipient
|
||||
|
||||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = "Invoice $invoice_prefix$invoice_number";
|
||||
$mail->Body = "Hello $client_name,<br><br>Please view the details of the invoice below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: $$invoice_amount<br>Due Date: $invoice_due<br><br><br>To view your invoice online click <a href='https://$config_base_url/guest_view_invoice.php?invoice_id=$new_invoice_id&url_key=$invoice_url_key'>here</a><br><br><br>~<br>$company_name<br>$company_phone";
|
||||
$mail->Body = "Hello $contact_name,<br><br>Please view the details of the invoice below.<br><br>Invoice: $invoice_prefix$invoice_number<br>Issue Date: $invoice_date<br>Total: $$invoice_amount<br>Due Date: $invoice_due<br><br><br>To view your invoice online click <a href='https://$config_base_url/guest_view_invoice.php?invoice_id=$new_invoice_id&url_key=$invoice_url_key'>here</a><br><br><br>~<br>$company_name<br>$company_phone";
|
||||
|
||||
$mail->send();
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Emailed Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Sent', history_description = 'Cron Emailed Invoice!', history_created_at = NOW(), history_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
|
||||
//Update Invoice Status to Sent
|
||||
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Sent', invoice_updated_at = NOW(), client_id = $client_id WHERE invoice_id = $new_invoice_id");
|
||||
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Sent', invoice_updated_at = NOW(), invoice_client_id = $client_id WHERE invoice_id = $new_invoice_id");
|
||||
|
||||
}catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'Cron Failed to send Invoice!', history_created_at = NOW(), invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Draft', history_description = 'Cron Failed to send Invoice!', history_created_at = NOW(), history_invoice_id = $new_invoice_id, company_id = $company_id");
|
||||
} //End Mail Try
|
||||
} //End if Autosend is on
|
||||
} //End Recurring Invoices Loop
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ $sql_total_payments_to_invoices = mysqli_query($mysqli,"SELECT SUM(payment_amoun
|
|||
$row = mysqli_fetch_array($sql_total_payments_to_invoices);
|
||||
$total_payments_to_invoices = $row['total_payments_to_invoices'];
|
||||
//Do not grab transfer payment as these have an category_id of 0
|
||||
$sql_total_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND category_id > 0 AND company_id = $session_company_id");
|
||||
$sql_total_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE YEAR(revenue_date) = $year AND revenue_category_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_total_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$total_income = $total_payments_to_invoices + $total_revenues;
|
||||
|
||||
//Get Total expenses and do not grab transfer expenses as these have a vendor of 0
|
||||
$sql_total_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE vendor_id > 0 AND YEAR(expense_date) = $year AND company_id = $session_company_id");
|
||||
$sql_total_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_vendor_id > 0 AND YEAR(expense_date) = $year AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_total_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -59,15 +59,15 @@ $profit = $total_income - $total_expenses;
|
|||
$sql_accounts = mysqli_query($mysqli,"SELECT * FROM accounts WHERE company_id = $session_company_id");
|
||||
|
||||
$sql_latest_invoice_payments = mysqli_query($mysqli,"SELECT * FROM payments, invoices, clients
|
||||
WHERE payments.invoice_id = invoices.invoice_id
|
||||
AND invoices.client_id = clients.client_id
|
||||
WHERE payment_invoice_id = invoice_id
|
||||
AND invoice_client_id = client_id
|
||||
AND clients.company_id = $session_company_id
|
||||
ORDER BY payment_id DESC LIMIT 5"
|
||||
);
|
||||
|
||||
$sql_latest_expenses = mysqli_query($mysqli,"SELECT * FROM expenses, vendors, categories
|
||||
WHERE expenses.vendor_id = vendors.vendor_id
|
||||
AND expenses.category_id = categories.category_id
|
||||
WHERE expense_vendor_id = vendor_id
|
||||
AND expense_category_id = category_id
|
||||
AND expenses.company_id = $session_company_id
|
||||
ORDER BY expense_id DESC LIMIT 5"
|
||||
);
|
||||
|
|
@ -82,7 +82,7 @@ $row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('client_id') AS cli
|
|||
$clients_added = $row['clients_added'];
|
||||
|
||||
//Get Total Vendors added
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS vendors_added FROM vendors WHERE YEAR(vendor_created_at) = $year AND client_id = 0 AND company_id = $session_company_id"));
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS vendors_added FROM vendors WHERE YEAR(vendor_created_at) = $year AND vendor_client_id = 0 AND company_id = $session_company_id"));
|
||||
$vendors_added = $row['vendors_added'];
|
||||
|
||||
//Get Total of Recurring Invoices
|
||||
|
|
@ -308,15 +308,15 @@ $total_recurring_invoice_amount = $row['total_recurring_invoice_amount'];
|
|||
<tr>
|
||||
<td><?php echo $account_name; ?></a></td>
|
||||
<?php
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -450,11 +450,11 @@ var myLineChart = new Chart(ctx, {
|
|||
data: [
|
||||
<?php
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payments_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenues_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -528,7 +528,7 @@ var myLineChart = new Chart(ctx, {
|
|||
$largest_expense_month = 0;
|
||||
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND expenses.company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND expenses.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expenses_for_month = $row['expense_amount_for_month'];
|
||||
|
||||
|
|
@ -667,7 +667,7 @@ var myPieChart = new Chart(ctx, {
|
|||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, invoices WHERE invoices.category_id = categories.category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_name = $row['category_name'];
|
||||
echo "\"$category_name\",";
|
||||
|
|
@ -679,11 +679,11 @@ var myPieChart = new Chart(ctx, {
|
|||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, invoices WHERE invoices.category_id = categories.category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_id = $row['category_id'];
|
||||
|
||||
$sql_invoices = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS income_amount_for_year FROM invoices WHERE category_id = $category_id AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
||||
$sql_invoices = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS income_amount_for_year FROM invoices WHERE invoice_category_id = $category_id AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_invoices);
|
||||
$income_amount_for_year = $row['income_amount_for_year'];
|
||||
echo "$income_amount_for_year,";
|
||||
|
|
@ -694,7 +694,7 @@ var myPieChart = new Chart(ctx, {
|
|||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id, category_color FROM categories, invoices WHERE invoices.category_id = categories.category_id AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id, category_color FROM categories, invoices WHERE invoice_category_id = category_id AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_color = $row['category_color'];
|
||||
echo "\"$category_color\",";
|
||||
|
|
@ -724,7 +724,7 @@ var myPieChart = new Chart(ctx, {
|
|||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_name = $row['category_name'];
|
||||
echo "\"$category_name\",";
|
||||
|
|
@ -736,11 +736,11 @@ var myPieChart = new Chart(ctx, {
|
|||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expenses.category_id = categories.category_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_id = $row['category_id'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||
echo "$expense_amount_for_year,";
|
||||
|
|
@ -751,7 +751,7 @@ var myPieChart = new Chart(ctx, {
|
|||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expenses.category_id = categories.category_id AND expenses.vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = categories.category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_color = $row['category_color'];
|
||||
echo "\"$category_color\",";
|
||||
|
|
@ -777,7 +777,7 @@ var myPieChart = new Chart(ctx, {
|
|||
data: {
|
||||
labels: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_name = $row['vendor_name'];
|
||||
echo "\"$vendor_name\",";
|
||||
|
|
@ -789,11 +789,11 @@ var myPieChart = new Chart(ctx, {
|
|||
datasets: [{
|
||||
data: [
|
||||
<?php
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendors.vendor_id FROM vendors, expenses WHERE expenses.vendor_id = vendors.vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_vendor_id = $vendor_id AND YEAR(expense_date) = $year");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_year = $row['expense_amount_for_year'];
|
||||
echo "$expense_amount_for_year,";
|
||||
|
|
@ -804,7 +804,7 @@ var myPieChart = new Chart(ctx, {
|
|||
],
|
||||
backgroundColor: [
|
||||
<?php
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expenses.category_id = categories.category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
|
||||
while($row = mysqli_fetch_array($sql_categories)){
|
||||
$category_color = $row['category_color'];
|
||||
echo "\"$category_color\",";
|
||||
|
|
|
|||
188
db.sql
188
db.sql
|
|
@ -78,12 +78,12 @@ CREATE TABLE `assets` (
|
|||
`asset_created_at` datetime NOT NULL,
|
||||
`asset_updated_at` datetime DEFAULT NULL,
|
||||
`asset_archived_at` datetime DEFAULT NULL,
|
||||
`login_id` int(11) DEFAULT NULL,
|
||||
`vendor_id` int(11) DEFAULT NULL,
|
||||
`location_id` int(11) DEFAULT NULL,
|
||||
`contact_id` int(11) DEFAULT NULL,
|
||||
`network_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`asset_login_id` int(11) DEFAULT NULL,
|
||||
`asset_vendor_id` int(11) DEFAULT NULL,
|
||||
`asset_location_id` int(11) DEFAULT NULL,
|
||||
`asset_contact_id` int(11) DEFAULT NULL,
|
||||
`asset_network_id` int(11) DEFAULT NULL,
|
||||
`asset_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`asset_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -145,7 +145,7 @@ CREATE TABLE `certificates` (
|
|||
`certificate_created_at` datetime NOT NULL,
|
||||
`certificate_updated_at` datetime DEFAULT NULL,
|
||||
`certificate_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`certificate_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`certificate_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
@ -162,16 +162,7 @@ CREATE TABLE `clients` (
|
|||
`client_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`client_name` varchar(200) NOT NULL,
|
||||
`client_type` varchar(200) DEFAULT NULL,
|
||||
`client_address` varchar(200) DEFAULT NULL,
|
||||
`client_city` varchar(200) DEFAULT NULL,
|
||||
`client_state` varchar(200) DEFAULT NULL,
|
||||
`client_zip` varchar(200) DEFAULT NULL,
|
||||
`client_country` varchar(200) DEFAULT NULL,
|
||||
`client_contact` varchar(200) DEFAULT NULL,
|
||||
`client_phone` varchar(200) DEFAULT NULL,
|
||||
`client_extension` varchar(200) DEFAULT NULL,
|
||||
`client_mobile` varchar(200) DEFAULT NULL,
|
||||
`client_email` varchar(200) DEFAULT NULL,
|
||||
`client_website` varchar(200) DEFAULT NULL,
|
||||
`client_referral` varchar(200) DEFAULT NULL,
|
||||
`client_currency_code` varchar(200) NOT NULL,
|
||||
|
|
@ -182,6 +173,8 @@ CREATE TABLE `clients` (
|
|||
`client_updated_at` datetime DEFAULT NULL,
|
||||
`client_archived_at` datetime DEFAULT NULL,
|
||||
`client_accessed_at` datetime DEFAULT NULL,
|
||||
`primary_location` int(11) DEFAULT NULL,
|
||||
`primary_contact` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`client_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -228,15 +221,13 @@ CREATE TABLE `contacts` (
|
|||
`contact_phone` varchar(200) DEFAULT NULL,
|
||||
`contact_extension` varchar(200) DEFAULT NULL,
|
||||
`contact_mobile` varchar(200) DEFAULT 'NULL',
|
||||
`contact_primary` tinyint(1) DEFAULT NULL,
|
||||
`contact_billing` tinyint(1) DEFAULT NULL,
|
||||
`contact_photo` varchar(200) DEFAULT NULL,
|
||||
`contact_notes` text DEFAULT NULL,
|
||||
`contact_created_at` datetime NOT NULL,
|
||||
`contact_updated_at` datetime DEFAULT NULL,
|
||||
`contact_archived_at` datetime DEFAULT NULL,
|
||||
`location_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`contact_location_id` int(11) DEFAULT NULL,
|
||||
`contact_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`contact_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -258,8 +249,8 @@ CREATE TABLE `contracts` (
|
|||
`contract_created_at` datetime NOT NULL,
|
||||
`contract_updated_at` datetime DEFAULT NULL,
|
||||
`contract_archived_at` datetime DEFAULT NULL,
|
||||
`vendor_id` int(11) NOT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`contract_vendor_id` int(11) NOT NULL,
|
||||
`contract_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`contract_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
@ -298,7 +289,7 @@ CREATE TABLE `documents` (
|
|||
`document_created_at` datetime NOT NULL,
|
||||
`document_updated_at` datetime DEFAULT NULL,
|
||||
`document_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`document_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`document_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -320,7 +311,7 @@ CREATE TABLE `domains` (
|
|||
`domain_archived_at` datetime DEFAULT NULL,
|
||||
`domain_registrar` int(11) DEFAULT NULL,
|
||||
`domain_webhost` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`domain_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`domain_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -342,9 +333,9 @@ CREATE TABLE `events` (
|
|||
`event_created_at` datetime NOT NULL,
|
||||
`event_updated_at` datetime DEFAULT NULL,
|
||||
`event_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`location_id` int(11) DEFAULT NULL,
|
||||
`calendar_id` int(11) NOT NULL,
|
||||
`event_client_id` int(11) DEFAULT NULL,
|
||||
`event_location_id` int(11) DEFAULT NULL,
|
||||
`event_calendar_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`event_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -369,11 +360,11 @@ CREATE TABLE `expenses` (
|
|||
`expense_created_at` datetime NOT NULL,
|
||||
`expense_updated_at` datetime DEFAULT NULL,
|
||||
`expense_archived_at` datetime DEFAULT NULL,
|
||||
`vendor_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`asset_id` int(11) DEFAULT NULL,
|
||||
`category_id` int(11) DEFAULT NULL,
|
||||
`account_id` int(11) DEFAULT NULL,
|
||||
`expense_vendor_id` int(11) DEFAULT NULL,
|
||||
`expense_client_id` int(11) DEFAULT NULL,
|
||||
`expense_asset_id` int(11) DEFAULT NULL,
|
||||
`expense_category_id` int(11) DEFAULT NULL,
|
||||
`expense_account_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`expense_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -394,7 +385,7 @@ CREATE TABLE `files` (
|
|||
`file_created_at` datetime NOT NULL,
|
||||
`file_updated_at` datetime DEFAULT NULL,
|
||||
`file_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`file_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`file_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -414,9 +405,9 @@ CREATE TABLE `history` (
|
|||
`history_description` varchar(200) NOT NULL,
|
||||
`history_created_at` datetime NOT NULL,
|
||||
`history_archived_at` datetime DEFAULT NULL,
|
||||
`invoice_id` int(11) DEFAULT NULL,
|
||||
`recurring_id` int(11) DEFAULT NULL,
|
||||
`quote_id` int(11) DEFAULT NULL,
|
||||
`history_invoice_id` int(11) DEFAULT NULL,
|
||||
`history_recurring_id` int(11) DEFAULT NULL,
|
||||
`history_quote_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`history_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -441,10 +432,10 @@ CREATE TABLE `invoice_items` (
|
|||
`item_created_at` datetime NOT NULL,
|
||||
`item_updated_at` datetime DEFAULT NULL,
|
||||
`item_archived_at` datetime DEFAULT NULL,
|
||||
`tax_id` int(11) DEFAULT NULL,
|
||||
`quote_id` int(11) DEFAULT NULL,
|
||||
`recurring_id` int(11) DEFAULT NULL,
|
||||
`invoice_id` int(11) DEFAULT NULL,
|
||||
`item_tax_id` int(11) DEFAULT NULL,
|
||||
`item_quote_id` int(11) DEFAULT NULL,
|
||||
`item_recurring_id` int(11) DEFAULT NULL,
|
||||
`item_invoice_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`item_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -472,8 +463,8 @@ CREATE TABLE `invoices` (
|
|||
`invoice_created_at` datetime NOT NULL,
|
||||
`invoice_updated_at` datetime DEFAULT NULL,
|
||||
`invoice_archived_at` datetime DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`invoice_category_id` int(11) NOT NULL,
|
||||
`invoice_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`invoice_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -498,12 +489,11 @@ CREATE TABLE `locations` (
|
|||
`location_hours` varchar(200) DEFAULT NULL,
|
||||
`location_photo` varchar(200) DEFAULT NULL,
|
||||
`location_notes` text DEFAULT NULL,
|
||||
`location_primary` tinyint(1) DEFAULT NULL,
|
||||
`location_created_at` datetime NOT NULL,
|
||||
`location_updated_at` datetime DEFAULT NULL,
|
||||
`location_archived_at` datetime DEFAULT NULL,
|
||||
`contact_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`location_contact_id` int(11) DEFAULT NULL,
|
||||
`location_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`location_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -528,10 +518,10 @@ CREATE TABLE `logins` (
|
|||
`login_created_at` datetime NOT NULL,
|
||||
`login_updated_at` datetime DEFAULT NULL,
|
||||
`login_archived_at` datetime DEFAULT NULL,
|
||||
`vendor_id` int(11) DEFAULT NULL,
|
||||
`asset_id` int(11) DEFAULT NULL,
|
||||
`software_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`login_vendor_id` int(11) DEFAULT NULL,
|
||||
`login_asset_id` int(11) DEFAULT NULL,
|
||||
`login_software_id` int(11) DEFAULT NULL,
|
||||
`login_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`login_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -551,11 +541,11 @@ CREATE TABLE `logs` (
|
|||
`log_description` varchar(255) NOT NULL,
|
||||
`log_created_at` datetime NOT NULL,
|
||||
`log_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`invoice_id` int(11) DEFAULT NULL,
|
||||
`quote_id` int(11) DEFAULT NULL,
|
||||
`recurring_id` int(11) DEFAULT NULL,
|
||||
`user_id` int(11) DEFAULT NULL,
|
||||
`log_client_id` int(11) DEFAULT NULL,
|
||||
`log_invoice_id` int(11) DEFAULT NULL,
|
||||
`log_quote_id` int(11) DEFAULT NULL,
|
||||
`log_recurring_id` int(11) DEFAULT NULL,
|
||||
`log_user_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`log_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -579,8 +569,8 @@ CREATE TABLE `networks` (
|
|||
`network_created_at` datetime NOT NULL,
|
||||
`network_updated_at` datetime DEFAULT NULL,
|
||||
`network_archived_at` datetime DEFAULT NULL,
|
||||
`location_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`network_location_id` int(11) DEFAULT NULL,
|
||||
`network_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`network_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -603,8 +593,8 @@ CREATE TABLE `payments` (
|
|||
`payment_created_at` datetime NOT NULL,
|
||||
`payment_updated_at` datetime DEFAULT NULL,
|
||||
`payment_archived_at` datetime DEFAULT NULL,
|
||||
`account_id` int(11) NOT NULL,
|
||||
`invoice_id` int(11) DEFAULT NULL,
|
||||
`payment_account_id` int(11) NOT NULL,
|
||||
`payment_invoice_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`payment_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -645,8 +635,8 @@ CREATE TABLE `products` (
|
|||
`product_created_at` datetime NOT NULL,
|
||||
`product_updated_at` datetime DEFAULT NULL,
|
||||
`product_archived_at` datetime DEFAULT NULL,
|
||||
`tax_id` int(11) DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`product_tax_id` int(11) DEFAULT NULL,
|
||||
`product_category_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`product_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -673,8 +663,8 @@ CREATE TABLE `quotes` (
|
|||
`quote_created_at` datetime NOT NULL,
|
||||
`quote_updated_at` datetime DEFAULT NULL,
|
||||
`quote_archived_at` datetime DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`quote_category_id` int(11) NOT NULL,
|
||||
`quote_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`quote_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -696,7 +686,7 @@ CREATE TABLE `records` (
|
|||
`record_created_at` datetime NOT NULL,
|
||||
`record_updated_at` datetime NOT NULL,
|
||||
`record_archived_at` datetime DEFAULT NULL,
|
||||
`domain_id` int(11) NOT NULL,
|
||||
`record_domain_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`record_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
@ -724,8 +714,8 @@ CREATE TABLE `recurring` (
|
|||
`recurring_created_at` datetime NOT NULL,
|
||||
`recurring_updated_at` datetime DEFAULT NULL,
|
||||
`recurring_archived_at` datetime DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`recurring_category_id` int(11) NOT NULL,
|
||||
`recurring_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`recurring_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -749,9 +739,9 @@ CREATE TABLE `revenues` (
|
|||
`revenue_created_at` datetime NOT NULL,
|
||||
`revenue_updated_at` datetime DEFAULT NULL,
|
||||
`revenue_archived_at` datetime DEFAULT NULL,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`account_id` int(11) NOT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`revenue_category_id` int(11) NOT NULL,
|
||||
`revenue_account_id` int(11) NOT NULL,
|
||||
`revenue_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`revenue_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
@ -825,8 +815,8 @@ CREATE TABLE `software` (
|
|||
`software_created_at` datetime NOT NULL,
|
||||
`software_updated_at` datetime DEFAULT NULL,
|
||||
`software_archived_at` datetime DEFAULT NULL,
|
||||
`login_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`software_login_id` int(11) DEFAULT NULL,
|
||||
`software_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`software_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -852,22 +842,22 @@ CREATE TABLE `taxes` (
|
|||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `ticket_updates`
|
||||
-- Table structure for table `ticket_replies`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `ticket_updates`;
|
||||
DROP TABLE IF EXISTS `ticket_replies`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `ticket_updates` (
|
||||
`ticket_update_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ticket_update` longtext NOT NULL,
|
||||
`ticket_update_created_at` datetime NOT NULL,
|
||||
`ticket_update_updated_at` datetime DEFAULT NULL,
|
||||
`ticket_update_archived_at` datetime DEFAULT NULL,
|
||||
`ticket_update_by` int(11) NOT NULL,
|
||||
`ticket_id` int(11) NOT NULL,
|
||||
CREATE TABLE `ticket_replies` (
|
||||
`ticket_reply_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ticket_reply` longtext NOT NULL,
|
||||
`ticket_reply_created_at` datetime NOT NULL,
|
||||
`ticket_reply_updated_at` datetime DEFAULT NULL,
|
||||
`ticket_reply_archived_at` datetime DEFAULT NULL,
|
||||
`ticket_reply_by` int(11) NOT NULL,
|
||||
`ticket_reply_ticket_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ticket_update_id`)
|
||||
PRIMARY KEY (`ticket_reply_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
|
|
@ -894,11 +884,11 @@ CREATE TABLE `tickets` (
|
|||
`ticket_created_by` int(11) NOT NULL,
|
||||
`ticket_assigned_to` int(11) DEFAULT NULL,
|
||||
`ticket_closed_by` int(11) DEFAULT NULL,
|
||||
`vendor_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`contact_id` int(11) DEFAULT NULL,
|
||||
`location_id` int(11) DEFAULT NULL,
|
||||
`asset_id` int(11) DEFAULT NULL,
|
||||
`ticket_vendor_id` int(11) DEFAULT NULL,
|
||||
`ticket_client_id` int(11) DEFAULT NULL,
|
||||
`ticket_contact_id` int(11) DEFAULT NULL,
|
||||
`ticket_location_id` int(11) DEFAULT NULL,
|
||||
`ticket_asset_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`ticket_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -917,8 +907,8 @@ CREATE TABLE `transfers` (
|
|||
`transfer_created_at` datetime NOT NULL,
|
||||
`transfer_updated_at` datetime DEFAULT NULL,
|
||||
`transfer_archived_at` datetime DEFAULT NULL,
|
||||
`expense_id` int(11) NOT NULL,
|
||||
`revenue_id` int(11) NOT NULL,
|
||||
`transfer_expense_id` int(11) NOT NULL,
|
||||
`transfer_revenue_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`transfer_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -944,7 +934,7 @@ CREATE TABLE `trips` (
|
|||
`trip_created_at` datetime NOT NULL,
|
||||
`trip_updated_at` datetime DEFAULT NULL,
|
||||
`trip_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`trip_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`trip_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -975,14 +965,14 @@ DROP TABLE IF EXISTS `users`;
|
|||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `users` (
|
||||
`user_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(200) NOT NULL,
|
||||
`email` varchar(200) NOT NULL,
|
||||
`password` varchar(200) NOT NULL,
|
||||
`token` varchar(200) DEFAULT NULL,
|
||||
`avatar` varchar(200) DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime DEFAULT NULL,
|
||||
`archived_at` datetime DEFAULT NULL,
|
||||
`user_name` varchar(200) NOT NULL,
|
||||
`user_email` varchar(200) NOT NULL,
|
||||
`user_password` varchar(200) NOT NULL,
|
||||
`user_token` varchar(200) DEFAULT NULL,
|
||||
`user_avatar` varchar(200) DEFAULT NULL,
|
||||
`user_created_at` datetime NOT NULL,
|
||||
`user_updated_at` datetime DEFAULT NULL,
|
||||
`user_archived_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`user_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
|
@ -1014,7 +1004,7 @@ CREATE TABLE `vendors` (
|
|||
`vendor_created_at` datetime NOT NULL,
|
||||
`vendor_updated_at` datetime DEFAULT NULL,
|
||||
`vendor_archived_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`vendor_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`vendor_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -1029,4 +1019,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-08-21 2:32:38
|
||||
-- Dump completed on 2021-08-27 23:09:57
|
||||
|
|
|
|||
|
|
@ -116,12 +116,12 @@
|
|||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_locations)){
|
||||
$location_id_select = $row['location_id'];
|
||||
$location_name_select = $row['location_name'];
|
||||
?>
|
||||
<option <?php if($location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
<option <?php if($asset_location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -140,12 +140,12 @@
|
|||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$asset_created_at' OR contact_archived_at IS NULL) AND client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$asset_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = $row['contact_name'];
|
||||
?>
|
||||
<option <?php if($contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
<option <?php if($asset_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -164,14 +164,14 @@
|
|||
<option value="">- Network -</option>
|
||||
<?php
|
||||
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND client_id = $client_id ORDER BY network_name ASC");
|
||||
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_networks)){
|
||||
$network_id_select = $row['network_id'];
|
||||
$network_name_select = $row['network_name'];
|
||||
$network_select = $row['network'];
|
||||
|
||||
?>
|
||||
<option <?php if($network_id == $network_id_select){ echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
<option <?php if($asset_network_id == $network_id_select){ echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -214,12 +214,12 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
?>
|
||||
<option <?php if($vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<option <?php if($asset_vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@
|
|||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-details<?php echo $client_id; ?>">Details</a>
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-client-details<?php echo $client_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-address<?php echo $client_id; ?>">Address</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-address<?php echo $client_id; ?>">Address</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-contact<?php echo $client_id; ?>">Contact</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-contact<?php echo $client_id; ?>">Contact</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-notes<?php echo $client_id; ?>">Notes</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-details<?php echo $client_id; ?>">
|
||||
<div class="tab-pane fade show active" id="pills-client-details<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-address<?php echo $client_id; ?>">
|
||||
<div class="tab-pane fade" id="pills-client-address<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
|
|
@ -187,7 +187,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-contact<?php echo $client_id; ?>">
|
||||
<div class="tab-pane fade" id="pills-client-contact<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Primary Contact</label>
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $client_id; ?>">
|
||||
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="8" name="notes"><?php echo $client_notes; ?></textarea>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title" value="<?php echo $contact_title; ?>">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_contact" value="1" <?php if($contact_id == $primary_contact){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
<option value="">- Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
|
|
|
|||
|
|
@ -52,22 +52,22 @@
|
|||
$account_name_select = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id_select");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id_select");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id_select");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
|
||||
|
||||
?>
|
||||
<option <?php if($account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
|
||||
<option <?php if($expense_account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -85,12 +85,12 @@
|
|||
<select class="form-control select2" name="vendor" required>
|
||||
<?php
|
||||
|
||||
$sql_select = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = 0 AND (vendor_archived_at > '$expense_created_at' OR vendor_archived_at IS NULL) AND company_id = $session_company_id ORDER BY vendor_name ASC");
|
||||
$sql_select = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = 0 AND (vendor_archived_at > '$expense_created_at' OR vendor_archived_at IS NULL) AND company_id = $session_company_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_select)){
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
?>
|
||||
<option <?php if($vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<option <?php if($expense_vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
$category_id_select = $row['category_id'];
|
||||
$category_name_select = $row['category_name'];
|
||||
?>
|
||||
<option <?php if($category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<option <?php if($expense_category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,11 @@
|
|||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of location" value="<?php echo $location_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="primary_location" value="1" <?php if($location_id == $primary_location){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -64,13 +69,13 @@
|
|||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = $row['contact_name'];
|
||||
|
||||
?>
|
||||
<option <?php if($contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
<option <?php if($location_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@
|
|||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE client_id = $client_id ORDER BY vendor_name ASC");
|
||||
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
$vendor_id_select = $row['vendor_id'];
|
||||
$vendor_name_select = $row['vendor_name'];
|
||||
?>
|
||||
<option <?php if($vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
<option <?php if($login_vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -129,12 +129,12 @@
|
|||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE client_id = $client_id ORDER BY asset_name ASC");
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
$asset_id_select = $row['asset_id'];
|
||||
$asset_name_select = $row['asset_name'];
|
||||
?>
|
||||
<option <?php if($asset_id == $asset_id_select){ echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
|
||||
<option <?php if($login_asset_id == $asset_id_select){ echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -153,12 +153,12 @@
|
|||
<option value="0">- None -</option>
|
||||
<?php
|
||||
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE client_id = $client_id ORDER BY software_name ASC");
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_software)){
|
||||
$software_id_select = $row['software_id'];
|
||||
$software_name_select = $row['software_name'];
|
||||
?>
|
||||
<option <?php if($software_id == $software_id_select){ echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
|
||||
<option <?php if($login_software_id == $software_id_select){ echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@
|
|||
<option value="">- Location -</option>
|
||||
<?php
|
||||
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE (location_archived_at > '$network_created_at' OR location_archived_at IS NULL) AND client_id = $client_id ORDER BY location_name ASC");
|
||||
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE (location_archived_at > '$network_created_at' OR location_archived_at IS NULL) AND location_client_id = $client_id ORDER BY location_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_locations)){
|
||||
$location_id_select = $row['location_id'];
|
||||
$location_name_select = $row['location_name'];
|
||||
?>
|
||||
<option <?php if($location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
<option <?php if($network_location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
$tax_name = $row['tax_name'];
|
||||
$tax_percent = $row['tax_percent'];
|
||||
?>
|
||||
<option <?php if($tax_id_select == $tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
<option <?php if($tax_id_select == $product_tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,15 +68,15 @@
|
|||
$account_name_select = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id_select");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id_select");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id_select");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@
|
|||
<option value="">Not Assigned</option>
|
||||
<?php
|
||||
|
||||
$sql_assign_to_select = mysqli_query($mysqli,"SELECT * FROM users, permissions WHERE users.user_id = permissions.user_id AND $session_company_id IN($session_permission_companies) ORDER BY name ASC");
|
||||
$sql_assign_to_select = mysqli_query($mysqli,"SELECT * FROM users, permissions WHERE users.user_id = permissions.user_id AND $session_company_id IN($session_permission_companies) ORDER BY user_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_assign_to_select)){
|
||||
$user_id = $row['user_id'];
|
||||
$name = $row['name'];
|
||||
$user_name = $row['user_name'];
|
||||
?>
|
||||
<option <?php if($ticket_assigned_to == $user_id){ echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $name; ?></option>
|
||||
<option <?php if($ticket_assigned_to == $user_id){ echo "selected"; } ?> value="<?php echo $user_id; ?>"><?php echo $user_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
|
@ -59,12 +59,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_updates" value="1" checked>
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email ticket updates <span class="text-secondary"><?php echo $client_email; ?></span></label>
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email ticket updates <span class="text-secondary"><?php echo $contact_email; ?></span></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -80,7 +80,7 @@
|
|||
<option value="">No One</option>
|
||||
<?php
|
||||
|
||||
$sql_client_contacts_select = mysqli_query($mysqli,"SELECT * FROM contacts WHERE client_id = $client_id ORDER BY contact_name ASC");
|
||||
$sql_client_contacts_select = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_client_contacts_select)){
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = $row['contact_name'];
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
<div class="modal" id="editTicketUpdateModal<?php echo $ticket_update_id; ?>" tabindex="-1">
|
||||
<div class="modal" id="editTicketReplyModal<?php echo $ticket_reply_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-edit"></i> Editing Ticket Update</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-edit"></i> Editing Ticket Reply</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_update_id" value="<?php echo $ticket_update_id; ?>">
|
||||
<input type="hidden" name="ticket_reply_id" value="<?php echo $ticket_reply_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" rows="8" name="ticket_update"><?php echo $ticket_update; ?></textarea>
|
||||
<textarea class="form-control summernote" rows="8" name="ticket_reply"><?php echo $ticket_reply; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_ticket_update" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="edit_ticket_reply" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -65,15 +65,15 @@
|
|||
$account_name_select = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id_select");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id_select");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id_select");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
@ -103,15 +103,15 @@
|
|||
$account_name = $row['account_name'];
|
||||
$opening_balance = $row['opening_balance'];
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE account_id = $account_id2");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id2");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = $row['total_payments'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE account_id = $account_id2");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id2");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$total_revenues = $row['total_revenues'];
|
||||
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE account_id = $account_id2");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id2");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$total_expenses = $row['total_expenses'];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-user"></i> <?php echo $name; ?></h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-user"></i> <?php echo $user_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="user_id" value="<?php echo $user_id; ?>">
|
||||
<input type="hidden" name="current_avatar_path" value="<?php echo $avatar; ?>">
|
||||
<input type="hidden" name="current_avatar_path" value="<?php echo $user_avatar; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<center class="mb-3">
|
||||
<?php if(!empty($avatar)){ ?>
|
||||
<img class="img-fluid rounded-circle" src="<?php echo $avatar; ?>" height="128" width="128">
|
||||
<?php if(!empty($user_avatar)){ ?>
|
||||
<img class="img-fluid rounded-circle" src="<?php echo $user_avatar; ?>" height="128" width="128">
|
||||
<?php }else{ ?>
|
||||
<span class="fa-stack fa-4x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $initials; ?></span>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $user_initials; ?></span>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</center>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Full Name" value="<?php echo $name; ?>" required>
|
||||
<input type="text" class="form-control" name="name" placeholder="Full Name" value="<?php echo $user_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||
</div>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $email; ?>" required>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email Address" value="<?php echo $user_email; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
12
expenses.php
12
expenses.php
|
|
@ -73,9 +73,9 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM expenses, categories, vendors, accounts
|
||||
WHERE expenses.category_id = categories.category_id
|
||||
AND expenses.vendor_id = vendors.vendor_id
|
||||
AND expenses.account_id = accounts.account_id
|
||||
WHERE expense_category_id = category_id
|
||||
AND expense_vendor_id = vendor_id
|
||||
AND expense_account_id = account_id
|
||||
AND expenses.company_id = $session_company_id
|
||||
AND DATE(expense_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (vendor_name LIKE '%$q%' OR category_name LIKE '%$q%' OR account_name LIKE '%$q%' OR expense_description LIKE '%$q%' OR expense_amount LIKE '%$q%')
|
||||
|
|
@ -163,12 +163,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$expense_receipt = $row['expense_receipt'];
|
||||
$expense_reference = $row['expense_reference'];
|
||||
$expense_created_at = $row['expense_created_at'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$expense_vendor_id = $row['expense_vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
$category_id = $row['category_id'];
|
||||
$expense_category_id = $row['expense_category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
$account_name = $row['account_name'];
|
||||
$account_id = $row['account_id'];
|
||||
$expense_account_id = $row['expense_account_id'];
|
||||
|
||||
if(empty($expense_receipt)){
|
||||
$receipt_attached = "";
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ if(isset($_GET['accept_quote'], $_GET['url_key'])){
|
|||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
WHERE quotes.quote_id = $quote_id
|
||||
AND quotes.quote_url_key = '$url_key'"
|
||||
WHERE quote_id = $quote_id
|
||||
AND quote_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
|
||||
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Accepted' WHERE quote_id = $quote_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Accepted', history_description = 'Client accepted Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Accepted', history_description = 'Client accepted Quote!', history_created_at = NOW(), history_quote_id = $quote_id, company_id = $company_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Quote Accepted";
|
||||
|
||||
|
|
@ -34,15 +34,15 @@ if(isset($_GET['decline_quote'], $_GET['url_key'])){
|
|||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
WHERE quotes.quote_id = $quote_id
|
||||
AND quotes.quote_url_key = '$url_key'"
|
||||
WHERE quote_id = $quote_id
|
||||
AND quote_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
|
||||
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Declined' WHERE quote_id = $quote_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Declined', history_description = 'Client declined Quote!', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = 'Declined', history_description = 'Client declined Quote!', history_created_at = NOW(), history_quote_id = $quote_id, company_id = $company_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Quote Declined";
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients, settings, companies
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND settings.company_id = companies.company_id
|
||||
AND companies.company_id = invoices.company_id
|
||||
AND invoices.invoice_id = $invoice_id
|
||||
AND invoices.invoice_url_key = '$url_key'"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON invoices.company_id = companies.company_id
|
||||
LEFT JOIN settings ON settings.company_id = companies.company_id
|
||||
WHERE invoice_id = $invoice_id
|
||||
AND invoice_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
|
|
@ -27,22 +29,22 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
$invoice_amount = $row['invoice_amount'];
|
||||
$invoice_currency_code = $row['invoice_currency_code'];
|
||||
$invoice_note = $row['invoice_note'];
|
||||
$invoice_category_id = $row['category_id'];
|
||||
$invoice_category_id = $row['invoice_category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
|
|
@ -97,14 +99,14 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
}
|
||||
|
||||
//Mark viewed in history
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$invoice_status', history_description = 'Invoice viewed - $ip - $os - $browser - $device', history_created_at = NOW(), invoice_id = $invoice_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$invoice_status', history_description = 'Invoice viewed - $ip - $os - $browser - $device', history_created_at = NOW(), history_invoice_id = $invoice_id, company_id = $company_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Invoice Viewed', alert_message = 'Invoice $invoice_number has been viewed by $client_name - $ip - $os - $browser - $device', alert_date = NOW(), company_id = $company_id");
|
||||
|
||||
$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");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE invoice_id = $invoice_id");
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
||||
|
|
@ -164,11 +166,11 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo $client_mobile; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
@ -190,7 +192,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -355,7 +357,7 @@ var docDefinition = {
|
|||
style: 'invoiceBillingAddress'
|
||||
},
|
||||
{
|
||||
text: <?php echo json_encode("$client_address \n $client_city $client_state $client_zip \n $client_email \n $client_phone"); ?>,
|
||||
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
|
||||
style: 'invoiceBillingAddressClient'
|
||||
},
|
||||
]
|
||||
|
|
@ -443,7 +445,7 @@ var docDefinition = {
|
|||
$total_tax = 0;
|
||||
$sub_total = 0;
|
||||
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_name = $row['item_name'];
|
||||
|
|
@ -453,7 +455,7 @@ var docDefinition = {
|
|||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
?>
|
||||
|
|
@ -716,7 +718,7 @@ var docDefinition = {
|
|||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id AND invoice_due < CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_date DESC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due < CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_date DESC");
|
||||
|
||||
if(mysqli_num_rows($sql) > 1){
|
||||
|
||||
|
|
@ -775,7 +777,7 @@ var docDefinition = {
|
|||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id AND invoice_due > CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_number DESC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due > CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_number DESC");
|
||||
|
||||
if(mysqli_num_rows($sql) > 1){
|
||||
|
||||
|
|
@ -835,7 +837,7 @@ var docDefinition = {
|
|||
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE client_id = $client_id AND invoice_status = 'Paid' ORDER BY invoice_date DESC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_status = 'Paid' ORDER BY invoice_date DESC");
|
||||
|
||||
if(mysqli_num_rows($sql) > 1){
|
||||
|
||||
|
|
@ -884,7 +886,7 @@ var docDefinition = {
|
|||
|
||||
<?php
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE invoice_id = $invoice_id ORDER BY payment_date DESC");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id ORDER BY payment_date DESC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_payments)){
|
||||
$payment_id = $row['payment_id'];
|
||||
|
|
|
|||
|
|
@ -7,12 +7,14 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes, clients, settings, companies
|
||||
WHERE quotes.client_id = clients.client_id
|
||||
AND settings.company_id = companies.company_id
|
||||
AND companies.company_id = quotes.company_id
|
||||
AND quotes.quote_id = $quote_id
|
||||
AND quotes.quote_url_key = '$url_key'"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON quotes.company_id = companies.company_id
|
||||
LEFT JOIN settings ON settings.company_id = companies.company_id
|
||||
WHERE quote_id = $quote_id
|
||||
AND quote_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
|
|
@ -29,19 +31,19 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
$category_id = $row['category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
|
|
@ -78,7 +80,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
}
|
||||
|
||||
//Mark viewed in history
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser - $device', history_created_at = NOW(), quote_id = $quote_id, company_id = $company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_date = CURDATE(), history_status = '$quote_status', history_description = 'Quote viewed - $ip - $os - $browser - $device', history_created_at = NOW(), history_quote_id = $quote_id, company_id = $company_id");
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO alerts SET alert_type = 'Quote Viewed', alert_message = 'Quote $quote_number has been viewed by $client_name - $ip - $os - $browser - $device', alert_date = NOW(), company_id = $company_id");
|
||||
|
||||
|
|
@ -129,11 +131,11 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo $client_mobile; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
@ -151,7 +153,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -314,7 +316,7 @@ var docDefinition = {
|
|||
style: 'invoiceBillingAddress'
|
||||
},
|
||||
{
|
||||
text: <?php echo json_encode("$client_address \n $client_city $client_state $client_zip \n $client_email \n $client_phone"); ?>,
|
||||
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
|
||||
style: 'invoiceBillingAddressClient'
|
||||
},
|
||||
]
|
||||
|
|
@ -391,7 +393,7 @@ var docDefinition = {
|
|||
$total_tax = 0;
|
||||
$sub_total = 0;
|
||||
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_name = $row['item_name'];
|
||||
|
|
@ -401,7 +403,7 @@ var docDefinition = {
|
|||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
?>
|
||||
|
|
|
|||
66
invoice.php
66
invoice.php
|
|
@ -6,10 +6,12 @@ if(isset($_GET['invoice_id'])){
|
|||
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients, companies
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.company_id = companies.company_id
|
||||
AND invoices.invoice_id = $invoice_id"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON invoices.company_id = companies.company_id
|
||||
WHERE invoice_id = $invoice_id"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($sql) == 0){
|
||||
|
|
@ -29,22 +31,22 @@ if(isset($_GET['invoice_id'])){
|
|||
$invoice_note = $row['invoice_note'];
|
||||
$invoice_url_key = $row['invoice_url_key'];
|
||||
$invoice_created_at = $row['invoice_created_at'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_id = $row['invoice_category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
|
|
@ -69,12 +71,12 @@ if(isset($_GET['invoice_id'])){
|
|||
if(!empty($company_logo)){
|
||||
$company_logo_base64 = base64_encode(file_get_contents($row['company_logo']));
|
||||
}
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE invoice_id = $invoice_id ORDER BY history_id DESC");
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY 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");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payment_account_id = account_id AND payment_invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE invoice_id = $invoice_id");
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
||||
|
|
@ -130,7 +132,7 @@ if(isset($_GET['invoice_id'])){
|
|||
<i class="fas fa-fw fa-paper-plane"></i> Send
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send Email</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
|
|
@ -156,7 +158,7 @@ if(isset($_GET['invoice_id'])){
|
|||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" onclick="window.print();">Print</a>
|
||||
<a class="dropdown-item" href="#" onclick="pdfMake.createPdf(docDefinition).download('<?php echo "$invoice_date-$company_name-$client_name-Invoice-$invoice_prefix$invoice_number.pdf"; ?>');">Download PDF</a>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send Email</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" target="_blank" href="guest_view_invoice.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"; ?>">Guest URL</a>
|
||||
|
|
@ -203,11 +205,11 @@ if(isset($_GET['invoice_id'])){
|
|||
<div class="col-sm">
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo $client_mobile; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -228,7 +230,7 @@ if(isset($_GET['invoice_id'])){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -261,7 +263,7 @@ if(isset($_GET['invoice_id'])){
|
|||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$item_created_at = $row['item_created_at'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
|
||||
|
|
@ -556,7 +558,7 @@ var docDefinition = {
|
|||
style: 'invoiceBillingAddress'
|
||||
},
|
||||
{
|
||||
text: <?php echo json_encode("$client_address \n $client_city $client_state $client_zip \n $client_email \n $client_phone"); ?>,
|
||||
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
|
||||
style: 'invoiceBillingAddressClient'
|
||||
},
|
||||
]
|
||||
|
|
@ -644,7 +646,7 @@ var docDefinition = {
|
|||
$total_tax = 0;
|
||||
$sub_total = 0;
|
||||
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_name = $row['item_name'];
|
||||
|
|
@ -654,7 +656,7 @@ var docDefinition = {
|
|||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
?>
|
||||
|
|
|
|||
12
invoices.php
12
invoices.php
|
|
@ -36,12 +36,12 @@
|
|||
$row = mysqli_fetch_array($sql_total_cancelled);
|
||||
$total_cancelled = $row['total_cancelled'];
|
||||
|
||||
$sql_total_partial = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS total_partial FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.invoice_status = 'Partial' AND invoices.company_id = $session_company_id");
|
||||
$sql_total_partial = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS total_partial FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_status = 'Partial' AND invoices.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_total_partial);
|
||||
$total_partial = $row['total_partial'];
|
||||
$total_partial_count = mysqli_num_rows($sql_total_partial);
|
||||
|
||||
$sql_total_overdue_partial = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_overdue_partial FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.invoice_status = 'Partial' AND invoices.invoice_due < CURDATE() AND invoices.company_id = $session_company_id");
|
||||
$sql_total_overdue_partial = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_overdue_partial FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_status = 'Partial' AND invoice_due < CURDATE() AND invoices.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_total_overdue_partial);
|
||||
$total_overdue_partial = $row['total_overdue_partial'];
|
||||
|
||||
|
|
@ -123,10 +123,10 @@
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM invoices, clients, categories
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.category_id = categories.category_id
|
||||
AND invoices.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM invoices
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN categories ON invoice_category_id = category_id
|
||||
WHERE invoices.company_id = $session_company_id
|
||||
AND DATE(invoice_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR client_name LIKE '%$q%' OR invoice_status LIKE '%$q%' OR category_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
10
login.php
10
login.php
|
|
@ -30,14 +30,14 @@ if(isset($_POST['login'])){
|
|||
if(!empty($token)){
|
||||
$current_code = mysqli_real_escape_string($mysqli,$_POST['current_code']);
|
||||
}
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM users WHERE email = '$username' AND password = '$password'");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM users WHERE user_email = '$username' AND user_password = '$password'");
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$token = $row['token'];
|
||||
$_SESSION['user_id'] = $row['user_id'];
|
||||
$_SESSION['name'] = $row['name'];
|
||||
$name = $row['name'];
|
||||
$_SESSION['user_name'] = $row['user_name'];
|
||||
$user_name = $row['user_name'];
|
||||
$user_id = $row['user_id'];
|
||||
|
||||
if(empty($token)){
|
||||
|
|
@ -59,11 +59,11 @@ if(isset($_POST['login'])){
|
|||
|
||||
if(TokenAuth6238::verify($token,$current_code)){
|
||||
$_SESSION['logged'] = TRUE;
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login 2FA', log_action = 'Success', log_description = '$ip - $os - $browser - $device', log_created_at = NOW(), user_id = $user_id");
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login 2FA', log_action = 'Success', log_description = '$ip - $os - $browser - $device', log_created_at = NOW(), log_user_id = $user_id");
|
||||
//header("Location: $config_start_page");
|
||||
header("Location: dashboard.php");
|
||||
}else{
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login', log_action = '2FA Failed', log_description = '$ip - $os - $browser - $device', log_created_at = NOW(), user_id = $user_id");
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login', log_action = '2FA Failed', log_description = '$ip - $os - $browser - $device', log_created_at = NOW(), log_user_id = $user_id");
|
||||
|
||||
$response = "
|
||||
<div class='alert alert-primary'>
|
||||
|
|
|
|||
77
logs.php
77
logs.php
|
|
@ -17,13 +17,6 @@ if(isset($_GET['q'])){
|
|||
$q = "";
|
||||
}
|
||||
|
||||
if($_GET['log'] == "user"){
|
||||
|
||||
$extended_query = "= users.user_id";
|
||||
}else{
|
||||
$extended_query = "IS NULL";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
|
|
@ -43,10 +36,34 @@ if(isset($_GET['o'])){
|
|||
$disp = "ASC";
|
||||
}
|
||||
|
||||
//Date From and Date To Filter
|
||||
if(!empty($_GET['dtf'])){
|
||||
//Date Filter
|
||||
if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
||||
$dtf = $_GET['dtf'];
|
||||
$dtt = $_GET['dtt'];
|
||||
}elseif($_GET['canned_date'] == "today"){
|
||||
$dtf = date('Y-m-d');
|
||||
$dtt = date('Y-m-d');
|
||||
}elseif($_GET['canned_date'] == "yesterday"){
|
||||
$dtf = date('Y-m-d',strtotime("yesterday"));
|
||||
$dtt = date('Y-m-d',strtotime("yesterday"));
|
||||
}elseif($_GET['canned_date'] == "thisweek"){
|
||||
$dtf = date('Y-m-d',strtotime("monday this week"));
|
||||
$dtt = date('Y-m-d');
|
||||
}elseif($_GET['canned_date'] == "lastweek"){
|
||||
$dtf = date('Y-m-d',strtotime("monday last week"));
|
||||
$dtt = date('Y-m-d',strtotime("sunday last week"));
|
||||
}elseif($_GET['canned_date'] == "thismonth"){
|
||||
$dtf = date('Y-m-01');
|
||||
$dtt = date('Y-m-d');
|
||||
}elseif($_GET['canned_date'] == "lastmonth"){
|
||||
$dtf = date('Y-m-d',strtotime("first day of last month"));
|
||||
$dtt = date('Y-m-d',strtotime("last day of last month"));
|
||||
}elseif($_GET['canned_date'] == "thisyear"){
|
||||
$dtf = date('Y-01-01');
|
||||
$dtt = date('Y-m-d');
|
||||
}elseif($_GET['canned_date'] == "lastyear"){
|
||||
$dtf = date('Y-m-d',strtotime("first day of january last year"));
|
||||
$dtt = date('Y-m-d',strtotime("last day of december last year"));
|
||||
}else{
|
||||
$dtf = "0000-00-00";
|
||||
$dtt = "9999-00-00";
|
||||
|
|
@ -55,10 +72,10 @@ if(!empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM logs, users
|
||||
WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM logs
|
||||
LEFT JOIN users ON log_user_id = user_id
|
||||
WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
AND DATE(log_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (logs.user_id $extended_query)
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
|
|
@ -82,15 +99,25 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="btn-group float-right">
|
||||
<a href="?log=user" class="btn <?php if($log == 'user'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">User</a>
|
||||
<a href="?log=system" class="btn <?php if($log == 'system'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">System</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Canned Date</label>
|
||||
<select class="form-control select2" name="canned_date">
|
||||
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="">Custom</option>
|
||||
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
|
||||
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
|
||||
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
|
||||
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
|
||||
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
|
||||
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
|
||||
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
|
||||
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>Date From</label>
|
||||
|
|
@ -112,7 +139,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_created_at&o=<?php echo $disp; ?>">Timestamp</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=name&o=<?php echo $disp; ?>">User</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">User</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_type&o=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_action&o=<?php echo $disp; ?>">Action</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_description&o=<?php echo $disp; ?>">Description</a></th>
|
||||
|
|
@ -127,19 +154,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$log_action = $row['log_action'];
|
||||
$log_description = $row['log_description'];
|
||||
$log_created_at = $row['log_created_at'];
|
||||
$user_id = $row['logs.user_id'];
|
||||
|
||||
if($user_id == 0){
|
||||
$name = "-";
|
||||
$user_id = $row['user_id'];
|
||||
$user_name = $row['user_name'];
|
||||
if(empty($user_name)){
|
||||
$user_name_display = "-";
|
||||
}else{
|
||||
$name = $row['name'];
|
||||
$user_name_display = $user_name;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $log_created_at; ?></td>
|
||||
<td><?php echo $name; ?></td>
|
||||
<td><?php echo $user_name_display; ?></td>
|
||||
<td><?php echo $log_type; ?></td>
|
||||
<td><?php echo $log_action; ?></td>
|
||||
<td><?php echo $log_description; ?></td>
|
||||
|
|
|
|||
10
payments.php
10
payments.php
|
|
@ -72,11 +72,11 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM payments, invoices, clients, accounts
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND payments.invoice_id = invoices.invoice_id
|
||||
AND payments.account_id = accounts.account_id
|
||||
AND payments.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM payments
|
||||
LEFT JOIN invoices ON payment_invoice_id = invoice_id
|
||||
LEFT JOIN clients ON invoice_client_id = client_id
|
||||
LEFT JOIN accounts ON payment_account_id = account_id
|
||||
WHERE payments.company_id = $session_company_id
|
||||
AND DATE(payment_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR account_name LIKE '%$q%' OR payment_method LIKE '%$q%' OR payment_reference LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ if(isset($_GET['o'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM products, categories
|
||||
WHERE products.category_id = categories.category_id
|
||||
AND products.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM products LEFT JOIN categories ON product_category_id = category_id
|
||||
WHERE products.company_id = $session_company_id
|
||||
AND (product_name LIKE '%$q%' OR product_description LIKE '%$q%' OR category_name LIKE '%$q%' OR product_cost LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
|
|
@ -98,7 +97,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$product_created_at = $row['product_created_at'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$product_tax_id = $row['product_tax_id'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
62
quote.php
62
quote.php
|
|
@ -6,10 +6,12 @@ if(isset($_GET['quote_id'])){
|
|||
|
||||
$quote_id = intval($_GET['quote_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes, clients, companies
|
||||
WHERE quotes.client_id = clients.client_id
|
||||
AND quotes.company_id = companies.company_id
|
||||
AND quotes.quote_id = $quote_id"
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON quotes.company_id = companies.company_id
|
||||
WHERE quote_id = $quote_id"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
|
@ -24,22 +26,22 @@ if(isset($_GET['quote_id'])){
|
|||
$quote_note = $row['quote_note'];
|
||||
$quote_url_key = $row['quote_url_key'];
|
||||
$quote_created_at = $row['quote_created_at'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_id = $row['quote_category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
|
|
@ -65,7 +67,7 @@ if(isset($_GET['quote_id'])){
|
|||
$company_logo_base64 = base64_encode(file_get_contents($row['company_logo']));
|
||||
}
|
||||
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE quote_id = $quote_id ORDER BY history_id DESC");
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_quote_id = $quote_id ORDER BY history_id DESC");
|
||||
|
||||
//Set Badge color based off of quote status
|
||||
if($quote_status == "Sent"){
|
||||
|
|
@ -107,7 +109,7 @@ if(isset($_GET['quote_id'])){
|
|||
<i class="fas fa-fw fa-paper-plane"></i> Send
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
<a class="dropdown-item" href="post.php?email_quote=<?php echo $quote_id; ?>">Send Email</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
|
|
@ -137,7 +139,7 @@ if(isset($_GET['quote_id'])){
|
|||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" onclick="window.print();">Print</a>
|
||||
<a class="dropdown-item" href="#" onclick="pdfMake.createPdf(docDefinition).download('<?php echo "$quote_date-$company_name-$client_name-Quote-$quote_prefix$quote_number.pdf"; ?>');">Download PDF</a>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($client_email)){ ?>
|
||||
<?php if(!empty($config_smtp_host) AND !empty($contact_email)){ ?>
|
||||
<a class="dropdown-item" href="post.php?email_quote=<?php echo $quote_id; ?>">Send Email</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" target="_blank" href="guest_view_quote.php?quote_id=<?php echo "$quote_id&url_key=$quote_url_key"; ?>">Guest URL</a>
|
||||
|
|
@ -172,11 +174,11 @@ if(isset($_GET['quote_id'])){
|
|||
<div class="col-sm">
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo "$client_mobile"; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -193,7 +195,7 @@ if(isset($_GET['quote_id'])){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -227,7 +229,7 @@ if(isset($_GET['quote_id'])){
|
|||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$item_created_at = $row['item_created_at'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
|
||||
|
|
@ -465,7 +467,7 @@ var docDefinition = {
|
|||
style: 'invoiceBillingAddress'
|
||||
},
|
||||
{
|
||||
text: <?php echo json_encode("$client_address \n $client_city $client_state $client_zip \n $client_email \n $client_phone"); ?>,
|
||||
text: <?php echo json_encode("$location_address \n $location_city $location_state $location_zip \n $contact_email \n $contact_phone"); ?>,
|
||||
style: 'invoiceBillingAddressClient'
|
||||
},
|
||||
]
|
||||
|
|
@ -542,7 +544,7 @@ var docDefinition = {
|
|||
$total_tax = 0;
|
||||
$sub_total = 0;
|
||||
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE quote_id = $quote_id ORDER BY item_id ASC");
|
||||
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_name = $row['item_name'];
|
||||
|
|
@ -552,7 +554,7 @@ var docDefinition = {
|
|||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -74,10 +74,10 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM quotes, clients, categories
|
||||
WHERE quotes.client_id = clients.client_id
|
||||
AND quotes.category_id = categories.category_id
|
||||
AND quotes.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM quotes
|
||||
LEFT JOIN clients ON quote_client_id = client_id
|
||||
LEFT JOIN categories ON quote_category_id = category_id
|
||||
WHERE quotes.company_id = $session_company_id
|
||||
AND (CONCAT(quote_prefix,quote_number) LIKE '%$q%' OR quote_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR quote_status LIKE '%$q%' OR quote_amount LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
AND DATE(quote_date) BETWEEN '$dtf' AND '$dtt'
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM recurring, clients, categories
|
||||
WHERE recurring.client_id = clients.client_id
|
||||
AND recurring.category_id = categories.category_id
|
||||
AND recurring.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM recurring
|
||||
LEFT JOIN clients ON recurring_client_id = client_id
|
||||
LEFT JOIN categories ON recurring_category_id = category_id
|
||||
WHERE recurring.company_id = $session_company_id
|
||||
AND (CONCAT(recurring_prefix,recurring_number) LIKE '%$q%' OR recurring_frequency LIKE '%$q%' OR recurring_scope LIKE '%$q%' OR client_name LIKE '%$q%' OR category_name LIKE '%$q%')
|
||||
AND DATE(recurring_last_sent) BETWEEN '$dtf' AND '$dtt'
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@ if(isset($_GET['recurring_id'])){
|
|||
AND recurring.recurring_id = $recurring_id"
|
||||
);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM recurring
|
||||
LEFT JOIN clients ON recurring_client_id = client_id
|
||||
LEFT JOIN locations ON primary_location = location_id
|
||||
LEFT JOIN contacts ON primary_contact = contact_id
|
||||
LEFT JOIN companies ON recurring.company_id = companies.company_id
|
||||
WHERE recurring_id = $recurring_id"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$recurring_id = $row['recurring_id'];
|
||||
$recurring_prefix = $row['recurring_prefix'];
|
||||
|
|
@ -29,22 +37,22 @@ if(isset($_GET['recurring_id'])){
|
|||
$recurring_currency_code = $row['recurring_currency_code'];
|
||||
$recurring_note = $row['recurring_note'];
|
||||
$recurring_created_at = $row['recurring_created_at'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_id = $row['recurring_category_id'];
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
if(strlen($contact_phone)>2){
|
||||
$contact_phone = substr($row['contact_phone'],0,3)."-".substr($row['contact_phone'],3,3)."-".substr($row['contact_phone'],6,4);
|
||||
}
|
||||
$client_extension = $row['client_extension'];
|
||||
$client_mobile = $row['client_mobile'];
|
||||
if(strlen($client_mobile)>2){
|
||||
$client_mobile = substr($row['client_mobile'],0,3)."-".substr($row['client_mobile'],3,3)."-".substr($row['client_mobile'],6,4);
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
if(strlen($contact_mobile)>2){
|
||||
$contact_mobile = substr($row['contact_mobile'],0,3)."-".substr($row['contact_mobile'],3,3)."-".substr($row['contact_mobile'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_currency_code = $row['client_currency_code'];
|
||||
|
|
@ -71,7 +79,7 @@ if(isset($_GET['recurring_id'])){
|
|||
$company_website = $row['company_website'];
|
||||
$company_logo = $row['company_logo'];
|
||||
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE recurring_id = $recurring_id ORDER BY history_id DESC");
|
||||
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_recurring_id = $recurring_id ORDER BY history_id DESC");
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -137,11 +145,11 @@ if(isset($_GET['recurring_id'])){
|
|||
<div class="col-sm">
|
||||
<ul class="list-unstyled text-right">
|
||||
<li><h4><strong><?php echo $client_name; ?></strong></h4></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo "$client_phone $client_extension"; ?></li>
|
||||
<li><?php echo $client_mobile; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
<li><?php echo $location_address; ?></li>
|
||||
<li><?php echo "$location_city $location_state $location_zip"; ?></li>
|
||||
<li><?php echo "$contact_phone $contact_extension"; ?></li>
|
||||
<li><?php echo $contact_mobile; ?></li>
|
||||
<li><?php echo $contact_email; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -166,7 +174,7 @@ if(isset($_GET['recurring_id'])){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE recurring_id = $recurring_id ORDER BY item_id ASC"); ?>
|
||||
<?php $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -200,7 +208,7 @@ if(isset($_GET['recurring_id'])){
|
|||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$item_created_at = $row['item_created_at'];
|
||||
$tax_id = $row['tax_id'];
|
||||
$tax_id = $row['item_tax_id'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ if(isset($_GET['year'])){
|
|||
$year = date('Y');
|
||||
}
|
||||
|
||||
$sql_expense_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(expense_date) AS expense_year FROM expenses WHERE category_id > 0 AND company_id = $session_company_id ORDER BY expense_year DESC");
|
||||
$sql_expense_years = mysqli_query($mysqli,"SELECT DISTINCT YEAR(expense_date) AS expense_year FROM expenses WHERE expense_category_id > 0 AND company_id = $session_company_id ORDER BY expense_year DESC");
|
||||
|
||||
$sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense' AND company_id = $session_company_id ORDER BY category_name ASC");
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_
|
|||
|
||||
$total_expense_for_all_months = 0;
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_month = $row['expense_amount_for_month'];
|
||||
$total_expense_for_all_months = $expense_amount_for_month + $total_expense_for_all_months;
|
||||
|
|
@ -99,7 +99,7 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_
|
|||
<?php
|
||||
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_month = $row['expense_total_amount_for_month'];
|
||||
$total_expense_for_all_months = $expense_total_amount_for_month + $total_expense_for_all_months;
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_
|
|||
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
//Payments to Invoices
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_amount_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
//Revenues
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenues.category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenues_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -109,11 +109,11 @@ $sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_
|
|||
<?php
|
||||
|
||||
for($month = 1; $month<=12; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_total_amount_for_month = $row['payment_total_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenues_total_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_amount_for_quarter_one = 0;
|
||||
|
||||
for($month = 1; $month<=3; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_amount_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenues.category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -94,11 +94,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_amount_for_quarter_two = 0;
|
||||
|
||||
for($month = 4; $month<=6; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_amount_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenues.category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -116,11 +116,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_amount_for_quarter_three = 0;
|
||||
|
||||
for($month = 7; $month<=9; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_amount_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenues.category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -137,11 +137,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_amount_for_quarter_four = 0;
|
||||
|
||||
for($month = 10; $month<=12; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND invoices.category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_amount_for_month = $row['payment_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenues.category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_amount_for_month = $row['revenue_amount_for_month'];
|
||||
|
||||
|
|
@ -173,11 +173,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_total_amount_for_quarter_one = 0;
|
||||
|
||||
for($month = 1; $month<=3; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_total_amount_for_month = $row['payment_total_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_total_amount_for_month = $row['revenue_total_amount_for_month'];
|
||||
|
||||
|
|
@ -195,11 +195,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_total_amount_for_quarter_two = 0;
|
||||
|
||||
for($month = 4; $month<=6; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_total_amount_for_month = $row['payment_total_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_total_amount_for_month = $row['revenue_total_amount_for_month'];
|
||||
|
||||
|
|
@ -217,11 +217,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_total_amount_for_quarter_three = 0;
|
||||
|
||||
for($month = 7; $month<=9; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_total_amount_for_month = $row['payment_total_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_total_amount_for_month = $row['revenue_total_amount_for_month'];
|
||||
|
||||
|
|
@ -239,11 +239,11 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$payment_total_amount_for_quarter_four = 0;
|
||||
|
||||
for($month = 10; $month<=12; $month++) {
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payments.invoice_id = invoices.invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month AND payments.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$payment_total_amount_for_month = $row['payment_total_amount_for_month'];
|
||||
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$sql_revenues = mysqli_query($mysqli,"SELECT SUM(revenue_amount) AS revenue_total_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month AND revenues.company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_revenues);
|
||||
$revenue_total_amount_for_month = $row['revenue_total_amount_for_month'];
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_amount_for_quarter_one = 0;
|
||||
|
||||
for($month = 1; $month<=3; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_quarter_one = $expense_amount_for_quarter_one + $row['expense_amount_for_month'];
|
||||
}
|
||||
|
|
@ -293,7 +293,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_amount_for_quarter_two = 0;
|
||||
|
||||
for($month = 4; $month<=6; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_quarter_two = $expense_amount_for_quarter_two + $row['expense_amount_for_month'];
|
||||
}
|
||||
|
|
@ -307,7 +307,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_amount_for_quarter_three = 0;
|
||||
|
||||
for($month = 7; $month<=9; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_quarter_three = $expense_amount_for_quarter_three + $row['expense_amount_for_month'];
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_amount_for_quarter_four = 0;
|
||||
|
||||
for($month = 10; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_amount_for_quarter_four = $expense_amount_for_quarter_four + $row['expense_amount_for_month'];
|
||||
}
|
||||
|
|
@ -350,7 +350,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_total_amount_for_quarter_one = 0;
|
||||
|
||||
for($month = 1; $month<=3; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_one = $expense_total_amount_for_quarter_one + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -364,7 +364,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_total_amount_for_quarter_two = 0;
|
||||
|
||||
for($month = 4; $month<=6; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_two = $expense_total_amount_for_quarter_two + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -378,7 +378,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_total_amount_for_quarter_three = 0;
|
||||
|
||||
for($month = 7; $month<=9; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_three = $expense_total_amount_for_quarter_three + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -392,7 +392,7 @@ $sql_categories_expense = mysqli_query($mysqli,"SELECT * FROM categories WHERE c
|
|||
$expense_total_amount_for_quarter_four = 0;
|
||||
|
||||
for($month = 10; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_four = $expense_total_amount_for_quarter_four + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if(isset($_GET['year'])){
|
|||
}
|
||||
|
||||
//GET unique years from expenses, payments and revenues
|
||||
$sql_all_years = mysqli_query($mysqli,"SELECT YEAR(item_created_at) AS all_years FROM invoice_items WHERE company_id = $session_company_id ORDER BY all_years DESC");
|
||||
$sql_all_years = mysqli_query($mysqli,"SELECT DISTINCT(YEAR(item_created_at)) AS all_years FROM invoice_items WHERE company_id = $session_company_id ORDER BY all_years DESC");
|
||||
|
||||
$sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
|
||||
|
||||
|
|
@ -67,9 +67,9 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
for($month = 1; $month<=3; $month++) {
|
||||
|
||||
$sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month FROM taxes, invoices, invoice_items
|
||||
WHERE invoice_items.invoice_id = invoices.invoice_id
|
||||
AND invoices.status LIKE 'Paid'
|
||||
AND invoices_items.tax_id = $tax_id
|
||||
WHERE item_invoice_id = invoice_id
|
||||
AND invoice_status LIKE 'Paid'
|
||||
AND item_tax_id = $tax_id
|
||||
AND YEAR(invoice_date) = $year AND MONTH(invoice_date) = $month"
|
||||
);
|
||||
|
||||
|
|
@ -90,9 +90,9 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
for($month = 4; $month <= 6; $month ++) {
|
||||
|
||||
$sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month FROM taxes, invoices, invoice_items
|
||||
WHERE invoice_items.invoice_id = invoices.invoice_id
|
||||
AND invoices.status LIKE 'Paid'
|
||||
AND invoices_items.tax_id = $tax_id
|
||||
WHERE item_invoice_id = invoice_id
|
||||
AND invoice_status LIKE 'Paid'
|
||||
AND item_tax_id = $tax_id
|
||||
AND YEAR(invoice_date) = $year AND MONTH(invoice_date) = $month"
|
||||
);
|
||||
|
||||
|
|
@ -113,9 +113,9 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
for($month = 7; $month <= 9; $month ++) {
|
||||
|
||||
$sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month FROM taxes, invoices, invoice_items
|
||||
WHERE invoice_items.invoice_id = invoices.invoice_id
|
||||
AND invoices.status LIKE 'Paid'
|
||||
AND invoices_items.tax_id = $tax_id
|
||||
WHERE item_invoice_id = invoice_id
|
||||
AND invoice_status LIKE 'Paid'
|
||||
AND item_tax_id = $tax_id
|
||||
AND YEAR(invoice_date) = $year AND MONTH(invoice_date) = $month"
|
||||
);
|
||||
|
||||
|
|
@ -136,9 +136,9 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
for($month = 10; $month <= 12; $month ++) {
|
||||
|
||||
$sql_tax_collected = mysqli_query($mysqli,"SELECT SUM(item_tax) AS tax_collected_for_month FROM taxes, invoices, invoice_items
|
||||
WHERE invoice_items.invoice_id = invoices.invoice_id
|
||||
AND invoices.status LIKE 'Paid'
|
||||
AND invoices_items.tax_id = $tax_id
|
||||
WHERE item_invoice_id = invoice_id
|
||||
AND invoice_status LIKE 'Paid'
|
||||
AND item_tax_id = $tax_id
|
||||
AND YEAR(invoice_date) = $year AND MONTH(invoice_date) = $month"
|
||||
);
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
$tax_total_for_quarter_one = 0;
|
||||
|
||||
for($month = 1; $month<=3; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_one = $expense_total_amount_for_quarter_one + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
$expense_total_amount_for_quarter_two = 0;
|
||||
|
||||
for($month = 4; $month<=6; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_two = $expense_total_amount_for_quarter_two + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
$expense_total_amount_for_quarter_three = 0;
|
||||
|
||||
for($month = 7; $month<=9; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_three = $expense_total_amount_for_quarter_three + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ $sql_tax = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session
|
|||
$expense_total_amount_for_quarter_four = 0;
|
||||
|
||||
for($month = 10; $month<=12; $month++) {
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND vendor_id > 0 AND company_id = $session_company_id");
|
||||
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_total_amount_for_month FROM expenses WHERE expense_category_id > 0 AND YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0 AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql_expenses);
|
||||
$expense_total_amount_for_quarter_four = $expense_total_amount_for_quarter_four + $row['expense_total_amount_for_month'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,10 +72,10 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM accounts, revenues, categories
|
||||
WHERE revenues.account_id = accounts.account_id
|
||||
AND revenues.category_id = categories.category_id
|
||||
AND revenues.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM revenues
|
||||
JOIN categories ON revenue_category_id = category_id
|
||||
LEFT JOIN accounts ON revenue_account_id = account_id
|
||||
WHERE revenues.company_id = $session_company_id
|
||||
AND (account_name LIKE '%$q%' OR revenue_payment_method LIKE '%$q%' OR category_name LIKE '%$q%' OR revenue_reference LIKE '%$q%' OR revenue_amount LIKE '%$q%')
|
||||
AND DATE(revenue_date) BETWEEN '$dtf' AND '$dtt'
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
<?php
|
||||
|
||||
$sql_recent_logins = mysqli_query($mysqli,"SELECT * FROM logs
|
||||
WHERE log_type = 'Login' AND log_action = 'Success' AND user_id = $session_user_id
|
||||
WHERE log_type = 'Login' AND log_action = 'Success' AND log_user_id = $session_user_id
|
||||
ORDER BY log_id DESC LIMIT 5");
|
||||
|
||||
$sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
|
||||
WHERE user_id = $session_user_id AND log_type NOT LIKE 'Login'
|
||||
WHERE log_user_id = $session_user_id AND log_type NOT LIKE 'Login'
|
||||
ORDER BY log_id DESC LIMIT 10");
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ if(isset($_POST['add_user'])){
|
|||
$email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])));
|
||||
$password = md5($_POST['password']);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO users SET name = '$name', email = '$email', password = '$password', created_at = NOW()");
|
||||
mysqli_query($mysqli,"INSERT INTO users SET user_name = '$name', user_email = '$email', user_password = '$password', user_created_at = NOW()");
|
||||
|
||||
$user_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
@ -169,9 +169,9 @@ if(isset($_POST['add_user'])){
|
|||
move_uploaded_file($_FILES['file']['tmp_name'], $path);
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"UPDATE users SET avatar = '$path' WHERE user_id = $user_id");
|
||||
mysqli_query($mysqli,"UPDATE users SET user_avatar = '$path' WHERE user_id = $user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "User <strong>$name</strong> created!";
|
||||
$_SESSION['alert_message'] = "User <strong>$user_name</strong> created!";
|
||||
|
||||
header("Location: setup.php?company");
|
||||
|
||||
|
|
|
|||
99
ticket.php
99
ticket.php
|
|
@ -6,7 +6,7 @@
|
|||
if(isset($_GET['ticket_id'])){
|
||||
$ticket_id = intval($_GET['ticket_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM tickets, clients, users WHERE tickets.client_id = clients.client_id AND tickets.ticket_created_by = users.user_id AND ticket_id = $ticket_id AND tickets.company_id = $session_company_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id LEFT JOIN contacts ON ticket_contact_id = contact_id LEFT JOIN users ON ticket_assigned_to = user_id LEFT JOIN locations ON ticket_location_id = location_id WHERE ticket_id = $ticket_id AND tickets.company_id = $session_company_id");
|
||||
|
||||
if(mysqli_num_rows($sql) == 0){
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
|
|
@ -19,15 +19,6 @@ if(isset($_GET['ticket_id'])){
|
|||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_type = $row['client_type'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
if($client_net_terms == 0){
|
||||
|
|
@ -65,31 +56,27 @@ if(isset($_GET['ticket_id'])){
|
|||
}
|
||||
|
||||
$contact_id = $row['contact_id'];
|
||||
if(!empty($contact_id)){
|
||||
$sql_contact = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_id = $contact_id");
|
||||
$row = mysqli_fetch_array($sql_contact);
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_title = $row['contact_title'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
$location_id = $row['location_id'];
|
||||
if(!empty($location_id)){
|
||||
$sql_location = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_id = $location_id");
|
||||
$row = mysqli_fetch_array($sql_location);
|
||||
$location_name = $row['location_name'];
|
||||
}
|
||||
$contact_name = $row['contact_name'];
|
||||
$contact_title = $row['contact_title'];
|
||||
$contact_email = $row['contact_email'];
|
||||
$contact_phone = $row['contact_phone'];
|
||||
$contact_extension = $row['contact_extension'];
|
||||
$contact_mobile = $row['contact_mobile'];
|
||||
$location_name = $row['location_name'];
|
||||
$location_address = $row['location_address'];
|
||||
$location_city = $row['location_city'];
|
||||
$location_state = $row['location_state'];
|
||||
$location_zip = $row['location_zip'];
|
||||
$location_phone = $row['location_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$location_phone = substr($row['location_phone'],0,3)."-".substr($row['location_phone'],3,3)."-".substr($row['location_phone'],6,4);
|
||||
}
|
||||
|
||||
|
||||
$ticket_assigned_to = $row['ticket_assigned_to'];
|
||||
if(empty($ticket_assigned_to)){
|
||||
$ticket_assigned_to_display = "<span class='text-danger'>Not Assigned</span>";
|
||||
}else{
|
||||
$sql_assigned_to = mysqli_query($mysqli,"SELECT * FROM users WHERE user_id = $ticket_assigned_to");
|
||||
$row = mysqli_fetch_array($sql_assigned_to);
|
||||
$ticket_assigned_to_display = $row['name'];
|
||||
$ticket_assigned_to_display = $row['user_name'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -140,7 +127,7 @@ if(isset($_GET['ticket_id'])){
|
|||
<form class="mb-3" action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_id" value="<?php echo $ticket_id; ?>">
|
||||
<div class="form-group">
|
||||
<textarea class="form-control summernote" name="ticket_update"></textarea>
|
||||
<textarea class="form-control summernote" name="ticket_reply"></textarea>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col-md-3">
|
||||
|
|
@ -164,7 +151,7 @@ if(isset($_GET['ticket_id'])){
|
|||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_update" value="1" checked>
|
||||
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_ticket_reply" value="1" checked>
|
||||
<label class="custom-control-label" for="customControlAutosizing">Email update to client</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -173,7 +160,7 @@ if(isset($_GET['ticket_id'])){
|
|||
<?php } ?>
|
||||
|
||||
<div class="col-md-1">
|
||||
<button type="submit" name="add_ticket_update" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> Save</button>
|
||||
<button type="submit" name="add_ticket_reply" class="btn btn-primary"><i class="fa fa-fw fa-check"></i> Save</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
|
@ -191,36 +178,33 @@ if(isset($_GET['ticket_id'])){
|
|||
</form>
|
||||
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM ticket_updates WHERE ticket_id = $ticket_id AND ticket_update_archived_at IS NULL ORDER BY ticket_update_id DESC");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM ticket_replies LEFT JOIN users ON ticket_reply_by = user_id WHERE ticket_reply_ticket_id = $ticket_id AND ticket_reply_archived_at IS NULL ORDER BY ticket_reply_id DESC");
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){;
|
||||
$ticket_update_id = $row['ticket_update_id'];
|
||||
$ticket_update = $row['ticket_update'];
|
||||
$ticket_update_created_at = $row['ticket_update_created_at'];
|
||||
$ticket_update_by = $row['ticket_update_by'];
|
||||
|
||||
$sql_update_by = mysqli_query($mysqli,"SELECT * FROM users WHERE user_id = $ticket_update_by");
|
||||
$row = mysqli_fetch_array($sql_update_by);
|
||||
$ticket_update_by_display = $row['name'];
|
||||
$ticket_reply_id = $row['ticket_reply_id'];
|
||||
$ticket_reply = $row['ticket_reply'];
|
||||
$ticket_reply_created_at = $row['ticket_reply_created_at'];
|
||||
$ticket_reply_by = $row['ticket_reply_by'];
|
||||
$ticket_reply_by_display = $row['user_name'];
|
||||
?>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><i class="fa fa-fw fa-clock"></i> <?php echo $ticket_update_created_at; ?> <i class="fa fa-fw fa-user"></i> <?php echo $ticket_update_by_display; ?>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketUpdateModal<?php echo $ticket_update_id; ?>"><i class="fas fa-fw fa-edit text-secondary"></i></a>
|
||||
<a href="post.php?archive_ticket_update=<?php echo $ticket_update_id; ?>"><i class="fas fa-fw fa-trash text-danger"></i></a>
|
||||
<div class="card-header"><i class="fa fa-fw fa-clock"></i> <?php echo $ticket_reply_created_at; ?> <i class="fa fa-fw fa-user"></i> <?php echo $ticket_reply_by_display; ?>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketReplyModal<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-edit text-secondary"></i></a>
|
||||
<a href="post.php?archive_ticket_reply=<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-trash text-danger"></i></a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p><?php echo $ticket_update; ?></p>
|
||||
<p><?php echo $ticket_reply; ?></p>
|
||||
</div>
|
||||
<div class="card-footer"><i class="fa fa-fw fa-clock"></i> <?php echo $ticket_update_created_at; ?> <i class="fa fa-fw fa-user"></i> <?php echo $ticket_update_by_display; ?>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketUpdateModal<?php echo $ticket_update_id; ?>"><i class="fas fa-fw fa-edit text-secondary"></i></a>
|
||||
<a href="post.php?archive_ticket_update=<?php echo $ticket_update_id; ?>"><i class="fas fa-fw fa-trash text-danger"></i></a>
|
||||
<div class="card-footer"><i class="fa fa-fw fa-clock"></i> <?php echo $ticket_reply_created_at; ?> <i class="fa fa-fw fa-user"></i> <?php echo $ticket_reply_by_display; ?>
|
||||
<a href="#" data-toggle="modal" data-target="#editTicketReplyModal<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-edit text-secondary"></i></a>
|
||||
<a href="post.php?archive_ticket_reply=<?php echo $ticket_reply_id; ?>"><i class="fas fa-fw fa-trash text-danger"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
include("edit_ticket_update_modal.php");
|
||||
include("edit_ticket_reply_modal.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -235,23 +219,6 @@ if(isset($_GET['ticket_id'])){
|
|||
<div>
|
||||
<h4 class="text-secondary">Client</h4>
|
||||
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_name; ?>
|
||||
<br>
|
||||
<?php
|
||||
if(!empty($client_email)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i> <a href="mailto:<?php echo $client_email; ?>"><?php echo $client_email; ?></a>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(!empty($client_phone)){
|
||||
?>
|
||||
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <?php echo $client_phone; ?>
|
||||
<br>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
19
tickets.php
19
tickets.php
|
|
@ -17,12 +17,6 @@
|
|||
$q = "";
|
||||
}
|
||||
|
||||
if(isset($_GET['status'])){
|
||||
$status = mysqli_real_escape_string($mysqli,$_GET['status']);
|
||||
}else{
|
||||
$status = "Open";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
|
|
@ -79,12 +73,11 @@
|
|||
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM tickets, clients
|
||||
WHERE tickets.client_id = clients.client_id
|
||||
AND tickets.company_id = $session_company_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id LEFT JOIN users ON ticket_assigned_to = user_id
|
||||
WHERE tickets.company_id = $session_company_id
|
||||
AND ticket_status LIKE '%$status%'
|
||||
AND DATE(ticket_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_priority LIKE '%$q%')
|
||||
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_priority LIKE '%$q%' OR user_name LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -162,7 +155,7 @@
|
|||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_status&o=<?php echo $disp; ?>">Status</a>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_subject&o=<?php echo $disp; ?>">Subject</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=client_name&o=<?php echo $disp; ?>">Client</a></th>
|
||||
<th>Assigned</th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Assigned</a></th>
|
||||
<th>Last Response</th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_created_at&o=<?php echo $disp; ?>">Created</a></th>
|
||||
|
||||
|
|
@ -212,9 +205,7 @@
|
|||
if(empty($ticket_assigned_to)){
|
||||
$ticket_assigned_to_display = "<p class='text-danger'>Not Assigned</p>";
|
||||
}else{
|
||||
$sql_assigned_to = mysqli_query($mysqli,"SELECT * FROM users WHERE user_id = $ticket_assigned_to");
|
||||
$row = mysqli_fetch_array($sql_assigned_to);
|
||||
$ticket_assigned_to_display = $row['name'];
|
||||
$ticket_assigned_to_display = $row['user_name'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ if($_GET['canned_date'] == "custom" AND !empty($_GET['dtf'])){
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS expenses.expense_date AS transfer_date, expenses.expense_amount AS transfer_amount, expenses.account_id AS transfer_account_from, revenues.account_id AS transfer_account_to, transfers.expense_id, transfers.revenue_id , transfers.transfer_id, transfers.transfer_notes AS transfer_notes FROM transfers, expenses, revenues
|
||||
WHERE transfers.expense_id = expenses.expense_id
|
||||
AND transfers.revenue_id = revenues.revenue_id
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS expense_date AS transfer_date, expense_amount AS transfer_amount, expense_account_id AS transfer_account_from, revenue_account_id AS transfer_account_to, transfer_expense_id, transfer_revenue_id , transfer_id, transfer_notes FROM transfers, expenses, revenues
|
||||
WHERE transfer_expense_id = expense_id
|
||||
AND transfer_revenue_id = revenue_id
|
||||
AND transfers.company_id = $session_company_id
|
||||
AND DATE(expense_date) BETWEEN '$dtf' AND '$dtt'
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
|
|
|
|||
15
trips.php
15
trips.php
|
|
@ -72,10 +72,10 @@
|
|||
//Rebuild URL
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM trips
|
||||
WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%' OR trip_miles LIKE '%$q%')
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM trips LEFT JOIN clients ON trip_client_id = client_id
|
||||
WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%' OR trip_miles LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
AND DATE(trip_date) BETWEEN '$dtf' AND '$dtt'
|
||||
AND company_id = $session_company_id
|
||||
AND trips.company_id = $session_company_id
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
|
|
@ -150,6 +150,7 @@
|
|||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=trip_date&o=<?php echo $disp; ?>">Date</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=client_name&o=<?php echo $disp; ?>">Client</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=trip_purpose&o=<?php echo $disp; ?>">Purpose</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=trip_source&o=<?php echo $disp; ?>">Source</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=trip_destination&o=<?php echo $disp; ?>">Destination</a></th>
|
||||
|
|
@ -169,7 +170,12 @@
|
|||
$trip_miles = $row['trip_miles'];
|
||||
$round_trip = $row['round_trip'];
|
||||
$client_id = $row['client_id'];
|
||||
|
||||
$client_name = $row['client_name'];
|
||||
if(empty($client_name)){
|
||||
$client_name_display = "-";
|
||||
}else{
|
||||
$client_name_display = "<a href='client.php?client_id=$client_id&tab=trips'>$client_name</a>";
|
||||
}
|
||||
if($round_trip == 1){
|
||||
$round_trip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
|
||||
}else{
|
||||
|
|
@ -179,6 +185,7 @@
|
|||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editTripModal<?php echo $trip_id; ?>"><?php echo $trip_date; ?></a></td>
|
||||
<td><?php echo $client_name_display; ?></td>
|
||||
<td><?php echo $trip_purpose; ?></td>
|
||||
<td><?php echo $trip_source; ?></td>
|
||||
<td><?php echo $trip_destination; ?></td>
|
||||
|
|
|
|||
30
users.php
30
users.php
|
|
@ -20,7 +20,7 @@
|
|||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
$sb = "name";
|
||||
$sb = "user_name";
|
||||
}
|
||||
|
||||
if(isset($_GET['o'])){
|
||||
|
|
@ -40,8 +40,8 @@
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM users, permissions
|
||||
WHERE users.user_id = permissions.user_id
|
||||
AND (name LIKE '%$q%' OR email LIKE '%$q%')
|
||||
WHERE users.user_id = permissions.user_id
|
||||
AND (user_name LIKE '%$q%' OR user_email LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -69,8 +69,8 @@
|
|||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=email&o=<?php echo $disp; ?>">Email</a></th>
|
||||
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_email&o=<?php echo $disp; ?>">Email</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=Permission_level&o=<?php echo $disp; ?>">Access Level</a></th>
|
||||
<th>Status</th>
|
||||
<th>Last Login</th>
|
||||
|
|
@ -82,9 +82,9 @@
|
|||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$user_id = $row['user_id'];
|
||||
$name = $row['name'];
|
||||
$email = $row['email'];
|
||||
$avatar = $row['avatar'];
|
||||
$user_name = $row['user_name'];
|
||||
$user_email = $row['user_email'];
|
||||
$user_avatar = $row['user_avatar'];
|
||||
$permission_default_company = $row['permission_default_company'];
|
||||
$permission_level = $row['permission_level'];
|
||||
if($permission_level == 5){
|
||||
|
|
@ -103,10 +103,10 @@
|
|||
$permission_clients = $row['permission_clients'];
|
||||
$permission_clients_array = explode(",",$permission_clients);
|
||||
$permission_actions = $row['permission_actions'];
|
||||
$initials = initials($name);
|
||||
$user_initials = initials($user_name);
|
||||
|
||||
$sql_last_login = mysqli_query($mysqli,"SELECT * FROM logs
|
||||
WHERE user_id = $user_id AND log_type = 'Login'
|
||||
WHERE log_user_id = $user_id AND log_type = 'Login'
|
||||
ORDER BY log_id DESC LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_last_login);
|
||||
|
|
@ -120,20 +120,20 @@
|
|||
<tr>
|
||||
<td class="text-center">
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editUserModal<?php echo $user_id; ?>">
|
||||
<?php if(!empty($avatar)){ ?>
|
||||
<img height="48" width="48" class="img-fluid rounded-circle" src="<?php echo $avatar; ?>">
|
||||
<?php if(!empty($user_avatar)){ ?>
|
||||
<img height="48" width="48" class="img-fluid rounded-circle" src="<?php echo $user_avatar; ?>">
|
||||
<?php }else{ ?>
|
||||
<span class="fa-stack fa-2x">
|
||||
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $initials; ?></span>
|
||||
<span class="fa fa-stack-1x text-white"><?php echo $user_initials; ?></span>
|
||||
</span>
|
||||
<br>
|
||||
<?php } ?>
|
||||
|
||||
<div class="text-secondary"><?php echo $name; ?></div>
|
||||
<div class="text-secondary"><?php echo $user_name; ?></div>
|
||||
</a>
|
||||
</td>
|
||||
<td><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></td>
|
||||
<td><a href="mailto:<?php echo $email; ?>"><?php echo $user_email; ?></a></td>
|
||||
<td><?php echo $permission_level_display; ?></td>
|
||||
<td>-</td>
|
||||
<td><?php echo $log_created_at; ?> <br> <small class="text-secondary"><?php echo $last_login; ?></small></td>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ if(!empty($_GET['dtf'])){
|
|||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM vendors
|
||||
WHERE client_id = 0
|
||||
WHERE vendor_client_id = 0
|
||||
AND DATE(vendor_created_at) BETWEEN '$dtf' AND '$dtt'
|
||||
AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%')
|
||||
AND vendor_archived_at IS NULL
|
||||
|
|
|
|||
Loading…
Reference in New Issue