mirror of https://github.com/itflow-org/itflow
Added Quote Scope capabilities
This commit is contained in:
parent
413d67e409
commit
2b1baa99c0
|
|
@ -50,6 +50,7 @@
|
|||
<input type="date" class="form-control" name="date" value="<?php echo date("Y-m-d"); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
|
|
@ -73,6 +74,16 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Scope</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="scope" placeholder="Quick description">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ if(isset($_GET['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
|
||||
AND (quote_id LIKE '%$q%' OR category_name LIKE '%$q%' OR quote_status LIKE '%$q%')
|
||||
AND (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");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
|
@ -74,6 +74,7 @@ $total_pages = ceil($total_found_rows / 10);
|
|||
<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=quote_number&o=<?php echo $disp; ?>">Number</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_scope&o=<?php echo $disp; ?>">Scope</a></th>
|
||||
<th class="text-right"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_amount&o=<?php echo $disp; ?>">Amount</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_date&o=<?php echo $disp; ?>">Date</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=category_name&o=<?php echo $disp; ?>">Category</a></th>
|
||||
|
|
@ -87,6 +88,7 @@ $total_pages = ceil($total_found_rows / 10);
|
|||
while($row = mysqli_fetch_array($sql)){
|
||||
$quote_id = $row['quote_id'];
|
||||
$quote_number = $row['quote_number'];
|
||||
$quote_scope = $row['quote_scope'];
|
||||
$quote_status = $row['quote_status'];
|
||||
$quote_date = $row['quote_date'];
|
||||
$quote_amount = $row['quote_amount'];
|
||||
|
|
@ -109,6 +111,7 @@ $total_pages = ceil($total_found_rows / 10);
|
|||
|
||||
<tr>
|
||||
<td><a href="quote.php?quote_id=<?php echo $quote_id; ?>"><?php echo $quote_number; ?></a></td>
|
||||
<td><?php echo $quote_scope; ?></td>
|
||||
<td class="text-right">$<?php echo number_format($quote_amount,2); ?></td>
|
||||
<td><?php echo $quote_date; ?></td>
|
||||
<td><?php echo $category_name; ?></td>
|
||||
|
|
|
|||
|
|
@ -45,6 +45,17 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Scope</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="scope" placeholder="Quick description" value="<?php echo $quote_scope; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
14
post.php
14
post.php
|
|
@ -1500,6 +1500,7 @@ if(isset($_POST['add_quote'])){
|
|||
$client = intval($_POST['client']);
|
||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||
$category = intval($_POST['category']);
|
||||
$scope = strip_tags(mysqli_real_escape_string($mysqli,$_POST['scope']));
|
||||
|
||||
//Get the last Invoice Number and add 1 for the new invoice number
|
||||
$quote_number = "$config_quote_prefix$config_quote_next_number";
|
||||
|
|
@ -1509,8 +1510,7 @@ if(isset($_POST['add_quote'])){
|
|||
//Generate a unique URL key for clients to access
|
||||
$quote_url_key = keygen();
|
||||
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO quotes SET quote_number = '$quote_number', quote_date = '$date', category_id = $category, quote_status = 'Draft', quote_url_key = '$quote_url_key', quote_created_at = NOW(), client_id = $client, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO quotes SET quote_number = '$quote_number', quote_scope = '$scope', quote_date = '$date', category_id = $category, quote_status = 'Draft', quote_url_key = '$quote_url_key', quote_created_at = NOW(), client_id = $client, company_id = $session_company_id");
|
||||
|
||||
$quote_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
@ -1538,11 +1538,12 @@ if(isset($_POST['add_quote_copy'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$quote_amount = $row['quote_amount'];
|
||||
$quote_scope = mysqli_real_escape_string($mysqli,$row['quote_scope']);
|
||||
$quote_note = mysqli_real_escape_string($mysqli,$row['quote_note']);
|
||||
$client_id = $row['client_id'];
|
||||
$category_id = $row['category_id'];
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO quotes SET quote_number = '$quote_number', quote_date = '$date', category_id = $category_id, quote_status = 'Draft', quote_amount = '$quote_amount', quote_note = '$quote_note', quote_created_at = NOW(), client_id = $client_id, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO quotes SET quote_number = '$quote_number', quote_scope = '$quote_scope', quote_date = '$date', category_id = $category_id, quote_status = 'Draft', quote_amount = '$quote_amount', quote_note = '$quote_note', quote_created_at = NOW(), client_id = $client_id, company_id = $session_company_id");
|
||||
|
||||
$new_quote_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
@ -1584,14 +1585,16 @@ if(isset($_POST['add_quote_to_invoice'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id AND company_id = $session_company_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$quote_amount = $row['quote_amount'];
|
||||
$quote_scope = mysqli_real_escape_string($mysqli,$row['quote_scope']);
|
||||
$quote_note = mysqli_real_escape_string($mysqli,$row['quote_note']);
|
||||
|
||||
$client_id = $row['client_id'];
|
||||
$category_id = $row['category_id'];
|
||||
|
||||
//Generate a unique URL key for clients to access
|
||||
$url_key = keygen();
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = '$invoice_number', invoice_date = '$date', invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$quote_amount', invoice_note = '$quote_note', invoice_url_key = '$url_key', invoice_created_at = NOW(), client_id = $client_id, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO invoices SET invoice_number = '$invoice_number', invoice_scope = '$quote_scope', invoice_date = '$date', invoice_due = DATE_ADD(CURDATE(), INTERVAL $client_net_terms day), category_id = $category_id, invoice_status = 'Draft', invoice_amount = '$quote_amount', invoice_note = '$quote_note', invoice_url_key = '$url_key', invoice_created_at = NOW(), client_id = $client_id, company_id = $session_company_id");
|
||||
|
||||
$new_invoice_id = mysqli_insert_id($mysqli);
|
||||
|
||||
|
|
@ -1699,8 +1702,9 @@ if(isset($_POST['edit_quote'])){
|
|||
$quote_id = intval($_POST['quote_id']);
|
||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||
$category = intval($_POST['category']);
|
||||
$scope = strip_tags(mysqli_real_escape_string($mysqli,$_POST['scope']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE quotes SET quote_date = '$date', category_id = $category, quote_updated_at = NOW() WHERE quote_id = $quote_id AND company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE quotes SET quote_scope = '$scope', quote_date = '$date', category_id = $category, quote_updated_at = NOW() WHERE quote_id = $quote_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Quote', log_action = 'Modified', log_description = '$quote_id', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ if(isset($_GET['quote_id'])){
|
|||
$row = mysqli_fetch_array($sql);
|
||||
$quote_id = $row['quote_id'];
|
||||
$quote_number = $row['quote_number'];
|
||||
$quote_scope = $row['quote_scope'];
|
||||
$quote_status = $row['quote_status'];
|
||||
$quote_date = $row['quote_date'];
|
||||
$quote_amount = $row['quote_amount'];
|
||||
|
|
|
|||
|
|
@ -73,6 +73,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=quote_number&o=<?php echo $disp; ?>">Number</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_scope&o=<?php echo $disp; ?>">Scope</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 class="text-right"><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_amount&o=<?php echo $disp; ?>">Amount</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_date&o=<?php echo $disp; ?>">Date</a></th>
|
||||
|
|
@ -87,6 +88,7 @@
|
|||
while($row = mysqli_fetch_array($sql)){
|
||||
$quote_id = $row['quote_id'];
|
||||
$quote_number = $row['quote_number'];
|
||||
$quote_scope = $row['quote_scope'];
|
||||
$quote_status = $row['quote_status'];
|
||||
$quote_date = $row['quote_date'];
|
||||
$quote_amount = $row['quote_amount'];
|
||||
|
|
@ -115,6 +117,7 @@
|
|||
|
||||
<tr>
|
||||
<td><a href="quote.php?quote_id=<?php echo $quote_id; ?>"><?php echo $quote_number; ?></a></td>
|
||||
<td><?php echo $quote_scope; ?></td>
|
||||
<td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=quotes"><?php echo $client_name; ?></a></td>
|
||||
<td class="text-right">$<?php echo number_format($quote_amount,2); ?></td>
|
||||
<td><?php echo $quote_date; ?></td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue