<?php $__env->startSection('content'); ?>
<script src="<?php echo e(url('js/Productos.js')); ?>"></script>
<div class="container-fluid">

    <div class="row">
		<div class="col-md-8 col-md-offset-2">
			<div class="panel panel-default">
                            <div class="panel-heading"><center>Venta</center></div>
                                <div class="panel-body">
                                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                                <ul class="nav navbar-nav navbar-right">		
                                   <!-- <li><a href="<?php echo e(url('/cajera')); ?>">Opciones</a></li> -->
                                    <!-- <li><a href="<?php echo e(url('/Mod_producto')); ?>"> Atras </a></li>-->
                                 </ul>
                                </div>
				<?php if(count($errors) > 0): ?>
					<div class="alert alert-danger">
                                            <strong>Whoops!</strong> Hay algunos problemas!!!.<br><br>
						<ul>
                                                    <?php foreach($errors->all() as $error): ?>
                                                        <li><?php echo e($error); ?></li>
                                                    <?php endforeach; ?>
						</ul>
					</div>
				<?php endif; ?>
                                <?php if($alert = Session::get('alert-success')): ?>
                                        <div class="alert alert-success">
                                            <?php echo $alert; ?>

                                        </div>
                                <?php endif; ?>               
                           
                                         <div class="form-horizontal">   
					<?php echo Form::open(array('url' =>'/factura', 'method'=>'POST','role'=>'form','id'=>'regForm','name'=>'regForm')); ?>

					<?php echo Form::token(); ?>

                                        <div class="form-group" hidden="">
                                                        <div class="col-md-4 control-label"> 
                                                            <?php echo Form::label('idfactura','Numero Venta'); ?>

                                                        </div>
                                                        <div class="col-md-6">
                                                            <?php echo Form::text('idfactura',$venta,array('class'=>'form-control','readonly')); ?>

							</div>
						</div> 
                                                <div class="form-group">
                                                        <div class="col-md-4 control-label"> 
                                                            <?php echo Form::label('cliente','Cliente'); ?>

                                                        </div>
                                                        <div class="col-md-6">
                                                            <?php echo Form::number('cliente',$datos[0]['Cliente'],array('class'=>'form-control')); ?>

							</div>
                                                    <center><div class="col-md-12" id="clientes"></div></center>
						</div>
                                                <div class="form-group">
                                                        <div class="col-md-4 control-label"> 
                                                            <?php echo Form::label('producto','Producto'); ?>

                                                        </div>
                                                        <div class="col-md-6">
                                                            <?php echo Form::text('producto',@old('producto'),array('class'=>'form-control','id'=>'producto')); ?>

							</div>
                                                    <center> <div class="col-md-12" id="productos"></div></center>
						</div>
                                                <div class="form-group">
                                                        <div class="col-md-4 control-label"> 
                                                            <?php echo Form::label('cantidad','Cantidad'); ?>

                                                        </div>
                                                        <div class="col-md-6">
                                                            <?php echo Form::number('cantidad',@old('cantidad'),array('class'=>'form-control','id'=>'cantidad','required')); ?>

							</div>
						</div>                                             
                                                <div class="form-group">
                                                    <div><center>
								<?php echo Form::submit('Agregar',array('name'=>'Agregar','id'=>'Agregar','class'=>'btn btn-primary')); ?>

                                                        </center></div>
						</div>        
                                           <?php echo Form::close(); ?>

                                                   
                                                <table class="table" border="0" WIDTH=100%>
                                                    <tr>
                                                    <th width="20%">Id Producto</th>
                                                    <th width="25%">Producto</th>
                                                    <th width="10%">Cantidad</th>
                                                    <th width="17%">V. Unidad</th>
                                                    <th width="20%">V. Total</th>
                                                    <th width="20%">Descuento</th>
                                                    <th></th>
                                                    <th></th>
                                                    <!--<th>Eliminar</th>-->
                                                    </tr>
                                                    
                                                    <?php if(!empty($datos[0])): ?>
                                                    <?php foreach($datos as $mostrar): ?>                                                                                                           
                                                    <?php echo Form::open(array('url' =>'em', 'method'=>'POST','role'=>'form','id'=>'regFormm','name'=>'regFormm')); ?>   
                                                        <tr>
                                                        <td><?php echo e($mostrar['idproducto']); ?></td>
                                                        <td><?php echo e($mostrar['Producto']); ?></td>
                                                        <td><?php echo Form::number('cantidad1',$mostrar['Cantidad'],array('class'=>'form-control','id'=>'cantidad1','required')); ?></td>
                                                        <?php echo Form::hidden('cantidada',$mostrar['Cantidad'],array('class'=>'form-control')); ?>

                                                        <td><?php echo e(($mostrar['Valor_unidad']+$mostrar['iva'])); ?></td>
                                                        <td><?php echo e($mostrar['Valor_Total']); ?></td>
                                                        <td><?php echo Form::number('descpa',$mostrar['descuento'],array('class'=>'form-control','id'=>'descpa','required')); ?></td>
                                                        <!--<td><a href="<?php echo e(url('eliminar/'.$mostrar['idproducto'].'/Eliminar')); ?>"><img src="<?php echo e(url('images/Eliminar.png')); ?>" width="30" height="25"></a></td>
                                                        <td><a href="<?php echo e(url('modificar/'.$mostrar['idproducto'].'/Modificar/')); ?>"><img src="<?php echo e(url('images/Modificar.png')); ?>" width="30" height="25"></a></td>-->
                                                        <td><input type="hidden" name="aid" value="<?=$mostrar['idproducto']?>"/>
                                                            <button class="btn btn-xs btn-link" name="em"  value="Eliminar" type="submit" title="Eliminar"><img id="icofor" src="<?php echo e(url('images/Eliminar.png')); ?>" width="25" height="20" alt="Submit"/></button>
                                                            </td>
                                                        <td><button class="btn  btn-xs btn-link" name="em"  value="Modificar" type="submit" title="Modificar"><img id="icofor" src="<?php echo e(url('images/Modificar.png')); ?>" width="25" height="20" alt="Submit"/></button></td>
                                                        
                                                        </tr>
                                                    <?php echo Form::close(); ?>        
                                                     <?php endforeach; ?>
                                                    <?php endif; ?>                                      
                                                 
                                               
                                                    <?php echo Form::open(array('url' =>'/recibo', 'method'=>'POST','role'=>'form','id'=>'regFormv','name'=>'regFormv')); ?>

                                                    <?php echo Form::token(); ?>

                                                    <tr>
                                                        <?php foreach($valor as $valor): ?>
                                                        <td colspan="4" align="right"><?php echo Form::label('stotal','Sub-Total'); ?></td>                                                          
                                                        <td><?php echo Form::text('stotal',$valor->total,array('class'=>'form-control','id'=>'stotal','readonly')); ?></td>
                                                        <?php endforeach; ?>
                                                    </tr>
                                                    <tr>
                                                        <?php foreach($dest as $dest): ?>
                                                            <?php
                                                                //$sl="";
                                                                $sl="readonly";
                                                                $obl="";
                                                                if(($dest->tdesc)>0){
                                                                    $sl="readonly";
                                                                    $obl="required";
                                                                }
                                                            ?>
                                                            
                                                        <td colspan="4" align="right">&nbsp;&nbsp;<?php echo Form::label('descuento','Descuento'); ?></td>
                                                        <td><?php echo Form::number('vdescu',$dest->tdesc,array('class'=>'form-control','id'=>'vdescu',$sl,'onkeyup'=>'descuento()')); ?></td>
                                                        <?php endforeach; ?>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" align="right"><?php echo Form::label('total','Total'); ?></td>                                                          
                                                        <td><?php echo Form::text('total',($valor->total-$dest->tdesc),array('class'=>'form-control','id'=>'total','readonly')); ?></td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" align="right"> <?php echo Form::label('efectivo','Efectivo'); ?></td> 
                                                        <td><?php echo Form::number('efectivo',@old('efectivo'),array('class'=>'form-control','id'=>'efectivo','onkeyup'=>'efectivos()')); ?></td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" align="right"> <?php echo Form::label('cambio','Cambio'); ?></td> 
                                                        <td><?php echo Form::text('cambio',@old('cambio'),array('class'=>'form-control','id'=>'cambio','readonly')); ?></td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" align="right"><?php echo Form::label('formapago','Forma de Pago'); ?></td>
                                                        <td><?php echo Form::select('formapago',@$formapago,@old('formapago'),array('class'=>'form-control','id'=>'formapago','onchange'=>'vptos()')); ?></td>
                                                    </tr>                                                    
                                                    <tr>
                                                        <td colspan="2" align="right"> <?php echo Form::label('Obs','Observaci&oacute;n (Descuento):'); ?></td> 
                                                        <td colspan="6"><?php echo Form::text('obsdes',@old('cambio'),array('class'=>'form-control','id'=>'obsdes','maxlength'=>'250',$obl)); ?></td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" align="right"> <?php echo Form::label('Obspt','Observaci&oacute;n (Tarj./Ptos./Créd.):'); ?></td> 
                                                        <td colspan="6"><?php echo Form::text('obspt',@old('cambio'),array('class'=>'form-control','id'=>'obspt','maxlength'=>'250')); ?></td>
                                                    </tr>
                                                    </table>                                         
                                                           
						                                               
                                                <div class="form-group">
                                                    <div><center>
							<?php echo Form::submit('Generar Venta',array('name'=>'Venta','id'=>'Venta','class'=>'btn btn-primary')); ?>

                                                        </center></div>
						</div>
                                        <?php echo Form::close(); ?>

				</div>
			</div>
		</div>
	</div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>