Miglioramento import FE

This commit is contained in:
Fabio Lovato 2019-04-18 13:08:03 +02:00
parent 92640a4f96
commit bcf29081fe
1 changed files with 22 additions and 5 deletions

View File

@ -145,7 +145,7 @@ if (!empty($righe)) {
echo '
<h4>
'.tr('Righe').'
<button type="button" class="btn btn-info btn-sm pull-right" onclick="copy()"><i class="fa fa-copy"></i> '.tr('Copia dati contabili dalla prima riga').'</button>
<button type="button" class="btn btn-info btn-sm pull-right" onclick="copy()"><i class="fa fa-copy"></i> '.tr('Copia dati contabili dalla prima riga valorizzata').'</button>
<div class="clearfix"></div>
</h4>
@ -199,16 +199,33 @@ if (!empty($righe)) {
echo '
<script>
function copy(){
$iva = $("select[name^=iva").first().selectData();
$conto = $("select[name^=conto").first().selectData();
var first_iva = null;
var first_conto = null;
$("select[name^=iva").each( function(){
if( $(this).val() != "" && first_iva == null ){
first_iva = $(this);
}
});
$("select[name^=conto").each( function(){
if( $(this).val() != "" && first_conto == null ){
first_conto = $(this);
}
});
if(first_iva) {
$iva = first_iva.selectData();
if($iva) {
$("select[name^=iva").each(function(){
$(this).selectSet($iva.id);
});
}
if($conto) {
if(first_conto) {
$conto = first_conto.selectData();
$("select[name^=conto").each(function(){
$(this).selectSetNew($conto.id, $conto.text);
});