Merge remote-tracking branch 'jekkos/item-kit' into item-kit

This commit is contained in:
Steve Ireland
2017-01-29 23:10:37 -05:00
8 changed files with 87 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
FROM php:5-apache
FROM php:7.0.15-apache
MAINTAINER jekkos
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
php5-apcu \
@@ -7,7 +7,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
libmcrypt-dev
RUN a2enmod rewrite
RUN docker-php-ext-install mysql mysqli bcmath intl gd sockets mbstring mcrypt
RUN docker-php-ext-install mysqli bcmath intl gd sockets mbstring mcrypt
RUN echo "date.timezone = \"\${PHP_TIMEZONE}\"" > /usr/local/etc/php/conf.d/timezone.ini
RUN echo -e “$(hostname -i)\t$(hostname) $(hostname).localhost” >> /etc/hosts

View File

@@ -3,6 +3,7 @@
class Sale_lib
{
private $CI;
private $line_sequence_options = array('0' => 'Standard', '1' => 'Entry', '2' => 'Group by Type', '3' => 'Group by Category');
public function __construct()
{
@@ -327,7 +328,8 @@ class Sale_lib
$insertkey = 0; //Key to use for new entry.
$updatekey = 0; //Key to use to update(quantity)
foreach ($items as $item) {
foreach($items as $item)
{
//We primed the loop so maxkey is 0 the first time.
//Also, we have stored the key in the element itself so we can compare.
@@ -338,7 +340,8 @@ class Sale_lib
if ($item['item_id'] == $item_id && $item['item_location'] == $item_location) {
$itemalreadyinsale = TRUE;
$updatekey = $item['line'];
if (!$item_info->is_serialized) {
if(!$item_info->is_serialized)
{
$quantity = bcadd($quantity, $items[$updatekey]['quantity']);
}
}
@@ -380,7 +383,8 @@ class Sale_lib
'total' => $total,
'discounted_total' => $discounted_total,
'print_option' => $print_option
));
)
);
//add to existing array
$items += $item;
}

View File

@@ -106,8 +106,8 @@ class Receiving extends CI_Model
//Update stock quantity
$item_quantity = $this->Item_quantity->get_item_quantity($item['item_id'], $item['item_location']);
$this->Item_quantity->save(array('quantity' => $item_quantity->quantity + $items_received, 'item_id' => $item['item_id'],
'location_id' => $item['item_location']), $item['item_id'], $item['item_location']);
$this->Item_quantity->save(array('quantity' => $item_quantity->quantity + $items_received, 'item_id' => $item['item_id'],
'location_id' => $item['item_location']), $item['item_id'], $item['item_location']);
$recv_remarks = 'RECV ' . $receiving_id;
$inv_data = array(

View File

@@ -222,13 +222,13 @@ class Sale extends CI_Model
}
if($filters['sale_type'] == 'sales')
{
$this->db->where('sales_items.quantity_purchased > 0');
}
elseif($filters['sale_type'] == 'returns')
{
$this->db->where('sales_items.quantity_purchased < 0');
}
{
$this->db->where('sales_items.quantity_purchased > 0');
}
elseif($filters['sale_type'] == 'returns')
{
$this->db->where('sales_items.quantity_purchased < 0');
}
if($filters['only_invoices'] != FALSE)
{
@@ -550,6 +550,7 @@ class Sale extends CI_Model
}
// if an items was deleted but later returned it's restored with this rule
if($item['quantity'] < 0)
{
$this->Item->undelete($item['item_id']);
@@ -622,20 +623,24 @@ class Sale extends CI_Model
$items = $this->get_sale_items($sale_id)->result_array();
foreach($items as $item)
{
// create query to update inventory tracking
$inv_data = array(
'trans_date' => date('Y-m-d H:i:s'),
'trans_items' => $item['item_id'],
'trans_user' => $employee_id,
'trans_comment' => 'Deleting sale ' . $sale_id,
'trans_location' => $item['item_location'],
'trans_inventory' => $item['quantity_purchased']
);
// update inventory
$this->Inventory->insert($inv_data);
$cur_item_info = $this->Item->get_info($item['item_id']);
// update quantities
$this->Item_quantity->change_quantity($item['item_id'], $item['item_location'], $item['quantity_purchased']);
if ($cur_item_info->stock_type === '0') {
// create query to update inventory tracking
$inv_data = array(
'trans_date' => date('Y-m-d H:i:s'),
'trans_items' => $item['item_id'],
'trans_user' => $employee_id,
'trans_comment' => 'Deleting sale ' . $sale_id,
'trans_location' => $item['item_location'],
'trans_inventory' => $item['quantity_purchased']
);
// update inventory
$this->Inventory->insert($inv_data);
// update quantities
$this->Item_quantity->change_quantity($item['item_id'], $item['item_location'], $item['quantity_purchased']);
}
}
}
@@ -674,7 +679,10 @@ class Sale extends CI_Model
item_unit_price,
discount_percent,
item_location,
<<<<<<< HEAD
print_option,
=======
>>>>>>> upstream/item-kit
items.name as name,
category,
item_type');
@@ -682,13 +690,22 @@ class Sale extends CI_Model
$this->db->join('items as items', 'sales_items.item_id = items.item_id');
$this->db->where('sale_id', $sale_id);
<<<<<<< HEAD
// Entry sequence (this will also render kits in the expected sequence)
if($this->config->item('line_sequence') == '0')
=======
// Entry sequence (this will render kits in the expected sequence)
if($this->config->item('line_sequence') == '1')
>>>>>>> upstream/item-kit
{
$this->db->order_by('line', 'asc');
}
// Group by Stock Type (nonstock first - type 1, stock next - type 0)
<<<<<<< HEAD
elseif($this->config->item('line_sequence') == '1')
=======
elseif($this->config->item('line_sequence') == '2')
>>>>>>> upstream/item-kit
{
$this->db->order_by('stock_type', 'desc');
$this->db->order_by('sales_items.description', 'asc');
@@ -696,14 +713,22 @@ class Sale extends CI_Model
}
// Group by Item Category
<<<<<<< HEAD
elseif($this->config->item('line_sequence') == '2')
=======
elseif($this->config->item('line_sequence') == '3')
>>>>>>> upstream/item-kit
{
$this->db->order_by('category', 'asc');
$this->db->order_by('sales_items.description', 'asc');
$this->db->order_by('items.name', 'asc');
}
<<<<<<< HEAD
// Group by reverse entry sequence in descending sequence (the Standard)
=======
// Group by entry sequence in descending sequence (the Standard)
>>>>>>> upstream/item-kit
else
{
$this->db->order_by('line', 'desc');

View File

@@ -26,8 +26,8 @@ class Detailed_receivings extends Report
array('supplier_name' => $this->lang->line('reports_supplied_by')),
array('total' => $this->lang->line('reports_total'), 'sorter' => 'number_sorter'),
array('payment_type' => $this->lang->line('reports_payment_type')),
array('reference' => $this->lang->line('receivings_reference')),
array('comment' => $this->lang->line('reports_comments'))),
array('comment' => $this->lang->line('reports_comments')),
array('reference' => $this->lang->line('receivings_reference'))),
'details' => array(
$this->lang->line('reports_item_number'),
$this->lang->line('reports_name'),
@@ -42,11 +42,22 @@ class Detailed_receivings extends Report
public function getDataByReceivingId($receiving_id)
{
$this->db->select('receiving_id, receiving_date, SUM(quantity_purchased) AS items_purchased, CONCAT(employee.first_name, " ", employee.last_name) AS employee_name, supplier.company_name AS supplier_name, SUM(subtotal) AS subtotal, SUM(total) AS total, SUM(profit) AS profit, payment_type, comment, reference');
$this->db->select('receiving_id,
MAX(receiving_date) as receiving_date,
SUM(quantity_purchased) AS items_purchased,
MAX(CONCAT(employee.first_name, " ", employee.last_name)) AS employee_name,
MAX(supplier.company_name) AS supplier_name,
SUM(subtotal) AS subtotal,
SUM(total) AS total,
SUM(profit) AS profit,
MAX(payment_type) as payment_type,
MAX(comment) as comment,
MAX(reference) as reference');
$this->db->from('receivings_items_temp');
$this->db->join('people AS employee', 'receivings_items_temp.employee_id = employee.person_id');
$this->db->join('suppliers AS supplier', 'receivings_items_temp.supplier_id = supplier.person_id', 'left');
$this->db->where('receiving_id', $receiving_id);
$this->db->group_by('receiving_id');
return $this->db->get()->row_array();
}
@@ -83,8 +94,8 @@ class Detailed_receivings extends Report
{
$this->db->having('items_purchased = 0');
}
$this->db->group_by('receiving_id');
$this->db->order_by('receiving_date');
$this->db->group_by('receiving_id', 'receiving_date');
$this->db->order_by('receiving_id');
$data = array();
$data['summary'] = $this->db->get()->result_array();

View File

@@ -85,13 +85,13 @@ class Specific_employee extends Report
$this->db->where('employee_id', $inputs['employee_id']);
if ($inputs['sale_type'] == 'sales')
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
{
$this->db->where('quantity_purchased > 0');
}
elseif ($inputs['sale_type'] == 'returns')
{
$this->db->where('quantity_purchased < 0');
}
return $this->db->get()->row_array();
}

View File

@@ -66,6 +66,13 @@
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('config_line_sequence'), 'line_sequence', array('class' => 'control-label col-xs-2')); ?>
<div class='col-xs-2'>
<?php echo form_dropdown('line_sequence', $line_sequence_options, $this->config->item('line_sequence'), array('class' => 'form-control input-sm')); ?>
</div>
</div>
<?php echo form_submit(array(
'name' => 'submit_form',
'id' => 'submit_form',

View File

@@ -168,6 +168,7 @@
</tbody>
</table>
</fieldset>
<?php echo form_close(); ?>
<script type="text/javascript">