Fix Reports and few other minor things

This commit is contained in:
FrancescoUK
2017-12-12 20:58:36 +00:00
parent 323738210b
commit c96c2a69a6
15 changed files with 269 additions and 216 deletions

View File

@@ -252,7 +252,7 @@
);?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_image'), 'items_image', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
@@ -339,183 +339,182 @@
<?php echo form_close(); ?>
<script type="text/javascript">
//validation and submit handling
$(document).ready(function()
//validation and submit handling
$(document).ready(function()
{
$("#new").click(function() {
stay_open = true;
$("#item_form").submit();
});
$("#submit").click(function() {
stay_open = false;
});
var no_op = function(event, data, formatted){};
$("#category").autocomplete({source: "<?php echo site_url('items/suggest_category');?>",delay:10,appendTo: '.modal-content'});
<?php for ($i = 1; $i <= 10; ++$i)
{
$("#new").click(function() {
stay_open = true;
$("#item_form").submit();
});
$("#submit").click(function() {
stay_open = false;
});
var no_op = function(event, data, formatted){};
$("#category").autocomplete({source: "<?php echo site_url('items/suggest_category');?>",delay:10,appendTo: '.modal-content'});
<?php for ($i = 1; $i <= 10; ++$i)
{
?>
$("#custom"+<?php echo $i; ?>).autocomplete({
source:function (request, response) {
$.ajax({
type: "POST",
url: "<?php echo site_url('items/suggest_custom');?>",
dataType: "json",
data: $.extend(request, $extend(csrf_form_base(), {field_no: <?php echo $i; ?>})),
success: function(data) {
response($.map(data, function(item) {
return {
value: item.label
};
}))
}
});
},
delay:10,
appendTo: '.modal-content'});
<?php
}
?>
$("a.fileinput-exists").click(function() {
$.ajax({
type: "GET",
url: "<?php echo site_url("$controller_name/remove_logo/$item_info->item_id"); ?>",
dataType: "json"
})
});
$('#item_form').validate($.extend({
submitHandler: function(form, event) {
$(form).ajaxSubmit({
success: function(response) {
var stay_open = dialog_support.clicked_id() != 'submit';
if (stay_open)
{
// set action of item_form to url without item id, so a new one can be created
$("#item_form").attr("action", "<?php echo site_url("items/save/")?>");
// use a whitelist of fields to minimize unintended side effects
$(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1,' +
'#tax_percent_name_1, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price').val('');
// de-select any checkboxes, radios and drop-down menus
$(':input', '#item_form').not('#item_category_id').removeAttr('checked').removeAttr('selected');
}
else
{
dialog_support.hide();
}
table_support.handle_submit('<?php echo site_url('items'); ?>', response, stay_open);
},
dataType: 'json'
?>
$("#custom" + <?php echo $i; ?>).autocomplete({
source:function (request, response) {
$.ajax({
type: "POST",
url: "<?php echo site_url('items/suggest_custom');?>",
dataType: "json",
data: $.extend(request, $extend(csrf_form_base(), {field_no: <?php echo $i; ?>})),
success: function(data) {
response($.map(data, function(item) {
return {
value: item.label
};
}))
}
});
},
delay: 10,
appendTo: '.modal-content'});
<?php
}
?>
rules:
{
name:"required",
category:"required",
item_number:
{
required: false,
remote:
$("a.fileinput-exists").click(function() {
$.ajax({
type: "GET",
url: "<?php echo site_url("$controller_name/remove_logo/$item_info->item_id"); ?>",
dataType: "json"
})
});
$('#item_form').validate($.extend({
submitHandler: function(form, event) {
$(form).ajaxSubmit({
success: function(response) {
var stay_open = dialog_support.clicked_id() != 'submit';
if (stay_open)
{
url: "<?php echo site_url($controller_name . '/check_item_number')?>",
type: "post",
data: $.extend(csrf_form_base(),
{
"item_id" : "<?php echo $item_info->item_id; ?>",
"item_number" : function()
{
return $("#item_number").val();
},
})
// set action of item_form to url without item id, so a new one can be created
$("#item_form").attr("action", "<?php echo site_url("items/save/")?>");
// use a whitelist of fields to minimize unintended side effects
$(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1,' +
'#tax_percent_name_1, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price').val('');
// de-select any checkboxes, radios and drop-down menus
$(':input', '#item_form').not('#item_category_id').removeAttr('checked').removeAttr('selected');
}
else
{
dialog_support.hide();
}
table_support.handle_submit('<?php echo site_url('items'); ?>', response, stay_open);
},
cost_price:
dataType: 'json'
});
},
rules:
{
name: "required",
category: "required",
item_number:
{
required: false,
remote:
{
url: "<?php echo site_url($controller_name . '/check_item_number')?>",
type: "post",
data: $.extend(csrf_form_base(),
{
"item_id": "<?php echo $item_info->item_id; ?>",
"item_number": function()
{
return $("#item_number").val();
},
})
}
},
cost_price:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
unit_price:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>
<?php echo 'quantity_' . $key ?>:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
unit_price:
{
required:true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>
<?php echo 'quantity_' . $key ?>:
{
required:true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
<?php
}
?>
receiving_quantity:
{
required:true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
reorder_level:
{
required:true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
tax_percent:
{
required:true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
}
},
messages:
{
name:"<?php echo $this->lang->line('items_name_required'); ?>",
item_number: "<?php echo $this->lang->line('items_item_number_duplicate'); ?>",
category:"<?php echo $this->lang->line('items_category_required'); ?>",
cost_price:
{
required:"<?php echo $this->lang->line('items_cost_price_required'); ?>",
number:"<?php echo $this->lang->line('items_cost_price_number'); ?>"
},
unit_price:
{
required:"<?php echo $this->lang->line('items_unit_price_required'); ?>",
number:"<?php echo $this->lang->line('items_unit_price_number'); ?>"
},
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>
<?php echo 'quantity_' . $key ?>:
{
required:"<?php echo $this->lang->line('items_quantity_required'); ?>",
number:"<?php echo $this->lang->line('items_quantity_number'); ?>"
},
<?php
}
?>
receiving_quantity:
{
required:"<?php echo $this->lang->line('items_quantity_required'); ?>",
number:"<?php echo $this->lang->line('items_quantity_number'); ?>"
},
reorder_level:
{
required:"<?php echo $this->lang->line('items_reorder_level_required'); ?>",
number:"<?php echo $this->lang->line('items_reorder_level_number'); ?>"
},
tax_percent:
{
required:"<?php echo $this->lang->line('items_tax_percent_required'); ?>",
number:"<?php echo $this->lang->line('items_tax_percent_number'); ?>"
}
<?php
}
}, form_support.error));
});
</script>
?>
receiving_quantity:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
reorder_level:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
},
tax_percent:
{
required: true,
remote: "<?php echo site_url($controller_name . '/check_numeric')?>"
}
},
messages:
{
name: "<?php echo $this->lang->line('items_name_required'); ?>",
item_number: "<?php echo $this->lang->line('items_item_number_duplicate'); ?>",
category: "<?php echo $this->lang->line('items_category_required'); ?>",
cost_price:
{
required: "<?php echo $this->lang->line('items_cost_price_required'); ?>",
number: "<?php echo $this->lang->line('items_cost_price_number'); ?>"
},
unit_price:
{
required: "<?php echo $this->lang->line('items_unit_price_required'); ?>",
number: "<?php echo $this->lang->line('items_unit_price_number'); ?>"
},
<?php
foreach($stock_locations as $key=>$location_detail)
{
?>
<?php echo 'quantity_' . $key ?>:
{
required: "<?php echo $this->lang->line('items_quantity_required'); ?>",
number: "<?php echo $this->lang->line('items_quantity_number'); ?>"
},
<?php
}
?>
receiving_quantity:
{
required: "<?php echo $this->lang->line('items_quantity_required'); ?>",
number: "<?php echo $this->lang->line('items_quantity_number'); ?>"
},
reorder_level:
{
required: "<?php echo $this->lang->line('items_reorder_level_required'); ?>",
number: "<?php echo $this->lang->line('items_reorder_level_number'); ?>"
},
tax_percent:
{
required: "<?php echo $this->lang->line('items_tax_percent_required'); ?>",
number: "<?php echo $this->lang->line('items_tax_percent_number'); ?>"
}
}
}, form_support.error));
});
</script>

View File

@@ -4,7 +4,7 @@
<?php echo form_open('items/bulk_update/', array('id'=>'item_form', 'class'=>'form-horizontal')); ?>
<fieldset id="bulk_item_basic_info">
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_name'), 'name', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<?php echo form_input(array(
@@ -15,7 +15,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_category'), 'category', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<div class="input-group">
@@ -29,7 +29,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_supplier'), 'supplier', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<?php echo form_dropdown('supplier_id', $suppliers, '', array('class'=>'form-control'));?>
@@ -120,7 +120,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_reorder_level'), 'reorder_level', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-4'>
<?php echo form_input(array(
@@ -131,7 +131,7 @@
</div>
</div>
<div class="form-group form-group-sm">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_description'), 'description', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-8'>
<?php echo form_textarea(array(
@@ -161,8 +161,8 @@
<script type="text/javascript">
//validation and submit handling
$(document).ready(function()
{
$("#category").autocomplete({source: "<?php echo site_url('items/suggest_category');?>",appendTo:'.modal-content',delay:10});
{
$("#category").autocomplete({source: "<?php echo site_url('items/suggest_category');?>", appendTo:'.modal-content', delay:10});
var confirm_message = false;
$("#tax_percent_name_2, #tax_name_2").prop('disabled', true),
@@ -179,7 +179,7 @@ $(document).ready(function()
{
$(form).ajaxSubmit({
beforeSubmit: function(arr, $form, options) {
arr.push({name: 'item_ids', value: table_support.selected_ids().join(":")});
arr.push({name: 'item_ids', value: table_support.selected_ids().join(": ")});
},
success:function(response)
{
@@ -208,26 +208,25 @@ $(document).ready(function()
{
number:true
}
},
messages:
},
messages:
{
unit_price:
{
number:"<?php echo $this->lang->line('items_unit_price_number'); ?>"
number: "<?php echo $this->lang->line('items_unit_price_number'); ?>"
},
tax_percent:
{
number:"<?php echo $this->lang->line('items_tax_percent_number'); ?>"
number: "<?php echo $this->lang->line('items_tax_percent_number'); ?>"
},
quantity:
{
number:"<?php echo $this->lang->line('items_quantity_number'); ?>"
number: "<?php echo $this->lang->line('items_quantity_number'); ?>"
},
reorder_level:
{
number:"<?php echo $this->lang->line('items_reorder_level_number'); ?>"
number: "<?php echo $this->lang->line('items_reorder_level_number'); ?>"
}
}
}, form_support.error));
});

View File

@@ -91,7 +91,7 @@
foreach($inventory_array as $row)
{
$employee = $this->Employee->get_info($row['trans_user']);
array_push($employee_name, $employee->first_name . ' ' . $employee->last_name);
array_push($employee_name, $employee->first_name . ' ' . $employee->last_name);
}
?>
</tbody>
@@ -107,22 +107,22 @@ function display_stock(location_id)
{
var item_quantities = <?php echo json_encode($item_quantities); ?>;
document.getElementById("quantity").value = parseFloat(item_quantities[location_id]).toFixed(<?php echo quantity_decimals(); ?>);
var inventory_data = <?php echo json_encode($inventory_array); ?>;
var employee_data = <?php echo json_encode($employee_name); ?>;
var table = document.getElementById("inventory_result");
// Remove old query from tbody
var rowCount = table.rows.length;
for (var index = rowCount; index > 0; index--)
{
table.deleteRow(index-1);
table.deleteRow(index-1);
}
// Add new query to tbody
for (var index = 0; index < inventory_data.length; index++)
{
for (var index = 0; index < inventory_data.length; index++)
{
var data = inventory_data[index];
if(data['trans_location'] == location_id)
{
@@ -131,17 +131,17 @@ function display_stock(location_id)
var td = document.createElement('td');
td.appendChild(document.createTextNode(data['trans_date']));
tr.appendChild(td);
td = document.createElement('td');
td.appendChild(document.createTextNode(employee_data[index]));
tr.appendChild(td);
td = document.createElement('td');
td.appendChild(document.createTextNode(parseFloat(data['trans_inventory']).toFixed(<?php echo quantity_decimals(); ?>)));
td.setAttribute("style", "text-align:center");
tr.appendChild(td);
td = document.createElement('td');
td = document.createElement('td');
td.appendChild(document.createTextNode(data['trans_comment']));
tr.appendChild(td);

View File

@@ -106,7 +106,7 @@ $(document).ready(function()
dialog_support.hide();
table_support.handle_submit('<?php echo site_url('items'); ?>', response);
},
dataType:'json'
dataType: 'json'
});
},
@@ -122,11 +122,10 @@ $(document).ready(function()
},
messages:
{
newquantity:
{
required:"<?php echo $this->lang->line('items_quantity_required'); ?>",
number:"<?php echo $this->lang->line('items_quantity_number'); ?>"
required: "<?php echo $this->lang->line('items_quantity_required'); ?>",
number: "<?php echo $this->lang->line('items_quantity_number'); ?>"
}
}
});
@@ -137,4 +136,4 @@ function fill_quantity(val)
var item_quantities = <?php echo json_encode($item_quantities); ?>;
document.getElementById("quantity").value = parseFloat(item_quantities[val]).toFixed(<?php echo quantity_decimals(); ?>);
}
</script>
</script>

View File

@@ -76,7 +76,7 @@
<link rel="stylesheet" type="text/css" href="dist/opensourcepos.min.css?rel=1831dfe53b"/>
<!-- end mincss template tags -->
<!-- start minjs template tags -->
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=0310c09977"></script>
<script type="text/javascript" src="dist/opensourcepos.min.js?rel=c496e315c6"></script>
<!-- end minjs template tags -->
<?php endif; ?>