<script>
	function get_profit() {
		show_loading();
		jQuery.ajax({
			url: app_url + 'report_cash_profit/get_data',
			type: 'POST',
			dataType: 'JSON',
			data: jQuery('#form_cash').serialize(),
			success: function(response) {
				hide_loading();
				jQuery('#table_cash tbody').html('');
				jQuery(response.data).each(function(adata, bdata) {
					var table = "";
					table += "<tr>";
					table += "	<td>";
					table += bdata.code;
					table += "	</td>";
					table += "	<td>";
					table += bdata.date;
					table += "	</td>";
					table += "	<td>";
					table += bdata.description;
					table += "	</td>";
					table += "	<td align='right'>";
					table += bdata.debet;
					table += "	</td>";
					table += "	<td align='right'>";
					table += bdata.credit;
					table += "	</td>";
					table += "	<td align='right'>";
					table += bdata.balance;
					table += "	</td>";
					table += "<tr>";

					jQuery('#table_cash tbody').append(table);
				});
			},
			error: function(response) {
			}
		});
	}

	get_profit();

	jQuery("#btn_filter").on('click', function() {
		get_profit();
	});

	jQuery('body').on('click', '#btn_export', function() {
		jQuery('#form_cash').submit();
	});