<?php   $balance=0;
		$this->db->order_by("trid","desc");
		$chk=$this->db->get_where("transaction",array("userid"=>$depo->userid));
		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->userid;?>" id="userid" />
        	<input type="hidden" name="type" value="Credit" />
            <input type="hidden" name="depid" value="<?php echo $depo->depid;?>" />
        	<div class="form-group">
            	<label>Amount</label>
                <input type="number" readonly="readonly" required value="<?php echo round($depo->dep_amt);?>" 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">Credit</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_depo_reject',
				 data: {id:<?php echo $depo->depid;?>,remarks:remarks,user:<?php echo $depo->userid;?>,amount:'<?php echo $depo->dep_amt;?>'},
				 success: function(response){
					 alert(response);
					 $("#depo-"+<?php echo $depo->depid;?>).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->depid;?>).remove();

					}

			});

		});

	  </script>