gest366/modules/ordini/edit.php

244 lines
9.1 KiB
PHP
Raw Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
?><form action="" method="post" role="form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<input type="hidden" name="id_record" value="<?php echo $id_record ?>">
<?php
$dir="uscita";
$_SESSION['filtro_categoria']="0";
$_SESSION['filtro_fornitore']="0";
$pulsante_elimina = "0" ;
$idanagrafica=$records[0]['idanagrafica'];
// dati anagrafica
$rs_ana = $dbo->fetchArray("SELECT * FROM an_anagrafiche WHERE idanagrafica=\"".$idanagrafica."\"");
$idanagrafica=$records[0]['idanagrafica'];
?>
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="clearfix"></div>
</br>
<div class="col-md-4">
<div class="pull-left">
<button type="submit" class="btn-app btn-success"><i class="fa fa-check"></i> Salva </button>
<?php if( $records[0]['stato'] != 'Evaso' && $dir=='uscita' ){ ?>
<button type="button" class="btn-app btn-primary" data-href="<?php echo $rootdir ?>/modules/ordini/creadocumento.php?idordine=<?php echo $id_record ?>&dir=<?php echo $dir ?>" data-toggle="modal" data-title="Carica ordine" data-target="#bs-popup" ><i class="fa fa-plug"></i> Carica Ordine</i></a>
<?php } ?>
</div>
<button type="button" class="btn-app btn-primary"
onclick="launch_modal( 'Invio documento tramite E-mail', '<?php echo $rootdir ?>/modules/ordini/mail_pdf.php?id_module=<?php echo $id_module ?>&idordine=<?php echo $id_record ?>',1);">
<i class="fa fa-envelope"></i> Archivia ed Invia Mail</button>
</div>
<div class="col-md-4">
<div class="pull-right">
<?php
if( ( $records[0]['idstatoordine'] != "2" ) && ( $records[0]['idstatoordine'] != "3" )) {
?>
<div class="pull-left showcase sweet">
<button type="button" class="btn-app btn-danger" aria-label="Show SweetAlert2 success message" ><i class="fa fa-trash-o"></i> Elimina</span></button>
</div>
<?php
}
?>
</div>
</div>
<div class="col-md-4">
<div class="pull-right">
<a class="btn btn-app btn-info" target="_blank" href="<?php echo $rootdir ?>/templates/pdfgen.php?ptype=ordini&idordine=<?php echo $id_record ?>" data-title="Stampa ordine"><i class="fa fa-print"></i> Stampa ordine</a>
<a class="btn btn-app btn-info" target="_blank" href="<?php echo $rootdir ?>/editor.php?id_module=2&id_record=<?php echo $idanagrafica ?>"><i class="fa fa-user"></i>Anagrafica</a>
</div>
</div>
<div class="clearfix"></div>
</div>
<!-- INTESTAZIONE -->
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="panel-heading">
<h3 class="panel-title">Intestazione</h3>
</div>
<div class="panel-body">
<div class="col-md-4">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Dettaglio Anagrafica</h3>
</div>
<div class="box-body">
<div class="form-group">
{[ "type": "text", "label": "Ragione Sociale", "class": "form-control", "value": "<?php echo $rs_ana[0]['ragione_sociale']?>", "extra": "readonly" ]}
</div>
<div class="form-group">
{[ "type": "text", "label": "Localita", "class": "form-control", "value": "<?php echo $rs_ana[0]['citta']?>", "extra": "readonly" ]}
</div>
<div class="form-group">
{[ "type": "text", "label": "Telefono", "class": "form-control", "value": "<?php echo $rs_ana[0]['telefono']?>", "extra": "readonly" ]}
</div>
<div class="form-group">
{[ "type": "text", "label": "Email", "class": "form-control", "value": "<?php echo $rs_ana[0]['email']?>", "extra": "readonly" ]}
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Dettaglio Ordine</h3>
</div>
<div class="box-body">
<div class="form-group">
{[ "type": "text", "label": "<?php echo _("Numero ordine"); ?>", "name": "numero", "required": 1, "class": "text-center", "value": "$numero$", "extra": "" ]}
</div>
<div class="form-group">
{[ "type": "text", "label": "<?php echo _("Numero secondario"); ?>", "name": "numero_esterno", "required": 0, "class": "text-center", "value": "$numero_esterno$", "extra": "" ]}
</div>
<div class="form-group">
{[ "type": "date", "label": "<?php echo _("Data"); ?>", "maxlength": 10, "name": "data", "required": 1, "class": "text-center datepicker", "value": "$data$", "extra": "" ]}
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Dati Aggiuntivi</h3>
</div>
<div class="box-body">
<div class="form-group">
{[ "type": "select", "label": "<?php echo _("Stato"); ?>", "name": "idstatoordine", "required": 1, "class": "", "values": "query=SELECT * FROM or_statiordine", "value": "$idstatoordine$", "extra": "" ]}
</div>
<div class="form-group">
{[ "type": "select", "label": "<?php echo _("Pagamento"); ?>", "name": "idpagamento", "required": 0, "class": "", "values": "query=SELECT id, descrizione FROM co_pagamenti GROUP BY descrizione ORDER BY descrizione ASC", "value": "$idpagamento$", "extra": "" ]}
</div>
<div class="form-group">
{[ "type": "date", "label": "Data prevista consegna", "maxlength": 10, "name": "data_prevista_consegna", "required": 0, "class": "text-center date-mask", "value": "$data_prevista_consegna$", "extra": "" ]}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo _("Note"); ?>", "name": "note", "required": 0, "class": "", "value": "$note$", "extra": "" ]}
</div>
</div>
</div>
</div>
</form>
<!-- RIGHE -->
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="panel-heading">
<h3 class="panel-title">Transazioni di Carico</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="table-responsive">
<table class="table no-margin">
<thead>
<tr>
<th> Vedi</th>
<th class='text-left'> Utente</th>
<th class='text-left'>In Data</th>
<th class='text-left'> Documento</th>
<th class='text-left'>Documento</th>
<th class='text-left'>Data Doc</th>
<th class='text-right'>Totale</th>
</tr>
</thead>
<tbody>
<?php
storico_transazioni($id_record);
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- RIGHE -->
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="panel-heading">
<h3 class="panel-title">Posizioni</h3>
</div>
<div class="panel-body">
<div class="pull-left">
<?php if( $records[0]['stato'] != 'Evaso' ){ ?>
<a class="btn btn-sm btn-primary" data-href="<?php echo $rootdir ?>/modules/ordini/add_articolo.php?idordine=<?php echo $id_record ?>&dir=<?php echo $dir ?>" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup"><i class="fa fa-plus"></i> Articolo</a>
<a class="btn btn-sm btn-primary" data-href="<?php echo $rootdir ?>/modules/ordini/add_riga.php?idordine=<?php echo $id_record ?>&dir=<?php echo $dir ?>" data-toggle="modal" data-title="Aggiungi riga" data-target="#bs-popup"><i class="fa fa-plus"></i> Riga generica</a>
<?php } ?>
</div>
<div class="pull-right">
</div>
<div class="clearfix"></div>
<br>
<div class="row">
<div class="col-md-12">
<table class="table table-striped table-hover table-condensed table-bordered">
<tr>
<th>Descrizione</th>
<th width="120">Q.t&agrave;</th>
<th width="80">U.m.</th>
<th width="120">Costo unitario</th>
<th width="120">Iva</th>
<th width="120">Imponibile</th>
<th width="60"></th>
</tr>
<?php include($docroot."/modules/ordini/row-list.php"); ?>
</table>
</div>
</div>
</div>
</div>
<form action="" method="post" role="form" id="form-delete">
<input type="hidden" name="backto" value="record-list">
<input type="hidden" name="op" value="delete">
</form>
<script>
$('.showcase.sweet button').on('click', () => {
swal({
title: 'Sei sicuro?',
text: "Eliminare questo elemento!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Conferma!'
}).then((result) => {
if (result.value) {
{ $('#form-delete').submit(); }
}
})
})
</script>