2017-08-04 16:28:16 +02:00
< ? php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager : il software gestionale open source per l ' assistenza tecnica e la fatturazione
* Copyright ( C ) DevCode s . n . c .
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < https :// www . gnu . org / licenses />.
*/
2017-08-04 16:28:16 +02:00
include_once __DIR__ . '/../../core.php' ;
2019-07-24 12:42:45 +02:00
$block_edit = $record [ 'flag_completato' ];
2017-09-22 15:19:59 +02:00
$module = Modules :: get ( $id_module );
2017-08-04 16:28:16 +02:00
if ( $module [ 'name' ] == 'Ddt di vendita' ) {
$dir = 'entrata' ;
} else {
$dir = 'uscita' ;
}
2018-11-22 10:05:45 +01: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-18 19:53:23 +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 " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Intestazione' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
2018-03-21 23:49:08 +01:00
< ? php
if ( $dir == 'entrata' ) {
2018-07-18 15:20:10 +02:00
$rs2 = $dbo -> fetchArray ( 'SELECT piva, codice_fiscale, citta, indirizzo, cap, provincia FROM an_anagrafiche WHERE idanagrafica=' . prepare ( $record [ 'idanagrafica' ]));
2018-03-21 23:49:08 +01:00
$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 ( sizeof ( $campi_mancanti ) > 0 ) {
echo " <div class='alert alert-warning'><i class='fa fa-warning'></i> Prima di procedere alla stampa completa i seguenti campi dell'anagrafica:<br/><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-03-21 23:49:08 +01:00
}
}
?>
2018-07-08 18:11:17 +02:00
2017-08-04 16:28:16 +02:00
< div class = " row " >
2018-03-21 23:49:08 +01:00
< ? php
2018-03-22 15:40:20 +01:00
if ( $dir == 'uscita' ) {
echo '
2019-07-24 12:42:45 +02:00
< div class = " col-md-3 " >
{[ " type " : " span " , " label " : " '.tr('Numero ddt').' " , " class " : " text-center " , " value " : " $numero $ " ]}
</ div > ' ;
2018-03-22 15:40:20 +01:00
}
?>
2017-08-04 16:28:16 +02:00
< div class = " col-md-3 " >
2019-07-24 12:42:45 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero secondario'); ?> " , " name " : " numero_esterno " , " class " : " text-center " , " value " : " $numero_esterno $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2019-07-24 12:42:45 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data'); ?> " , " name " : " data " , " required " : 1 , " value " : " $data $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2018-05-22 14:41:42 +02:00
< ? php
2018-07-08 18:11:17 +02:00
if ( setting ( 'Cambia automaticamente stato ddt fatturati' )) {
2018-07-18 15:20:10 +02:00
if ( $record [ 'stato' ] == 'Fatturato' || $record [ 'stato' ] == 'Parzialmente fatturato' ) {
2018-06-26 14:30:26 +02:00
?>
2019-07-24 12:42:45 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatoddt " , " required " : 1 , " values " : " query=SELECT * FROM dt_statiddt " , " value " : " $idstatoddt $ " , " extra " : " readonly " , " class " : " unblockable " ]}
2018-06-26 14:30:26 +02:00
< ? php
} else {
?>
2019-07-24 12:42:45 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatoddt " , " required " : 1 , " values " : " query=SELECT * FROM dt_statiddt WHERE descrizione IN('Bozza', 'Evaso', 'Parzialmente evaso') " , " value " : " $idstatoddt $ " , " class " : " unblockable " ]}
2018-05-22 14:41:42 +02:00
< ? php
}
2018-06-26 14:30:26 +02:00
} else {
?>
2019-07-24 12:42:45 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatoddt " , " required " : 1 , " values " : " query=SELECT * FROM dt_statiddt " , " value " : " $idstatoddt $ " , " class " : " unblockable " ]}
2018-05-22 14:41:42 +02:00
< ? php
}
?>
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2019-07-29 16:54:20 +02:00
2020-07-31 14:25:50 +02:00
< div class = " row " >
< div class = " col-md-3 " >
< ? php echo Modules :: link ( 'Anagrafiche' , $record [ 'idanagrafica' ], null , null , 'class="pull-right"' ); ?>
{[ " type " : " select " , " label " : " <?php echo ( $dir == 'uscita') ? tr('Mittente') : tr('Destinatario'); ?> " , " name " : " idanagrafica " , " required " : 1 , " value " : " $idanagrafica $ " , " ajax-source " : " clienti_fornitori " ]}
</ div >
2019-05-29 19:17:57 +02:00
< ? php
// Conteggio numero articoli ddt in uscita
2019-06-04 20:45:40 +02:00
$articolo = $dbo -> fetchArray ( 'SELECT mg_articoli.id FROM ((mg_articoli INNER JOIN dt_righe_ddt ON mg_articoli.id=dt_righe_ddt.idarticolo) INNER JOIN dt_ddt ON dt_ddt.id=dt_righe_ddt.idddt) WHERE dt_ddt.id=' . prepare ( $id_record ));
2020-07-31 14:25:50 +02:00
$id_modulo_anagrafiche = Modules :: get ( 'Anagrafiche' )[ 'id' ];
$id_plugin_sedi = Plugins :: get ( 'Sedi' )[ 'id' ];
if ( $dir == 'entrata' ) {
echo '
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Partenza merce').' " , " name " : " idsede_partenza " , " ajax-source " : " sedi_azienda " , " value " : " $idsede_partenza $ " , " readonly " : " '.(sizeof( $articolo ) ? 1 : 0).' " , " help " : " '.tr( " Sedi di partenza dell 'azienda").' " ]}
</ div >
2017-08-04 16:28:16 +02:00
2020-07-31 14:25:50 +02:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Destinazione merce').' " , " name " : " idsede_destinazione " , " ajax-source " : " sedi " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' }, " value " : " $idsede_destinazione $ " , " help " : " '.tr('Sedi del destinatario').' " , " icon-after " : " add|'. $id_modulo_anagrafiche .'|id_plugin='. $id_plugin_sedi .'&id_parent='. $record['idanagrafica'] .'||'.(intval( $block_edit ) ? 'disabled' : '').' " ]}
</ div > ' ;
} else {
echo '
< div class = " col-md-3 " >
2020-08-11 08:10:06 +02:00
{[ " type " : " select " , " label " : " '.tr('Partenza merce').' " , " name " : " idsede_partenza " , " ajax-source " : " sedi " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' }, " value " : " $idsede_partenza $ " , " help " : " '.tr('Sedi del mittente').' " , " icon-after " : " add|'. $id_modulo_anagrafiche .'|id_plugin='. $id_plugin_sedi .'&id_parent='. $record['idanagrafica'] .'||'.(intval( $block_edit ) ? 'disabled' : '').' " ]}
2019-05-29 19:17:57 +02:00
</ div >
2020-07-31 14:25:50 +02:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Destinazione merce').' " , " name " : " idsede_destinazione " , " ajax-source " : " sedi_azienda " , " value " : " $idsede_destinazione $ " , " help " : " '.tr( " Sedi di arrivo dell 'azienda").' " ]}
</ div > ' ;
}
?>
</ div >
2019-05-29 19:17:57 +02:00
< hr >
2017-08-04 16:28:16 +02:00
< div class = " row " >
< div class = " col-md-3 " >
2020-08-11 08:10:06 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Aspetto beni'); ?> " , " name " : " idaspettobeni " , " value " : " $idaspettobeni $ " , " ajax-source " : " aspetto-beni " , " icon-after " : " add|<?php echo Modules::get('Aspetto beni')['id']; ?>|||<?php echo $block_edit ? 'disabled' : ''; ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2020-08-11 08:10:06 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Causale trasporto'); ?> " , " name " : " idcausalet " , " value " : " $idcausalet $ " , " ajax-source " : " causali " , " icon-after " : " add|<?php echo Modules::get('Causali')['id']; ?>|||<?php echo $block_edit ? 'disabled' : ''; ?> " , " help " : " <?php echo tr('Definisce la causale del trasporto.'); ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2019-08-29 19:00:05 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Tipo di spedizione'); ?> " , " name " : " idspedizione " , " placeholder " : " - " , " values " : " query=SELECT id, descrizione FROM dt_spedizione ORDER BY descrizione ASC " , " value " : " $idspedizione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2019-07-24 12:42:45 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Num. colli'); ?> " , " name " : " n_colli " , " value " : " $n_colli $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-3 " >
2019-07-24 12:42:45 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Pagamento'); ?> " , " name " : " idpagamento " , " ajax-source " : " pagamenti " , " value " : " $idpagamento $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2019-08-29 19:00:05 +02:00
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Porto'); ?> " , " name " : " idporto " , " placeholder " : " - " , " help " : " <?php echo tr('<ul><li>Franco: pagamento del trasporto a carico del mittente</li> <li>Assegnato: pagamento del trasporto a carico del destinatario</li> </ul>'); ?> " , " values " : " query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione ASC " , " value " : " $idporto $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2020-01-14 18:31:46 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Vettore'); ?> " , " name " : " idvettore " , " ajax-source " : " vettori " , " value " : " $idvettore $ " , " disabled " : < ? php echo intval ( $record [ 'idspedizione' ] == 3 ); ?> , "required": <?php echo (!empty($record['idspedizione'])) ? intval($record['idspedizione'] != 3) : 0; ?>, "icon-after": "add|<?php echo Modules::get('Anagrafiche')['id']; ?>|tipoanagrafica=Vettore&readonly_tipo=1|btn_idvettore|<?php echo (($record['idspedizione'] != 3 and intval(!$record['flag_completato']))) ? '' : 'disabled'; ?>" ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-11-28 01:21:22 +01:00
2020-01-14 18:31:46 +01:00
< div class = " col-md-3 " >
{[ " type " : " timestamp " , " label " : " <?php echo tr('Data ora trasporto'); ?> " , " name " : " data_ora_trasporto " , " required " : 0 , " value " : " $data_ora_trasporto $ " ]}
</ div >
2020-07-08 08:45:55 +02:00
2018-11-28 01:21:22 +01:00
< script >
2020-07-31 14:25:50 +02:00
$ ( " #idspedizione " ) . change ( function () {
2020-01-14 18:31:46 +01:00
//Per tutti tipi di spedizione, a parte "Espressa" o "Vettore", il campo vettore non deve essere richiesto
2019-08-29 19:00:05 +02:00
if ( $ ( this ) . val () != 1 && $ ( this ) . val () != 2 ) {
2018-11-28 01:21:22 +01:00
$ ( " #idvettore " ) . attr ( " required " , false );
$ ( " #idvettore " ) . attr ( " disabled " , true );
2018-11-30 16:10:15 +01:00
$ ( " label[for=idvettore] " ) . text ( " <?php echo tr('Vettore'); ?> " );
2020-01-14 18:31:46 +01:00
$ ( " #idvettore " ) . selectReset ( " <?php echo tr( " Seleziona un\ ' opzione " ); ?> " );
$ ( " .btn_idvettore " ) . prop ( " disabled " , true );
$ ( " .btn_idvettore " ) . addClass ( " disabled " );
2018-11-28 01:21:22 +01:00
} else {
$ ( " #idvettore " ) . attr ( " required " , true );
$ ( " #idvettore " ) . attr ( " disabled " , false );
2018-11-30 16:10:15 +01:00
$ ( " label[for=idvettore] " ) . text ( " <?php echo tr('Vettore'); ?>* " );
2020-01-14 18:31:46 +01:00
$ ( " .btn_idvettore " ) . prop ( " disabled " , false );
$ ( " .btn_idvettore " ) . removeClass ( " disabled " );
2020-07-08 08:45:55 +02:00
2018-11-28 01:21:22 +01:00
}
});
2019-07-29 16:54:20 +02:00
2020-07-31 14:25:50 +02:00
$ ( " #idcausalet " ) . change ( function () {
2018-11-28 01:21:22 +01:00
if ( $ ( this ) . val () == 3 ) {
$ ( " #tipo_resa " ) . attr ( " disabled " , false );
} else {
$ ( " #tipo_resa " ) . attr ( " disabled " , true );
}
});
</ script >
2017-08-04 16:28:16 +02:00
</ div >
2020-07-08 08:45:55 +02:00
< ? php
if ( $dir == 'entrata' ) {
echo '
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " '.tr('Peso').' " , " name " : " peso " , " value " : " $peso $ " , " readonly " : " '.intval(empty( $record['peso'] )).' " , " help " : " '.tr('Il valore del campo Peso viene calcolato in automatico sulla base degli articoli inseriti nel documento, a meno dell \ 'impostazione di un valore manuale in questo punto').' " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Modifica peso').' " , " name " : " peso_manuale " , " value " : '.intval(!empty($record[' peso '])).' , " help " : " '.tr('Seleziona per modificare manualmente il campo Peso').' " , " placeholder " : " '.tr('Modifica peso').' " ]}
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
2020-07-31 14:25:50 +02:00
$ ( " #peso_manuale " ) . click ( function () {
2020-07-08 08:45:55 +02:00
$ ( " #peso " ) . prop ( " readonly " , ! $ ( " #peso_manuale " ) . is ( " :checked " ));
});
});
</ script >
</ div >
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " '.tr('Volume').' " , " name " : " volume " , " value " : " $volume $ " , " readonly " : " '.intval(empty( $record['volume'] )).' " , " help " : " '.tr('Il valore del campo Volume viene calcolato in automatico sulla base degli articoli inseriti nel documento, a meno dell \ 'impostazione di un valore manuale in questo punto').' " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Modifica volume').' " , " name " : " volume_manuale " , " value " : '.intval(!empty($record[' volume '])).' , " help " : " '.tr('Seleziona per modificare manualmente il campo Volume').' " , " placeholder " : " '.tr('Modifica volume').' " ]}
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
2020-07-31 14:25:50 +02:00
$ ( " #volume_manuale " ) . click ( function () {
2020-07-08 08:45:55 +02:00
$ ( " #volume " ) . prop ( " readonly " , ! $ ( " #volume_manuale " ) . is ( " :checked " ));
});
});
</ script >
</ div >
</ div > ' ;
}
?>
2017-08-04 16:28:16 +02:00
< div class = " row " >
< div class = " col-md-12 " >
2019-07-24 12:42:45 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " value " : " $note $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2018-07-08 18:11:17 +02:00
2018-05-22 14:41:42 +02:00
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " textarea " , " label " : " <?php echo tr('Note aggiuntive'); ?> " , " name " : " note_aggiuntive " , " help " : " <?php echo tr('Note interne.'); ?> " , " value " : " $note_aggiuntive $ " ]}
</ div >
</ div >
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2019-10-14 19:13:11 +02:00
< ? php
2019-10-18 15:28:44 +02:00
if ( ! empty ( $record [ 'id_documento_fe' ]) || ! empty ( $record [ 'num_item' ]) || ! empty ( $record [ 'codice_cig' ]) || ! empty ( $record [ 'codice_cup' ])) {
2019-10-14 19:13:11 +02:00
$collapsed = 'in' ;
2019-10-18 15:28:44 +02:00
} else {
2019-10-14 19:13:11 +02:00
$collapsed = '' ;
}
?>
2019-07-22 16:13:38 +02:00
2019-10-14 19:13:11 +02:00
<!-- Fatturazione Elettronica PA -->
< div class = " panel-group " >
< div class = " panel panel-primary <?php echo ( $record['tipo_anagrafica'] == 'Ente pubblico' || $record['tipo_anagrafica'] == 'Azienda') ? 'show' : 'hide'; ?> " >
< div class = " panel-heading " >
< h4 class = " panel-title " >
< ? php echo tr ( 'Dati appalto' ); ?>
2019-11-29 18:21:31 +01:00
< div class = " box-tools pull-right " >
< a data - toggle = " collapse " href = " #dati_appalto " >< i class = " fa fa-plus " style = 'color:white;margin-top:2px;' ></ i ></ a >
2019-10-14 19:13:11 +02:00
</ div >
</ h4 >
2019-07-22 16:13:38 +02:00
</ div >
2019-10-18 15:28:44 +02:00
< div id = " dati_appalto " class = " panel-collapse collapse <?php echo $collapsed ; ?> " >
2019-10-14 19:13:11 +02:00
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Identificatore Documento'); ?> " , " name " : " id_documento_fe " , " required " : 0 , " help " : " <?php echo tr('<span>Obbligatorio per valorizzare CIG/CUP. È possible inserire: </span><ul><li>N. determina</li><li>RDO</li><li>Ordine MEPA</li></ul>'); ?> " , " value " : " $id_documento_fe $ " , " maxlength " : 20 ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Numero Riga'); ?> " , " name " : " num_item " , " required " : 0 , " value " : " $num_item $ " , " maxlength " : 15 ]}
</ div >
</ div >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice CIG'); ?> " , " name " : " codice_cig " , " required " : 0 , " value " : " $codice_cig $ " , " maxlength " : 15 ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice CUP'); ?> " , " name " : " codice_cup " , " required " : 0 , " value " : " $codice_cup $ " , " maxlength " : 15 ]}
</ div >
</ div >
2019-07-22 16:13:38 +02:00
</ div >
</ div >
</ div >
</ div >
</ form >
2017-08-04 16:28:16 +02:00
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Righe' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " pull-left " >
< ? php
2019-07-24 12:42:45 +02:00
if ( ! $block_edit ) {
2020-04-27 11:55:07 +02:00
// Lettura ordini (cliente o fornitore)
$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(\'Accettato\', \'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-06-25 11:44:06 +02:00
$ordini = $dbo -> fetchArray ( $ordini_query )[ 0 ][ 'tot' ];
2020-04-27 12:26:27 +02:00
2018-06-25 11:44:06 +02:00
echo '
2019-06-25 18:31:44 +02:00
< a class = " btn btn-sm btn-primary'.(!empty( $ordini ) ? '' : ' disabled').' " data - href = " '. $rootdir .'/modules/ddt/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 > '.tr(' Ordine ').'
2019-03-29 12:46:17 +01:00
</ a > ' ;
echo '
2020-08-26 14:28:56 +02:00
< button type = " button " class = " btn btn-sm btn-primary tip " title = " '.tr('Aggiungi articolo').' " onclick = " gestioneArticolo(this) " >
2019-03-29 12:46:17 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Articolo ').'
2020-08-03 12:08:52 +02:00
</ button > ' ;
2019-03-29 12:46:17 +01:00
2020-07-20 14:40:11 +02:00
echo '
2020-08-26 14:28:56 +02:00
< button type = " button " class = " btn btn-sm btn-primary tip " title = " '.tr('Aggiungi articoli tramite barcode').' " onclick = " gestioneBarcode(this) " >
2020-07-20 14:40:11 +02:00
< i class = " fa fa-plus " ></ i > '.tr(' Barcode ').'
2020-08-03 12:08:52 +02:00
</ button > ' ;
2020-07-20 14:40:11 +02:00
2019-03-29 12:46:17 +01:00
echo '
2020-08-26 14:28:56 +02:00
< button type = " button " class = " btn btn-sm btn-primary tip " title = " '.tr('Aggiungi riga').' " onclick = " gestioneRiga(this) " >
2019-03-29 12:46:17 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Riga ').'
2020-08-03 12:08:52 +02:00
</ button > ' ;
2019-03-29 12:46:17 +01:00
echo '
2020-08-26 14:28:56 +02:00
< button type = " button " class = " btn btn-sm btn-primary tip " title = " '.tr('Aggiungi descrizione').' " onclick = " gestioneDescrizione(this) " >
2019-03-29 12:46:17 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Descrizione ').'
2020-08-03 12:08:52 +02:00
</ button > ' ;
2019-03-29 12:46:17 +01:00
echo '
2020-08-26 14:28:56 +02:00
< button type = " button " class = " btn btn-sm btn-primary tip " title = " '.tr('Aggiungi sconto/maggiorazione').' " onclick = " gestioneSconto(this) " >
2019-03-29 12:46:17 +01:00
< i class = " fa fa-plus " ></ i > '.tr(' Sconto / maggiorazione ').'
2020-08-03 12:08:52 +02:00
</ button > ' ;
2017-08-04 16:28:16 +02:00
}
?>
</ div >
< div class = " clearfix " ></ div >
< br >
< div class = " row " >
< div class = " col-md-12 " >
< ? php
2020-08-03 12:08:52 +02:00
include $structure -> filepath ( 'row-list.php' );
echo '
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
{( " name " : " log_email " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2017-11-15 18:41:59 +01:00
2017-08-04 16:28:16 +02:00
< script >
2020-08-03 12:08:52 +02:00
function gestioneArticolo ( button ) {
gestioneRiga ( button , " is_articolo " );
}
function gestioneBarcode ( button ) {
gestioneRiga ( button , " is_barcode " );
}
2020-07-31 14:25:50 +02:00
2020-08-03 12:08:52 +02:00
function gestioneSconto ( button ) {
gestioneRiga ( button , " is_sconto " );
}
function gestioneDescrizione ( button ) {
gestioneRiga ( button , " is_descrizione " );
}
async function gestioneRiga ( button , options ) {
// Salvataggio via AJAX
let valid = await salvaForm ( button , $ ( " #edit-form " ));
// Apertura modal
if ( valid ) {
// Lettura titolo e chiusura tooltip
let title = $ ( button ) . tooltipster ( " content " );
$ ( button ) . tooltipster ( " close " )
// Apertura modal
options = options ? options : " is_riga " ;
openModal ( title , " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'& " + options );
}
}
$ ( " #idanagrafica " ) . change ( function () {
updateSelectOption ( " idanagrafica " , $ ( this ) . val ());
session_set ( " superselect,idanagrafica " , $ ( this ) . val (), 0 );
$ ( " #idsede_'.( $dir == 'uscita' ? 'partenza' : 'destinazione').' " ) . selectReset ();
});
</ script > ' ;
2017-08-04 16:28:16 +02:00
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
// Fatture collegate a questo ddt
$elementi = $dbo -> fetchArray ( 'SELECT `co_documenti`.*, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id` IN (SELECT `iddocumento` FROM `co_righe_documenti` WHERE `idddt` = ' . prepare ( $id_record ) . ') ORDER BY `data`' );
if ( ! empty ( $elementi )) {
2017-09-14 10:27:49 +02:00
echo '
2018-09-05 10:05:23 +02:00
< div class = " box box-warning collapsable collapsed-box " >
< div class = " box-header with-border " >
< h3 class = " box-title " >< i class = " fa fa-warning " ></ i > '.tr(' Documenti collegati : _NUM_ ' , [
2018-09-19 09:57:30 +02:00
'_NUM_' => count ( $elementi ),
2018-09-05 10:05:23 +02:00
]) . ' </ h3 >
< div class = " box-tools pull-right " >
< button type = " button " class = " btn btn-box-tool " data - widget = " collapse " >< i class = " fa fa-plus " ></ i ></ button >
</ div >
</ div >
< div class = " box-body " >
< ul > ' ;
foreach ( $elementi as $fattura ) {
2017-09-14 10:27:49 +02:00
$descrizione = tr ( '_DOC_ num. _NUM_ del _DATE_' , [
'_DOC_' => $fattura [ 'tipo_documento' ],
'_NUM_' => ! empty ( $fattura [ 'numero_esterno' ]) ? $fattura [ 'numero_esterno' ] : $fattura [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $fattura [ 'data' ]),
]);
$modulo = ( $fattura [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
$id = $fattura [ 'id' ];
echo '
2018-09-05 10:05:23 +02:00
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
2017-09-14 10:27:49 +02:00
}
echo '
</ ul >
2018-09-05 10:05:23 +02:00
</ div >
</ div > ' ;
}
if ( ! empty ( $elementi )) {
echo '
< div class = " alert alert-error " >
'.tr(' Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale ').' .
</ div > ' ;
2017-09-14 10:27:49 +02:00
}
2017-11-16 14:27:43 +01:00
?>
2019-06-20 16:44:45 +02:00
< ? php
// Eliminazione ddt solo se ho accesso alla sede aziendale
2019-06-29 11:01:26 +02:00
$field_name = ( $dir == 'entrata' ) ? 'idsede_partenza' : 'idsede_destinazione' ;
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
}