	<div class="d-flex justify-content-between">
		<div>
			<h4 id="html_documento"><?php if (isset($html_documento)) { echo $html_documento; } ?></h4>
		</div>
		
		<div></div>
	</div>
	
	<!-- Datos Clientes -->
	<?php if (isset($cliente)) { ?>
	
		<div class="col-lg-6 col-12">
			<div class="card p-2">
				<div class="d-flex justify-content-between">
					<div>
						<?= $cliente['contacto'] ?> <br>
						<small><?= $cliente['telefono1'] ?></small>
					</div>
					<div><?php if (isset($post)) { echo 'Orden: '. $post['id']; } ?></div>
				</div>
			</div>
		</div>
	<?php  } ?>
	<form id="<?php if (isset($form_doc)) { echo $form_doc; } ?>">
		<!-- Token CSRF -->
      <input type="hidden" name="csrf_test_name" value="<?= csrf_hash(); ?>">

		<div class="col-12">
			<div class="card">
				<div class="row">
					<?php if (isset($cliente['id'])) { ?>
						<div class="col-lg-1 col-3">
							<div class="form-floating">
								<input type="text" class="form-control" name="id_cliente" placeholder="Id_cliente" required="required" value="<?= $cliente['id'] ?>" readonly>
								<label for="id_cliente">Id Cliente</label>
							</div>
						</div>
					<?php } ?>
					
					<?php if (isset($post['id'])) { ?>
						<div class="col-lg-1 col-3">
							<div class="form-floating">
								<input type="text" class="form-control" name="id_orden" placeholder="Id_orden" required="required" value="<?= $post['id'] ?>" readonly>
								<label for="id_orden">Id Orden</label>
							</div>
						</div>
					<?php } ?>
					<?php if (isset($cotizacion['id'])) { ?>
						<div class="col-lg-1 col-3">
							<div class="form-floating">
								<input type="text" class="form-control" name="id_cotizacion" placeholder="id_cotizacion" required="required" value="<?= $cotizacion['id'] ?>" readonly>
								<label for="id_cotizacion">id_cotizacion</label>
							</div>
						</div>
					<?php } ?>
					
				</div>
			</div>
			<div class="card p-2 mb-2">
				<div class="row">
					<div class="col-lg-2 col-md-6 col-6">
						<div class="form-floating">
							<select id="categoria" name="categoria" class="form-select">
								<?php if (isset($cotizacion)) { ?>
									<option value="<?php echo $cotizacion['categoria']; ?>" <?= 'selected' ?> ><?php echo $cotizacion['categoria']; ?></option>
								<?php } ?>
								<option value="Servicio">Servicio</option>
								<option value="Servicio_Repuestos">Servicio y Repuestos</option>
								<option value="Mercancia" >Mercancia</option>
								<option value="Activo">Activo</option>
								<option value="Otros">Otros</option>
							</select>
							<label class="text-muted">Categoria</label>
						</div>
					</div>
					<div class="col-lg-2 col-md-6 col-6">
						<div class="form-floating">
							<select id="vendedor" name="vendedor" class="form-select">
								<?php if (isset($cotizacion)) { ?>
									<option value="<?php echo $cotizacion['vendedor']; ?>" <?= 'selected' ?> ><?php echo $cotizacion['vendedor']; ?></option>
								<?php } ?>
								<option value="Tecnico">Tecnico</option>
								<option value="Epscolor">Epscolor</option>
								<option value="Otro">Otro</option>
							</select>
							<label class="text-muted">Vendedor</label>
						</div>
					</div>
					<div class="col-lg-8 col-12">
						<div class="form-floating">
							<input type="text" class="form-control" name="notas" placeholder=" " value="<?php if (isset($cotizacion)) { echo $cotizacion['notas']; } ?>">
							<label for="notas" class="text-muted">Notas</label>
						</div>
					</div>
					
				</div>
			</div>
			<!-- TABLE ARTICULOS -->
			<div class="card p-2 mb-2">
				<div id="btn_tblar" class="fixed-table-toolbar">
					<button class="btn btn-info btn-sm" title="Editar" id="btn_tblar_edit"><i class="bi bi-pencil"></i></button>
					<button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#modal_productos_list" title="Productos"><span class="bi bi-upc" aria-hidden="true"></span></button>
					<button class="btn btn-danger btn-sm" title="Delete" id="btn_tblar_del"><i class="bi bi-trash"></i></button>
					<!--<button class="btn btn-warning btn-sm" title="Calcular Totales Compra" id="btn_calc_to_tblar" ><i class="bi bi-arrow-clockwise"></i></button>-->
				</div>
				<table id="tblar" class="table table-sm" data-classes="table table-hover" data-toggle="table" data-toolbar="#btn_tblar" data-click-to-select="true" data-select-item-name="rtblar" data-single-select="true" data-show-columns="true" data-pagination="true" data-page-size="10" data-icon-size="sm" data-url="<?php if (isset($articulos)) { echo base_url($articulos);} ?>">
						<thead>
							<tr>
								<th data-field="state" data-checkbox="true"></th>
								<th data-field="id_producto" data-sortable="true" data-visible="false">Id</th>
								<th data-field="codigo" data-sortable="true" data-visible="false">Codigo</th>
								<th data-field="descripcion" data-sortable="true">Descripcion</th>
								<th data-field="cantidad">Cant</th>
								<th data-field="stock" data-visible="false">Stock</th>
								<th data-field="costo_d" data-sortable="true"  
								<?php if ($form_doc ==='form_add_compras') { echo ' data-visible = "true" '; } else { echo ' data-visible = "false" '; } ?> >Costo</th>
								<th data-field="precio_d" data-sortable="true" 
								<?php if ($form_doc ==='form_add_compras') { echo ' data-visible = "false" '; } else { echo ' data-visible = "true" '; } ?>>Precio</th>
								<th data-field="precio_bs" data-visible="false">Precio Bs</th>
								<th data-field="tasa" data-visible="false">tasa</th>
								<th data-field="subtotal_d" data-visible="true">Subtotal</th>                          
								<th data-field="categoria" data-visible="false">Categoria</th>
								<th data-field="condicion" data-visible="false">Condicion</th>
							</tr>
						</thead>
				</table>
			</div>
			<div class="card p-2 mb-2">
				<div class="row">
					<div class="col-6"></div>
					<div class="col-lg-6 order-lg-2">
						<table data-toggle="table" class="table-sm" data-classes="table table-hover" data-cache="false" id="tblarto" data-url="<?php if (isset($articulos_totales)) { echo base_url($articulos_totales); } ?>">
							<thead>
								<tr>
									<th data-field="subtotal_d" data-halign="left">Subtotal</th>
									<th data-field="iva" data-halign="left">Iva
										<select name="sel_iva" id="select_iva" onchange="calc_to_tblar()" class="border-0">
											<?php if (isset($iva)) { foreach ($iva as $iva)
													echo '<option value= "', $iva->iva, '" >', $iva->iva, '</option>';
											} ?>
										</select> %
									</th>
									<th data-field="total_d" data-halign="left">TOTAL</th>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
	
			<?php if (($html_documento == 'Cotizacion') && (isset($post['id'])) ) { ?>
				<div class="card p-2 my-3">
					<div class="row">
						<div class="col-12">
							<label for="informe" class="form-label ps-2"><strong>Informe Tecnico</strong></label>
  							<textarea class="form-control" name="informe"  id="informe" rows="3"><?= $post['informe'] ?></textarea>				
						</div>
					</div>
				</div>

				<?php } ?>
			<!-- BOTON SUBMIT -->
            <div class="card bg-transparent border-0">
               <div class="d-flex justify-content-end ">
                  <button class="btn btn-sm btn-dark btn-enviar " type="submit">Guardar <i class="bi bi-hdd"></i></button>
               </div>
            </div>
		</div>
	</form>