2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
2017-09-22 15:19:59 +02:00
|
|
|
$module = Modules::get($id_module);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
if ($module['name'] == 'Fatture di vendita') {
|
|
|
|
$dir = 'entrata';
|
|
|
|
$conti = 'conti-vendite';
|
|
|
|
} else {
|
|
|
|
$dir = 'uscita';
|
|
|
|
$conti = 'conti-acquisti';
|
|
|
|
}
|
|
|
|
|
2018-07-19 12:50:34 +02:00
|
|
|
$info = $dbo->fetchOne('SELECT * FROM co_documenti WHERE id='.prepare($id_record));
|
2018-07-18 14:50:46 +02:00
|
|
|
$numero = ($info['numero_esterno'] != '') ? $info['numero_esterno'] : $info['numero'];
|
|
|
|
$idconto = $info['idconto'];
|
|
|
|
$idanagrafica = $info['idanagrafica'];
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Form di inserimento riga documento
|
|
|
|
*/
|
|
|
|
echo '
|
2017-09-10 14:35:41 +02:00
|
|
|
<p>'.tr('Documento numero _NUM_', [
|
|
|
|
'_NUM_' => $numero,
|
|
|
|
]).'</p>
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
<form action="'.$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record.'" method="post">
|
|
|
|
<input type="hidden" name="op" value="addcontratto">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="dir" value="'.$dir.'">';
|
|
|
|
|
|
|
|
// Contratto
|
2018-07-02 18:01:39 +02:00
|
|
|
$_SESSION['superselect']['stato'] = 'fatturabile';
|
|
|
|
$_SESSION['superselect']['non_fatturato'] = 1;
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2018-07-23 17:10:30 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Contratto').'", "name": "idcontratto", "required": 1, "ajax-source": "contratti", "extra": "onchange=\"$data = $(this).selectData(); $(\'#descrizione\').val($data.text); $(\'#prezzo\').val($data.totale); $(\'#sconto\').val($data.sconto);\"" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
2018-10-30 10:27:44 +01:00
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
{[ "type": "checkbox", "label": "'.tr('Importa righe').'", "name": "import", "value": "1", "placeholder": "'.tr('Replica righe del contratto in fattura').'" ]}
|
|
|
|
</div>
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>';
|
|
|
|
|
|
|
|
// Descrizione
|
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "descrizione", "required": 1 ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
// Leggo l'iva predefinita dall'articolo e se non c'è leggo quella predefinita generica
|
2018-07-08 18:11:17 +02:00
|
|
|
$idiva = $idiva ?: setting('Iva predefinita');
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
// Iva
|
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2018-09-21 18:08:47 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Iva').'", "name": "idiva", "required": 1, "value": "'.$idiva.'", "ajax-source": "iva" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<div class="col-md-6">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "select", "label": "'.tr('Conto').'", "name": "idconto", "required": 1, "value": "'.$idconto.'", "ajax-source": "'.$conti.'" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
// Costo unitario
|
|
|
|
echo '
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "number", "label": "'.tr('Costo unitario').'", "name": "prezzo", "required": 1, "icon-after": "€" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>';
|
|
|
|
|
|
|
|
// Sconto unitario
|
|
|
|
echo '
|
|
|
|
<div class="col-md-6">
|
2017-09-04 12:02:29 +02:00
|
|
|
{[ "type": "number", "label": "'.tr('Sconto unitario').'", "name": "sconto", "icon-after": "choice|untprc" ]}
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
|
|
|
|
<!-- PULSANTI -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 text-right">
|
2017-09-04 12:02:29 +02:00
|
|
|
<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> '.tr('Aggiungi').'</button>
|
2017-08-04 16:28:16 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<script src="'.$rootdir.'/lib/init.js"></script>';
|