<?php   $balance=0;
		$this->db->order_by("trid","desc");
		$chk=$this->db->get_where("transaction",array("userid"=>$depo->uid));
		if($chk->num_rows()>0){
		$l=$chk->row();
		//print_r($l);
		$balance=$l->left_amt;
		}?>
		
        <h6 style="background:#F90; color:#fff; padding:10px;">Available Balance <b class="float-right"><i class="fa fa-inr"></i><?php echo $balance;?>/-</b></h6>
        <hr/>
        <form action="" method="post" id="addmoney">
        	<input type="hidden" name="user" value="<?php echo $depo->uid;?>" id="userid" />
        	<input type="hidden" name="type" value="Debit" />
            <input type="hidden" name="wid" value="<?php echo $depo->wid;?>" />
        	<div class="form-group">
            	<label>Amount</label>
                <input type="number" readonly="readonly" required value="<?php echo round($depo->wamt);?>" name="amount" class="form-control" />
            </div>
            <div class="form-group">
            	<label>Remarks</label>
                <textarea class="form-control" rows="3" name="remarks" id="remarks"></textarea>
            </div>
            <button type="submit" name="submit" class="btn btn-success">Debit</button>
            <a href="#" class="btn btn-danger float-right" id="reject">Reject</a>
        </form>
		
		<script>
		$("#reject").click(function(e){e.preventDefault();
			var remarks=$("#remarks").val();
			if (!confirm("Sure you want to delete?")){return false;}
			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>mcxadmin/ajax_with_reject',
				 data: {id:<?php echo $depo->wid;?>,remarks:remarks,user:<?php echo $depo->uid;?>,amount:'<?php echo $depo->wamt;?>'},
				 success: function(response){
					 alert(response);
					 $("#depo-"+<?php echo $depo->wid;?>).remove();
					}
			});
		});
	    $("#addmoney").submit(function(e){e.preventDefault();

		var formdata=$(this).serialize();

		//console.log(formdata);return false;

		$.ajax({

				 type: "POST",

				 url: '<?php echo base_url();?>mcxadmin/add_money_submit',

				 data: {formdata:formdata},

				 success: function(response){

					 alert(response);
					 	$("#depo-"+<?php echo $depo->wid;?>).remove();
					}

			});

		});

	  </script>