mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-23 22:03:18 +01:00
93 lines
2.9 KiB
PHP
93 lines
2.9 KiB
PHP
<?php
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
$module = Modules::get($id_module);
|
|
|
|
if ($module['name'] == 'Fatture di vendita') {
|
|
$dir = 'entrata';
|
|
$conti = 'conti-vendite';
|
|
} else {
|
|
$dir = 'uscita';
|
|
$conti = 'conti-acquisti';
|
|
}
|
|
|
|
$record = $dbo->fetchArray('SELECT * FROM co_documenti WHERE id='.prepare($id_record));
|
|
$numero = ($record[0]['numero_esterno'] != '') ? $record[0]['numero_esterno'] : $record[0]['numero'];
|
|
$idconto = $record[0]['idconto'];
|
|
$idanagrafica = $record[0]['idanagrafica'];
|
|
|
|
/*
|
|
Form di inserimento riga documento
|
|
*/
|
|
echo '
|
|
<p>'.tr('Documento numero _NUM_', [
|
|
'_NUM_' => $numero,
|
|
]).'</p>
|
|
|
|
<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
|
|
$_SESSION['superselect']['stato'] = 'fatturabile';
|
|
$_SESSION['superselect']['non_fatturato'] = 1;
|
|
echo '
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
{[ "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);\"" ]}
|
|
</div>
|
|
</div>';
|
|
|
|
// Descrizione
|
|
echo '
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
{[ "type": "textarea", "label": "'.tr('Descrizione').'", "name": "descrizione", "required": 1 ]}
|
|
</div>
|
|
</div>';
|
|
|
|
// Leggo l'iva predefinita dall'articolo e se non c'è leggo quella predefinita generica
|
|
$idiva = $idiva ?: get_var('Iva predefinita');
|
|
|
|
// Iva
|
|
echo '
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
{[ "type": "select", "label": "'.tr('Iva').'", "name": "idiva", "required": 1, "value": "'.$idiva.'", "values": "query=SELECT * FROM co_iva ORDER BY descrizione ASC" ]}
|
|
</div>';
|
|
|
|
echo '
|
|
<div class="col-md-6">
|
|
{[ "type": "select", "label": "'.tr('Conto').'", "name": "idconto", "required": 1, "value": "'.$idconto.'", "ajax-source": "'.$conti.'" ]}
|
|
</div>
|
|
</div>';
|
|
|
|
// Costo unitario
|
|
echo '
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
{[ "type": "number", "label": "'.tr('Costo unitario').'", "name": "prezzo", "required": 1, "icon-after": "€" ]}
|
|
</div>';
|
|
|
|
// Sconto unitario
|
|
echo '
|
|
<div class="col-md-6">
|
|
{[ "type": "number", "label": "'.tr('Sconto unitario').'", "name": "sconto", "icon-after": "choice|untprc" ]}
|
|
</div>
|
|
</div>';
|
|
|
|
echo '
|
|
|
|
<!-- PULSANTI -->
|
|
<div class="row">
|
|
<div class="col-md-12 text-right">
|
|
<button type="submit" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> '.tr('Aggiungi').'</button>
|
|
</div>
|
|
</div>
|
|
</form>';
|
|
|
|
echo '
|
|
<script src="'.$rootdir.'/lib/init.js"></script>';
|