+function status_change(e)
+{
+ var ids = [];
+ var form = $(e.target).parents('form:first');
+ var p = $(e.target).parents('p:first');
+ form.find('tr').not('.deleted').find('input.checkbox').each(function(i,e){
+ if ($(this).prop('checked') == true)
+ ids.push($(this).val());
+ });
+
+ var new_status = 0;
+ p.find('input[name="status"]').each(function(i,e){
+ if ($(this).prop('checked') == true)
+ new_status = $(this).val();
+ });
+
+ $.invoke('Sales/SetStatus', {status: new_status, ids: ids}, function(data){
+ for (var i=0; i < ids.length; i++) {
+ show_message('Positionen aktualisiert');
+ var checkbox = form.find('input.checkbox[value="'+ids[i]+'"]');
+ var row = checkbox.parents('tr:first');
+
+ checkbox.prop('checked',false);
+ add_sum(form.find('table:first').attr('id').split('_')[1], checkbox);
+
+ if (row.attr('status') != new_status)
+ row.addClass('deleted').hide();
+ }
+ });
+
+ return false;
+}
+