

<style type="text/css">
@media only print {
	.print-modal-content {
	     position: absolute;
	     overflow: auto;
	     width: 100%;
	     height: 100%;
	     z-index: 100000; /* CSS doesn't support infinity */
	}
	.modal-dialog {
		display: none;
	}
}
</style>
<?php $customer_name = get_the_customer($quotation['customer_id'],'customer_name');


// Qrcode
$qrcode_text = 'https://solucionesdc.com.ar';
include(DIR_VENDOR.'/phpqrcode/qrlib.php');
QRcode::png($qrcode_text, ROOT.'/storage/qrcode.png', 'L', 3, 1);
?>
<div id="quotataion-view">
	<div class="logo" style="text-align:center;margin-bottom:10px;">
	<?php if ($store->get('logo')): ?>
	  <img src="<?php echo root_url(); ?>/assets/itsolution24/img/logo-favicons/<?php echo $store->get('logo'); ?>" width="300" height="100">
	<?php else: ?>
	  <img src="<?php echo root_url(); ?>/assets/itsolution24/img/logo-favicons/nologo.png" width="300" height="100">
	<?php endif; ?>
	<?php if ($quotation['status'] == 'presupuesto'):?>
	<h4 style="font-weight:bold;">PRESUPUESTO</h4>
	<?php endif; ?>
	<?php if ($quotation['status'] != 'presupuesto'):?>
	<h4 style="font-weight:bold;">VENTA ANTICIPADA</h4>
	<?php endif; ?>
	</div>
	<table class="table table-bordered table-condensed">
		<tbody>
			<tr>
				<td style="width:50%;vertical-align:top;">
					<h6 style="font-style:italic;font-weight:bold;"><?php echo trans('label_from');?>:</h6>
					<address class="mb-0">
						<h4 style="font-weight:bold;"><?php echo store('name');?></h4>
						<p><?php echo nl2br(store('address'));?></p>
						<?php if ($vat = store('vat_reg_no')):?>
						<span><?php echo trans('label_vat_number');?>: <?php echo $vat;?></span><br>
						<?php endif; ?>
						<?php if (get_preference('invoice_view') == 'indian_gst'):?>
				            <?php if (get_preference('gst_reg_no')):?>
				              <span><?php echo trans('label_gst_reg_no'); ?>: <?php echo get_preference('gst_reg_no'); ?></span>
				            <?php endif;?>
				        <?php endif;?>
						<span><?php echo trans('label_mobile');?>: <?php echo store('mobile');?></span><br>
						<span><?php echo trans('label_email');?>: <?php echo get_preference('smtp_username');?></span><br>
						<span><?php echo trans('label_date');?>: <?php echo format_date($quotation['created_at']);?></span><br>
						<span><?php echo trans('label_reference_no');?>: <?php echo $quotation['reference_no'];?></span><br>
						
						<span><?php echo 'COMPROBANTE NO VALIDO COMO FACTURA' ;?></span><br>
					</address>
				</td>
				<td style="width:50%;vertical-align:top;">
					<h6 style="font-style:italic;font-weight:bold;"><?php echo trans('label_to');?>:</h6>
					<address class="mb-0">
						<h4 style="font-weight:bold;"><?php echo $customer_name;?></h4>
						<p><?php echo nl2br(get_the_customer($quotation['customer_id'],'customer_address'));?></p>
						<span><?php echo trans('label_mobile');?>: <?php echo get_the_customer($quotation['customer_id'],'customer_mobile');?></span><br>
						<span><?php echo trans('label_email');?>: <?php echo get_the_customer($quotation['customer_id'],'customer_email');?></span><br>
						<?php if ($quotation['status'] != 'presupuesto'):?>
						<div class="qrcode">
						  <img src="<?php echo root_url();?>/storage/qrcode.png">
						</div>
						   <?php endif;?>
					</address>
				</td>
			</tr>
		</tbody>
	</table>

	
				<table width="100%"  class="table table-bordered table-condensed">
					<thead>
					<tr class="bg-gray">
						<td style="width:auto; class="text-center">
							<?php echo trans('Cant.'); ?>						</td>
						<td  class="text-center">
							<?php echo trans('label_product'); ?>						</td>
						<td  class=" text-center">
							<?php echo trans('Precio'); ?>						</td>
							<?php if ($quotation['status'] != 'presupuesto'):?>
						<td  class="text-center">
							<?php echo 'Falta Ent.'; ?>						</td>
						<td  class=" text-center"><?php echo 'Ent.'; ?></td>
						 <?php endif;?>
						<td  colspan="2" class=" text-center"><span class=" text-center"><?php echo trans('label_subtotal'); ?></span></td>
						
					  </tr>
					</thead>
					<tbody>
						<?php $inc=1;foreach ($quotation_items as $product) : ?>
							<tr>
								<td class="text-center"><?php echo $product['cantidad_comprada']; ?> </td>
								<td>
									<?php echo $product['item_name']; ?> 								</td>
								<td class="text-right"><?php echo currency_format($product['item_price']); ?>								</td>
									<?php if ($quotation['status'] != 'presupuesto'):?>
								<td class="text-right"><?php echo currency_format($product['item_quantity']); ?>								</td>
								<td><span class="text-right"><?php echo $product['cantidad_entregada']; ?></span>								</td>
								 <?php endif;?>
								<td colspan="2" class="text-right"><?php echo currency_format($product['item_total']); ?></td>
							</tr>
						<?php $inc++;endforeach; ?>
					</tbody>
					<tfoot>
						<tr>
						   
							<td class="text-right"  colspan="5"><span class="text-right"><?php echo trans('label_subtotal'); ?></span></td>
							<td class="text-right"><?php echo currency_format($quotation['subtotal']+$quotation['item_tax']); ?></td>
						</tr>
						<tr>
							
							<td class="text-right"  colspan="5"><span class="text-right"><?php echo trans('label_order_tax'); ?> (+)</span></td>
							<td class="text-right">
								<?php echo currency_format($quotation['order_tax']); ?>							</td>
						</tr>
						
						<tr>
							
							<td class="text-right"  colspan="5"><span class="text-right"><?php echo trans('label_others_charge'); ?> (+) </span></td>
							<td class="text-right">
								<?php echo currency_format($quotation['others_charge']); ?>							</td>
						</tr>
						<tr>
							
							<td class="text-right"  colspan="5"><span class="text-right"><?php echo trans('label_discount'); ?> (-) </span></td>
							<td class="text-right">
								<?php echo currency_format($quotation['discount_amount']); ?>							</td>
						</tr>
						<tr>
							
							<td class="text-right"  colspan="5" style="font-weight:bold"><span class="text-right" style="font-weight:bold"><?php echo trans('label_payable_amount'); ?> </span></td>
							<td class="text-right" style="font-weight:bold">
								<?php echo currency_format($quotation['payable_amount']); ?>							</td>
						</tr>
						<?php if ($quotation['quotation_note']):?>
						<tr>
							<td colspan="6"><b>Observaciones: </b><?php echo $quotation['quotation_note'];?></td>
						</tr>
						<?php endif;?>
						
						<?php if ($quotation['status'] == 'presupuesto'):?>
						<tr>
							<td colspan="6"><b>IMPORTANTE: Los precios aqui descriptos pueden modificarse SIN PREVIO AVISO.</b></td>
							<table class="table margin-b0 table-condensed" style="margin-top:100px;">
				<tr>
					<td style="text-align:center;border:0;"></td>
					<td style="text-align:center;border:0;"></td>
					<td style="text-align:center;border:0;">
						<hr>
						<?php echo trans('Comprobante generado por sys.dc www.solucionesdc.com.ar '); ?>
					</td>
				</tr>
			</table>
						</tr>
						<?php endif;?>
						<?php if ($quotation['status'] != 'presupuesto'):?>
						<tr>
						<table width="100%"  class="table table-bordered table-condensed" >
								    <thead>
            <tr width="100%" class="bg-gray">
              <th colspan="4">DETALLE DE FORMA DE PAGO </th>
              </tr>
            <tr width="100%" class="bg-gray">
               
				 <th>forma de pago</th>
               
				<th>nro Comp</th> 
				<th>fecha</th> 
				<th>Importe</th> 
				<th>Cotizacion</th> 
				<th>Importe</th> 
				
            </tr>
        </thead>
        <tbody>
						     <?php
            include "../admin/conexion_a.php";
			
			
$cod_caja = $quotation['reference_no'];

             $query = mysqli_query($conexion, "SELECT bank_transaction_info.*, bank_transaction_price.*
FROM bank_transaction_info
LEFT JOIN bank_transaction_price ON bank_transaction_info.info_id = bank_transaction_price.info_id WHERE  bank_transaction_info.ref_no = '$cod_caja'");
             

             
            $result = mysqli_num_rows($query);
            if ($result > 0) {
                while ($data = mysqli_fetch_assoc($query)) {
				
				
				
                   
            ?>
                    <tr>
                        
						<td><?php echo  get_the_bank_account($data['account_id'], 'account_details')?></td>
                        
						<td><?php echo  $data['numero_cheque'];?></td>
						<td><?php echo $data['fecha_cheque']; ?></td>
						<td><?php echo currency_format($data['importe_cheque']); ?></td>
						<td><?php echo currency_format($data['cotizacion_dolar']); ?></td>
						<td>
  <?php
    echo ($data['numero_cheque'] == 0)
      ? currency_format($data['amount'])
      : '-';
  ?>

</td>
                    </tr>
            <?php }
            } ?>
			<?php endif;?>
					</tr>	
						
						
						
					</tfoot>
				</table>
			</div>
			<?php if ($quotation['status'] != 'presupuesto'):?>
						<tr>
						<table width="100%"  class="table table-bordered table-condensed" >
								    <thead>
            <tr width="100%" class="bg-gray">
              <th colspan="4">DOCUMENTOS REALCIONADOS DE ENTREGA </th>
              </tr>
            <tr width="100%" class="bg-gray">
               
				    
				<th>Remito Nro</th> 
				<th>fecha</th> 
				<th>Atendido por</th> 
				<th>Notas</th> 
				
            </tr>
        </thead>
        <tbody>
						     <?php
            
			 include "../admin/conexion_a.php";
			
$qreferencia = $quotation['reference_no'];

             $query = mysqli_query($conexion, "SELECT * FROM quotation_entrega WHERE  quotation_id = '$qreferencia'");
            $result = mysqli_num_rows($query);
            if ($result > 0) {
                while ($data = mysqli_fetch_assoc($query)) {
				
				
				
                   
            ?>
                    <tr>
                                               
						<td><?php echo  $data['sell_id'];?></td>
						<td><?php echo $data['fecha']; ?></td>
						<td><?php echo get_the_user($data['user_id'],'username'); ?></td>
						<td><?php echo $data['notas']; ?></td>
						
                    </tr>
            <?php }
            } ?>
			<?php endif;?>
					</tr>	
						
						
						
					</tfoot>
				</table>
			</div>
<?php if ($quotation['status'] != 'presupuesto'):?>
			<table class="table margin-b0 table-condensed" style="margin-top:100px;">
				<tr>
					<td class="w-300" style="text-align:center;border:0;"></td>
					<td class="w-300" style="text-align:center;border:0;"></td>
					<td style="text-align:center;border:0;">
						<hr>
<?php echo trans('IMPORTANTE Los cambios de productos solo se realizan dentro del plazo de 30 dias luego de realizada la compra '); ?>
						<?php echo trans('Comprobante generado por sys.dc www.solucionesdc.com.ar '); ?>
					</td>
				</tr>
			</table>
			<?php endif;?>
			
  
		</div>
	</div>
</div>