mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-27 08:47:39 +01:00
Aggiunti campi nome e cognome + Fix vari FE
This commit is contained in:
parent
9d3ebe247c
commit
25c2eead97
@ -25,12 +25,17 @@ switch (post('op')) {
|
||||
$sede->email = post('email');
|
||||
|
||||
$sede->save();
|
||||
|
||||
|
||||
if (!empty(post('nome')) and !empty(post('cognome')) ){
|
||||
$ragione_sociale = post('nome').' '.post('cognome');
|
||||
}else{
|
||||
$ragione_sociale = post('ragione_sociale');
|
||||
}
|
||||
// Informazioni sull'anagrafica
|
||||
$anagrafica->codice = post('codice');
|
||||
$anagrafica->tipo = post('tipo');
|
||||
$anagrafica->codice_destinatario = post('codice_destinatario');
|
||||
$anagrafica->ragione_sociale = post('ragione_sociale');
|
||||
$anagrafica->ragione_sociale = $ragione_sociale;
|
||||
$anagrafica->partita_iva = post('piva');
|
||||
$anagrafica->codice_fiscale = post('codice_fiscale');
|
||||
$anagrafica->tipo = post('tipo');
|
||||
@ -63,7 +68,8 @@ switch (post('op')) {
|
||||
$anagrafica->idagente = post('idagente');
|
||||
$anagrafica->idrelazione = post('idrelazione');
|
||||
$anagrafica->sitoweb = post('sitoweb');
|
||||
$anagrafica->nome_cognome = post('nome_cognome');
|
||||
$anagrafica->nome = post('nome');
|
||||
$anagrafica->cognome = post('cognome');
|
||||
$anagrafica->iscrizione_tribunale = post('iscrizione_tribunale');
|
||||
$anagrafica->cciaa = post('cciaa');
|
||||
$anagrafica->cciaa_citta = post('cciaa_citta');
|
||||
@ -121,7 +127,7 @@ switch (post('op')) {
|
||||
case 'add':
|
||||
$idtipoanagrafica = post('idtipoanagrafica');
|
||||
$ragione_sociale = post('ragione_sociale');
|
||||
|
||||
|
||||
$anagrafica = Anagrafica::build($ragione_sociale, $idtipoanagrafica);
|
||||
$id_record = $anagrafica->id;
|
||||
|
||||
@ -139,7 +145,9 @@ switch (post('op')) {
|
||||
}
|
||||
|
||||
$idagente = ($agente_is_logged && in_array($id_cliente, $idtipoanagrafica)) ? $user['idanagrafica'] : 0;
|
||||
|
||||
|
||||
$anagrafica->nome = post('nome');
|
||||
$anagrafica->cognome = post('cognome');
|
||||
$anagrafica->partita_iva = post('piva');
|
||||
$anagrafica->codice_fiscale = post('codice_fiscale');
|
||||
$anagrafica->indirizzo = post('indirizzo');
|
||||
|
@ -14,13 +14,24 @@ echo '
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Ragione sociale').'", "name": "ragione_sociale", "required": 1 ]}
|
||||
{[ "type": "text", "label": "'.tr('Denominazione').'", "name": "ragione_sociale", "required": 1 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "select", "label": "'.tr('Tipo di anagrafica').'", "name": "idtipoanagrafica[]", "multiple": "1", "required": 1, "values": "query=SELECT idtipoanagrafica AS id, descrizione FROM an_tipianagrafiche WHERE idtipoanagrafica NOT IN (SELECT DISTINCT(x.idtipoanagrafica) FROM an_tipianagrafiche_anagrafiche x INNER JOIN an_tipianagrafiche t ON x.idtipoanagrafica = t.idtipoanagrafica INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = x.idanagrafica WHERE t.descrizione = \'Azienda\' AND deleted_at IS NULL) ORDER BY descrizione", "value": "'.(isset($idtipoanagrafica) ? $idtipoanagrafica : null).'", "readonly": '.(!empty($readonly_tipo) ? 1 : 0).' ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome", "required": 0 ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "'.tr('Cognome').'", "name": "cognome", "required": 0 ]}
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
echo '
|
||||
<div class="box box-info collapsed-box">
|
||||
|
@ -38,14 +38,34 @@ if (!$cliente) {
|
||||
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{[ "type": "text", "label": "<?php echo tr('Ragione sociale'); ?>", "name": "ragione_sociale", "required": 1, "value": "$ragione_sociale$" ]}
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Denominazione'); ?>", "name": "ragione_sociale", "required": 1, "value": "$ragione_sociale$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "text", "label": "<?php echo tr('Partita IVA'); ?>", "maxlength": 13, "name": "piva", "class": "text-center alphanumeric-mask text-uppercase", "value": "$piva$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "<?php echo tr('Tipologia'); ?>", "name": "tipo", "values": "list=\"\": \"<?php echo tr('Non specificato'); ?>\", \"Azienda\": \"<?php echo tr('Azienda'); ?>\", \"Privato\": \"<?php echo tr('Privato'); ?>\", \"Ente pubblico\": \"<?php echo tr('Ente pubblico'); ?>\"", "value": "$tipo$" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 0, "value": "$nome$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Cognome'); ?>", "name": "cognome", "required": 0, "value": "$cognome$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{[ "type": "text", "label": "<?php echo tr('Codice fiscale'); ?>", "maxlength": 16, "name": "codice_fiscale", "class": "text-center alphanumeric-mask text-uppercase", "value": "$codice_fiscale$" ]}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- RIGA PER LE ANAGRAFICHE CON TIPOLOGIA 'PRIVATO' -->
|
||||
<?php if ($record['tipo'] == 'Privato') {
|
||||
@ -66,15 +86,7 @@ if (!$cliente) {
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Partita IVA'); ?>", "maxlength": 13, "name": "piva", "class": "text-center alphanumeric-mask text-uppercase", "value": "$piva$" ]}
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{[ "type": "text", "label": "<?php echo tr('Codice fiscale'); ?>", "maxlength": 16, "name": "codice_fiscale", "class": "text-center alphanumeric-mask text-uppercase", "value": "$codice_fiscale$" ]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
@ -638,6 +650,42 @@ if (empty($record['deleted_at'])) {
|
||||
$("#lat").val(result.geometry.location.lat());
|
||||
$("#lng").val(result.geometry.location.lng());
|
||||
});
|
||||
|
||||
/* Campo nome e cognome*/
|
||||
if ($('#ragione_sociale').val()!='' && $('#ragione_sociale').val() != $('#nome').val()+' '+$('#cognome').val()){
|
||||
$('#nome').prop('disabled', true);
|
||||
$('#cognome').prop('disabled', true);
|
||||
};
|
||||
|
||||
if ($('#nome').val()!='' && $('#cognome').val()!=''){
|
||||
$('#ragione_sociale').prop('disabled', true);
|
||||
$("#ragione_sociale").attr('required', false);
|
||||
};
|
||||
|
||||
$('#nome, #cognome').keyup(function(){
|
||||
if ($('#nome').val() =='' && $('#cognome').val() =='' ){
|
||||
$('#ragione_sociale').prop('disabled', false);
|
||||
$("#ragione_sociale").attr('required', true);
|
||||
}else{
|
||||
|
||||
$('#ragione_sociale').prop('disabled', true);
|
||||
$("#ragione_sociale").attr('required', false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#ragione_sociale').keyup(function(){
|
||||
|
||||
if ($(this).val()!=''){
|
||||
$('#nome').prop('disabled', true);
|
||||
$('#cognome').prop('disabled', true);
|
||||
$("#ragione_sociale").attr('required', true);
|
||||
}else{
|
||||
$('#nome').prop('disabled', false);
|
||||
$('#cognome').prop('disabled', false);
|
||||
$("#ragione_sociale").attr('required', false);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -22,7 +22,7 @@ if (!empty($fattura_pa)) {
|
||||
// Campi obbligatori per il pagamento
|
||||
$pagamento = $database->fetchOne('SELECT * FROM `co_pagamenti` WHERE `id` = '.prepare($record['idpagamento']));
|
||||
$fields = [
|
||||
'codice_modalita_pagamento_fe' => 'Codice di pagamento FE',
|
||||
'codice_modalita_pagamento_fe' => 'Codice modalità pagamento FE',
|
||||
];
|
||||
|
||||
$missing = [];
|
||||
@ -35,7 +35,7 @@ foreach ($fields as $key => $name) {
|
||||
if (!empty($missing) && !$generated) {
|
||||
echo '
|
||||
<div class="alert alert-warning">
|
||||
<p><i class="fa fa-warning"></i> '.tr('Prima di procedere alla generazione della fattura elettronica completa i seguenti campi del tipo di pagamento: _FIELDS_', [
|
||||
<p><i class="fa fa-warning"></i> '.tr('Prima di procedere alla generazione della fattura elettronica completa i seguenti campi per il Pagamento: _FIELDS_', [
|
||||
'_FIELDS_' => '<b>'.implode(', ', $missing).'</b>',
|
||||
]).'</p>
|
||||
</div>';
|
||||
|
@ -621,6 +621,23 @@ class FatturaElettronica
|
||||
|
||||
return $this->cliente;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce le informazioni sull'anagrafica dell'intermediario.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getIntermediario()
|
||||
{
|
||||
if (empty($this->intermediario)) {
|
||||
$intermediario = static::getAnagrafica(setting('Terzo intermediario'));
|
||||
$this->intermediario = $intermediario;
|
||||
}
|
||||
|
||||
return $this->intermediario;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce le informazioni riguardanti un anagrafica sulla base dell'identificativo fornito.
|
||||
@ -823,7 +840,7 @@ class FatturaElettronica
|
||||
public function getFilename($new = false)
|
||||
{
|
||||
$azienda = static::getAzienda();
|
||||
$prefix = 'IT'.(empty($azienda['piva']) ? $azienda['codice_fiscale'] : $azienda['piva']);
|
||||
$prefix = 'IT'.(!empty($azienda['codice_fiscale']) ? $azienda['codice_fiscale'] : $azienda['piva']);
|
||||
|
||||
if (empty($this->documento['progressivo_invio']) || !empty($new)) {
|
||||
$database = database();
|
||||
@ -904,7 +921,7 @@ class FatturaElettronica
|
||||
$result = [
|
||||
'IdTrasmittente' => [
|
||||
'IdPaese' => $azienda['nazione'],
|
||||
'IdCodice' => (!empty($azienda['piva'])) ? $azienda['piva'] : $azienda['codice_fiscale'],
|
||||
'IdCodice' => (!empty($azienda['codice_fiscale'])) ? $azienda['codice_fiscale'] : $azienda['piva'],
|
||||
],
|
||||
'ProgressivoInvio' => $documento['progressivo_invio'],
|
||||
'FormatoTrasmissione' => ($cliente['tipo'] == 'Ente pubblico') ? 'FPA12' : 'FPR12',
|
||||
@ -940,10 +957,12 @@ class FatturaElettronica
|
||||
|
||||
// Partita IVA (obbligatoria se presente)
|
||||
if (!empty($anagrafica['piva'])) {
|
||||
$result['IdFiscaleIVA'] = [
|
||||
'IdPaese' => $anagrafica['nazione'],
|
||||
'IdCodice' => $anagrafica['piva'],
|
||||
];
|
||||
|
||||
if (!empty($anagrafica['nazione']))
|
||||
$result['IdFiscaleIVA']['IdPaese'] = $anagrafica['nazione'];
|
||||
|
||||
$result['IdFiscaleIVA']['IdCodice'] = $anagrafica['piva'];
|
||||
|
||||
}
|
||||
|
||||
// Codice fiscale
|
||||
@ -1043,7 +1062,7 @@ class FatturaElettronica
|
||||
}
|
||||
|
||||
/**
|
||||
* Restituisce l'array responsabile per la generazione del tag CessionarioCommittente.
|
||||
* Restituisce l'array responsabile per la generazione del tag CessionarioCommittente (1.4).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -1058,6 +1077,24 @@ class FatturaElettronica
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce l'array responsabile per la generazione del tag TerzoIntermediarioOSoggettoEmittente (1.5).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function getTerzoIntermediarioOSoggettoEmittente($fattura)
|
||||
{
|
||||
$intermediario = $fattura->getIntermediario();
|
||||
|
||||
$result = [
|
||||
'DatiAnagrafici' => static::getDatiAnagrafici($intermediario),
|
||||
];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restituisce l'array responsabile per la generazione del tag DatiGeneraliDocumento.
|
||||
@ -1412,7 +1449,10 @@ class FatturaElettronica
|
||||
}
|
||||
|
||||
if (empty($percentuale)) {
|
||||
$dettaglio['Natura'] = $iva['codice_natura_fe'];
|
||||
//Controllo aggiuntivo codice_natura_fe per evitare che venga riportato il tag vuoto
|
||||
if (!empty($iva['codice_natura_fe'])){
|
||||
$dettaglio['Natura'] = $iva['codice_natura_fe'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($riga['riferimento_amministrazione'])) {
|
||||
@ -1611,6 +1651,12 @@ class FatturaElettronica
|
||||
'CedentePrestatore' => static::getCedentePrestatore($fattura),
|
||||
'CessionarioCommittente' => static::getCessionarioCommittente($fattura),
|
||||
];
|
||||
|
||||
//Terzo Intermediario o Soggetto Emittente
|
||||
if (!empty(setting('Terzo intermediario'))){
|
||||
$result['TerzoIntermediarioOSoggettoEmittente'] = static::getTerzoIntermediarioOSoggettoEmittente($fattura);
|
||||
$result['SoggettoEmittente'] = 'TZ';
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
@ -38,4 +38,17 @@ UPDATE `an_sedi` SET `provincia` = UPPER(provincia);
|
||||
|
||||
|
||||
-- Colonna Codice Modalità (Pagamenti)
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default` ) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Pagamenti'), 'Codice Modalità', 'codice_modalita_pagamento_fe', 2, 1, 0, 0, NULL, NULL, 1, 0, 0);
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default` ) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Pagamenti'), 'Codice Modalità', 'codice_modalita_pagamento_fe', 2, 1, 0, 0, NULL, NULL, 1, 0, 0);
|
||||
|
||||
|
||||
-- Impostazione "Anagrafica del terzo intermediario"
|
||||
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`) VALUES (NULL, 'Terzo intermediario', '', 'query=SELECT `an_anagrafiche`.`idanagrafica` AS ''id'', `ragione_sociale` AS ''descrizione'' FROM `an_anagrafiche` INNER JOIN `an_tipianagrafiche_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `an_tipianagrafiche_anagrafiche`.`idanagrafica` WHERE `idtipoanagrafica` = (SELECT `idtipoanagrafica` FROM `an_tipianagrafiche` WHERE `descrizione` = ''Fornitore'') AND `deleted_at` IS NULL', '1', 'Fatturazione Elettronica');
|
||||
|
||||
-- Aggiungo campi nome e cognome
|
||||
ALTER TABLE `an_anagrafiche` CHANGE `nome_cognome` `nome` VARCHAR(255) NOT NULL;
|
||||
ALTER TABLE `an_anagrafiche` ADD `cognome` VARCHAR(255) NOT NULL AFTER `nome`;
|
||||
|
||||
|
||||
-- Colonna Rif. fattura (Prima nota)
|
||||
INSERT INTO `zz_views` (`id`, `id_module`, `name`, `query`, `order`, `search`, `slow`, `format`, `search_inside`, `order_by`, `visible`, `summable`, `default` ) VALUES (NULL, (SELECT `id` FROM `zz_modules` WHERE `name` = 'Prima nota'), 'Rif. fattura', 'IF((iddocumento != ''),(SELECT numero_esterno FROM co_documenti WHERE id = iddocumento), ''-'')', 2, 1, 0, 0, NULL, NULL, 1, 0, 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user