$documento=$dbo->fetchOne("SELECT `in_interventi`.`codice` AS numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `in_interventi` ON (`in_interventi`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Attività' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `in_interventi`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero_esterno` AS numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `co_documenti` ON (`co_documenti`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Fatture di vendita' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `co_documenti`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero`, `ragione_sociale` FROM `zz_notes` INNER JOIN `co_documenti` ON (`co_documenti`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Fatture di acquisto' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `co_documenti`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero`, `ragione_sociale` FROM `zz_notes` INNER JOIN `co_preventivi` ON (`co_preventivi`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Preventivi' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `co_preventivi`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero`, `ragione_sociale` FROM `zz_notes` INNER JOIN `co_contratti` ON (`co_contratti`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Contratti' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `co_contratti`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero_esterno` as numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `or_ordini` ON (`or_ordini`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Ordini cliente' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `or_ordini`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero`, `ragione_sociale` FROM `zz_notes` INNER JOIN `or_ordini` ON (`or_ordini`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Ordini fornitore' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `or_ordini`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero_esterno` as numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `dt_ddt` ON (`dt_ddt`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_lang` FROM `zz_modules_lang` WHERE `title` = 'Ddt in uscita' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `dt_ddt`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `numero`, `ragione_sociale` FROM `zz_notes` INNER JOIN `dt_ddt` ON (`dt_ddt`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Ddt in uscita' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `dt_ddt`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `codice` AS numero FROM `zz_notes` INNER JOIN `mg_articoli` ON (`mg_articoli`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Articoli' AND `id_lang` = ".prepare(setting('Lingua')).")) WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT `matricola` AS numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `my_impianti` ON (`my_impianti`.`id` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Impianti' AND `id_lang` = ".prepare(setting('Lingua')).")) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `my_impianti`.`idanagrafica` WHERE `zz_notes`.`id` = ".$nota->id);
$documento=$dbo->fetchOne("SELECT ' ' AS numero, `ragione_sociale` FROM `zz_notes` INNER JOIN `an_anagrafiche` ON (`an_anagrafiche`.`idanagrafica` = `zz_notes`.`id_record` AND `zz_notes`.`id_module`=(SELECT `id_record` FROM `zz_modules_lang` WHERE `title` = 'Anagrafiche' AND `id_lang` = ".prepare(setting('Lingua')).")) WHERE `zz_notes`.`id` = ".$nota->id);