fetchArray('SELECT co_tipidocumento.descrizione, dir FROM co_tipidocumento INNER JOIN co_documenti ON co_tipidocumento.id=co_documenti.idtipodocumento WHERE co_documenti.id='.prepare($id_record)); $dir = $rs[0]['dir']; $tipodoc = $rs[0]['descrizione']; $_SESSION['superselect']['idanagrafica'] = $records[0]['idanagrafica']; ?>

{[ "type": "span", "label": "'.tr('Numero fattura').'", "name": "numero","class": "text-center", "value": "$numero$" ]}
'; } ?>
{[ "type": "text", "label": "", "name": "numero_esterno", "class": "text-center", "value": "$numero_esterno$" ]}
{[ "type": "date", "label": "", "maxlength": 10, "name": "data", "required": 1, "value": "$data$" ]}
{[ "type": "select", "label": "", "name": "idstatodocumento", "required": 1, "values": "query=SELECT * FROM co_statidocumento", "value": "$idstatodocumento$", "extra": " onchange = \"if ($('#idstatodocumento option:selected').text()=='Pagato'){if( confirm('Sicuri di voler impostare manualmente la fattura come pagata senza aggiungerla in prima nota?') ){ return true; }else{ $('#idstatodocumento').selectSet(); }}\" " ]}
{[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "ajax-source": "clienti", "value": "$idanagrafica$" ]} {[ "type": "select", "label": "", "name": "idanagrafica", "required": 1, "ajax-source": "fornitori", "value": "$idanagrafica$" ]}
{[ "type": "select", "label": "", "name": "idsede", "ajax-source": "sedi", "value": "$idsede$" ]}
{[ "type": "select", "label": "", "name": "idagente", "ajax-source": "agenti", "value": "$idagente_fattura$" ]}
fetchArray('SELECT * FROM co_scadenziario WHERE iddocumento = '.prepare($id_record)); echo '

'.tr('Scadenze').'

'; foreach ($scadenze as $scadenza) { echo '

'.Translator::dateToLocale($scadenza['scadenza']).' - '.Translator::numberToLocale($scadenza['da_pagare']).'€

'; } echo '
'; } ?>

{[ "type": "select", "label": "", "name": "idtipodocumento", "required": 1, "values": "query=SELECT id, descrizione FROM co_tipidocumento WHERE dir=''", "value": "$idtipodocumento$" ]}
{[ "type": "select", "label": "", "name": "idconto", "required": 1, "value": "$idconto$", "ajax-source": "" ]}
{[ "type": "select", "label": "", "name": "idpagamento", "required": 1, "values": "query=SELECT id, descrizione FROM co_pagamenti GROUP BY descrizione ORDER BY descrizione ASC", "value": "$idpagamento$" ]}
{[ "type": "select", "label": "", "name": "idaspettobeni", "placeholder": "-", "values": "query=SELECT id, descrizione FROM dt_aspettobeni ORDER BY descrizione ASC", "value": "$idaspettobeni$" ]}
{[ "type": "select", "label": "", "name": "idcausalet", "placeholder": "-", "values": "query=SELECT id, descrizione FROM dt_causalet ORDER BY descrizione ASC", "value": "$idcausalet$" ]}
{[ "type": "select", "label": "", "name": "idporto", "placeholder": "-", "values": "query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione ASC", "value": "$idporto$" ]}
{[ "type": "text", "label": "", "name": "n_colli", "value": "$n_colli$" ]}
{[ "type": "select", "label": "", "name": "idspedizione", "values": "query=SELECT id, descrizione FROM dt_spedizione ORDER BY descrizione ASC", "value": "$idspedizione$" ]}
{[ "type": "select", "label": "", "name": "idvettore", "values": "query=SELECT DISTINCT an_anagrafiche.idanagrafica AS id, an_anagrafiche.ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN an_tipianagrafiche_anagrafiche ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE an_tipianagrafiche_anagrafiche.idtipoanagrafica=(SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione='Vettore') ORDER BY descrizione ASC", "value": "$idvettore$"" ]}
{[ "type": "number", "label": "", "name": "bollo", "value": "$bollo$", "help": " Translator::numberToLocale(get_var("Soglia minima per l'applicazione della marca da bollo")), ]),'.'; ?>" ]}
fetchNum($query2); $query3 = 'SELECT SUM(da_pagare-pagato) AS differenza, SUM(da_pagare) FROM co_scadenziario GROUP BY iddocumento HAVING iddocumento='.$id_record.''; $rs3 = $dbo->fetchArray($query3); $differenza = $rs3[0]['differenza']; $da_pagare = $rs3[0]['da_pagare']; if (($n2 <= 0 && $records[0]['stato'] == 'Emessa') || $differenza != 0) { ?> Aggiungi prima nota...

Riapri fattura...
{[ "type": "number", "label": "", "name": "sconto_generico", "value": "$sconto_globale$", "help": "", "icon-after": "choice|untprc|$tipo_sconto_globale$" ]}
{[ "type": "textarea", "label": "", "name": "note", "help": "", "value": "$note$" ]}
{[ "type": "textarea", "label": "", "name": "note_aggiuntive", "help": "", "value": "$note_aggiuntive$" ]}

Righe

fetchArray($qi); $ni = sizeof($rsi); //Se non trovo niente provo a vedere se ce ne sono per clienti terzi if ($ni == 0) { //Lettura interventi non rifiutati, non fatturati e non collegati a preventivi o contratti (clienti terzi) $qi = 'SELECT id FROM in_interventi WHERE idclientefinale='.prepare($records[0]['idanagrafica'])." AND NOT idstatointervento='DENY' AND id NOT IN (SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND id NOT IN (SELECT idintervento FROM co_preventivi_interventi WHERE idintervento IS NOT NULL) AND id NOT IN (SELECT idintervento FROM co_righe_contratti WHERE idintervento IS NOT NULL)"; $rsi = $dbo->fetchArray($qi); $ni = sizeof($rsi); } //Lettura preventivi accettati, in attesa di conferma o in lavorazione $qp = 'SELECT id FROM co_preventivi WHERE idanagrafica='.prepare($records[0]['idanagrafica'])." AND id NOT IN (SELECT idpreventivo FROM co_righe_documenti WHERE NOT idpreventivo=NULL) AND idstato IN( SELECT id FROM co_statipreventivi WHERE descrizione='Accettato' OR descrizione='In lavorazione' OR descrizione='In attesa di conferma')"; $rsp = $dbo->fetchArray($qp); $np = sizeof($rsp); //Lettura contratti accettati, in attesa di conferma o in lavorazione $qc = 'SELECT id FROM co_contratti WHERE idanagrafica='.prepare($records[0]['idanagrafica']).' AND id NOT IN (SELECT idcontratto FROM co_righe_documenti WHERE NOT idcontratto=NULL) AND idstato IN( SELECT id FROM co_staticontratti WHERE fatturabile = 1) AND NOT EXISTS (SELECT id FROM co_righe_documenti WHERE co_righe_documenti.idcontratto = co_contratti.id)'; $rsc = $dbo->fetchArray($qc); $nc = sizeof($rsc); //Lettura ddt $qd = 'SELECT id FROM dt_ddt WHERE idanagrafica='.prepare($records[0]['idanagrafica']); $rsd = $dbo->fetchArray($qd); $nd = sizeof($rsd); if ($ni > 0) { ?> Intervento Intervento 0) { ?> Preventivo Preventivo 0) { ?> Contratto Contratto 0) { echo ' Ddt'; } else { echo ' Ddt'; } } ?> Articolo Riga generica
fetchArray('SELECT piva, codice_fiscale, citta, indirizzo, cap, provincia FROM an_anagrafiche WHERE idanagrafica='.prepare($records[0]['idanagrafica'])); $campi_mancanti = []; if ($rs2[0]['piva'] == '') { if ($rs2[0]['codice_fiscale'] == '') { array_push($campi_mancanti, 'codice fiscale'); } } if ($rs2[0]['citta'] == '') { array_push($campi_mancanti, 'citta'); } if ($rs2[0]['indirizzo'] == '') { array_push($campi_mancanti, 'indirizzo'); } if ($rs2[0]['cap'] == '') { array_push($campi_mancanti, 'C.A.P.'); } if ($dir == 'entrata') { if (sizeof($campi_mancanti) > 0) { echo "
Prima di procedere alla stampa completa i seguenti campi dell'anagrafica:
".implode(', ', $campi_mancanti).'
'.Modules::link('Anagrafiche', $records[0]['idanagrafica'], tr('Vai alla scheda anagrafica'), null).'
'; } else { if ($records[0]['descrizione_tipodoc'] == 'Fattura accompagnatoria di vendita') { ?> Stampa fattura Stampa fattura

{( "name": "filelist_and_upload", "id_module": "", "id_record": "" )}