added fatturazione avanzata to template and imported

This commit is contained in:
2026-07-02 15:20:55 +02:00
parent 1476160a38
commit bef600ae11
6 changed files with 146 additions and 63 deletions
@@ -627,6 +627,7 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
'ClienteResponsabile',
'ClienteFornitore',
'ClienteAnalisi',
'ClienteFatturazione',
'MoltiplicatorePrezzo',
'AnagraficaCertestObject',
'AnagraficaCertestService'
@@ -2183,11 +2184,11 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
'ClienteResponsabile',
'ClienteFornitore',
'ClienteAnalisi',
'ClienteFatturazione', // ← AGGIUNGI QUESTA RIGA
'MoltiplicatorePrezzo',
'AnagraficaCertestObject',
'AnagraficaCertestService'
];
tbody.innerHTML = rows.map(r => {
const type = String(r.data_type || '').toUpperCase();
const dv = r.default_value ?? '';
@@ -2491,11 +2492,22 @@ $apiSampleJson = $template['api_sample_json'] ?? '';
})).filter(x => x.id != null && x.label);
}
if (key === 'ClienteFornitore' || key === 'ClienteAnalisi') {
if (key === 'ClienteFornitore' || key === 'ClienteAnalisi' || key === 'ClienteFatturazione') {
const j = await fetchJson('get_clienti.php');
const list = normalizeList(j, key);
return list.map(x => ({
const isInattivo = (x) => {
const v = x.Inattivo;
return v === true || v === 1 || v === '1' || v === 'true';
};
// Fornitore e Analisi: solo clienti ATTIVI (Inattivo = false)
// Fatturazione: solo clienti INATTIVI (Inattivo = true)
const filtered = (key === 'ClienteFatturazione') ?
list.filter(isInattivo) :
list.filter(x => !isInattivo(x));
return filtered.map(x => ({
id: x.IdCliente ?? x.Id ?? x.id,
label: formatClientLabel(x)
})).filter(x => x.id != null && x.label);