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 />.
*/
2017-08-04 16:28:16 +02:00
include_once __DIR__ . '/../../core.php' ;
2018-02-23 16:04:50 +01:00
?> <form action="" method="post" id="edit-form" enctype="multipart/form-data">
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update " >
<!-- DATI ANAGRAFICI -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2017-09-04 12:02:29 +02:00
< h3 class = " panel-title " >< ? php echo tr ( 'Articolo' ); ?> </h3>
2017-08-04 16:28:16 +02:00
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-3 " >
2020-05-04 09:45:48 +02:00
{[ " type " : " image " , " label " : " <?php echo tr('Immagine'); ?> " , " name " : " immagine " , " class " : " img-thumbnail " , " value " : " <?php echo $articolo->image ; ?> " , " accept " : " image/x-png,image/gif,image/jpeg " ]}
2017-08-04 16:28:16 +02:00
</ div >
2019-11-08 14:58:49 +01:00
< div class = " col-md-9 " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice'); ?> " , " name " : " codice " , " required " : 1 , " value " : " $codice $ " , " validation " : " codice " ]}
</ div >
2019-11-19 18:06:10 +01:00
< div class = " col-md-6 " >
2019-11-08 14:58:49 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Barcode'); ?> " , " name " : " barcode " , " value " : " $barcode $ " ]}
2019-12-03 20:16:43 +01:00
</ div >
2019-11-08 14:58:49 +01:00
</ div >
< div class = " row " >
< div class = " col-md-6 " >
2020-09-29 23:04:49 +02:00
< ? php echo Modules :: link ( 'Categorie articoli' , $record [ 'id_categoria' ], null , null , 'class="pull-right"' ); ?>
{[ " type " : " select " , " label " : " <?php echo tr('Categoria'); ?> " , " name " : " categoria " , " required " : 0 , " value " : " $id_categoria $ " , " ajax-source " : " categorie " , " icon-after " : " add|<?php echo Modules::get('Categorie articoli')['id']; ?> " ]}
2019-11-08 14:58:49 +01:00
</ div >
< div class = " col-md-6 " >
2020-08-24 17:22:52 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Sottocategoria'); ?> " , " name " : " subcategoria " , " value " : " $id_sottocategoria $ " , " ajax-source " : " sottocategorie " , " select-options " : < ? php echo json_encode ([ 'id_categoria' => $record [ 'id_categoria' ]]); ?> ]}
2019-11-08 14:58:49 +01:00
</ div >
</ div >
2018-04-04 00:13:26 +02:00
</ div >
2017-08-04 16:28:16 +02:00
</ div >
2020-07-06 13:32:43 +02:00
2017-08-04 16:28:16 +02:00
< div class = " row " >
< div class = " col-md-12 " >
2021-03-27 14:17:32 +01:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Descrizione'); ?> " , " name " : " descrizione " , " required " : 1 , " value " : " $descrizione $ " , " charcounter " : 1 ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2020-07-06 13:32:43 +02:00
2020-02-01 11:02:23 +01:00
< div class = " row " >
2020-11-13 17:54:58 +01:00
< div class = " col-md-6 " >
2020-02-01 11:02:23 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Abilita serial number'); ?> " , " name " : " abilita_serial " , " value " : " $abilita_serial $ " , " help " : " <?php echo tr('Abilita serial number in fase di aggiunta articolo in fattura o ddt'); ?> " , " placeholder " : " <?php echo tr('Serial number'); ?> " , " extra " : " <?php echo ( $record['serial'] > 0) ? 'readonly' : ''; ?> " ]}
</ div >
2020-11-13 17:54:58 +01:00
< div class = " col-md-6 " >
2020-02-01 11:02:23 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Attivo'); ?> " , " name " : " attivo " , " help " : " <?php echo tr('Seleziona per rendere attivo l \ 'articolo'); ?> " , " value " : " $attivo $ " , " placeholder " : " <?php echo tr('Articolo attivo'); ?> " ]}
</ div >
2017-08-04 16:28:16 +02:00
2020-02-01 11:02:23 +01:00
</ div >
2020-07-08 08:45:55 +02:00
2020-11-13 17:54:58 +01:00
< div class = " row " >
< div class = " col-md-8 " >
{[ " type " : " text " , " label " : " <?php echo tr('Ubicazione'); ?> " , " name " : " ubicazione " , " value " : " $ubicazione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2020-11-13 17:54:58 +01:00
< div class = " col-md-4 " >
{[ " type " : " select " , " label " : " <?php echo tr('Unità di misura'); ?> " , " name " : " um " , " value " : " $um $ " , " ajax-source " : " misure " , " icon-after " : " add|<?php echo Modules::get('Unità di misura')['id']; ?> " ]}
2017-08-04 16:28:16 +02:00
</ div >
2020-02-01 11:02:23 +01:00
</ div >
2017-08-04 16:28:16 +02:00
2020-11-13 17:54:58 +01:00
< div class = " row " >
2017-08-04 16:28:16 +02:00
< div class = " col-md-12 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " value " : " $note $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ div >
</ div >
2020-11-13 17:54:58 +01:00
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " >
< ? php echo tr ( 'Giacenza totale' ); ?>
</ h3 >
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " <?php echo tr('Quantità'); ?> " , " name " : " qta " , " required " : 1 , " value " : " $qta $ " , " readonly " : 1 , " decimals " : " qta " , " min-value " : " undefined " ]}
< input type = " hidden " id = " old_qta " value = " <?php echo $record['qta'] ; ?> " >
</ div >
< div class = " col-md-6 " >
{[ " type " : " checkbox " , " label " : " <?php echo tr('Modifica quantità'); ?> " , " name " : " qta_manuale " , " value " : 0 , " help " : " <?php echo tr('Seleziona per modificare manualmente la quantità'); ?> " , " placeholder " : " <?php echo tr('Quantità manuale'); ?> " , " extra " : " <?php echo ( $record['servizio'] ) ? 'disabled' : ''; ?> " ]}
</ div >
</ div >
< div class = 'row' id = " div_modifica_manuale " style = " display:none; " >
< div class = 'col-md-8' >
{[ " type " : " text " , " label " : " <?php echo tr('Descrizione movimento'); ?> " , " name " : " descrizione_movimento " ]}
</ div >
< div class = 'col-md-4' >
{[ " type " : " date " , " label " : " <?php echo tr('Data movimento'); ?> " , " name " : " data_movimento " , " value " : " -now- " ]}
</ div >
</ div >
< div class = " alert alert-info " >
< p >< ? php echo tr ( 'Le modifiche alle quantità in questa schermata prevedono la generazione di un movimento relativo per la Sede legale' ); ?> . <?php echo tr('Per effettuare movimenti in altre Sedi, utilizzare il modulo Movimenti relativo'); ?>.</p>
</ div >
< script type = " text/javascript " >
$ ( document ) . ready ( function () {
$ ( '#servizio' ) . click ( function () {
$ ( " #qta_manuale " ) . attr ( " disabled " , $ ( '#servizio' ) . is ( " :checked " ));
});
$ ( '#qta_manuale' ) . click ( function () {
$ ( " #qta " ) . attr ( " readonly " , ! $ ( '#qta_manuale' ) . is ( " :checked " ));
if ( $ ( '#qta_manuale' ) . is ( " :checked " )){
$ ( " #div_modifica_manuale " ) . show ();
$ ( " #div_modifica_manuale " ) . show ();
$ ( " #descrizione_movimento " ) . attr ( 'required' , true );
$ ( " #data_movimento " ) . attr ( 'required' , true );
} else {
$ ( " #div_modifica_manuale " ) . hide ();
$ ( '#qta' ) . val ( $ ( '#old_qta' ) . val ());
$ ( " #descrizione_movimento " ) . attr ( 'required' , false );
$ ( " #data_movimento " ) . attr ( 'required' , false );
}
});
});
</ script >
</ div >
</ div >
2018-04-03 23:31:44 +02:00
<!-- informazioni Acquisto / Vendita -->
< div class = " row " >
< div class = " col-md-6 " >
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " >< ? php echo tr ( 'Acquisto' ); ?> </h3>
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-6 " >
2020-07-06 13:32:43 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Prezzo di acquisto'); ?> " , " name " : " prezzo_acquisto " , " value " : " $prezzo_acquisto $ " , " icon-after " : " <?php echo currency(); ?> " , " help " : " <?php echo tr('Prezzo di acquisto previsto per i fornitori i cui dati non sono stati inseriti nel plugin Fornitori'); ?>. " ]}
2018-04-03 23:31:44 +02:00
</ div >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " <?php echo tr('Soglia minima quantità'); ?> " , " name " : " threshold_qta " , " value " : " $threshold_qta $ " , " decimals " : " qta " , " min-value " : " undefined " ]}
</ div >
</ div >
2018-07-09 17:21:25 +02:00
2019-11-12 18:45:52 +01:00
< div class = " row " >
< div class = " col-md-12 " >
2021-10-26 10:18:32 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Fornitore predefinito'); ?> " , " name " : " id_fornitore " , " ajax-source " : " fornitori-articolo " , " select-options " : < ? php echo json_encode ([ 'id_articolo' => $id_record ]); ?> , "value":"$id_fornitore$", "help": "<?php echo tr('Fornitore predefinito selezionabile tra i fornitori presenti nel plugin \"Listino fornitori\"'); ?>." ]}
2019-11-12 18:45:52 +01:00
</ div >
</ div >
2018-07-09 17:21:25 +02:00
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " select " , " label " : " <?php echo tr('Conto predefinito di acquisto'); ?> " , " name " : " idconto_acquisto " , " value " : " $idconto_acquisto $ " , " ajax-source " : " conti-acquisti " ]}
</ div >
</ div >
2020-10-02 18:27:07 +02:00
< div class = " row " >
2020-11-05 16:37:47 +01:00
< div class = " col-md-4 " >
{[ " type " : " select " , " label " : " <?php echo tr('U.m. secondaria'); ?> " , " name " : " um_secondaria " , " value " : " $um_secondaria $ " , " ajax-source " : " misure " , " help " : " <?php echo tr( " Unità di misura da utilizzare nelle stampe di Ordini fornitori in relazione all ' articolo " ); ?> " ]}
2020-10-02 18:27:07 +02:00
</ div >
2020-11-05 16:37:47 +01:00
< div class = " col-md-4 " >
2020-11-25 14:36:21 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Fattore moltiplicativo'); ?> " , " name " : " fattore_um_secondaria " , " value " : " $fattore_um_secondaria $ " , " decimals " : " qta " , " help " : " <?php echo tr( " Fattore moltiplicativo per l ' unità di misura da utilizzare nelle stampe di Ordini fornitori " ); ?> " ]}
2020-10-02 18:27:07 +02:00
</ div >
2020-11-05 16:37:47 +01:00
< div class = " col-md-4 " >
2021-05-14 14:29:49 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Q.tà multipla'); ?> " , " name " : " qta_multipla " , " value " : " $qta_multipla $ " , " decimals " : " qta " , " help " : " <?php echo tr('Quantità multipla di scorta da tenere a magazzino.'); ?> " ]}
2020-11-05 16:37:47 +01:00
</ div >
2020-10-02 18:27:07 +02:00
</ div >
2018-04-03 23:31:44 +02:00
</ div >
</ div >
</ div >
< div class = " col-md-6 " >
< div class = " panel panel-primary " >
< div class = " panel-heading " >
2019-03-01 16:41:24 +01:00
< h3 class = " panel-title " >
< ? php echo tr ( 'Vendita' ); ?>
</ h3 >
2018-04-03 23:31:44 +02:00
</ div >
< div class = " panel-body " >
2019-03-01 16:41:24 +01:00
< div class = " clearfix " ></ div >
2018-04-03 23:31:44 +02:00
< div class = " row " >
< div class = " col-md-6 " >
2020-02-17 09:44:09 +01:00
< ? php
2020-07-06 13:57:45 +02:00
$prezzi_ivati = setting ( 'Utilizza prezzi di vendita comprensivi di IVA' );
if ( empty ( $prezzi_ivati )) {
2020-02-17 09:44:09 +01:00
echo '
2020-09-23 13:59:50 +02:00
< button type = " button " class = " btn btn-info btn-xs pull-right tip pull-right " title = " '.tr('Scorpora iva dal prezzo di vendita.').' " id = " scorporaIva " >
< i class = " fa fa-calculator " ></ i >
</ button > ' ;
2020-02-17 09:44:09 +01:00
}
2020-07-06 13:57:45 +02:00
echo '
{[ " type " : " number " , " label " : " '.tr('Prezzo di vendita').' " , " name " : " prezzo_vendita " , " value " : " '.( $prezzi_ivati ? $articolo->prezzo_vendita_ivato : $articolo->prezzo_vendita ).' " , " icon-after " : " '.currency().' " , " help " : " '.( $prezzi_ivati ? tr('Importo IVA inclusa') : '').' " ]}
</ div > ' ;
?>
2018-04-03 23:31:44 +02:00
< div class = " col-md-6 " >
2020-02-05 13:05:34 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Iva di vendita'); ?> " , " name " : " idiva_vendita " , " ajax-source " : " iva " , " value " : " $idiva_vendita $ " , " valore_predefinito " : " Iva predefinita " , " help " : " <?php echo tr('Se non specificata, verrà utilizzata l \ 'iva di default delle impostazioni'); ?> " ]}
2018-04-03 23:31:44 +02:00
</ div >
</ div >
2018-04-04 00:13:26 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " <?php echo tr('Garanzia'); ?> " , " name " : " gg_garanzia " , " decimals " : 0 , " value " : " $gg_garanzia $ " , " icon-after " : " GG " ]}
</ div >
< div class = " col-md-6 " >
2018-04-24 00:35:18 +02:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Questo articolo è un servizio'); ?> " , " name " : " servizio " , " value " : " $servizio $ " , " help " : " <?php echo tr('Le quantità non saranno considerate'); ?> " , " placeholder " : " <?php echo tr('Servizio'); ?> " ]}
2018-04-04 00:13:26 +02:00
</ div >
</ div >
2018-05-05 09:29:09 +02:00
2018-04-04 00:13:26 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " <?php echo tr('Peso lordo'); ?> " , " name " : " peso_lordo " , " value " : " $peso_lordo $ " , " icon-after " : " KG " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " <?php echo tr('Volume'); ?> " , " name " : " volume " , " value " : " $volume $ " , " icon-after " : " M<sup>3</sup> " ]}
</ div >
</ div >
2018-07-09 17:21:25 +02:00
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " select " , " label " : " <?php echo tr('Conto predefinito di vendita'); ?> " , " name " : " idconto_vendita " , " value " : " $idconto_vendita $ " , " ajax-source " : " conti-vendite " ]}
</ div >
</ div >
2018-04-03 23:31:44 +02:00
</ div >
</ div >
</ div >
</ div >
2021-08-31 15:46:14 +02:00
</ form >
2017-08-04 16:28:16 +02:00
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2018-05-17 14:33:40 +02:00
2017-08-04 16:28:16 +02:00
< script >
2020-07-31 14:25:50 +02:00
$ ( " #categoria " ) . change ( function () {
2020-08-17 10:57:51 +02:00
updateSelectOption ( " id_categoria " , $ ( this ) . val ());
2017-08-04 16:28:16 +02:00
$ ( " #subcategoria " ) . val ( null ) . trigger ( " change " );
});
2019-03-01 16:41:24 +01:00
2020-09-23 13:59:50 +02:00
function scorporaIva () {
let iva_vendita = $ ( " #idiva_vendita " );
if ( iva_vendita . val ()) {
let percentuale = parseFloat ( iva_vendita . selectData () . percentuale );
2019-03-01 18:04:07 +01:00
if ( ! percentuale ) return ;
2019-03-01 16:41:24 +01:00
2020-09-23 13:59:50 +02:00
let input = $ ( " #prezzo_vendita " );
let prezzo = input . val () . toEnglish ();
2019-03-01 16:41:24 +01:00
2020-09-23 13:59:50 +02:00
let scorporato = prezzo * 100 / ( 100 + percentuale );
2019-03-01 16:41:24 +01:00
2019-03-01 18:04:07 +01:00
input . val ( scorporato );
} else {
swal ( " <?php echo tr('Attenzione'); ?> " , " <?php echo tr('Seleziona Iva di vendita.'); ?> " , " warning " );
}
2019-03-01 16:41:24 +01:00
}
2019-03-01 18:04:07 +01:00
2020-09-23 13:59:50 +02:00
$ ( " #scorporaIva " ) . click ( function () {
scorporaIva ();
2019-10-01 18:01:00 +02:00
});
2019-03-01 18:04:07 +01:00
2017-08-04 16:28:16 +02:00
</ script >
2017-09-06 11:59:47 +02:00
< ? php
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
// Fatture, ddt, preventivi collegati a questo articolo
$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 `idarticolo` = ' . 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 `idarticolo` = '.prepare($id_record).' )
UNION SELECT `co_preventivi` . `id` , `co_preventivi` . `data_bozza` , `co_preventivi` . `numero` , 0 AS numero_esterno , " Preventivo " AS tipo_documento , 0 AS dir FROM `co_preventivi` WHERE `co_preventivi` . `id` IN ( SELECT `idpreventivo` FROM `co_righe_preventivi` WHERE `idarticolo` = '.prepare($id_record).' ) ORDER BY `data` ' );
2017-11-16 14:27:43 +01: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-11-16 14:27:43 +01: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' ]),
]);
2018-01-12 16:23:26 +01:00
//se non è un preventivo è un ddt o una fattura
//se non è un ddt è una fattura.
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Preventivo' ])) {
$modulo = 'Preventivi' ;
2020-02-19 13:05:31 +01:00
} elseif ( ! in_array ( $elemento [ 'tipo_documento' ], [ 'Ddt di vendita' , 'Ddt di acquisto' , 'Ddt in entrata' , 'Ddt in uscita' ])) {
2018-01-12 16:23:26 +01:00
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
} else {
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Ddt di vendita' : 'Ddt di acquisto' ;
}
2017-11-16 14:27:43 +01:00
$id = $elemento [ 'id' ];
echo '
2018-09-05 10:05:23 +02:00
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
2017-11-16 14:27:43 +01:00
}
2017-09-06 11:59:47 +02:00
echo '
2017-11-16 14:27:43 +01:00
</ 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 > ' ;
2020-07-02 17:30:09 +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' ); ?>
2020-07-06 13:57:45 +02:00
</ a >
2020-12-04 14:30:29 +01:00
< script >
input ( 'id_fornitore' ) . change ( function (){
2020-12-04 15:33:06 +01:00
let prezzo_unitario = $ ( this ) . selectData () ? $ ( this ) . selectData () . prezzo_unitario : " " ;
2020-12-04 14:30:29 +01:00
if ( input ( 'id_fornitore' ) . get ()){
input ( 'prezzo_acquisto' ) . set ( prezzo_unitario );
input ( 'prezzo_acquisto' ) . disable ();
} else {
input ( 'prezzo_acquisto' ) . enable ();
input ( 'prezzo_acquisto' ) . set ( '0' );
}
});
$ ( document ) . ready ( function (){
if ( input ( 'id_fornitore' ) . get ()){
input ( 'prezzo_acquisto' ) . disable ();
}
});
2020-12-04 15:33:06 +01:00
</ script >