mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-01 08:26:53 +01:00
Fix #444
This commit is contained in:
parent
858a3060bf
commit
f00543bccf
@ -142,7 +142,7 @@ if ($record['stato'] == 'Emessa') {
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Identificatore Documento'); ?>", "help": "<?php echo tr("<span>Obbligatorio per valorizzare CIG/CUP. È possible inserire: </span><ul><li>N. determina</li><li>RDO</li><li>Ordine MEPA</li></ul>"); ?>","name": "id_documento_fe", "required": 0, "value": "$id_documento_fe$", "maxlength": 20 ]}
|
||||
{[ "type": "text", "label": "<?php echo tr('Identificatore Documento'); ?>", "help": "<?php echo tr('<span>Obbligatorio per valorizzare CIG/CUP. È possible inserire: </span><ul><li>N. determina</li><li>RDO</li><li>Ordine MEPA</li></ul>'); ?>","name": "id_documento_fe", "required": 0, "value": "$id_documento_fe$", "maxlength": 20 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
@ -32,7 +32,7 @@ $result['idiva'] = $iva[0]['idiva'] ?: setting('Iva predefinita');
|
||||
// Aggiunta sconto di default da listino per le vendite
|
||||
$listino = $dbo->fetchArray('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_listini ON an_anagrafiche.idlistino_vendite=mg_listini.id WHERE idanagrafica='.prepare($idanagrafica));
|
||||
|
||||
if( $listino[0]['prc_guadagno'] > 0 ){
|
||||
if ($listino[0]['prc_guadagno'] > 0) {
|
||||
$result['sconto_unitario'] = $listino[0]['prc_guadagno'];
|
||||
$result['tipo_sconto'] = 'PRC';
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ $_SESSION['superselect']['idanagrafica'] = $record['idanagrafica'];
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Porto'); ?>", "name": "idporto", "placeholder": "-", "help": "<?php echo tr("<ul><li>Franco: pagamento del trasporto a carico del mittente</li> <li>Assegnato pagamento del trasporto a carico del destinatario</li> </ul>"); ?>", "values": "query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione ASC", "value": "$idporto$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
||||
{[ "type": "select", "label": "<?php echo tr('Porto'); ?>", "name": "idporto", "placeholder": "-", "help": "<?php echo tr('<ul><li>Franco: pagamento del trasporto a carico del mittente</li> <li>Assegnato pagamento del trasporto a carico del destinatario</li> </ul>'); ?>", "values": "query=SELECT id, descrizione FROM dt_porto ORDER BY descrizione ASC", "value": "$idporto$", "readonly": "<?php echo $record['flag_completato']; ?>" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
@ -38,7 +38,7 @@ $result['idiva'] = $iva[0]['idiva'] ?: setting('Iva predefinita');
|
||||
// Aggiunta sconto di default da listino per le vendite
|
||||
$listino = $dbo->fetchArray('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_listini ON an_anagrafiche.idlistino_'.($dir == 'uscita' ? 'acquisti' : 'vendite').'=mg_listini.id WHERE idanagrafica='.prepare($idanagrafica));
|
||||
|
||||
if( $listino[0]['prc_guadagno'] > 0 ){
|
||||
if ($listino[0]['prc_guadagno'] > 0) {
|
||||
$result['sconto_unitario'] = $listino[0]['prc_guadagno'];
|
||||
$result['tipo_sconto'] = 'PRC';
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ include $docroot.'/modules/fatture/row-list.php';
|
||||
|
||||
<?php
|
||||
if ($dir == 'entrata') {
|
||||
echo '
|
||||
echo '
|
||||
<div class="alert alert-info text-center">'.tr('Per allegare un documento alla fattura elettronica caricare il file specificando come categoria "Fattura Elettronica"').'.</div>';
|
||||
}
|
||||
?>
|
||||
|
@ -47,7 +47,7 @@ $result['idiva'] = $iva[0]['idiva'] ?: setting('Iva predefinita');
|
||||
// Aggiunta sconto di default da listino per le vendite
|
||||
$listino = $dbo->fetchArray('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_listini ON an_anagrafiche.idlistino_'.($dir == 'uscita' ? 'acquisti' : 'vendite').'=mg_listini.id WHERE idanagrafica='.prepare($idanagrafica));
|
||||
|
||||
if( $listino[0]['prc_guadagno'] > 0 ){
|
||||
if ($listino[0]['prc_guadagno'] > 0) {
|
||||
$result['sconto_unitario'] = $listino[0]['prc_guadagno'];
|
||||
$result['tipo_sconto'] = 'PRC';
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ $result['idiva'] = $iva[0]['idiva'] ?: setting('Iva predefinita');
|
||||
// Aggiunta sconto di default da listino per le vendite
|
||||
$listino = $dbo->fetchArray('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_listini ON an_anagrafiche.idlistino_'.($dir == 'uscita' ? 'acquisti' : 'vendite').'=mg_listini.id WHERE idanagrafica='.prepare($idanagrafica));
|
||||
|
||||
if( $listino[0]['prc_guadagno'] > 0 ){
|
||||
if ($listino[0]['prc_guadagno'] > 0) {
|
||||
$result['sconto_unitario'] = $listino[0]['prc_guadagno'];
|
||||
$result['tipo_sconto'] = 'PRC';
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ $result['idiva'] = $iva[0]['idiva'] ?: setting('Iva predefinita');
|
||||
// Aggiunta sconto di default da listino per le vendite
|
||||
$listino = $dbo->fetchArray('SELECT prc_guadagno FROM an_anagrafiche INNER JOIN mg_listini ON an_anagrafiche.idlistino_vendite=mg_listini.id WHERE idanagrafica='.prepare($idanagrafica));
|
||||
|
||||
if( $listino[0]['prc_guadagno'] > 0 ){
|
||||
if ($listino[0]['prc_guadagno'] > 0) {
|
||||
$result['sconto_unitario'] = $listino[0]['prc_guadagno'];
|
||||
$result['tipo_sconto'] = 'PRC';
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ if (!empty($tecnici)) {
|
||||
<tr>
|
||||
<th>'.$tecnico['ragione_sociale'].'</th>
|
||||
<th>'.tr('Attività').'</th>
|
||||
<th>'.tr('Addebito orario').' <span class="tip" title="'.tr("Addebito al cliente").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Addebito km').' <span class="tip" title="'.tr("Addebito al cliente").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Addebito diritto ch.').' <span class="tip" title="'.tr("Addebito al cliente").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Addebito orario').' <span class="tip" title="'.tr('Addebito al cliente').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Addebito km').' <span class="tip" title="'.tr('Addebito al cliente').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Addebito diritto ch.').' <span class="tip" title="'.tr('Addebito al cliente').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
|
||||
<th>'.tr('Costo orario').' <span class="tip" title="'.tr("Costo interno").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Costo km').' <span class="tip" title="'.tr("Costo interno").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Costo diritto ch.').' <span class="tip" title="'.tr("Costo interno").'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Costo orario').' <span class="tip" title="'.tr('Costo interno').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Costo km').' <span class="tip" title="'.tr('Costo interno').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th>'.tr('Costo diritto ch.').' <span class="tip" title="'.tr('Costo interno').'"><i class="fa fa-question-circle-o"></i></span></th>
|
||||
<th width="40"></th>
|
||||
</tr>';
|
||||
|
||||
|
@ -141,17 +141,19 @@ echo '
|
||||
<i class="fa fa-download"></i> '.tr('Scarica').'
|
||||
</a>';
|
||||
|
||||
$file = $generated ? Models\Upload::where('filename', $fattura_pa->getFilename())->where('id_record', $id_record)->first() : null;
|
||||
|
||||
echo '
|
||||
|
||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||
|
||||
<a href="'.ROOTDIR.'/plugins/exportFE/view.php?id_record='.$id_record.'" class="btn btn-info btn-lg '.($generated ? '' : 'disabled').'" target="_blank" '.($generated ? '' : 'disabled').'>
|
||||
<a href="'.ROOTDIR.'/view.php?file_id='.($file ? $file->id : null).'" class="btn btn-info btn-lg '.($generated ? '' : 'disabled').'" target="_blank" '.($generated ? '' : 'disabled').'>
|
||||
<i class="fa fa-eye"></i> '.tr('Visualizza').'
|
||||
</a>';
|
||||
|
||||
$send = Interaction::isEnabled() && $generated && $record['codice_stato_fe'] == 'GEN';
|
||||
$send = Interaction::isEnabled() && $generated && $record['codice_stato_fe'] == 'GEN';
|
||||
|
||||
echo '
|
||||
echo '
|
||||
|
||||
<i class="fa fa-arrow-right fa-fw text-muted"></i>
|
||||
|
||||
|
@ -465,9 +465,10 @@ class FatturaElettronica
|
||||
if (!empty($anagrafica['provincia']) && $anagrafica->nazione->iso2 == 'IT') {
|
||||
$result['Provincia'] = strtoupper($anagrafica['provincia']);
|
||||
}
|
||||
|
||||
if (!empty($anagrafica->nazione->iso2))
|
||||
$result['Nazione'] = $anagrafica->nazione->iso2;
|
||||
|
||||
if (!empty($anagrafica->nazione->iso2)) {
|
||||
$result['Nazione'] = $anagrafica->nazione->iso2;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/init.php';
|
||||
|
||||
// XML
|
||||
$xml = new DOMDocument();
|
||||
$xml->loadXML($fattura_pa->toXML());
|
||||
|
||||
// XSL
|
||||
$xsl = new DOMDocument();
|
||||
$xsl->load(__DIR__.'/src/stylesheet-1.2.1.xsl');
|
||||
|
||||
// XSLT
|
||||
$xslt = new XSLTProcessor();
|
||||
$xslt->importStylesheet($xsl);
|
||||
|
||||
echo $xslt->transformToXML($xml);
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace HTMLBuilder\Manager;
|
||||
|
||||
use Models\Upload;
|
||||
|
||||
/**
|
||||
* Gestione allegati.
|
||||
*
|
||||
@ -77,13 +79,14 @@ class FileManager implements ManagerInterface
|
||||
</tr>';
|
||||
|
||||
foreach ($rs as $r) {
|
||||
$extension = pathinfo($r['original'])['extension'];
|
||||
$file = Upload::find($r['id']);
|
||||
|
||||
$result .= '
|
||||
<tr>
|
||||
<td align="left">
|
||||
<a href="'.ROOTDIR.'/'.$directory.'/'.$r['filename'].'" target="_blank">
|
||||
<i class="fa fa-external-link"></i> '.$r['name'].'
|
||||
</a> ('.$extension.')'.'
|
||||
</a> ('.$file->extension.')'.'
|
||||
</td>
|
||||
<td>'.\Translator::timestampToLocale($r['created_at']).'</td>
|
||||
<td class="text-center">
|
||||
@ -92,31 +95,11 @@ class FileManager implements ManagerInterface
|
||||
</a>';
|
||||
|
||||
// Anteprime supportate dal browser
|
||||
$supported_extensions = ['pdf', 'jpg', 'png', 'gif', 'jpeg', 'bmp'];
|
||||
if (in_array(strtolower($extension), $supported_extensions)) {
|
||||
$result .= "
|
||||
<div class='hide-it-off-screen' id='view-".$r['id']."'>";
|
||||
|
||||
if ($extension == 'pdf') {
|
||||
$result .= '
|
||||
<iframe src="'.\Prints::getPDFLink($directory.'/'.$r['filename']).'" frameborder="0" width="100%" height="550"></iframe>';
|
||||
} else {
|
||||
$result .= '
|
||||
<img src="'.ROOTDIR.'/'.$directory.'/'.$r['filename'].'" width="100%"></img>';
|
||||
}
|
||||
|
||||
if ($file->hasPreview()) {
|
||||
$result .= '
|
||||
</div>';
|
||||
|
||||
$result .= '
|
||||
<button class="btn btn-xs btn-info" data-target="#bs-popup2" type="button" data-title="'.prepareToField($r['name']).' <small><em>('.$r['filename'].')</em></small>" data-href="#view-'.$r['id'].'">
|
||||
<button class="btn btn-xs btn-info" data-target="#bs-popup2" type="button" data-title="'.prepareToField($r['name']).' <small style=\'color:white\'><i>('.$r['filename'].')</i></small>" data-href="'.ROOTDIR.'/view.php?file_id='.$r['id'].'">
|
||||
<i class="fa fa-eye"></i>
|
||||
</button>';
|
||||
} elseif (strtolower($extension) == 'xml') {
|
||||
$result .= '
|
||||
<a class="btn btn-xs btn-info" href="'.ROOTDIR.'/plugins/exportFE/view.php?id_record='.$r['id_record'].'" target="_blank">
|
||||
<i class="fa fa-eye"></i>
|
||||
</a>';
|
||||
} else {
|
||||
$result .= '
|
||||
<button class="btn btn-xs btn-default disabled" title="'.tr('Anteprima file non disponibile').'" disabled>
|
||||
|
@ -13,6 +13,66 @@ class Upload extends Model
|
||||
return $this->attributes['category'] ?: 'Generale';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getExtensionAttribute()
|
||||
{
|
||||
$pos = strrpos($this->filename, '.');
|
||||
|
||||
if (!$pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$extension = substr($this->filename, $pos + 1);
|
||||
|
||||
return strtolower($extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFilepathAttribute()
|
||||
{
|
||||
$parent = $this->plugin ?: $this->module;
|
||||
|
||||
return $parent->upload_directory.'/'.$this->filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isImage()
|
||||
{
|
||||
$list = ['jpg', 'png', 'gif', 'jpeg', 'bmp'];
|
||||
|
||||
return in_array($this->extension, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isFatturaElettronica()
|
||||
{
|
||||
return $this->extension == 'xml' && strtolower($this->category) == 'fattura elettronica';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPDF()
|
||||
{
|
||||
return $this->extension == 'pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPreview()
|
||||
{
|
||||
return $this->isImage() || $this->isFatturaElettronica() || $this->isPDF();
|
||||
}
|
||||
|
||||
/* Relazioni Eloquent */
|
||||
|
||||
public function module()
|
||||
|
59
view.php
Normal file
59
view.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
include_once __DIR__.'/core.php';
|
||||
|
||||
$file_id = filter('file_id');
|
||||
|
||||
$file = Models\Upload::find($file_id);
|
||||
|
||||
if (empty($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$link = ROOTDIR.'/'.$file->filepath;
|
||||
|
||||
if ($file->isFatturaElettronica()) {
|
||||
$content = file_get_contents(DOCROOT.'/'.$file->filepath);
|
||||
|
||||
// XML
|
||||
$xml = new DOMDocument();
|
||||
$xml->loadXML($content);
|
||||
|
||||
// XSL
|
||||
$xsl = new DOMDocument();
|
||||
$xsl->load(__DIR__.'/assets/src/xml/fe-stylesheet-1.2.1.xsl');
|
||||
|
||||
// XSLT
|
||||
$xslt = new XSLTProcessor();
|
||||
$xslt->importStylesheet($xsl);
|
||||
|
||||
echo $xslt->transformToXML($xml);
|
||||
} else {
|
||||
echo '
|
||||
<style>
|
||||
body, iframe, img{
|
||||
border: 0;
|
||||
margin: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
iframe{
|
||||
width:100%;
|
||||
height:100%;
|
||||
min-height: 500px;
|
||||
}
|
||||
</style>';
|
||||
|
||||
if ($file->isImage()) {
|
||||
echo '
|
||||
<img src="'.$link.'"></img>';
|
||||
} else {
|
||||
if ($file->isPDF()) {
|
||||
$src = \Prints::getPDFLink($file->filepath);
|
||||
}
|
||||
|
||||
echo '
|
||||
<iframe src="'.($link ?: $src).'">
|
||||
<a src="'.$link.'">'.tr('Il browser non supporta i contenuti iframe: clicca qui per raggiungere il file originale').'</a>
|
||||
</iframe>';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user