2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
unset ( $_SESSION [ 'superselect' ][ 'idanagrafica' ]);
2018-07-18 15:20:10 +02:00
$_SESSION [ 'superselect' ][ 'idanagrafica' ] = $record [ 'idanagrafica' ];
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
<!-- DATI INTESTAZIONE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Intestazione </ h3 >
</ div >
< div class = " panel-body " >
< div class = " row " >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Numero'); ?> " , " name " : " numero " , " required " : 1 , " class " : " text-center " , " value " : " $numero $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-4 " >
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
?>
2018-07-17 08:05:19 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Cliente'); ?> " , " name " : " idanagrafica " , " required " : 1 , " values " : " query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Cliente' AND deleted_at IS NULL ORDER BY ragione_sociale " , " value " : " $idanagrafica $ " , " ajax-source " : " clienti " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2018-01-15 20:28:36 +01:00
< ? php
2018-07-18 15:20:10 +02:00
if ( $record [ 'idagente' ] != 0 ) {
echo Modules :: link ( 'Anagrafiche' , $record [ 'idagente' ], null , null , 'class="pull-right"' );
2018-02-04 17:26:25 +01:00
}
2018-01-15 20:28:36 +01:00
?>
2018-07-17 08:05:19 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Agente'); ?> " , " name " : " idagente " , " values " : " query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Agente' AND deleted_at IS NULL ORDER BY ragione_sociale " , " value " : " $idagente $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Referente'); ?> " , " name " : " idreferente " , " value " : " $idreferente $ " , " ajax-source " : " referenti " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-6 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Nome'); ?> " , " name " : " nome " , " required " : 1 , " value " : " $nome $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Tempi di consegna'); ?> " , " name " : " tempi_consegna " , " value " : " $tempi_consegna $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Validità'); ?> " , " name " : " validita " , " decimals " : " 0 " , " value " : " $validita $ " , " icon-after " : " giorni " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-4 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Metodo di pagamento'); ?> " , " name " : " idpagamento " , " values " : " query=SELECT id, descrizione FROM co_pagamenti GROUP BY descrizione ORDER BY descrizione " , " value " : " $idpagamento $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data bozza'); ?> " , " maxlength " : 10 , " name " : " data_bozza " , " value " : " $data_bozza $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data accettazione'); ?> " , " maxlength " : 10 , " name " : " data_accettazione " , " value " : " $data_accettazione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data conclusione'); ?> " , " maxlength " : 10 , " name " : " data_conclusione " , " value " : " $data_conclusione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-2 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data rifiuto'); ?> " , " maxlength " : 10 , " name " : " data_rifiuto " , " value " : " $data_rifiuto $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Stato'); ?> " , " name " : " idstato " , " required " : 1 , " values " : " query=SELECT id, descrizione FROM co_statipreventivi " , " value " : " $idstato $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Tipo di attività'); ?> " , " name " : " idtipointervento " , " required " : 1 , " values " : " query=SELECT idtipointervento AS id, descrizione FROM in_tipiintervento ORDER BY descrizione " , " value " : " $idtipointervento $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-08-08 19:00:19 +02:00
<!-- div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Resa materiale'); ?> " , " name " : " idporto " , " values " : " query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione " , " value " : " $idporto $ " ]}
2018-08-08 19:00:19 +02:00
</ div -->
2017-08-04 16:28:16 +02:00
</ div >
< div class = " row " >
< div class = " col-md-3 " >
2018-02-18 19:53:23 +01:00
{[ " type " : " number " , " label " : " <?php echo tr('Sconto incondizionato'); ?> " , " name " : " sconto_generico " , " value " : " $sconto_globale $ " , " icon-after " : " choice|untprc| $tipo_sconto_globale $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Esclusioni'); ?> " , " name " : " esclusioni " , " class " : " autosize " , " value " : " $esclusioni $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
< div class = " row " >
< div class = " col-md-12 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " textarea " , " label " : " <?php echo tr('Descrizione'); ?> " , " name " : " descrizione " , " class " : " autosize " , " value " : " $descrizione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2018-02-20 10:55:00 +01:00
<!-- div class = " pull-right " >
2017-09-04 12:02:29 +02:00
< button type = " submit " class = " btn btn-success " >< i class = " fa fa-check " ></ i > < ? php echo tr ( 'Salva modifiche' ); ?> </button>
2018-02-20 10:55:00 +01:00
</ div -->
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ form >
<!-- RIGHE -->
< div class = " panel panel-primary " >
< div class = " panel-heading " >
< h3 class = " panel-title " > Righe </ h3 >
</ div >
< div class = " panel-body " >
2018-07-18 15:20:10 +02:00
< ? php if ( $record [ 'stato' ] != 'Pagato' ) {
2018-02-04 17:26:25 +01:00
?>
2018-01-18 19:03:06 +01:00
2018-06-09 18:12:37 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/preventivi/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_articolo " data - toggle = " modal " data - title = " Aggiungi articolo " data - target = " #bs-popup " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Articolo' ); ?> </a>
2018-01-18 19:03:06 +01:00
2018-06-09 18:12:37 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/preventivi/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_riga " data - toggle = " modal " data - title = " Aggiungi riga " data - target = " #bs-popup " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Riga' ); ?> </a>
2018-02-19 11:25:56 +01:00
2018-06-09 18:12:37 +02:00
< a class = " btn btn-primary " data - href = " <?php echo $rootdir ; ?>/modules/preventivi/row-add.php?id_module=<?php echo $id_module ; ?>&id_record=<?php echo $id_record ; ?>&is_descrizione " data - toggle = " modal " data - title = " Aggiungi descrizione " data - target = " #bs-popup " >< i class = " fa fa-plus " ></ i > < ? php echo tr ( 'Descrizione' ); ?> </a>
2018-01-18 19:03:06 +01:00
2017-08-04 16:28:16 +02:00
< ? php
2018-02-04 17:26:25 +01:00
} ?>
2017-08-04 16:28:16 +02:00
2018-02-20 10:55:00 +01:00
<!-- div class = " pull-right " >
2018-02-18 19:53:23 +01:00
{( " name " : " button " , " type " : " print " , " id_module " : " <?php echo $id_module ; ?> " , " id_record " : " <?php echo $id_record ; ?> " )}
2018-02-20 10:55:00 +01:00
</ div -->
2018-02-21 09:53:38 +01:00
2017-08-04 16:28:16 +02:00
< div class = " clearfix " ></ div >
< br >
< div class = " row " >
< div class = " col-md-12 " >
< ? php
include $docroot . '/modules/preventivi/row-list.php' ;
?>
</ div >
</ div >
</ div >
</ div >
2017-09-14 10:27:49 +02:00
2017-11-16 14:27:43 +01:00
< ? php
//fatture collegate a questo preventivo
2018-09-05 10:05:23 +02:00
$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 `idpreventivo` = ' . 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_ ' , [
'_NUM_' => count ( $elementi )
]) . ' </ 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
?>
2018-03-27 18:47:17 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " <?php echo $id_module ; ?> " , " id_record " : " <?php echo $id_record ; ?> " )}
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' ); ?>
2018-01-15 20:28:36 +01:00
</ a >