<?php

	require_once ("../formatos/formato.php");

	

	session_start();

	

if(isset($_SESSION['notadebito_asu'])){

	$num_rows=count($_SESSION['notadebito_asu']);

	if($num_rows==0)$num_rows="";

}else{

	$num_rows="";

}

	

	?>

<style>

		#notalm_car_tabla td{

		vertical-align: middle;

		padding: 4px 4px !important;

	}

	#notalm_car_tabla td.editable,#notalm_car_tabla td.editable *{

		cursor: text !important;

		height: 100%; 

		border-bottom-color: #ccc;

		border-bottom-style: dashed; 

		border-bottom-width: 0.5px;

	}

	#notalm_car_tabla td.editando{

		background-color: rgba(18, 180, 243, 0.05);

		outline: 2px solid #35A4F3;

	}

	#notalm_car_tabla td input{

		height: 100%;

		width: 100%;

		box-sizing: border-box;

		display: inline-block;

		border: none;

		background: transparent;

	}

	#notalm_car_tabla td input:focus{

		background: transparent;

		height: 100%;

		width: 100%;

		outline: none;

		border: none;

	}

	#notalm_car_tabla td input[readonly]{

		background: transparent;

	}

</style>

<table cellspacing="1" id="notalm_car_tabla"  class="table table-bordered table-striped" cellpadding="2">

	<thead>

		<tr>

			<th>ASUNTO/MOTIVO</th>

			<th>MONTO</th>

			<th></th>

		</tr>

	</thead>

	<tbody>

		<?php 

		$total = 0;

			if($num_rows>0){

				

				foreach($_SESSION['notadebito_asu'] as $indice=>$asu) {



				$total += $_SESSION['notadebito_mon'][$indice];

		?>

			<tr class="even">

				<td>

					<?php echo $_SESSION['notadebito_asu'][$indice] ?>

				</td>

				<td>

					<?php echo formato_money($_SESSION['notadebito_mon'][$indice]) ?>

				</td>

				

				<td align="center">

					<span title="Eliminar" data-indice="<?php echo $_SESSION['notadebito_asu'][$indice];?>" class="btn btn-danger btn-sm btn_eliminar" ><i class="fa fa-remove"></i></span> 	

				</td>

			</tr>

			<?php 

				}

			}

			?>

	</tbody>

</table>

<input type="hidden" id="hdd_notalm_numite" name="hdd_notalm_numite" value="<?php echo ($numitems)?$numitems:'' ?>">

<script>

	

	$("#txt_notdeb_tot").val(<?php echo $total ?>);

	

	



$( ".btn_eliminar" ).click(function() { 

	var asu = $(this).attr('data-indice');

	if(confirm('¿Seguro de quitar el ítem?')){

		agregar_asunto('quitar', asu);

	}

	});

</script>