<commit_before>$(document).ready(function(){

	$(".edit-payments").live("click", function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
				tour_id: my_tour,
				payer_id: my_payer, 
				ajax: 1
		};
		$.ajax({
			type: "get",
			url: base_url + "payment/view_list",
			data: form_data,
			success: function(data){
				show_popup("List of Payments",data, "auto");
			}
		});
	});
	
	$(".add-payment").live("click", function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
			tour_id: my_tour,
			payer_id: my_payer,
			ajax: 1
		};

		$.ajax({
			type: "get",
			data: form_data,
			url: base_url + "payment/create",
			success: function(data){
				$("#payment-list tbody").append(data);
			}
		});
	});
	
	$(".insert-payment").live("click",function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
				tour_id: my_tour,
				payer_id: my_payer,
				amount: $("#amount").val(),
				receipt_date: $("#receipt_date").val(),
				ajax: 1
		};
		$.ajax({
			type: "post",
			data: form_data,
			url: base_url + "payment/insert",
			success: function(data){
				$("#payment-list-box").html(data);
				set_payment_total();
			}
		});
	});
	
	$(".delete-payment").live("click",function(){
		ask = confirm("Are you sure you want to delete this payment? This cannot be undone!");
		if(ask){
			again = confirm("Are you absolutely sure?");
			if(again){
				
				my_id = this.id.split("_")[1];

				form_data = {
						id: my_id
				};
				$.ajax({
						type: "post",
						url: base_url + "payment/delete",
						data: form_data,
						success: function(data){
							$("#payment-row_" + my_id).remove();
							$("#payment-list-box").html(data);
							set_payment_total();
						}
			});
			}
		}
	});
	
});

function set_payment_total(){
	total = $("#total-paid").val();
	$("#amt_paid").val(total);
}<commit_msg>payment auto adjustments: issue #9 in tracker<commit_after>$(document).ready(function(){

	$(".edit-payments").live("click", function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
				tour_id: my_tour,
				payer_id: my_payer, 
				ajax: 1
		};
		$.ajax({
			type: "get",
			url: base_url + "payment/view_list",
			data: form_data,
			success: function(data){
				show_popup("List of Payments",data, "auto");
			}
		});
	});
	
	$(".add-payment").live("click", function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
			tour_id: my_tour,
			payer_id: my_payer,
			ajax: 1
		};

		$.ajax({
			type: "get",
			data: form_data,
			url: base_url + "payment/create",
			success: function(data){
				$("#payment-list tbody").append(data);
			}
		});
	});
	
	$(".insert-payment").live("click",function(){
		my_id = this.id.split("_");
		my_tour = my_id[1];
		my_payer = my_id[2];
		form_data = {
				tour_id: my_tour,
				payer_id: my_payer,
				amount: $("#amount").val(),
				receipt_date: $("#receipt_date").val(),
				ajax: 1
		};
		$.ajax({
			type: "post",
			data: form_data,
			url: base_url + "payment/insert",
			success: function(data){
				$("#payment-list-box").html(data);
				set_payment_total();
			}
		});
	});
	
	$(".delete-payment").live("click",function(){
		ask = confirm("Are you sure you want to delete this payment? This cannot be undone!");
		if(ask){
			again = confirm("Are you absolutely sure?");
			if(again){
				
				my_id = this.id.split("_")[1];

				form_data = {
						id: my_id
				};
				$.ajax({
						type: "post",
						url: base_url + "payment/delete",
						data: form_data,
						success: function(data){
							$("#payment-row_" + my_id).remove();
							$("#payment-list-box").html(data);
							set_payment_total();
						}
			});
			}
		}
	});
	
});

function set_payment_total(){
	total = $("#total-paid").val();
	$("#amt_paid").val(total);
	calculate_cost(1);
}
{'fraction_non_alphanumeric': 0.2068527918781726, 'fraction_numerical': 0.005583756345177665, 'mean_word_length': 3.0255362614913177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '860379', 'n_tokens_mistral': 1876, 'n_tokens_neox': 1498, 'n_words': 275}