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
2021-01-20 15:08:51 +01:00
* Copyright ( C ) DevCode s . r . l .
2020-09-07 15:04:06 +02:00
*
* 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 />.
*/
2019-07-24 12:42:45 +02:00
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' ] == 'Ordini cliente' ) {
$dir = 'entrata' ;
} else {
$dir = 'uscita' ;
}
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 " >
2019-07-24 12:42:45 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Intestazione' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
2020-07-17 00:22:20 +02:00
< div class = " col-md-3 " < ? php echo ( $dir == 'entrata' ) ? 'hidden' : '' ; ?> >
2019-07-24 12:42:45 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero ordine'); ?> " , " name " : " numero " , " required " : 1 , " class " : " text-center " , " value " : " $numero $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2020-07-20 14:40:11 +02:00
{[ " type " : " text " , " label " : " <?php echo ( $dir == 'entrata') ? tr('Numero ordine') : tr('Numero ordine fornitore'); ?> " , " 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
2019-07-22 18:35:13 +02:00
2018-07-08 18:11:17 +02:00
if ( setting ( 'Cambia automaticamente stato ordini fatturati' )) {
2018-07-18 15:20:10 +02:00
if ( $record [ 'stato' ] == 'Evaso' || $record [ 'stato' ] == 'Parzialmente evaso' || $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 " : " idstatoordine " , " required " : 1 , " values " : " query=SELECT * FROM or_statiordine " , " value " : " $idstatoordine $ " , " extra " : " readonly " , " class " : " unblockable " ]}
2018-06-26 14:30:26 +02:00
< ? php
} else {
?>
2020-07-05 00:25:03 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstatoordine " , " required " : 1 , " values " : " query=SELECT * FROM or_statiordine WHERE descrizione IN('Bozza', 'Accettato', 'In attesa di conferma', 'Annullato') " , " value " : " $idstatoordine $ " , " 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 " : " idstatoordine " , " required " : 1 , " values " : " query=SELECT * FROM or_statiordine " , " value " : " $idstatoordine $ " , " class " : " unblockable " ]}
2018-05-22 14:41:42 +02:00
< ? php
}
?>
2017-08-04 16:28:16 +02:00
</ div >
2022-05-18 16:36:22 +02:00
< ? php
if ( $dir == 'entrata' ) {
echo '
< div class = " col-md-3 " > ' ;
if ( $record [ 'idagente' ] != 0 ) {
echo Modules :: link ( 'Anagrafiche' , $record [ 'idagente' ], null , null , 'class="pull-right"' );
}
echo '
{[ " type " : " select " , " label " : " '.tr('Agente').' " , " name " : " idagente " , " ajax-source " : " agenti " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' }, " value " : " $idagente $ " ]}
</ div > ' ;
}
?>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " row " >
< div class = " col-md-3 " >
2018-01-15 20:28:36 +01:00
< ? php
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-09-14 10:27:49 +02:00
if ( $dir == 'entrata' ) {
2018-02-04 17:26:25 +01:00
?>
2020-08-17 16:25:01 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Cliente'); ?> " , " name " : " idanagrafica " , " required " : 1 , " value " : " $idanagrafica $ " , " ajax-source " : " clienti " ]}
2017-08-04 16:28:16 +02:00
< ? php
2017-09-14 10:27:49 +02:00
} else {
?>
2022-07-07 17:28:18 +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
2017-09-14 10:27:49 +02:00
}
2020-07-31 14:25:50 +02:00
echo '
2021-02-11 15:05:29 +01:00
</ div >
2021-03-29 18:31:23 +02:00
2021-02-11 15:05:29 +01:00
< div class = " col-md-3 " > ' ;
if ( ! empty ( $record [ 'idreferente' ])) {
echo Plugins :: link ( 'Referenti' , $record [ 'idanagrafica' ], null , null , 'class="pull-right"' );
}
echo '
{[ " type " : " select " , " label " : " '.tr('Referente').' " , " name " : " idreferente " , " value " : " $idreferente $ " , " ajax-source " : " referenti " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' } ]}
</ div >
2019-09-12 17:13:53 +02:00
2019-01-29 13:13:24 +01:00
< div class = " col-md-3 " >
2020-07-31 14:25:50 +02:00
{[ " type " : " select " , " label " : " '.tr('Sede').' " , " name " : " idsede " , " required " : 1 , " ajax-source " : " sedi " , " select-options " : { " idanagrafica " : '.$record[' idanagrafica '].' }, " value " : " '. $record['idsede'] .' " ]}
2019-01-29 13:13:24 +01:00
</ div >
2017-08-04 16:28:16 +02:00
< div class = " col-md-3 " >
2020-07-31 14:25:50 +02:00
{[ " type " : " select " , " label " : " '.tr('Pagamento').' " , " name " : " idpagamento " , " required " : 0 , " ajax-source " : " pagamenti " , " value " : " $idpagamento $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2021-04-06 15:10:55 +02:00
</ div > ' ;
2021-04-12 15:51:27 +02:00
2019-09-12 17:13:53 +02:00
if ( $dir == 'entrata' ) {
?>
2021-04-07 09:33:55 +02:00
< div class = " row " >
2019-09-12 17:13:53 +02:00
< div class = " col-md-6 " >
2021-02-22 14:48:50 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero ordine cliente'); ?> " , " name " : " numero_cliente " , " required " : 0 , " value " : " <?php echo $record['numero_cliente'] ; ?> " , " 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>'); ?> " ]}
2019-09-12 17:13:53 +02:00
</ div >
2021-04-06 15:10:55 +02:00
< div class = " col-md-3 " >
2019-09-12 17:13:53 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data ordine cliente'); ?> " , " name " : " data_cliente " , " value " : " <?php echo $record['data_cliente'] ; ?> " ]}
</ div >
2021-04-06 15:10:55 +02:00
< div class = " col-md-3 " >
2022-01-15 17:30:49 +01:00
{[ " type " : " number " , " label " : " <?php echo 'Sconto in fattura'; ?> " , " name " : " sconto_finale " , " value " : " <?php echo $ordine->sconto_finale_percentuale ?: $ordine->sconto_finale ; ?> " , " icon-after " : " choice|untprc|<?php echo empty( $ordine->sconto_finale ) ? 'PRC' : 'UNT'; ?> " , " help " : " <?php echo tr('Sconto in fattura, utilizzabile per applicare sconti sul netto a pagare del documento'); ?>. " ]}
2021-04-06 15:10:55 +02:00
</ div >
</ div >
2021-04-07 09:33:55 +02:00
< ? php
}
?>
2022-10-27 15:08:33 +02:00
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " ckeditor " , " use_full_ckeditor " : 0 , " label " : " <?php echo tr('Condizioni generali di fornitura'); ?> " , " name " : " condizioni_fornitura " , " class " : " autosize " , " value " : " $condizioni_fornitura $ " ]}
</ div >
</ div >
2021-04-07 09:33:55 +02:00
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 $ " ]}
2018-05-22 14:41:42 +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 " >
2020-07-17 00:22:20 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note interne'); ?> " , " name " : " note_aggiuntive " , " value " : " $note_aggiuntive $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2019-10-14 18:30:34 +02:00
< ? php
2021-02-22 14:48:50 +01:00
if ( ! empty ( $record [ 'codice_commessa' ]) || ! empty ( $record [ 'num_item' ]) || ! empty ( $record [ 'codice_cig' ]) || ! empty ( $record [ 'codice_cup' ])) {
2019-10-14 18:30:34 +02:00
$collapsed = 'in' ;
2019-10-18 15:28:44 +02:00
} else {
2019-10-14 18:30:34 +02:00
$collapsed = '' ;
}
?>
2018-11-23 12:43:45 +01:00
2019-10-14 18:30:34 +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 " >
2019-10-14 19:13:11 +02:00
< ? php echo tr ( 'Dati appalto' ); ?>
2020-07-08 09:15:14 +02: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 >
2019-10-14 18:30:34 +02:00
</ h4 >
</ div >
2019-10-18 15:28:44 +02:00
< div id = " dati_appalto " class = " panel-collapse collapse <?php echo $collapsed ; ?> " >
2019-10-14 18:30:34 +02:00
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-6 " >
2021-02-22 14:48:50 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Codice Commessa'); ?> " , " name " : " codice_commessa " , " required " : 0 , " value " : " $codice_commessa $ " , " maxlength " : 100 ]}
2019-10-14 18:30:34 +02:00
</ 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 >
2018-11-23 12:43:45 +01:00
</ div >
</ div >
</ div >
</ div >
</ form >
2017-08-04 16:28:16 +02:00
2020-07-08 09:15:14 +02:00
< ? php
echo '
2017-08-04 16:28:16 +02:00
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2020-07-08 09:15:14 +02:00
< h3 class = " panel-title " > '.tr(' Righe ').' </ h3 >
2017-08-04 16:28:16 +02:00
</ div >
2020-07-08 09:15:14 +02:00
< div class = " panel-body " > ' ;
2018-02-19 11:50:42 +01:00
2019-07-24 12:42:45 +02:00
if ( ! $block_edit ) {
2019-03-29 12:46:17 +01:00
echo '
2020-08-03 12:08:52 +02:00
< div class = " pull-left " > ' ;
2021-02-18 18:48:44 +01:00
2020-12-22 11:09:33 +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 is_fatturabile = 1) 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)' ;
$preventivi = $dbo -> fetchArray ( $prev_query )[ 0 ][ 'tot' ];
2021-02-18 18:48:44 +01:00
if ( $dir == 'entrata' ) {
echo '
2020-12-22 11:09:33 +01:00
< div class = " tip " >
< a class = " btn btn-sm btn-primary '.(!empty( $preventivi ) ? '' : ' disabled').' " data - href = " '.base_path().'/modules/ordini/add_preventivo.php?id_module='. $id_module .'&id_record='. $id_record .' " data - title = " '.tr('Aggiungi preventivo').' " data - toggle = " tooltip " >
< i class = " fa fa-plus " ></ i > '.tr(' Preventivo ').'
</ a >
</ div > ' ;
}
2020-08-03 12:08:52 +02:00
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
2020-07-08 09:15:14 +02:00
echo '
</ div > ' ;
if ( $dir == 'entrata' ) {
echo '
< div class = " pull-right " >
< a class = " btn btn-sm btn-info " data - href = " '. $structure->fileurl ('quantita_impegnate.php').'?id_module='. $id_module .'&id_record='. $id_record .' " data - toggle = " tooltip " data - title = " '.tr('Controllo sulle quantità impegnate').' " >
2020-07-16 11:22:38 +02:00
< i class = " fa fa-question-circle " ></ i > '.tr(' Verifica disponibilità ').'
2020-07-08 09:15:14 +02:00
</ a >
</ div > ' ;
}
2017-08-04 16:28:16 +02:00
2020-07-08 09:15:14 +02:00
echo '
< div class = " clearfix " ></ div >
< br > ' ;
}
2017-08-04 16:28:16 +02:00
2020-07-08 09:15:14 +02:00
echo '
2017-08-04 16:28:16 +02:00
< div class = " row " >
2020-09-14 10:49:23 +02:00
< div class = " col-md-12 " id = " righe " ></ div >
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2020-08-03 12:08:52 +02:00
{( " name " : " log_email " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
< script >
function gestioneArticolo ( button ) {
gestioneRiga ( button , " is_articolo " );
}
function gestioneBarcode ( button ) {
gestioneRiga ( button , " is_barcode " );
}
function gestioneSconto ( button ) {
gestioneRiga ( button , " is_sconto " );
}
function gestioneDescrizione ( button ) {
gestioneRiga ( button , " is_descrizione " );
}
async function gestioneRiga ( button , options ) {
// Salvataggio via AJAX
2021-03-29 18:31:23 +02:00
await salvaForm ( " #edit-form " , {}, button );
// Lettura titolo e chiusura tooltip
let title = $ ( button ) . tooltipster ( " content " );
$ ( button ) . tooltipster ( " close " )
2020-08-03 12:08:52 +02:00
// Apertura modal
2021-03-29 18:31:23 +02:00
options = options ? options : " is_riga " ;
openModal ( title , " '. $structure->fileurl ('row-add.php').'?id_module='. $id_module .'&id_record='. $id_record .'& " + options );
2020-08-03 12:08:52 +02:00
}
2020-09-14 10:49:23 +02:00
/**
* Funzione dedicata al caricamento dinamico via AJAX delle righe del documento .
*/
function caricaRighe () {
let container = $ ( " #righe " );
localLoading ( container , true );
2020-09-14 11:06:35 +02:00
return $ . get ( " '. $structure->fileurl ('row-list.php').'?id_module='. $id_module .'&id_record='. $id_record .' " , function ( data ) {
container . html ( data );
2020-09-14 10:49:23 +02:00
localLoading ( container , false );
});
}
$ ( document ) . ready ( function () {
caricaRighe ();
});
2020-08-03 12:08:52 +02:00
$ ( " #idanagrafica " ) . change ( function () {
updateSelectOption ( " idanagrafica " , $ ( this ) . val ());
session_set ( " superselect,idanagrafica " , $ ( this ) . val (), 0 );
$ ( " #idsede " ) . selectReset ();
2022-07-07 17:28:18 +02:00
$ ( " #idpagamento " ) . selectReset ();
let data = $ ( this ) . selectData ();
if ( data ) {
// Impostazione del tipo di pagamento da anagrafica
if ( data . id_pagamento ) {
input ( " idpagamento " ) . getElement ()
. selectSetNew ( data . id_pagamento , data . desc_pagamento );
}
}
2020-08-03 12:08:52 +02:00
});
$ ( document ) . ready ( function () {
$ ( " #codice_cig, #codice_cup " ) . bind ( " keyup change " , function ( e ) {
if ( $ ( " #codice_cig " ) . val () == " " && $ ( " #codice_cup " ) . val () == " " ){
2021-02-22 14:48:50 +01:00
$ ( " #numero_cliente " ) . prop ( " required " , false );
2020-08-03 12:08:52 +02:00
} else {
2021-02-22 14:48:50 +01:00
$ ( " #numero_cliente " ) . prop ( " required " , true );
2020-08-03 12:08:52 +02:00
}
});
});
</ script > ' ;
2017-09-14 10:27:49 +02:00
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
// Fatture o ddt collegati a questo ordine
$elementi = $dbo -> fetchArray ( 'SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `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 `idordine` = ' . prepare ( $id_record ) . ' )
UNION SELECT `dt_ddt` . `id` , `dt_ddt` . `data` , `dt_ddt` . `numero` , `dt_ddt` . `numero_esterno` , `dt_tipiddt` . `descrizione` AS tipo_documento , `dt_tipiddt` . `dir` FROM `dt_ddt` JOIN `dt_tipiddt` ON `dt_tipiddt` . `id` = `dt_ddt` . `idtipoddt` WHERE `dt_ddt` . `id` IN ( SELECT `idddt` FROM `dt_righe_ddt` WHERE `idordine` = '.prepare($id_record).' ) ORDER BY `data` ' );
2017-09-14 10:27:49 +02:00
if ( ! empty ( $elementi )) {
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 > ' ;
2017-09-14 10:27:49 +02:00
foreach ( $elementi as $elemento ) {
$descrizione = tr ( '_DOC_ num. _NUM_ del _DATE_' , [
'_DOC_' => $elemento [ 'tipo_documento' ],
'_NUM_' => ! empty ( $elemento [ 'numero_esterno' ]) ? $elemento [ 'numero_esterno' ] : $elemento [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $elemento [ 'data' ]),
]);
2019-02-11 19:18:17 +01:00
if ( ! in_array ( $elemento [ 'tipo_documento' ], [ 'Ddt in uscita' , 'Ddt in entrata' ])) {
2017-09-14 10:27:49 +02:00
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
} else {
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Ddt di vendita' : 'Ddt di acquisto' ;
}
$id = $elemento [ '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
?>
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > < ? php echo tr ( 'Elimina' ); ?>
</ a >
2018-05-22 14:41:42 +02:00