<?php
 
////ini_set('display_erros',1);
session_start();

if($_SESSION["sistema"]!= "1"){ header("location: ../login/index.php"); exit();}

date_default_timezone_set('America/Lima');

require_once ("../../config/Cado.php");


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

if($_POST['action']!="editar"){
$_POST['can'] = 1;
}

?>
<style type="text/css">
.ui-autocomplete
{
    z-index: 99999; 
}
</style>
			<div class="col-lg-12 col-md-12 col-xs-12 " style="">
					<form  id="for_ordtra"  > 
							
<input name="hdd_item_in" id="hdd_item_in" type="hidden" value="<?php echo $_POST['ind']?>">

							
						<div class="box-header with-border">
							<h3 class="box-title">Agregar Item</h3>			
						</div>
						
						<div class="row" >
						
						<div class="col-lg-6 col-sm-4 col-12 ">
							<label for="txt_item_des">Descripcion:</label>								
						

						<textarea name="txt_item_des" rows="4" type="text" class="form-control" 
													id="txt_item_des" 
													><?php echo $_POST['det']?></textarea>
						
						</div>	
						
						<div class="col-lg-3 col-sm-12 col-6">
 							<label for="txt_item_can">Cantidad:</label>
 							<input type="text" id="txt_item_can" name="txt_item_can"  value="<?php echo formato_money($_POST['can'])?>" class="form-control" />
 						</div>
						
						<div class="col-lg-3 col-sm-12 col-6">
 							<label for="txt_item_pre">Precio Unitario:</label>
 							<input type="text" id="txt_item_pre" name="txt_item_pre"  value="<?php echo formato_money($_POST['pre'])?>" class="form-control" />
 						</div>
						
 						</div> 
	
						</form> 
						
			<div class="box-footer float-right ">
				<span  data-dismiss="modal" class="btn btn-default cancel">Cancelar</span>
				<span class="btn btn-primary" id="save_formitem">Guardar</span>
				</div>
				
			</div>
						
<script type="text/javascript">
				
				
	
	$('#txt_item_des').change(function()
	{
		$(this).val($(this).val().toUpperCase());
	});
	
	$('#txt_item_pre').keydown(function(e){
		if (e.which == 13){return false;}
	});

	
	$('#save_formitem').click(function()
	{
		var des = $('#txt_item_des').val();
		var preumi = $('#txt_item_pre').val();
		var can = $('#txt_item_can').val();
		var ind = $('#hdd_item_in').val();
	
		valuni = preumi ;
				
		agregar_producto('agregar','1',can,valuni,'1','','',des,ind);
		
		$('#txt_item_des').val('');
		$('#txt_item_pre').val('');
		$('#txt_item_can').val('');
		$('#txt_item_des').focus();
		
		<?php if($_POST['action']=="editar"){
			
			?>
			$('#div_cotizacion_formitem_dialog').modal('hide');
			<?php
			
		}?>
		
	});
		
			
			
			
			
			
			</script>