2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
2019-05-24 19:26:59 +02:00
$block_edit = ! empty ( $note_accredito ) || $record [ 'stato' ] == 'Emessa' || $record [ 'stato' ] == 'Pagato' || $record [ 'stato' ] == 'Parzialmente pagato' ;
2018-07-04 12:57:53 +02:00
2017-08-04 16:28:16 +02:00
$rs = $dbo -> 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' ];
2019-05-29 19:17:57 +02:00
unset ( $_SESSION [ 'superselect' ][ 'idanagrafica' ]);
unset ( $_SESSION [ 'superselect' ][ 'idsede_partenza' ]);
unset ( $_SESSION [ 'superselect' ][ 'idsede_destinazione' ]);
$_SESSION [ 'superselect' ][ 'idsede_partenza' ] = $record [ 'idsede_partenza' ];
$_SESSION [ 'superselect' ][ 'idsede_destinazione' ] = $record [ 'idsede_destinazione' ];
2018-07-18 15:20:10 +02:00
$_SESSION [ 'superselect' ][ 'idanagrafica' ] = $record [ 'idanagrafica' ];
2018-02-09 14:25:40 +01:00
$_SESSION [ 'superselect' ][ 'ddt' ] = $dir ;
2018-12-28 19:06:53 +01:00
$_SESSION [ 'superselect' ][ 'split_payment' ] = $record [ 'split_payment' ];
2017-08-31 16:23:26 +02:00
2018-05-24 18:29:37 +02:00
if ( $dir == 'entrata' ) {
2018-06-26 10:25:50 +02:00
$conto = 'vendite' ;
2018-05-24 18:29:37 +02:00
} else {
2018-06-26 10:25:50 +02:00
$conto = 'acquisti' ;
2018-05-24 18:29:37 +02:00
}
2017-08-04 16:28:16 +02:00
?>
2018-02-23 16:04:50 +01:00
< form action = " " method = " post " id = " edit-form " >
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update " >
2018-02-09 14:25:40 +01:00
< input type = " hidden " name = " id_record " value = " <?php echo $id_record ; ?> " >
2017-08-04 16:28:16 +02:00
<!-- INTESTAZIONE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2018-02-09 14:25:40 +01:00
< h3 class = " panel-title " >< ? php echo tr ( 'Intestazione' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
2018-02-11 20:24:29 +01:00
2018-02-09 15:43:51 +01:00
< ? php
2018-07-03 17:28:02 +02:00
2018-02-11 20:24:29 +01:00
if ( $dir == 'entrata' ) {
2019-01-10 18:41:25 +01:00
$rs2 = $dbo -> fetchArray ( 'SELECT piva, codice_fiscale, citta, indirizzo, cap, provincia, id_nazione, tipo FROM an_anagrafiche WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]));
2018-02-11 20:24:29 +01:00
$campi_mancanti = [];
2019-02-12 11:42:48 +01:00
//di default è un azienda e chiedo la partita iva
if ( empty ( $rs2 [ 0 ][ 'piva' ]) and ( empty ( $rs2 [ 0 ][ 'tipo' ]) or $rs2 [ 0 ][ 'tipo' ] == 'Azienda' )) {
2019-01-10 18:41:25 +01:00
array_push ( $campi_mancanti , 'Partita IVA' );
2019-01-10 18:06:15 +01:00
}
2019-02-12 11:42:48 +01:00
//se è un privato o un ente pubblico controllo il codice fiscale
2019-02-07 19:19:11 +01:00
if (( $rs2 [ 0 ][ 'tipo' ] == 'Privato' or $rs2 [ 0 ][ 'tipo' ] == 'Ente pubblico' ) and empty ( $rs2 [ 0 ][ 'codice_fiscale' ])) {
array_push ( $campi_mancanti , 'Codice fiscale' );
}
2019-02-12 11:42:48 +01:00
2018-02-11 20:24:29 +01:00
if ( $rs2 [ 0 ][ 'citta' ] == '' ) {
2018-12-27 23:07:19 +01:00
array_push ( $campi_mancanti , 'Città' );
2018-02-11 20:24:29 +01:00
}
if ( $rs2 [ 0 ][ 'indirizzo' ] == '' ) {
2018-12-27 23:07:19 +01:00
array_push ( $campi_mancanti , 'Indirizzo' );
2018-02-11 20:24:29 +01:00
}
if ( $rs2 [ 0 ][ 'cap' ] == '' ) {
array_push ( $campi_mancanti , 'C.A.P.' );
}
2019-01-03 18:54:09 +01:00
if ( empty ( $rs2 [ 0 ][ 'id_nazione' ])) {
2018-12-27 23:07:19 +01:00
array_push ( $campi_mancanti , 'Nazione' );
}
2018-02-11 20:24:29 +01:00
if ( sizeof ( $campi_mancanti ) > 0 ) {
2018-12-27 23:07:19 +01:00
echo " <div class='alert alert-warning'><i class='fa fa-warning'></i> Prima di procedere alla stampa completa i seguenti campi dell'anagrafica Cliente: <b> " . implode ( ', ' , $campi_mancanti ) . ' </ b >< br />
2018-07-18 15:20:10 +02:00
'.Modules::link(' Anagrafiche ', $record[' idanagrafica '], tr(' Vai alla scheda anagrafica '), null).' </ div > ' ;
2018-02-11 20:24:29 +01:00
}
}
?>
2017-08-04 16:28:16 +02:00
< div class = " row " >
2017-11-07 19:19:52 +01:00
< ? php
if ( $dir == 'uscita' ) {
echo '
< div class = " col-md-3 " >
2018-03-22 13:32:04 +01:00
{[ " type " : " text " , " label " : " '.tr('Numero fattura/protocollo').' " , " required " : 1 , " name " : " numero " , " class " : " text-center alphanumeric-mask " , " value " : " $numero $ " ]}
2017-11-07 19:19:52 +01:00
</ div > ' ;
2018-12-07 12:10:55 +01:00
$label = tr ( 'Numero fattura del fornitore' );
2017-11-07 19:19:52 +01:00
} else {
2018-02-04 17:26:25 +01:00
$label = tr ( 'Numero fattura' );
2017-11-07 19:19:52 +01:00
}
?>
2018-06-26 10:25:50 +02:00
2018-04-03 12:30:12 +02:00
<!-- id_segment -->
{[ " type " : " hidden " , " label " : " Segmento " , " name " : " id_segment " , " class " : " text-center " , " value " : " $id_segment $ " ]}
2018-06-26 10:25:50 +02:00
2017-08-04 16:28:16 +02:00
< div class = " col-md-3 " >
2019-03-08 15:43:36 +01:00
{[ " type " : " text " , " label " : " <?php echo $label ; ?> " , " name " : " numero_esterno " , " class " : " text-center " , " value " : " $numero_esterno $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2019-07-10 15:02:09 +02:00
< div class = " col-md-<?php echo ( $dir == 'entrata') ? '3' : '2'; ?> " >
2018-11-09 11:34:27 +01:00
{[ " type " : " date " , " label " : " <?php echo tr('Data emissione'); ?> " , " name " : " data " , " required " : 1 , " value " : " $data $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-09-27 15:50:03 +02:00
< ? php
$query = 'SELECT * FROM co_statidocumento' ;
if ( empty ( $record [ 'is_fiscale' ])) {
$query .= " WHERE descrizione = 'Bozza' " ;
2018-09-28 09:30:46 +02:00
$plugin = $dbo -> fetchArray ( " SELECT id FROM zz_plugins WHERE name='Fatturazione Elettronica' AND idmodule_to = " . prepare ( $id_module ));
echo '<script>$("#link-tab_' . $plugin [ 0 ][ 'id' ] . '").addClass("disabled");</script>' ;
2018-09-27 15:50:03 +02:00
}
?>
2019-05-29 19:17:57 +02:00
< ? php if ( $dir == 'uscita' ) {
2019-06-04 20:45:40 +02:00
?>
2019-05-29 19:17:57 +02:00
< div class = " col-md-2 " >
{[ " type " : " date " , " label " : " <?php echo tr('Data registrazione'); ?> " , " name " : " data_registrazione " , " required " : 0 , " value " : " $data_registrazione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-12-14 12:50:44 +01:00
2019-05-29 19:17:57 +02:00
< div class = " col-md-2 " >
{[ " type " : " date " , " label " : " <?php echo tr('Data competenza'); ?> " , " name " : " data_competenza " , " required " : 0 , " value " : " $data_competenza $ " ]}
</ div >
< ? php
2019-06-04 20:45:40 +02:00
} ?>
2019-05-29 19:17:57 +02:00
2018-12-14 12:50:44 +01:00
< div class = " col-md-3 " >
2018-12-28 18:03:38 +01:00
< ? php
2018-12-29 12:03:22 +01:00
if ( $dir == 'entrata' ) {
?>
2019-03-15 12:16:20 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato FE'); ?> " , " name " : " codice_stato_fe " , " required " : 0 , " values " : " query=SELECT codice as id, CONCAT_WS(' - ',codice,descrizione) as text FROM fe_stati_documento " , " value " : " $codice_stato_fe $ " , " disabled " : < ? php echo intval ( Plugins\ExportFE\Connection :: isEnabled ()); ?> , "class": "unblockable", "help": "<?php echo (!empty($record['data_stato_fe'])) ? Translator::timestampToLocale($record['data_stato_fe']) : ''; ?>" ]}
2018-12-29 12:03:22 +01:00
< ? php
}
?>
2018-12-14 12:50:44 +01:00
</ div >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " row " >
< div class = " col-md-3 " >
< ? php
2018-01-15 20:28:36 +01:00
2018-07-18 15:20:10 +02:00
echo Modules :: link ( 'Anagrafiche' , $record [ 'idanagrafica' ], null , null , 'class="pull-right"' );
2018-01-15 20:28:36 +01:00
2017-08-04 16:28:16 +02:00
if ( $dir == 'entrata' ) {
?>
2019-02-27 12:19:07 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Cliente'); ?> " , " name " : " idanagrafica " , " required " : 1 , " ajax-source " : " clienti " , " help " : " <?php echo tr( " In caso di autofattura indicare l 'azienda: ").stripslashes($database->fetchOne(' SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting(' Azienda predefinita ')))[' ragione_sociale ' ]); ?> ", "value": "$idanagrafica$" ]}
2017-08-04 16:28:16 +02:00
< ? php
} else {
?>
2018-08-11 15:49:46 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Fornitore'); ?> " , " name " : " idanagrafica " , " required " : 1 , " ajax-source " : " fornitori " , " value " : " $idanagrafica $ " ]}
2017-08-04 16:28:16 +02:00
< ? php
}
?>
</ div >
2019-05-29 19:17:57 +02:00
2019-06-20 16:44:45 +02:00
< ? php
// Conteggio numero articoli fatture
$articolo = $dbo -> fetchArray ( 'SELECT mg_articoli.id FROM ((mg_articoli INNER JOIN co_righe_documenti ON mg_articoli.id=co_righe_documenti.idarticolo) INNER JOIN co_documenti ON co_documenti.id=co_righe_documenti.iddocumento) WHERE co_documenti.id=' . prepare ( $id_record ));
if ( $dir == 'uscita' ) {
2019-05-29 19:17:57 +02:00
?>
2019-06-20 16:44:45 +02:00
< div class = " col-md-3 " >
2019-06-25 17:13:17 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Partenza merce'); ?> " , " name " : " idsede_partenza " , " ajax-source " : " sedi " , " placeholder " : " Sede legale " , " value " : " $idsede_partenza $ " , " icon-after " : " add|<?php echo Modules::get('Anagrafiche')['id']; ?>|id_plugin=<?php echo Plugins::get('Sedi')['id']; ?>&id_parent=<?php echo $record['idanagrafica'] ; ?>||<?php echo (intval( $block_edit )) ? 'disabled' : ''; ?> " ]}
2019-06-20 16:44:45 +02:00
</ div >
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Destinazione merce'); ?> " , " name " : " idsede_destinazione " , " ajax-source " : " sedi_azienda " , " value " : " $idsede_destinazione $ " , " readonly " : " <?php echo (sizeof( $articolo )) ? 1 : 0; ?> " ]}
</ div >
< ? php
} else {
?>
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Partenza merce'); ?> " , " name " : " idsede_partenza " , " ajax-source " : " sedi_azienda " , " placeholder " : " Sede legale " , " value " : " $idsede_partenza $ " , " readonly " : " <?php echo (sizeof( $articolo )) ? 1 : 0; ?> " ]}
</ div >
< div class = " col-md-3 " >
2019-06-25 17:13:17 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Destinazione merce'); ?> " , " name " : " idsede_destinazione " , " ajax-source " : " sedi " , " value " : " $idsede_destinazione $ " , " readonly " : " " , " icon-after " : " add|<?php echo Modules::get('Anagrafiche')['id']; ?>|id_plugin=<?php echo Plugins::get('Sedi')['id']; ?>&id_parent=<?php echo $record['idanagrafica'] ; ?>||<?php echo (intval( $block_edit )) ? 'disabled' : ''; ?> " ]}
2019-06-20 16:44:45 +02:00
</ div >
< ? php
}
?>
2019-05-29 19:17:57 +02:00
< div class = " col-md-3 " >
<!-- TODO : Rimuovere possibilità di selezionare lo stato pagato obbligando l ' utente ad aggiungere il movimento in prima nota -->
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatodocumento " , " required " : 1 , " values " : " query=<?php echo $query ; ?> " , " value " : " $idstatodocumento $ " , " class " : " unblockable " , " extra " : " onchange = \" if ( $ ('#idstatodocumento option:selected').text()=='Pagato' || $ ('#idstatodocumento option:selected').text()=='Parzialmente pagato' ) { if( confirm('<?php echo tr('Sicuro di voler impostare manualmente la fattura come pagata senza aggiungere il movimento in prima nota?'); ?>') ) { return true; }else { $ ('#idstatodocumento').selectSet(<?php echo $record['idstatodocumento'] ; ?>); }} \" " ]}
</ div >
2017-08-04 16:28:16 +02:00
< ? php if ( $dir == 'entrata' ) {
2019-06-29 11:01:26 +02:00
?>
2017-08-04 16:28:16 +02:00
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Agente di riferimento'); ?> " , " name " : " idagente " , " ajax-source " : " agenti " , " value " : " $idagente_fattura $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< ? php
2019-06-29 11:01:26 +02:00
} ?>
2019-05-17 06:00:15 +02:00
</ div >
< hr >
< div class = " row " >
< div class = " col-md-3 " >
<!-- Nella realtà la fattura accompagnatoria non può esistere per la fatturazione elettronica , in quanto la risposta dal SDI potrebbe non essere immediata e le merci in viaggio . Dunque si può emettere una documento di viaggio valido per le merci ed eventualmente una fattura pro - forma per l ' incasso della stessa , emettendo infine la fattura elettronica differita . -->
{[ " type " : " select " , " label " : " <?php echo tr('Tipo fattura'); ?> " , " name " : " idtipodocumento " , " required " : 1 , " values " : " query=SELECT id, descrizione FROM co_tipidocumento WHERE dir='<?php echo $dir ; ?>' AND (reversed = 0 OR id = <?php echo $record['idtipodocumento'] ; ?>) " , " value " : " $idtipodocumento $ " , " readonly " : < ? php echo intval ( $record [ 'stato' ] != 'Bozza' && $record [ 'stato' ] != 'Annullata' ); ?> , "help": "<?php echo ($database->fetchOne('SELECT tipo FROM an_anagrafiche WHERE idanagrafica = '.prepare($record['idanagrafica']))['tipo'] == 'Ente pubblico') ? 'FPA12 - fattura verso PA' : 'FPR12 - fattura verso privati'; ?>" ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Pagamento'); ?> " , " name " : " idpagamento " , " required " : 1 , " values " : " query=SELECT id, CONCAT_WS(' - ', codice_modalita_pagamento_fe, descrizione) AS descrizione, (SELECT id FROM co_banche WHERE id_pianodeiconti3 = co_pagamenti.idconto_<?php echo $conto ; ?> LIMIT 0,1) AS idbanca FROM co_pagamenti GROUP BY descrizione ORDER BY descrizione ASC " , " value " : " $idpagamento $ " , " extra " : " onchange= \" $ ('#idbanca').val( $ (this).find('option:selected').data('idbanca') ).change(); \" " ]}
</ div >
< div class = " col-md-3 " >
2019-06-26 11:42:11 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Banca'); ?> " , " name " : " idbanca " , " values " : " query=SELECT id, CONCAT (nome, ' - ' , iban) AS descrizione FROM co_banche WHERE deleted_at IS NULL ORDER BY nome ASC " , " value " : " $idbanca $ " , " icon-after " : " add|<?php echo Modules::get('Banche')['id']; ?>|| " , " extra " : " <?php echo (intval( $block_edit )) ? 'disabled' : ''; ?> " ]}
2019-05-17 06:00:15 +02:00
</ div >
2017-08-04 16:28:16 +02:00
< ? php
2018-07-18 15:20:10 +02:00
if ( $record [ 'stato' ] != 'Bozza' && $record [ 'stato' ] != 'Annullata' ) {
2019-03-08 16:59:55 +01:00
$ricalcola = true ;
2017-08-04 16:28:16 +02:00
$scadenze = $dbo -> fetchArray ( 'SELECT * FROM co_scadenziario WHERE iddocumento = ' . prepare ( $id_record ));
echo '
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
< p >< strong > '.tr(' Scadenze ').' </ strong ></ p > ' ;
2017-08-04 16:28:16 +02:00
foreach ( $scadenze as $scadenza ) {
echo '
2019-03-08 16:59:55 +01:00
< p > '.Translator::dateToLocale($scadenza[' scadenza ']).' : ' ;
if ( $scadenza [ 'pagato' ] == $scadenza [ 'da_pagare' ]) {
echo '
< strike > ' ;
}
2019-04-13 02:56:39 +02:00
echo moneyFormat ( $scadenza [ 'da_pagare' ]);
2019-03-08 16:59:55 +01:00
if ( $scadenza [ 'pagato' ] == $scadenza [ 'da_pagare' ]) {
echo '
</ strike > ' ;
}
echo '
</ p > ' ;
$ricalcola = empty ( floatval ( $scadenza [ 'pagato' ])) && $ricalcola ;
}
if ( $fattura -> isFE () && $ricalcola && $module [ 'name' ] == 'Fatture di acquisto' ) {
echo '
< button type = " button " class = " btn btn-info btn-xs pull-right tip " title = " '.tr('Ricalcola le scadenze').'. '.tr('Per ricalcolare correttamente le scadenze, imposta la fattura in stato \ ' \ 'Bozza \ ' \ ' e correggi il metodo di come desiderato, poi re-imposta lo stato \ ' \ 'Emessa \ ' \ ' e utilizza questa funzione').'. " id = " ricalcola_scadenze " >
< i class = " fa fa-calculator " aria - hidden = " true " ></ i >
</ button > ' ;
2017-08-04 16:28:16 +02:00
}
2019-03-08 16:59:55 +01:00
2017-08-04 16:28:16 +02:00
echo '
</ div > ' ;
}
?>
</ div >
2018-12-28 18:03:38 +01:00
2017-08-04 16:28:16 +02:00
< div class = " row " >
2018-12-28 18:03:38 +01:00
< div class = " col-md-3 " >
2019-03-27 10:47:06 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Split payment'); ?> " , " name " : " split_payment " , " value " : " $split_payment $ " , " help " : " <?php echo tr('Abilita lo split payment per questo documento. Le aliquote iva con natura N6 (reverse charge) non saranno disponibili.'); ?> " , " placeholder " : " <?php echo tr('Split payment'); ?> " ]}
2018-12-28 18:03:38 +01:00
</ div >
2019-03-08 16:59:55 +01:00
2019-01-10 15:19:17 +01:00
< ? php
2019-01-10 18:41:25 +01:00
//TODO: Fattura per conto del fornitore (es. cooperative agricole che emettono la fattura per conto dei propri soci produttori agricoli conferenti)
if ( $dir == 'entrata' ) {
?>
2019-01-10 15:19:17 +01:00
< div class = " col-md-3 " >
2019-02-27 12:19:07 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Fattura per conto terzi'); ?> " , " name " : " is_fattura_conto_terzi " , " value " : " $is_fattura_conto_terzi $ " , " help " : " <?php echo tr('Nell \ 'xml della FE imposta il fornitore ('.stripslashes( $database->fetchOne ('SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica = '.prepare(setting('Azienda predefinita')))['ragione_sociale']).') come cessionario e il cliente come cedente/prestatore.'); ?> " , " placeholder " : " <?php echo tr('Fattura per conto terzi'); ?> " ]}
2019-01-10 15:19:17 +01:00
</ div >
2019-03-08 16:59:55 +01:00
2019-01-10 15:19:17 +01:00
< ? php
2019-01-10 18:41:25 +01:00
}
?>
2019-02-15 12:12:44 +01:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Ritenuta contributi'); ?> " , " name " : " id_ritenuta_contributi " , " value " : " $id_ritenuta_contributi $ " , " values " : " query=SELECT * FROM co_ritenuta_contributi " ]}
</ div >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2019-02-26 11:01:35 +01:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " help " : " <?php echo tr('Note visibili anche in fattura.'); ?> " , " value " : " $note $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2019-02-12 11:42:48 +01:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note aggiuntive'); ?> " , " name " : " note_aggiuntive " , " help " : " <?php echo tr('Note interne.'); ?> " , " value " : " $note_aggiuntive $ " , " class " : " unblockable " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2018-09-24 11:24:48 +02:00
< ? php
2019-05-10 02:50:01 +02:00
echo '
< div class = " box box-info " >
< div class = " box-header with-border " >
2019-05-10 03:32:28 +02:00
< h3 class = " box-title " >< i class = " fa fa-certificate " ></ i > '.tr(' Marca da bollo ').' </ h3 >
2019-05-10 02:50:01 +02:00
</ div >
< div class = " box-body " >
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " checkbox " , " label " : " '.tr('Addebita marca da bollo').' " , " name " : " addebita_bollo " , " value " : " $addebita_bollo $ " ]}
</ div >
< div class = " col-md-4 " >
2019-05-10 03:32:28 +02:00
{[ " type " : " checkbox " , " label " : " '.tr('Marca da bollo automatica').' " , " name " : " bollo_automatico " , " value " : " '.intval(!isset( $record['bollo'] )).' " , " help " : " '.tr( " Seleziona per impostare automaticamente l 'importo della marca da bollo").' . '.tr(' Applicata solo se il totale della fattura è maggiore di _MONEY_ ' , [
'_MONEY_' => moneyFormat ( setting ( " Soglia minima per l'applicazione della marca da bollo " )),
]) . '.", "placeholder": "' . tr ( 'Bollo automatico' ) . ' " ]}
2019-05-10 02:50:01 +02:00
</ div >
< div class = " col-md-4 " >
2019-05-10 03:32:28 +02:00
{[ " type " : " number " , " label " : " '.tr('Importo marca da bollo').' " , " name " : " bollo " , " value " : " $bollo $ " , " disabled " : '.intval(!isset($record[' bollo '])).' ]}
2019-05-10 02:50:01 +02:00
</ div >
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
$ ( " #bollo_automatico " ) . click ( function (){
$ ( " #bollo " ) . attr ( " disabled " , $ ( this ) . is ( " :checked " ));
});
});
</ script >
</ div >
</ div >
</ div > ' ;
2018-09-24 11:24:48 +02:00
if ( $tipodoc == 'Fattura accompagnatoria di vendita' ) {
echo '
< div class = " box box-info " >
< div class = " box-header with-border " >
< h3 class = " box-title " >< i class = " fa fa-edit " ></ i > '.tr(' Dati Fattura accompagnatoria ').' </ h3 >
</ div >
< div class = " box-body " >
< div class = " row " >
< div class = " col-md-3 " >
2018-11-30 16:10:15 +01:00
{[ " type " : " select " , " label " : " '.tr('Aspetto beni').' " , " name " : " idaspettobeni " , " placeholder " : " " , " ajax-source " : " aspetto-beni " , " value " : " $idaspettobeni $ " , " icon-after " : " add|'.Modules::get('Aspetto beni')['id'].'||'.(( $record['stato'] != 'Bozza') ? 'disabled' : '').' " ]}
2018-09-24 11:24:48 +02:00
</ div >
< div class = " col-md-3 " >
2018-11-30 16:10:15 +01:00
{[ " type " : " select " , " label " : " '.tr('Causale trasporto').' " , " name " : " idcausalet " , " placeholder " : " " , " ajax-source " : " causali " , " value " : " $idcausalet $ " , " icon-after " : " add|'.Modules::get('Causali')['id'].'||'.(( $record['stato'] != 'Bozza') ? 'disabled' : '').' " ]}
2018-09-24 11:24:48 +02:00
</ div >
< div class = " col-md-3 " >
2018-11-28 02:10:12 +01:00
{[ " type " : " select " , " label " : " '.tr('Porto').' " , " name " : " idporto " , " placeholder " : " " , " values " : " query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione ASC " , " value " : " $idporto $ " ]}
2018-09-24 11:24:48 +02:00
</ div >
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " '.tr('Num. colli').' " , " name " : " n_colli " , " value " : " $n_colli $ " ]}
</ div >
</ div >
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Tipo di spedizione').' " , " name " : " idspedizione " , " values " : " query=SELECT id, descrizione FROM dt_spedizione ORDER BY descrizione ASC " , " value " : " $idspedizione $ " ]}
</ div >
< div class = " col-md-3 " >
2018-11-30 16:10:15 +01:00
{[ " type " : " select " , " label " : " '.tr('Vettore').' " , " name " : " idvettore " , " ajax-source " : " vettori " , " value " : " $idvettore $ " , " icon-after " : " add|'.Modules::get('Anagrafiche')['id'].'|tipoanagrafica=Vettore|'.((( $record['idspedizione'] != 3) and ( $record['stato'] == 'Bozza')) ? '' : 'disabled').' " , " disabled " : '.intval($record[' idspedizione '] == 3).' , " required " : '.intval($record[' idspedizione '] != 3).' ]}
2018-09-24 11:24:48 +02:00
</ div >
2018-11-23 16:48:30 +01:00
< script >
$ ( " #idspedizione " ) . change ( function (){
if ( $ ( this ) . val () == 3 ) {
$ ( " #idvettore " ) . attr ( " required " , false );
2018-11-27 01:00:48 +01:00
$ ( " #idvettore " ) . attr ( " disabled " , true );
2018-11-27 11:43:22 +01:00
$ ( " label[for=idvettore] " ) . text ( " '.tr('Vettore').' " );
2019-07-08 18:10:52 +02:00
$ ( " #idvettore " ) . selectReset ( " '.tr( " Seleziona un 'opzione").' " );
2018-11-27 11:43:22 +01:00
$ ( " #idvettore " ) . next () . next () . find ( " button.bound:nth-child(1) " ) . prop ( " disabled " , true );
2018-11-23 16:48:30 +01:00
} else {
$ ( " #idvettore " ) . attr ( " required " , true );
2018-11-27 01:00:48 +01:00
$ ( " #idvettore " ) . attr ( " disabled " , false );
2018-11-27 11:43:22 +01:00
$ ( " label[for=idvettore] " ) . text ( " '.tr('Vettore').'* " );
$ ( " #idvettore " ) . next () . next () . find ( " button.bound:nth-child(1) " ) . prop ( " disabled " , false );
}
});
2018-12-07 09:39:42 +01:00
2018-11-27 11:43:22 +01:00
$ ( " #idcausalet " ) . change ( function (){
if ( $ ( this ) . val () == 3 ) {
$ ( " #tipo_resa " ) . attr ( " disabled " , false );
} else {
$ ( " #tipo_resa " ) . attr ( " disabled " , true );
2018-11-23 16:48:30 +01:00
}
});
</ script > ' ;
$tipo_resa = [
[
'id' => 'EXW' ,
'text' => 'EXW' ,
],
[
'id' => 'FCA' ,
'text' => 'FCA' ,
],
[
'id' => 'FAS' ,
'text' => 'FAS' ,
],
[
'id' => 'FOB' ,
'text' => 'FOB' ,
],
[
'id' => 'CFR' ,
'text' => 'CFR' ,
],
[
'id' => 'CIF' ,
'text' => 'CIF' ,
],
[
'id' => 'CPT' ,
'text' => 'CPT' ,
],
[
'id' => 'CIP' ,
'text' => 'CIP' ,
],
[
'id' => 'DAF' ,
'text' => 'DAF' ,
],
[
'id' => 'DES' ,
'text' => 'DES' ,
],
[
'id' => 'DEQ' ,
'text' => 'DEQ' ,
],
[
'id' => 'DDU' ,
'text' => 'DDU' ,
],
[
'id' => 'DDP' ,
'text' => 'DDP' ,
2018-11-30 16:10:15 +01:00
],
2018-11-23 16:48:30 +01:00
];
echo '
< div class = " col-md-3 " >
2018-11-27 01:00:48 +01:00
{[ " type " : " select " , " label " : " '.tr('Tipo Resa').' " , " name " : " tipo_resa " , " value " : " $tipo_resa $ " , " values " : '.json_encode($tipo_resa).' , " readonly " : '.intval($record[' causale_desc '] != ' Reso ').' ]}
2018-11-23 16:48:30 +01:00
</ div >
2018-09-24 11:24:48 +02:00
</ div >
</ div >
</ div > ' ;
}
?>
2017-08-04 16:28:16 +02:00
</ form >
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Righe </ h3 >
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-12 " >
< div class = " pull-left " >
< ? php
2019-05-24 19:26:59 +02:00
if ( ! $block_edit ) {
2018-07-18 15:20:10 +02:00
if ( empty ( $record [ 'ref_documento' ])) {
2018-07-03 17:28:02 +02:00
if ( $dir == 'entrata' ) {
// Lettura interventi non rifiutati, non fatturati e non collegati a preventivi o contratti
2018-09-03 15:29:55 +02:00
$int_query = 'SELECT COUNT(*) AS tot FROM in_interventi INNER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]) . ' AND in_statiintervento.completato=1 AND in_interventi.id NOT IN (SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND in_interventi.id_preventivo IS NULL AND in_interventi.id NOT IN (SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL)' ;
2018-02-09 14:25:40 +01:00
$interventi = $dbo -> fetchArray ( $int_query )[ 0 ][ 'tot' ];
2017-08-04 16:28:16 +02:00
2018-07-03 17:28:02 +02:00
// Se non trovo niente provo a vedere se ce ne sono per clienti terzi
if ( empty ( $interventi )) {
// Lettura interventi non rifiutati, non fatturati e non collegati a preventivi o contratti (clienti terzi)
2018-09-03 15:29:55 +02:00
$int_query = 'SELECT COUNT(*) AS tot FROM in_interventi INNER JOIN in_statiintervento ON in_interventi.idstatointervento=in_statiintervento.idstatointervento WHERE idclientefinale=' . prepare ( $record [ 'idanagrafica' ]) . ' AND in_statiintervento.completato=1 AND in_interventi.id NOT IN (SELECT idintervento FROM co_righe_documenti WHERE idintervento IS NOT NULL) AND in_interventi.id_preventivo IS NULL AND in_interventi.id NOT IN (SELECT idintervento FROM co_promemoria WHERE idintervento IS NOT NULL)' ;
2018-07-03 17:28:02 +02:00
$interventi = $dbo -> fetchArray ( $int_query )[ 0 ][ 'tot' ];
}
echo '
2018-08-30 13:06:59 +02:00
< div class = " tip " data - toggle = " tooltip " title = " '.tr('Interventi completati non collegati a preventivi o contratti e che non siano già stati fatturati.').' " style = " display:inline; " >
2018-10-25 17:11:02 +02:00
< a class = " btn btn-sm btn-primary '.(!empty( $interventi ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/fatture/add_intervento.php?id_module='. $id_module .'&id_record='. $id_record .' " data - title = " Aggiungi intervento " >
2017-09-19 17:27:31 +02:00
< i class = " fa fa-plus " ></ i > Intervento
2018-07-27 16:17:14 +02:00
</ a >
</ div > ' ;
2017-09-19 17:27:31 +02:00
2018-07-03 17:28:02 +02:00
// Lettura preventivi accettati, in attesa di conferma o in lavorazione
2019-02-14 17:49:58 +01:00
$prev_query = 'SELECT COUNT(*) AS tot FROM co_preventivi WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]) . " AND idstato IN(SELECT id FROM co_statipreventivi WHERE descrizione='Accettato' OR descrizione='In lavorazione' OR descrizione='In attesa di conferma') AND default_revision=1 AND co_preventivi.id IN (SELECT idpreventivo FROM co_righe_preventivi WHERE co_righe_preventivi.idpreventivo = co_preventivi.id AND (qta - qta_evasa) > 0) " ;
2018-07-03 17:28:02 +02:00
$preventivi = $dbo -> fetchArray ( $prev_query )[ 0 ][ 'tot' ];
echo '
2018-07-27 16:17:14 +02:00
< div class = " tip " data - toggle = " tooltip " title = " '.tr('Preventivi accettati, in attesa di conferma o in lavorazione.').' " style = " display:inline; " >
2018-10-25 17:11:02 +02:00
< a class = " btn btn-sm btn-primary '.(!empty( $preventivi ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/fatture/add_preventivo.php?id_module='. $id_module .'&id_record='. $id_record .' " data - title = " Aggiungi preventivo " >
2017-09-19 17:27:31 +02:00
< i class = " fa fa-plus " ></ i > Preventivo
2018-07-27 16:17:14 +02:00
</ a >
</ div > ' ;
2017-08-04 16:28:16 +02:00
2018-07-03 17:28:02 +02:00
// Lettura contratti accettati, in attesa di conferma o in lavorazione
2019-03-22 11:35:26 +01:00
$contr_query = 'SELECT COUNT(*) AS tot FROM co_contratti WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]) . ' AND idstato IN( SELECT id FROM co_staticontratti WHERE is_fatturabile = 1) AND co_contratti.id IN (SELECT idcontratto FROM co_righe_contratti WHERE co_righe_contratti.idcontratto = co_contratti.id AND (qta - qta_evasa) > 0)' ;
2018-07-03 17:28:02 +02:00
$contratti = $dbo -> fetchArray ( $contr_query )[ 0 ][ 'tot' ];
echo '
2018-07-27 16:17:14 +02:00
< div class = " tip " data - toggle = " tooltip " title = " '.tr('Contratti accettati, in attesa di conferma o in lavorazione.').' " style = " display:inline; " >
2018-10-25 17:11:02 +02:00
< a class = " btn btn-sm btn-primary '.(!empty( $contratti ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/fatture/add_contratto.php?id_module='. $id_module .'&id_record='. $id_record .' " data - title = " Aggiungi contratto " >
2017-09-19 17:27:31 +02:00
< i class = " fa fa-plus " ></ i > Contratto
2018-07-27 16:17:14 +02:00
</ a >
</ div > ' ;
2018-07-03 17:28:02 +02:00
}
2018-06-26 10:25:50 +02:00
2018-07-28 18:02:17 +02:00
// Lettura ddt
2018-08-03 09:34:06 +02:00
$ddt_query = 'SELECT COUNT(*) AS tot FROM dt_ddt WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]) . ' AND idstatoddt IN (SELECT id FROM dt_statiddt WHERE descrizione IN(\'Bozza\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoddt IN (SELECT id FROM dt_tipiddt WHERE dir=' . prepare ( $dir ) . ') AND dt_ddt.id IN (SELECT idddt FROM dt_righe_ddt WHERE dt_righe_ddt.idddt = dt_ddt.id AND (qta - qta_evasa) > 0)' ;
2018-07-28 18:02:17 +02:00
$ddt = $dbo -> fetchArray ( $ddt_query )[ 0 ][ 'tot' ];
echo '
2018-10-25 17:11:02 +02:00
< a class = " btn btn-sm btn-primary'.(!empty( $ddt ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/fatture/add_ddt.php?id_module='. $id_module .'&id_record='. $id_record .' " data - toggle = " tooltip " data - title = " Aggiungi ddt " >
2018-07-26 10:35:48 +02:00
< i class = " fa fa-plus " ></ i > Ddt
</ a > ' ;
2018-06-26 10:25:50 +02:00
2018-07-03 17:28:02 +02:00
// Lettura ordini
2018-07-18 15:20:10 +02:00
$ordini_query = 'SELECT COUNT(*) AS tot FROM or_ordini WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]) . ' AND idstatoordine IN (SELECT id FROM or_statiordine WHERE descrizione IN(\'Bozza\', \'Evaso\', \'Parzialmente evaso\', \'Parzialmente fatturato\')) AND idtipoordine=(SELECT id FROM or_tipiordine WHERE dir=' . prepare ( $dir ) . ') AND or_ordini.id IN (SELECT idordine FROM or_righe_ordini WHERE or_righe_ordini.idordine = or_ordini.id AND (qta - qta_evasa) > 0)' ;
2018-07-03 17:28:02 +02:00
$ordini = $dbo -> fetchArray ( $ordini_query )[ 0 ][ 'tot' ];
echo '
2018-10-25 17:11:02 +02:00
< a class = " btn btn-sm btn-primary'.(!empty( $ordini ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/fatture/add_ordine.php?id_module='. $id_module .'&id_record='. $id_record .' " data - toggle = " modal " data - title = " Aggiungi ordine " >
2018-06-25 11:44:06 +02:00
< i class = " fa fa-plus " ></ i > Ordine
2018-07-03 17:28:02 +02:00
</ a > ' ;
}
2017-08-04 16:28:16 +02:00
2017-09-19 17:27:31 +02:00
// Lettura articoli
2018-02-09 14:25:40 +01:00
$art_query = 'SELECT COUNT(*) AS tot FROM mg_articoli WHERE attivo = 1' ;
if ( $dir == 'entrata' ) {
$art_query .= ' AND (qta > 0 OR servizio = 1)' ;
}
$articoli = $dbo -> fetchArray ( $art_query )[ 0 ][ 'tot' ];
2017-09-19 17:27:31 +02:00
echo '
2019-03-29 12:46:17 +01:00
< a class = " btn btn-sm btn-primary'.(!empty( $articoli ) ? '' : ' disabled').' " data - href = " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'&is_articolo " data - toggle = " tooltip " data - title = " '.tr('Aggiungi articolo').' " >
2018-02-19 17:57:27 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Articolo ').'
2017-09-19 17:27:31 +02:00
</ a > ' ;
2017-09-19 16:20:44 +02:00
2017-09-19 17:27:31 +02:00
echo '
2019-03-29 12:46:17 +01:00
< a class = " btn btn-sm btn-primary " data - href = " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'&is_riga " data - toggle = " tooltip " data - title = " '.tr('Aggiungi riga').' " >
2018-02-19 17:57:27 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Riga ').'
2017-09-19 17:27:31 +02:00
</ a > ' ;
2018-02-04 17:26:25 +01:00
2018-01-18 19:03:06 +01:00
echo '
2019-03-29 12:46:17 +01:00
< a class = " btn btn-sm btn-primary " data - href = " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'&is_descrizione " data - toggle = " tooltip " data - title = " '.tr('Aggiungi descrizione').' " >
2018-02-19 17:57:27 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Descrizione ').'
2018-01-18 19:03:06 +01:00
</ a > ' ;
2019-03-29 12:46:17 +01:00
echo '
< a class = " btn btn-sm btn-primary " data - href = " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'&is_sconto " data - toggle = " tooltip " data - title = " '.tr('Aggiungi sconto/maggiorazione').' " >
< i class = " fa fa-plus " ></ i > '.tr(' Sconto / maggiorazione ').'
</ a > ' ;
2017-08-04 16:28:16 +02:00
}
2017-09-19 17:27:31 +02:00
?>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " pull-right " >
<!-- Stampe -->
< ? php
2018-02-09 15:43:51 +01:00
//stampa solo per fatture di vendita
2017-08-04 16:28:16 +02:00
if ( $dir == 'entrata' ) {
2018-02-11 20:24:29 +01:00
if ( sizeof ( $campi_mancanti ) > 0 ) {
2018-02-27 00:12:11 +01:00
//echo '{( "name": "button", "type": "print", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "class": "btn-info disabled" )}';
2018-02-11 20:24:29 +01:00
} else {
2018-02-27 00:12:11 +01:00
//echo '{( "name": "button", "type": "print", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )}';
2017-08-04 16:28:16 +02:00
}
}
?>
</ div >
</ div >
</ div >
< div class = " clearfix " ></ div >
< br >
< div class = " row " >
< div class = " col-md-12 " >
< ? php
include $docroot . '/modules/fatture/row-list.php' ;
?>
</ div >
</ div >
</ div >
</ div >
2019-03-15 12:16:20 +01:00
< ? php
if ( $dir == 'uscita' && $fattura -> isFE ()) {
echo '
< div class = " alert alert-info text-center " id = " controlla_totali " >< i class = " fa fa-spinner fa-spin " ></ i > '.tr(' Controllo sui totali del documento e della fattura elettronica in corso ').' ...</ div >
< script >
$ ( document ) . ready ( function () {
$ . ajax ({
url : globals . rootdir + " /actions.php " ,
type : " post " ,
data : {
id_module : globals . id_module ,
id_record : globals . id_record ,
op : " controlla_totali " ,
},
success : function ( data ){
data = JSON . parse ( data );
var div = $ ( " #controlla_totali " );
div . removeClass ( " alert-info " );
2019-05-04 00:32:28 +02:00
2019-03-15 12:16:20 +01:00
if ( data . stored == null ) {
2019-03-15 15:54:29 +01:00
div . addClass ( " alert-info " ) . html ( " '.tr( " Il file XML non contiene il nodo '' ImportoTotaleDocumento '' : impossibile controllare corrispondenza dei totali " ).'. " )
2019-03-15 12:16:20 +01:00
} else if ( data . stored == data . calculated ){
div . addClass ( " alert-success " ) . html ( " '.tr('Il totale del file XML corrisponde a quello calcolato dal gestionale').'. " )
} else {
div . addClass ( " alert-warning " ) . html ( " '.tr('Il totale del file XML non corrisponde a quello calcolato dal gestionale: previsto _XML_, calcolato _CALC_', [
2019-04-13 00:09:48 +02:00
'_XML_' => '" + data.stored + " " + globals.currency + "' ,
'_CALC_' => '" + data.calculated + " " + globals.currency + "' ,
2019-03-15 12:16:20 +01:00
]) . ' . " )
}
}
});
})
</ script > ' ;
}
?>
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2017-08-04 16:28:16 +02:00
2019-01-11 15:57:46 +01:00
< ? php
2019-03-08 16:59:55 +01:00
if ( $dir == 'entrata' ) {
echo '
2019-07-12 16:08:15 +02:00
< div class = " alert alert-info text-center " > '.tr(' Per allegare un documento alla fattura elettronica caricare il file PDF specificando come categoria " Allegati Fattura Elettronica " ').' .</ div > ' ;
2019-03-08 16:59:55 +01:00
}
2019-01-11 15:57:46 +01:00
2019-03-08 16:59:55 +01:00
echo '
2017-08-04 16:28:16 +02:00
< script type = " text/javascript " >
2019-03-08 16:59:55 +01:00
$ ( " #idanagrafica " ) . change ( function (){
2019-06-25 17:34:26 +02:00
session_set ( " superselect,idanagrafica " , $ ( this ) . val (), 0 ); ' ;
if ( $dir == 'entrata' ) {
echo '$("#idsede_destinazione").selectReset();' ;
2019-06-29 11:01:26 +02:00
} else {
2019-06-25 17:34:26 +02:00
echo '$("#idsede_partenza").selectReset();' ;
}
echo '
2017-08-04 16:28:16 +02:00
});
2019-03-08 16:59:55 +01:00
$ ( " #ricalcola_scadenze " ) . click ( function (){
swal ({
title : " '.tr('Desideri ricalcolare le scadenze?').' " ,
type : " warning " ,
showCancelButton : true ,
confirmButtonText : " '.tr('Sì').' "
}) . then ( function ( result ) {
redirect ( globals . rootdir + " /editor.php " , {
id_module : globals . id_module ,
id_record : globals . id_record ,
op : " ricalcola_scadenze " ,
backto : " record-edit " ,
}, " post " )
})
});
</ script > ' ;
2018-07-04 12:57:53 +02:00
2018-07-04 17:56:51 +02:00
if ( ! empty ( $note_accredito )) {
2018-07-04 12:57:53 +02:00
echo '
2018-09-28 17:29:59 +02:00
< div class = " alert alert-info text-center " > '.tr(' Note di credito collegate ').' : ' ;
2018-07-04 17:56:51 +02:00
foreach ( $note_accredito as $nota ) {
2018-07-04 12:57:53 +02:00
$text = tr ( 'Rif. fattura _NUM_ del _DATE_' , [
'_NUM_' => $nota [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $nota [ 'data' ]),
]);
echo '
< br > '.Modules::link(' Fatture di vendita ', $nota[' id ' ], $text , $text );
}
echo '
</ div > ' ;
}
2018-07-10 16:01:28 +02:00
?>
2018-09-28 16:17:10 +02:00
{( " name " : " log_email " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2018-07-10 16:19:38 +02:00
2018-07-26 16:19:34 +02:00
< ? php
2019-06-20 16:44:45 +02:00
// Eliminazione ddt solo se ho accesso alla sede aziendale
2019-06-29 11:01:26 +02:00
$field_name = ( $dir == 'entrata' ) ? 'idsede_partenza' : 'idsede_uscita' ;
if ( in_array ( $record [ $field_name ], $user -> sedi )) {
?>
2019-06-20 16:44:45 +02:00
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > < ? php echo tr ( 'Elimina' ); ?>
</ a >
< ? php
}
2018-07-28 18:02:17 +02:00
echo '
2018-07-26 16:19:34 +02:00
< script >
2018-07-26 17:34:12 +02:00
2018-09-19 09:57:30 +02:00
$ ( " .btn-sm[data-toggle= \" tooltip \" ] " ) . each ( function () {
2018-07-28 18:02:17 +02:00
2018-10-04 17:25:42 +02:00
$ ( this ) . on ( " click " , function () {
2018-08-09 10:14:26 +02:00
form = $ ( " #edit-form " );
btn = $ ( this );
2018-07-28 18:02:17 +02:00
2018-09-19 09:57:30 +02:00
var restore = buttonLoading ( btn );
2018-07-26 17:34:12 +02:00
2019-07-05 17:10:20 +02:00
valid = submitAjax ( form , {}, function () {
buttonRestore ( btn , restore );
}, function () {
buttonRestore ( btn , restore );
});
2018-11-12 16:00:57 +01:00
// Procedo al salvataggio solo se tutti i campi obbligatori sono compilati, altrimenti mostro avviso
2019-07-05 17:10:20 +02:00
//form.find("input:disabled, select:disabled").removeAttr("disabled");
2018-07-28 18:02:17 +02:00
2019-07-05 17:10:20 +02:00
if ( ! valid ) {
2018-07-26 17:34:12 +02:00
swal ({
2018-08-09 10:14:26 +02:00
type : " error " ,
title : " '.tr('Errore').' " ,
2018-10-04 17:25:42 +02:00
text : " '.tr('Alcuni campi obbligatori non sono stati compilati correttamente').'. " ,
2018-08-09 10:14:26 +02:00
});
2018-07-28 18:02:17 +02:00
2018-10-04 17:25:42 +02:00
$ ( " #bs-popup " ) . one ( " show.bs.modal " , function ( e ) {
return e . preventDefault ();
});
2018-07-26 17:34:12 +02:00
2018-09-19 09:57:30 +02:00
buttonRestore ( btn , restore );
2018-07-26 17:34:12 +02:00
}
2018-07-28 18:02:17 +02:00
2018-07-26 16:19:34 +02:00
});
});
</ script > ' ;
2018-07-28 18:02:17 +02:00
?>