Add receipt button in takings (#507)

Fix add stock location in store config
Fix stock location filtering in items module
Fix item kits barcode generation
Fix broken form after first submit in all modules
Remove temp js from dist/ (#293)
This commit is contained in:
jekkos
2016-04-27 18:34:10 +02:00
parent 7e088348e0
commit d5d96fa777
13 changed files with 55 additions and 50530 deletions

View File

@@ -152,7 +152,7 @@ class Item_kits extends Secure_area implements iData_controller
// calculate the total cost and retail price of the Kit so it can be added to the barcode text at the bottom
$item_kit = $this->add_totals_to_item_kit($this->Item_kit->get_info($item_kid_id));
$result[] = array('name'=>$item_kit->name, 'item_id'=>'KIT '.$item_kid_id, 'item_number'=>'KIT '.$item_kid_id, 'cost_price'=>$item_kit->total_cost_price, 'unit_price'=>$item_kit->total_unit_price);
$result[] = array('name'=>$item_kit->name, 'item_id'=>urldecode($item_kid_id), 'item_number'=>urldecode($item_kid_id), 'cost_price'=>$item_kit->total_cost_price, 'unit_price'=>$item_kit->total_unit_price);
}
$data['items'] = $result;

View File

@@ -85,6 +85,13 @@ class Sales extends Secure_area
{
$data_rows[] = get_sale_data_row($sale, $this);
}
if ($total_rows > 0)
{
$total_rows++;
$data_rows[] = get_sale_data_last_row($sales, $this);
}
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows,'payment_summary' => $payment_summary));
}

View File

@@ -12,7 +12,8 @@ function get_sales_manage_table_headers()
array('customer' => $CI->lang->line('customers_customer')),
array('amount_tendered' => $CI->lang->line('sales_amount_tendered')),
array('amount_due' => $CI->lang->line('sales_amount_due')),
array('change_due' => $CI->lang->line('sales_change_due'))
array('change_due' => $CI->lang->line('sales_change_due')),
array('receipt' => '&nbsp'),
);
if($CI->config->item('invoice_enable') == TRUE)
@@ -33,17 +34,17 @@ function get_sale_data_last_row($sales, $controller)
$sum_amount_due = 0;
$sum_change_due = 0;
foreach($sales as $key=>$sale)
foreach($sales->result() as $key=>$sale)
{
$sum_amount_tendered += $sale['amount_tendered'];
$sum_amount_due += $sale['amount_due'];
$sum_change_due += $sale['change_due'];
$sum_amount_tendered += $sale->amount_tendered;
$sum_amount_due += $sale->amount_due;
$sum_change_due += $sale->change_due;
}
return array(
'receipt_number' => $CI->lang->line('sales_total'),
'amount_tendered' => to_currency($sum_amount_tendered),
'amount_due' => to_currency($sum_change_due)
'receipt_number' => '<b>'.$CI->lang->line('sales_total').'</b>',
'amount_tendered' => '<b>'. to_currency($sum_amount_tendered).'</b>',
'amount_due' => '<b>'.to_currency($sum_change_due).'</b>'
);
}

View File

@@ -118,6 +118,33 @@ class Item extends CI_Model
return $this->db->get();
}
/*
Returns all the items
*/
public function get_all($stock_location_id=-1, $rows=0, $limit_from=0)
{
$this->db->from('items');
$this->db->join('suppliers', 'suppliers.person_id = items.supplier_id', 'left');
if ($stock_location_id > -1)
{
$this->db->join('item_quantities', 'item_quantities.item_id=items.item_id');
$this->db->where('location_id', $stock_location_id);
}
$this->db->where('items.deleted', 0);
// order by name of item
$this->db->order_by('items.name', 'asc');
if ($rows > 0)
{
$this->db->limit($rows, $limit_from);
}
return $this->db->get();
}
/*
Gets information about a particular item
*/

View File

@@ -12,7 +12,7 @@ $(document).ready(function()
$('#generate_barcodes').click(function()
{
window.open(
'index.php/items/generate_barcodes/'+table_support.selected_ids().join(':'),
'index.php/item_kits/generate_barcodes/'+table_support.selected_ids().join(':'),
'_blank' // <- This is what makes it open in a new window.
);
});

View File

@@ -27,6 +27,10 @@ $(document).ready(function()
table_support.refresh();
});
$("#stock_location").change(function() {
table_support.refresh();
});
table_support.init({
resource: '<?php echo site_url($controller_name);?>',
headers: <?php echo $table_headers; ?>,
@@ -35,6 +39,7 @@ $(document).ready(function()
return $.extend(arguments[0], {
start_date: start_date,
end_date: end_date,
stock_location: $("#stock_location").val(),
filters: $("#filters").val() || [""]
});
}

View File

@@ -62,10 +62,9 @@
<link rel="stylesheet" type="text/css" href="dist/bootstrap.min.css?rel=9ed20b1ee8"/>
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=52c16a3504"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos_bower.css"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=2b273b707f" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=41fc7c17f8" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>

View File

@@ -49292,7 +49292,6 @@ $.tablesorter.addWidget({
var submit = function(button_id) {
return function(dlog_ref) {
btn_id = button_id;
debugger;;
dialog_ref = dlog_ref;
if (button_id == 'submit') {
$('form', dlog_ref.$modalBody).first().submit();
@@ -49501,6 +49500,7 @@ $.tablesorter.addWidget({
url: resource + '/get_row/' + id,
success: function (response) {
table().updateByUniqueId({id: response.id, row: response});
dialog_support.init("tr.selected a.modal-dlg");
highlight_rows();
set_feedback(message, 'alert alert-dismissible alert-success', false);
},

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

@@ -221,6 +221,7 @@
url: resource + '/get_row/' + id,
success: function (response) {
table().updateByUniqueId({id: response.id, row: response});
dialog_support.init("tr.selected a.modal-dlg");
highlight_rows();
set_feedback(message, 'alert alert-dismissible alert-success', false);
},

View File

@@ -62,11 +62,10 @@
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="dist/jquery-ui.css"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=52c16a3504"/>
<link rel="stylesheet" type="text/css" href="dist/opensourcepos_bower.css"/>
<!-- end mincss template tags -->
<link rel="stylesheet" type="text/css" href="templates/spacelab/css/style.css"/>
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=2b273b707f" language="javascript"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=41fc7c17f8" language="javascript"></script>
<!-- end minjs template tags -->
<?php endif; ?>