hm sto sbagliando qualcosa. ci mangio su e poi ci ripenso.
in pratica su 10 righe, ovunque io scriva con l'autocomplete i dati successivi poi vengono scritti sulla seconda riga.

sicuramente toppo qualcosa. dopo mi leggo meglio le funzioni e ci lavoro un po su
intanto posto lo script
Codice PHP:
$(function(){
    var 
nim;
    $(
"[id^=JQdesc_]").autocomplete({
                    
source"../../ajax_articolo.php",
                    
minLength3,
                    
select: function( eventui ) {
                        
nim=ui.item.id.substr(ui.item.id.indexOf('_'));
                        $(
"#JQcodice_"+nim).empty().append(ui.item.codice)
                        $(
"#JQhidCodice_"+nim).val(ui.item.codice)
                        $(
"#JQidArt_"+nim).val(ui.item.id)
                        $(
"#JQprezzo_"+nim).val(ui.item.prezzo_ven)
                        $(
"#JQunita_"+nim).val("1")
                        $(
"#JQprezzoUnita_"+nim).empty().append(ui.item.prezzo_ven)
                        $(
"#JQsconto_"+nim).val("0")
                        $(
"#JQprezzoSconto_"+nim).empty().append(ui.item.prezzo_ven)
                        $(
"#JQiva_"+nim).val(ui.item.iva)
                        $(
"#JQtotale_"+nim).empty().append(function(){$(this).calc(
                                    
// the equation to use for the calculation
                                    
"price+((price/100)*iva)",
                                    
// define the variables used in the equation, these can be a jQuery object
                                    
{
                                        
price: $("input[id^=JQprezzo_]"),
                                        
iva: $("input[id^=JQiva_]")
                                    },
                                    
// define the formatting callback, the results of the calculation are passed to this function
                                    
function (s){
                                        
// return the number as a dollar amount
                                        
return s.toFixed(2);
                                    }
                                )
                            })
                        
recalc()
                        }
                    });

l'assegnazione di nim l'ho fatta dentro a select: function( event, ui ) {
perchè se no ui. non era riconosciuto.