. */ use Modules\Anagrafiche\Nazione; use Modules\Anagrafiche\Tipo; include_once __DIR__.'/../../core.php'; $id_nazione_italia = (new Nazione())->getByField('name', 'Italia', Models\Locale::getPredefined()->id); $tipo = get('tipoanagrafica'); $id_tipo = (new Tipo())->getByField('name', $tipo, Models\Locale::getPredefined()->id); $id_tipo_azienda = (new Tipo())->getByField('name', 'Azienda', Models\Locale::getPredefined()->id); if (!empty($tipo)) { $rs = $dbo->fetchArray('SELECT `an_tipianagrafiche`.`id`, `an_tipianagrafiche_lang`.`name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id`='.prepare($id_tipo)); $idtipoanagrafica = $rs[0]['id']; } echo '
{[ "type": "text", "label": "'.tr('Denominazione').'", "name": "ragione_sociale", "id": "ragione_sociale_add", "required": 1 ]}
{[ "type": "select", "label": "'.tr('Tipo di anagrafica').'", "name": "idtipoanagrafica[]", "id": "idtipoanagrafica_add", "multiple": "1", "required": 1, "values": "query=SELECT `an_tipianagrafiche`.`id`, `name` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') WHERE `an_tipianagrafiche`.`id` NOT IN (SELECT DISTINCT(`x`.`idtipoanagrafica`) FROM `an_tipianagrafiche_anagrafiche` x INNER JOIN `an_tipianagrafiche` t ON `x`.`idtipoanagrafica` = `t`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`t`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `x`.`idanagrafica` WHERE `an_tipianagrafiche`.`id` = '.prepare($id_tipo_azienda).' AND `deleted_at` IS NULL) ORDER BY `name`", "value": "'.($idtipoanagrafica ?? null).'", "readonly": '.(!empty(get('readonly_tipo')) ? 1 : 0).' ]}
{[ "type": "text", "label": "'.tr('Cognome').'", "name": "cognome", "id": "cognome_add" ]}
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "id": "nome_add" ]}
'; echo '

'.tr('Dati anagrafici').'

{[ "type": "text", "label": "'.tr('Partita IVA').'", "maxlength": 16, "name": "piva", "id": "piva_add", "class": "text-center alphanumeric-mask", "validation": "partita_iva"]}
{[ "type": "text", "label": "'.tr('Codice fiscale').'", "maxlength": 16, "name": "codice_fiscale", "class": "text-center alphanumeric-mask", "validation": "codice_fiscale" ]}
{[ "type": "select", "label": "'.tr('Tipologia').'", "name": "tipo", "id": "tipo_add", "values": "list=\"Azienda\": \"'.tr('Azienda').'\", \"Ente pubblico\": \"'.tr('Ente pubblico').'\", \"Privato\": \"'.tr('Privato').'\"", "placeholder":"'.tr('Non specificato').'" ]}
{[ "type": "text", "label": "'.tr('Indirizzo').'", "name": "indirizzo" ]}
{[ "type": "text", "label": "'.tr('C.A.P.').'", "name": "cap", "maxlength": 6, "class": "text-center" ]}
{[ "type": "text", "label": "'.tr('Città').'", "name": "citta", "class": "text-center" ]}
{[ "type": "text", "label": "'.tr('Provincia').'", "name": "provincia", "maxlength": 2, "class": "text-center", "extra": "onkeyup=\"this.value = this.value.toUpperCase();\"" ]}
{[ "type": "select", "label": "'.tr('Nazione').'", "name": "id_nazione", "id": "id_nazione_add", "values": "query=SELECT `an_nazioni`.`id` AS id, CONCAT_WS(\' - \', `iso2`, `an_nazioni_lang`.`name`) AS descrizione, `iso2` FROM `an_nazioni` LEFT JOIN `an_nazioni_lang` ON (`an_nazioni`.`id` = `an_nazioni_lang`.`id_record` AND `an_nazioni_lang`.`id_lang` = '.prepare(Models\Locale::getDefault()->id).') ORDER BY CASE WHEN `iso2`=\'IT\' THEN -1 ELSE `iso2` END", "value": "'.$id_nazione_italia.'" ]}
{[ "type": "telefono", "label": "'.tr('Telefono').'", "name": "telefono", "class": "text-center" ]}
{[ "type": "telefono", "label": "'.tr('Cellulare').'", "name": "cellulare", "class": "text-center" ]}
{[ "type": "text", "label": "'.tr('Email').'", "name": "email", "class": "email-mask", "placeholder":"casella@dominio.ext", "icon-before": "", "validation": "email" ]}
{[ "type": "text", "label": "'.tr('PEC').'", "name": "pec", "class": "email-mask", "placeholder":"pec@dominio.ext", "icon-before": "" ]}
'; $help_codice_destinatario = tr("Per impostare il codice specificare prima 'Tipologia' e 'Nazione' dell'anagrafica").':

  • '.tr('Azienda (B2B) - Codice Destinatario, 7 caratteri').'
  • '.tr('Ente pubblico (B2G/PA) - Codice Univoco Ufficio (www.indicepa.gov.it), 6 caratteri').'
  • '.tr('Privato (B2C) - viene utilizzato il Codice Fiscale').'
Se non si conosce il codice destinatario lasciare vuoto il campo. Verrà applicato in automatico quello previsto di default dal sistema (\'0000000\', \'999999\', \'XXXXXXX\').'; echo '
{[ "type": "text", "label": "'.tr('Codice destinatario').'", "name": "codice_destinatario", "class": "text-center text-uppercase alphanumeric-mask", "maxlength": "7", "extra": "", "help": "'.tr($help_codice_destinatario).'", "readonly": "1" ]}
'; echo '
'; ?>