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' ;
2024-03-05 16:01:45 +01:00
use Models\Module ;
2017-08-04 16:28:16 +02:00
?> <form action="" method="post" id="edit-form">
2019-07-31 18:22:35 +02:00
< input type = " hidden " name = " op " value = " update " >
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
2018-02-18 19:53:23 +01:00
< input type = " hidden " name = " id_record " value = " <?php echo $id_record ; ?> " >
2018-07-18 15:20:10 +02:00
< input type = " hidden " name = " idmastrino " value = " <?php echo $record['idmastrino'] ; ?> " >
< input type = " hidden " name = " iddocumento " value = " <?php echo $record['iddocumento'] ; ?> " >
2017-08-04 16:28:16 +02:00
2018-04-04 01:04:55 +02:00
< div class = " row " >
2017-08-04 16:28:16 +02:00
< ? php
2023-08-04 14:54:28 +02:00
2024-01-15 15:30:45 +01:00
// Controllo se alla prima nota solo collegate più fatture
2019-04-15 11:35:09 +02:00
$rs_doc = $dbo -> fetchArray ( 'SELECT DISTINCT iddocumento, (SELECT IFNULL(numero_esterno, numero) FROM co_documenti WHERE id=co_movimenti.iddocumento) AS numero FROM co_movimenti WHERE idmastrino=' . prepare ( $record [ 'idmastrino' ]) . ' AND iddocumento!=0' );
2019-04-12 09:20:23 +02:00
2024-01-15 15:30:45 +01:00
if ( sizeof ( $rs_doc ) > 0 ) {
if ( sizeof ( $rs_doc ) == 1 ) {
2024-02-26 15:53:39 +01:00
$rs = $dbo -> fetchArray ( 'SELECT `dir` FROM `co_tipidocumento` INNER JOIN `co_documenti` ON `co_tipidocumento`.`id`=`co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id`=' . prepare ( $rs_doc [ 0 ][ 'iddocumento' ]));
2024-03-20 11:13:28 +01:00
$id_modulo = ( $rs [ 0 ][ 'dir' ] == 'entrata' ) ? ( new Module ()) -> getByField ( 'name' , 'Fatture di vendita' ) -> id_record : ( new Module ()) -> getByField ( 'name' , 'Fatture di acquisto' ); ?>
2022-03-10 15:38:58 +01:00
< div class = " col-md-2 " >
2019-04-15 11:35:09 +02:00
< br >
2022-03-10 15:38:58 +01:00
< div class = " btn-group " >
2024-03-20 11:13:28 +01:00
< a href = " <?php echo base_path(); ?>/editor.php?id_module=<?php echo (new Module())->getByField('name', 'Preventivi'); ?>&id_record=<?php echo $rs_doc[0] ['iddocumento']; ?> " class = " btn btn-info " >< i class = " fa fa-chevron-left " ></ i > < ? php echo tr ( 'Vai alla fattura' ); ?> </a>
2022-03-10 15:38:58 +01:00
< a type = " button " class = " btn btn-info dropdown-toggle " data - toggle = " dropdown " aria - haspopup = " true " aria - expanded = " false " >
< span class = " caret " ></ span >
< span class = " sr-only " > Toggle Dropdown </ span >
</ a >
< ul class = " dropdown-menu " >
2024-03-05 16:01:45 +01:00
< li >< a href = " <?php echo base_path(); ?>/controller.php?id_module=<?php echo $id_modulo ; ?> " class = " dropdown-item " >< i class = " fa fa-chevron-left " ></ i > < ? php echo tr ( 'Vai all\'elenco delle fatture' ); ?> </a></li>
2022-03-10 15:38:58 +01:00
</ ul >
</ div >
2019-04-12 09:20:23 +02:00
</ div >
2019-04-15 11:35:09 +02:00
< ? php
2024-01-15 15:30:45 +01:00
} else {
?>
2022-03-10 15:38:58 +01:00
< div class = " col-md-2 " >
2019-04-15 11:35:09 +02:00
< br >
2022-03-10 15:38:58 +01:00
< div class = " btn-group " >
2022-03-10 17:29:24 +01:00
< button type = " button " class = " btn btn-info dropdown-toggle " data - toggle = " dropdown " aria - haspopup = " true " aria - expanded = " false " >
< ? php echo tr ( 'Più fatture collegate' ); ?> ... <span class="caret"></span>
2022-03-10 15:38:58 +01:00
< span class = " sr-only " > Toggle Dropdown </ span >
2022-03-10 17:29:24 +01:00
</ button >
2022-03-10 15:38:58 +01:00
2019-04-15 11:35:09 +02:00
< ul class = " dropdown-menu " >
< ? php
2024-01-15 15:30:45 +01:00
for ( $i = 0 ; $i < sizeof ( $rs_doc ); ++ $i ) {
2024-02-26 15:53:39 +01:00
$rs = $dbo -> fetchArray ( 'SELECT `dir` FROM `co_tipidocumento` INNER JOIN `co_documenti` ON `co_tipidocumento`.`id`=`co_documenti`.`idtipodocumento` WHERE `co_documenti`.`id`=' . prepare ( $rs_doc [ $i ][ 'iddocumento' ]));
2024-03-20 11:13:28 +01:00
$id_modulo = ( $rs [ 0 ][ 'dir' ] == 'entrata' ) ? ( new Module ()) -> getByField ( 'name' , 'Fatture di vendita' ) -> id_record : ( new Module ()) -> getByField ( 'name' , 'Fatture di acquisto' ); ?>
2024-03-05 16:01:45 +01:00
< li >< a href = " <?php echo base_path(); ?>/editor.php?id_module=<?php echo $id_modulo ; ?>&id_record=<?php echo $rs_doc[$i] ['iddocumento']; ?> " class = " dropdown-item " >< i class = " fa fa-chevron-left " ></ i > < ? php echo tr ( 'Vai alla fattura n. ' . $rs_doc [ $i ][ 'numero' ]); ?> </a></li>
2019-04-15 11:35:09 +02:00
< ? php
2024-01-15 15:30:45 +01:00
} ?>
2019-04-15 11:35:09 +02:00
</ ul >
</ div >
</ div >
< ? php
2017-08-04 16:28:16 +02:00
}
2024-01-15 15:30:45 +01:00
}
?>
2017-08-04 16:28:16 +02:00
2018-04-04 01:04:55 +02:00
< div class = " col-md-3 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " date " , " label " : " <?php echo tr('Data movimento'); ?> " , " name " : " data " , " required " : 1 , " value " : " $data $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
2018-04-04 01:04:55 +02:00
< div class = " col-md-7 " >
2017-09-04 12:02:29 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Causale'); ?> " , " name " : " descrizione " , " required " : 1 , " value " : " $descrizione $ " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2019-07-31 18:22:35 +02:00
< ? php
2017-08-04 16:28:16 +02:00
2019-12-11 16:23:51 +01:00
$movimenti = $mastrino -> movimenti -> toArray ();
2017-08-04 16:28:16 +02:00
2019-07-31 18:22:35 +02:00
include $structure -> filepath ( 'movimenti.php' );
2019-04-13 00:09:48 +02:00
2019-07-31 18:22:35 +02:00
?>
2020-10-06 12:29:14 +02:00
2020-10-13 14:53:01 +02:00
<!-- Note -->
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " required " : 0 , " value " : " $note $ " ]}
</ div >
2020-10-06 12:29:14 +02:00
</ div >
2019-07-31 18:22:35 +02:00
</ form >
2018-06-26 14:30:26 +02:00
2020-01-18 11:42:36 +01:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2019-07-31 18:22:35 +02:00
< script >
$ ( " #edit-form " ) . submit ( function ( e ) {
2019-11-22 17:15:17 +01:00
return controllaConti ();
2019-07-31 18:22:35 +02:00
});
</ script >
2017-08-04 16:28:16 +02:00
2018-07-18 15:20:10 +02:00
< a class = " btn btn-danger ask " data - backto = " record-list " data - idmastrino = " <?php echo $record['idmastrino'] ; ?> " >
2017-09-04 12:02:29 +02:00
< i class = " fa fa-trash " ></ i > < ? php echo tr ( 'Elimina' ); ?>
2017-08-04 16:28:16 +02:00
</ a >