Add Employee name to suspended form (#2678)

This commit is contained in:
FrancescoUK
2020-02-16 13:46:25 +00:00
parent e0620e1a3e
commit efd53cbccf
4 changed files with 40 additions and 17 deletions

View File

@@ -1427,14 +1427,13 @@ class Sales extends Secure_Controller
*/
public function suspended()
{
$customer_id = $this->sale_lib->get_customer();
$data = array();
$customer_id = $this->sale_lib->get_customer();
$data['suspended_sales'] = $this->xss_clean($this->Sale->get_all_suspended($customer_id));
$data['dinner_table_enable'] = $this->config->item('dinner_table_enable');
$this->load->view('sales/suspended', $data);
}
/*
/**
* Unsuspended sales are now left in the tables and are only removed
* when they are intentionally cancelled.
*/

View File

@@ -1228,17 +1228,16 @@ class Sale extends CI_Model
{
if($customer_id == -1)
{
$query = $this->db->query("select sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' then quote_number when sale_type = '".SALE_TYPE_WORK_ORDER."' then work_order_number else sale_id end as doc_id, sale_id as suspended_sale_id, sale_status, sale_time, dinner_table_id, customer_id, comment from "
$query = $this->db->query("SELECT sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' THEN quote_number WHEN sale_type = '".SALE_TYPE_WORK_ORDER."' THEN work_order_number else sale_id end as doc_id, sale_id as suspended_sale_id, sale_status, sale_time, dinner_table_id, customer_id, employee_id, comment FROM "
. $this->db->dbprefix('sales') . ' where sale_status = ' . SUSPENDED);
}
else
{
$query = $this->db->query("select sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' then quote_number when sale_type = '".SALE_TYPE_WORK_ORDER."' then work_order_number else sale_id end as doc_id, sale_status, sale_time, dinner_table_id, customer_id, comment from "
$query = $this->db->query("SELECT sale_id, case when sale_type = '".SALE_TYPE_QUOTE."' THEN quote_number WHEN sale_type = '".SALE_TYPE_WORK_ORDER."' THEN work_order_number else sale_id end as doc_id, sale_status, sale_time, dinner_table_id, customer_id, employee_id, comment FROM "
. $this->db->dbprefix('sales') . ' where sale_status = '. SUSPENDED .' AND customer_id = ' . $customer_id);
}
return $query->result_array();
}
/**
@@ -1250,6 +1249,7 @@ class Sale extends CI_Model
{
return NULL;
}
$this->db->from('sales');
$this->db->where('sale_id', $sale_id);

View File

@@ -50,7 +50,7 @@ if (isset($error_message))
<?php
if(isset($customer))
{
?>
?>
<textarea id="customer" rows="5" cols="6"><?php echo $customer_info ?></textarea>
<?php
}
@@ -108,9 +108,9 @@ if (isset($error_message))
if($discount > 0)
{
$quote_columns = $quote_columns + 1;
?>
?>
<th><?php echo $this->lang->line('sales_customer_discount'); ?></th>
<?php
<?php
}
?>
<th><?php echo $this->lang->line('sales_total'); ?></th>

View File

@@ -1,3 +1,12 @@
<style>
@media (min-width: 768px)
{
.modal-dlg .modal-dialog
{
width: 750px !important;
}
}
</style>
<table id="suspended_sales_table" class="table table-striped table-hover">
<thead>
<tr bgcolor="#CCC">
@@ -12,29 +21,30 @@
}
?>
<th><?php echo $this->lang->line('sales_customer'); ?></th>
<th><?php echo $this->lang->line('sales_employee'); ?></th>
<th><?php echo $this->lang->line('sales_comments'); ?></th>
<th><?php echo $this->lang->line('sales_unsuspend_and_delete'); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($suspended_sales as $suspended_sale)
foreach($suspended_sales as $suspended_sale)
{
?>
<tr>
<td><?php echo $suspended_sale['doc_id'];?></td>
<td><?php echo date($this->config->item('dateformat'), strtotime($suspended_sale['sale_time']));?></td>
<td><?php echo $suspended_sale['doc_id']; ?></td>
<td><?php echo date($this->config->item('dateformat'), strtotime($suspended_sale['sale_time'])); ?></td>
<?php
if($this->config->item('dinner_table_enable') == TRUE)
{
?>
<td><?php echo $this->Dinner_table->get_name($suspended_sale['dinner_table_id']);?></td>
<td><?php echo $this->Dinner_table->get_name($suspended_sale['dinner_table_id']); ?></td>
<?php
}
?>
<td>
<?php
if (isset($suspended_sale['customer_id']))
if(isset($suspended_sale['customer_id']))
{
$customer = $this->Customer->get_info($suspended_sale['customer_id']);
echo $customer->first_name . ' ' . $customer->last_name;
@@ -47,11 +57,25 @@
}
?>
</td>
<td><?php echo $suspended_sale['comment'];?></td>
<td>
<?php echo form_open('sales/unsuspend');
echo form_hidden('suspended_sale_id', $suspended_sale['sale_id']);
<?php
if(isset($suspended_sale['employee_id']))
{
$employee = $this->Employee->get_info($suspended_sale['employee_id']);
echo $employee->first_name . ' ' . $employee->last_name;
}
else
{
?>
&nbsp;
<?php
}
?>
</td>
<td><?php echo $suspended_sale['comment']; ?></td>
<td>
<?php echo form_open('sales/unsuspend'); ?>
<?php echo form_hidden('suspended_sale_id', $suspended_sale['sale_id']); ?>
<input type="submit" name="submit" value="<?php echo $this->lang->line('sales_unsuspend'); ?>" id="submit" class="btn btn-primary btn-xs pull-right">
<?php echo form_close(); ?>
</td>