<div id="loadMaintenanceReceipts">
    <select name="mMaintenanceReceiptId" id="mMaintenanceReceiptId" class="select2 aw_m1">
         <option value="-1">-- اختر --</option>
         {foreach $ReceiptsData as $myRecipt}
         <option value="{$myRecipt->maintenanceReceiptId}">{$myRecipt->receiptserial}</option>
         {/foreach}
    </select>
    <!--<input type="hidden" id="selectedReciptTotalCost" name="selectedReciptTotalCost" value="{$myRecipt->totalCost}"/>-->
</div>




<script>

$("#mMaintenanceReceiptId").change(function(e) {
    
	$id=document.getElementById('mMaintenanceReceiptId').value;
	//alert($id);
	$.ajax({
			 url: "MaintennanceSettlementControllerAjax.php?do=getTotalCost&clientId&id="+$id,
			 type: "get",
			 success: function(data){
					 //alert(data);
					 if(data.length>0&&data != '')
					 {
						document.getElementById("selectedReciptTotalCostLbl1").innerHTML = "الاجمالى : "+data;
						document.getElementById("selectedReciptTotalCostLbl1_hidden").value = data;
						$('select').select2();
					 }
					 else
					 {
						document.getElementById("selectedReciptTotalCostLbl1").innerHTML = "الاجمالى : 0";
						document.getElementById("selectedReciptTotalCostLbl1_hidden").value = 0;	 
					 }
					 calculateRemain();
			  },
			  error:function(){
			  alert("لقد حدث خطأ أثناء إجراء العملية");
		  }   
		}); 
	
		
});	
		


</script>