/////MOSTRTAR ITEM EN TABLA///////////////////

function mostrar_carrito(p){
	p = "%"+p+"%";
	
  db.transaction(function(tx){
  tx.executeSql("SELECT * FROM detalle_compra_factoria WHERE descripcion LIKE ?",[p],function(tx,resultado){
      var row = resultado.rows;
      var tr="";
      var i=0;
	  
	     tr+="<table style='width:100%'>";
        tr+="<th>CODIGO</th>";
		tr+="<th>DESCRIPCION</th>";
		tr+="<th>CANTIDAD</th>";
		tr+="<th>PRECIO</th>";
		tr+="<th>IMPORTE</th>";
		tr+="<th>OPCION</th>";
      for(i=0;i<row.length;i++){ 
        var cod_sel = row[i].id_detalle;
        tr+="<tr>";
        tr+="<td><a href='javascript:void(0)' id='"+cod_sel+"'href='javascript:void(0)' onClick='get_item(this.id)'>"+row[i].codigo+"</a></td>";
        tr+="<td>"+row[i].descripcion+"</td>";
		tr+="<td> <a  href='javascript:void(0)' onClick='get_item("+cod_sel+")'>"+numeral(row[i].cantidad).format('0,0.00')+"</a></td>";
		tr+="<td>"+numeral(row[i].precio).format('0,0.00')+"</td>";
		tr+="<td>"+numeral(row[i].subtotal_precio).format('0,0.00')+"</td>";
		tr+="<td align='center'><a href='javascript:void(0)' id='"+cod_sel+"'href='javascript:void(0)' onClick='eliminar("+cod_sel+")'><img src='img/borrar.png' class='icon2'>Borrar</a></td>";

        tr+="</tr>";
      }	
	  tr+="</table>";
      $("#lista").html(tr);
	  suma();
	  cant_items=0;
    
      
      });
    });
}
////////////////////////////////////////////////////////



